@sparted/shared-library 1.7.14 → 1.7.16
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/business/types/activity.d.ts +2 -1
- package/business/types/activity.js +2 -0
- package/business/types/activity.js.map +1 -1
- package/business/types/content.d.ts +8 -8
- package/business/types/index.js +4 -0
- package/business/types/index.js.map +1 -1
- package/business/types/score.d.ts +17 -10
- package/business/types/score.js +10 -0
- package/business/types/score.js.map +1 -0
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ export type ActivityAudience = {
|
|
|
11
11
|
type: 'all' | 'segmentation' | 'magic-code' | 'email-list';
|
|
12
12
|
segments: Segment[];
|
|
13
13
|
};
|
|
14
|
-
export type ActivityStatus =
|
|
14
|
+
export type ActivityStatus = (typeof ACTIVITY_STATUS)[number];
|
|
15
15
|
export type SharedActivityMetadata = {
|
|
16
16
|
status: ActivityStatus;
|
|
17
17
|
languages?: LanguageCode[];
|
|
@@ -23,6 +23,7 @@ export type SharedActivityMetadata = {
|
|
|
23
23
|
};
|
|
24
24
|
export type CampaignActivity = SharedActivityMetadata & Campaign;
|
|
25
25
|
export type Activity = CampaignActivity | BreakingNewsActivity;
|
|
26
|
+
export declare const ACTIVITY_STATUS: readonly ["inactive", "archived", "upcoming", "live", "finished"];
|
|
26
27
|
export declare const isActivityCampaign: (activity: CampaignActivity | BreakingNewsActivity) => activity is CampaignActivity;
|
|
27
28
|
export declare const isActivityBreakingNews: (activity: CampaignActivity | BreakingNewsActivity) => activity is BreakingNewsActivity;
|
|
28
29
|
export {};
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
const ACTIVITY_STATUS = ['inactive', 'archived', 'upcoming', 'live', 'finished'];
|
|
5
6
|
const isActivityCampaign = (activity) => activity.type === 'campaign';
|
|
6
7
|
const isActivityBreakingNews = (activity) => activity.type === 'breaking-news';
|
|
7
8
|
|
|
9
|
+
exports.ACTIVITY_STATUS = ACTIVITY_STATUS;
|
|
8
10
|
exports.isActivityBreakingNews = isActivityBreakingNews;
|
|
9
11
|
exports.isActivityCampaign = isActivityCampaign;
|
|
10
12
|
//# sourceMappingURL=activity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activity.js","sources":["../../../src/business/types/activity.ts"],"sourcesContent":["import { BreakingNewsActivity } from './breaking-news';\nimport type { Campaign } from './campaign';\nimport type { LanguageCode } from './multilingual';\n\ntype Segment = {\n id: number;\n label: string;\n dimensionId: number;\n};\n\nexport type ActivityAudience = {\n groupId: number;\n type: 'all' | 'segmentation' | 'magic-code' | 'email-list';\n segments: Segment[];\n};\n\nexport type ActivityStatus =
|
|
1
|
+
{"version":3,"file":"activity.js","sources":["../../../src/business/types/activity.ts"],"sourcesContent":["import { BreakingNewsActivity } from './breaking-news';\nimport type { Campaign } from './campaign';\nimport type { LanguageCode } from './multilingual';\n\ntype Segment = {\n id: number;\n label: string;\n dimensionId: number;\n};\n\nexport type ActivityAudience = {\n groupId: number;\n type: 'all' | 'segmentation' | 'magic-code' | 'email-list';\n segments: Segment[];\n};\n\nexport type ActivityStatus = (typeof ACTIVITY_STATUS)[number];\n\nexport type SharedActivityMetadata = {\n status: ActivityStatus;\n languages?: LanguageCode[];\n audiences?: ActivityAudience[];\n userEngagement?: {\n viewCount?: number;\n likeCount?: number;\n };\n};\n\nexport type CampaignActivity = SharedActivityMetadata & Campaign;\n\nexport type Activity = CampaignActivity | BreakingNewsActivity;\n\nexport const ACTIVITY_STATUS = ['inactive', 'archived', 'upcoming', 'live', 'finished'] as const;\n\nexport const isActivityCampaign = (activity: CampaignActivity | BreakingNewsActivity): activity is CampaignActivity =>\n activity.type === 'campaign';\n\nexport const isActivityBreakingNews = (\n activity: CampaignActivity | BreakingNewsActivity,\n): activity is BreakingNewsActivity => activity.type === 'breaking-news';\n"],"names":[],"mappings":";;;;AAgCO,MAAM,eAAe,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAW;AAE1F,MAAM,kBAAkB,GAAG,CAAC,QAAiD,KAClF,QAAQ,CAAC,IAAI,KAAK,WAAW;AAExB,MAAM,sBAAsB,GAAG,CACpC,QAAiD,KACZ,QAAQ,CAAC,IAAI,KAAK;;;;;;"}
|
|
@@ -125,7 +125,7 @@ export declare const isPartialGameMultipleChoiceQuestion: (game: DeepPartial<Gam
|
|
|
125
125
|
video?: {
|
|
126
126
|
id?: number | undefined;
|
|
127
127
|
url?: string | undefined;
|
|
128
|
-
type?: "Youtube" | "api.video" | "Kumullus" |
|
|
128
|
+
type?: "Youtube" | "api.video" | "Kumullus" | undefined;
|
|
129
129
|
} | undefined;
|
|
130
130
|
} | undefined;
|
|
131
131
|
question?: {
|
|
@@ -214,7 +214,7 @@ export declare const isPartialGameMultipleChoiceQuestion: (game: DeepPartial<Gam
|
|
|
214
214
|
video?: {
|
|
215
215
|
id?: number | undefined;
|
|
216
216
|
url?: string | undefined;
|
|
217
|
-
type?: "Youtube" | "api.video" | "Kumullus" |
|
|
217
|
+
type?: "Youtube" | "api.video" | "Kumullus" | undefined;
|
|
218
218
|
} | undefined;
|
|
219
219
|
} | undefined;
|
|
220
220
|
explanation?: {
|
|
@@ -268,7 +268,7 @@ export declare const isPartialGameErrorText: (game: DeepPartial<Game>) => game i
|
|
|
268
268
|
video?: {
|
|
269
269
|
id?: number | undefined;
|
|
270
270
|
url?: string | undefined;
|
|
271
|
-
type?: "Youtube" | "api.video" | "Kumullus" |
|
|
271
|
+
type?: "Youtube" | "api.video" | "Kumullus" | undefined;
|
|
272
272
|
} | undefined;
|
|
273
273
|
} | undefined;
|
|
274
274
|
wrongText?: {
|
|
@@ -354,7 +354,7 @@ export declare const isPartialGameErrorText: (game: DeepPartial<Game>) => game i
|
|
|
354
354
|
video?: {
|
|
355
355
|
id?: number | undefined;
|
|
356
356
|
url?: string | undefined;
|
|
357
|
-
type?: "Youtube" | "api.video" | "Kumullus" |
|
|
357
|
+
type?: "Youtube" | "api.video" | "Kumullus" | undefined;
|
|
358
358
|
} | undefined;
|
|
359
359
|
} | undefined;
|
|
360
360
|
explanation?: {
|
|
@@ -408,7 +408,7 @@ export declare const isPartialGameOpenQuestion: (game: DeepPartial<Game>) => gam
|
|
|
408
408
|
video?: {
|
|
409
409
|
id?: number | undefined;
|
|
410
410
|
url?: string | undefined;
|
|
411
|
-
type?: "Youtube" | "api.video" | "Kumullus" |
|
|
411
|
+
type?: "Youtube" | "api.video" | "Kumullus" | undefined;
|
|
412
412
|
} | undefined;
|
|
413
413
|
} | undefined;
|
|
414
414
|
question?: {
|
|
@@ -495,7 +495,7 @@ export declare const isPartialGameOpenQuestion: (game: DeepPartial<Game>) => gam
|
|
|
495
495
|
video?: {
|
|
496
496
|
id?: number | undefined;
|
|
497
497
|
url?: string | undefined;
|
|
498
|
-
type?: "Youtube" | "api.video" | "Kumullus" |
|
|
498
|
+
type?: "Youtube" | "api.video" | "Kumullus" | undefined;
|
|
499
499
|
} | undefined;
|
|
500
500
|
} | undefined;
|
|
501
501
|
explanation?: {
|
|
@@ -549,7 +549,7 @@ export declare const isPartialGameNoInteraction: (game: DeepPartial<Game>) => ga
|
|
|
549
549
|
video?: {
|
|
550
550
|
id?: number | undefined;
|
|
551
551
|
url?: string | undefined;
|
|
552
|
-
type?: "Youtube" | "api.video" | "Kumullus" |
|
|
552
|
+
type?: "Youtube" | "api.video" | "Kumullus" | undefined;
|
|
553
553
|
} | undefined;
|
|
554
554
|
} | undefined;
|
|
555
555
|
title?: {
|
|
@@ -635,7 +635,7 @@ export declare const isPartialGameNoInteraction: (game: DeepPartial<Game>) => ga
|
|
|
635
635
|
video?: {
|
|
636
636
|
id?: number | undefined;
|
|
637
637
|
url?: string | undefined;
|
|
638
|
-
type?: "Youtube" | "api.video" | "Kumullus" |
|
|
638
|
+
type?: "Youtube" | "api.video" | "Kumullus" | undefined;
|
|
639
639
|
} | undefined;
|
|
640
640
|
} | undefined;
|
|
641
641
|
};
|
package/business/types/index.js
CHANGED
|
@@ -6,9 +6,11 @@ var activity = require('./activity.js');
|
|
|
6
6
|
var content = require('./content.js');
|
|
7
7
|
var multilingual = require('./multilingual.js');
|
|
8
8
|
var campaign = require('./campaign.js');
|
|
9
|
+
var score = require('./score.js');
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
|
|
13
|
+
exports.ACTIVITY_STATUS = activity.ACTIVITY_STATUS;
|
|
12
14
|
exports.isActivityBreakingNews = activity.isActivityBreakingNews;
|
|
13
15
|
exports.isActivityCampaign = activity.isActivityCampaign;
|
|
14
16
|
exports.GAME_TYPE = content.GAME_TYPE;
|
|
@@ -30,4 +32,6 @@ exports.Languages = multilingual.Languages;
|
|
|
30
32
|
exports.isLanguageCode = multilingual.isLanguageCode;
|
|
31
33
|
exports.isCampaignSchedulingManual = campaign.isCampaignSchedulingManual;
|
|
32
34
|
exports.isCampaignSchedulingRandom = campaign.isCampaignSchedulingRandom;
|
|
35
|
+
exports.isBattleScore = score.isBattleScore;
|
|
36
|
+
exports.isCampaignScore = score.isCampaignScore;
|
|
33
37
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,20 +1,27 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type Points = {
|
|
2
2
|
question: number;
|
|
3
3
|
chrono: number;
|
|
4
4
|
bonus: number;
|
|
5
5
|
};
|
|
6
|
-
export type
|
|
6
|
+
export type Timer = {
|
|
7
7
|
timespent: number;
|
|
8
8
|
timeout: boolean;
|
|
9
9
|
};
|
|
10
|
-
export type
|
|
11
|
-
|
|
12
|
-
type: 'battle' | 'campaign' | 'wiki';
|
|
13
|
-
id: number;
|
|
14
|
-
};
|
|
10
|
+
export type BaseScore = {
|
|
11
|
+
id: number;
|
|
15
12
|
contentId: number;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
playerId: number;
|
|
14
|
+
points: Points;
|
|
15
|
+
timer: Timer;
|
|
19
16
|
createdAt: Date;
|
|
20
17
|
};
|
|
18
|
+
export type CampaignScore = BaseScore & {
|
|
19
|
+
campaignId: number;
|
|
20
|
+
sessionNumber?: number;
|
|
21
|
+
};
|
|
22
|
+
export type BattleScore = BaseScore & {
|
|
23
|
+
battleId: number;
|
|
24
|
+
};
|
|
25
|
+
export type Score = CampaignScore | BattleScore;
|
|
26
|
+
export declare const isCampaignScore: (score: Score) => score is CampaignScore;
|
|
27
|
+
export declare const isBattleScore: (score: Score) => score is BattleScore;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const isCampaignScore = (score) => 'campaignId' in score;
|
|
6
|
+
const isBattleScore = (score) => 'battleId' in score;
|
|
7
|
+
|
|
8
|
+
exports.isBattleScore = isBattleScore;
|
|
9
|
+
exports.isCampaignScore = isCampaignScore;
|
|
10
|
+
//# sourceMappingURL=score.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"score.js","sources":["../../../src/business/types/score.ts"],"sourcesContent":["export type Points = {\n question: number;\n chrono: number;\n bonus: number;\n};\n\nexport type Timer = {\n timespent: number;\n timeout: boolean;\n};\n\nexport type BaseScore = {\n id: number;\n contentId: number;\n playerId: number;\n points: Points;\n timer: Timer;\n createdAt: Date;\n};\n\nexport type CampaignScore = BaseScore & {\n campaignId: number;\n sessionNumber?: number; // TODO: should be required after conversion\n};\n\nexport type BattleScore = BaseScore & {\n battleId: number;\n};\n\nexport type Score = CampaignScore | BattleScore;\n\nexport const isCampaignScore = (score: Score): score is CampaignScore => 'campaignId' in score;\nexport const isBattleScore = (score: Score): score is BattleScore => 'battleId' in score;\n"],"names":[],"mappings":";;;;AA+BO,MAAM,eAAe,GAAG,CAAC,KAAY,KAA6B,YAAY,IAAI,MAAM;AACxF,MAAM,aAAa,GAAG,CAAC,KAAY,KAA2B,UAAU,IAAI;;;;;"}
|