@sparted/shared-library 1.7.15 → 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/index.js
CHANGED
|
@@ -6,6 +6,7 @@ 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
|
|
|
@@ -31,4 +32,6 @@ exports.Languages = multilingual.Languages;
|
|
|
31
32
|
exports.isLanguageCode = multilingual.isLanguageCode;
|
|
32
33
|
exports.isCampaignSchedulingManual = campaign.isCampaignSchedulingManual;
|
|
33
34
|
exports.isCampaignSchedulingRandom = campaign.isCampaignSchedulingRandom;
|
|
35
|
+
exports.isBattleScore = score.isBattleScore;
|
|
36
|
+
exports.isCampaignScore = score.isCampaignScore;
|
|
34
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;;;;;"}
|