@sparted/shared-library 1.7.52 → 1.7.54

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.
@@ -41,4 +41,5 @@ exports.Languages = multilingual.Languages;
41
41
  exports.isLanguageCode = multilingual.isLanguageCode;
42
42
  exports.isBattleScore = score.isBattleScore;
43
43
  exports.isCampaignScore = score.isCampaignScore;
44
+ exports.isWikiScore = score.isWikiScore;
44
45
  //# 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -13,3 +13,12 @@ export type PlayerWithParticipation = PlayerProfile & {
13
13
  lastPlayedDate?: Date;
14
14
  nbPlayedSessions: number;
15
15
  };
16
+ export type Opponent = {
17
+ id: number;
18
+ profile: PlayerProfile;
19
+ scores: {
20
+ nbBattlesAgainstPlayer: number;
21
+ battleWonByPlayer: number;
22
+ };
23
+ challengeStatus: 'ready' | 'pending' | 'finished';
24
+ };
@@ -24,9 +24,14 @@ export type CampaignScore = BaseScore & {
24
24
  campaignId: number;
25
25
  sessionNumber?: number;
26
26
  };
27
+ export type WikiScore = BaseScore & {
28
+ wikiId: number;
29
+ sessionNumber?: number;
30
+ };
27
31
  export type BattleScore = BaseScore & {
28
32
  battleId: number;
29
33
  };
30
- export type Score = CampaignScore | BattleScore;
34
+ export type Score = CampaignScore | WikiScore | BattleScore;
31
35
  export declare const isCampaignScore: (score: Score) => score is CampaignScore;
36
+ export declare const isWikiScore: (score: Score) => score is WikiScore;
32
37
  export declare const isBattleScore: (score: Score) => score is BattleScore;
@@ -3,8 +3,10 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const isCampaignScore = (score) => 'campaignId' in score;
6
+ const isWikiScore = (score) => 'wikiId' in score;
6
7
  const isBattleScore = (score) => 'battleId' in score;
7
8
 
8
9
  exports.isBattleScore = isBattleScore;
9
10
  exports.isCampaignScore = isCampaignScore;
11
+ exports.isWikiScore = isWikiScore;
10
12
  //# sourceMappingURL=score.js.map
@@ -1 +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 Stars = {\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 playerId: number;\n contentId: 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":";;;;AAqCO,MAAM,eAAe,GAAG,CAAC,KAAY,KAA6B,YAAY,IAAI,MAAM;AACxF,MAAM,aAAa,GAAG,CAAC,KAAY,KAA2B,UAAU,IAAI;;;;;"}
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 Stars = {\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 playerId: number;\n contentId: 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 WikiScore = BaseScore & {\n wikiId: number;\n sessionNumber?: number;\n};\n\nexport type BattleScore = BaseScore & {\n battleId: number;\n};\n\nexport type Score = CampaignScore | WikiScore | BattleScore;\n\nexport const isCampaignScore = (score: Score): score is CampaignScore => 'campaignId' in score;\nexport const isWikiScore = (score: Score): score is WikiScore => 'wikiId' in score;\nexport const isBattleScore = (score: Score): score is BattleScore => 'battleId' in score;\n"],"names":[],"mappings":";;;;AA0CO,MAAM,eAAe,GAAG,CAAC,KAAY,KAA6B,YAAY,IAAI,MAAM;AACxF,MAAM,WAAW,GAAG,CAAC,KAAY,KAAyB,QAAQ,IAAI,MAAM;AAC5E,MAAM,aAAa,GAAG,CAAC,KAAY,KAA2B,UAAU,IAAI;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sparted/shared-library",
3
- "version": "1.7.52",
3
+ "version": "1.7.54",
4
4
  "repository": "git@github.com:Sparted/shared-library.git",
5
5
  "author": {
6
6
  "name": "Sparted",