@sparted/shared-library 1.7.93 → 1.8.0

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,7 +4,7 @@ import type { Content, GameType } from './content';
4
4
  import type { Image } from './media';
5
5
  import type { MultilingualLabel } from './multilingual';
6
6
  import type { PlayerProfile, PlayerWithParticipation } from './player';
7
- import type { Points, Stars, Streaks } from './score';
7
+ import type { LiveCampaignPoints, Points, Stars, Streaks } from './score';
8
8
  export type WithCampaignContentId<T> = T & {
9
9
  campaignContentId: number;
10
10
  };
@@ -88,7 +88,7 @@ export type LiveCampaignAchievement = {
88
88
  lastSessionPlayed: number;
89
89
  lastPlayedAt: string;
90
90
  stars: Stars;
91
- points: Points;
91
+ points: LiveCampaignPoints;
92
92
  streaks?: Streaks;
93
93
  };
94
94
  export type SessionInsight = {
@@ -1 +1 @@
1
- {"version":3,"file":"campaign.js","sources":["../../../src/business/types/campaign.ts"],"sourcesContent":["import type { CampaignStats } from './achievement';\nimport { ActivityStatus } from './activity';\nimport type { Content, GameType } from './content';\nimport type { Image } from './media';\nimport type { MultilingualLabel } from './multilingual';\nimport type { PlayerProfile, PlayerWithParticipation } from './player';\nimport type { Points, Stars, Streaks } from './score';\n\nexport type WithCampaignContentId<T> = T & { campaignContentId: number };\n\nexport type CampaignInformations = {\n coverImage: Image;\n name: MultilingualLabel;\n description: MultilingualLabel;\n disclaimer?: MultilingualLabel;\n lastSave: Date;\n};\n\nexport type BaseCampaignScheduling = {\n type: 'flexible' | 'intense';\n launchDate: string;\n endDate?: string;\n extraDays: number;\n enabledWeekDays: number[];\n disabledDates: string[];\n};\n\nexport type ManualCampaignScheduling = BaseCampaignScheduling & {\n mode: 'manual';\n orderedSessions: Content[][];\n};\n\nexport type RandomCampaignScheduling = BaseCampaignScheduling & {\n mode: 'random';\n nbSessions: number;\n contents: Content[];\n};\n\nexport type CampaignScheduling = ManualCampaignScheduling | RandomCampaignScheduling;\n\nexport type Campaign = {\n id: number;\n informations: CampaignInformations;\n scheduling: CampaignScheduling;\n type: 'campaign';\n};\n\nexport type BaseCampaignCardDetails = {\n id: number;\n status: ActivityStatus;\n cover: string;\n title: MultilingualLabel;\n description: MultilingualLabel;\n disclaimer?: MultilingualLabel;\n utcStartDate: string;\n utcEndDate: string;\n contentCount: number;\n sessionContentDistribution: number[];\n isRandom: boolean;\n playableDays?: Date[];\n};\n\nexport type WikiCardDetails = BaseCampaignCardDetails;\n\nexport type WikiCardPlayerInteraction = {\n contentPlayedIds: number[];\n favorite: boolean;\n};\n\nexport type WikiCard = {\n details: WikiCardDetails;\n playerInteraction: WikiCardPlayerInteraction;\n};\n\nexport type WikiContentCardDetails = {\n id: number;\n campaignContentId: number;\n coverImage: string;\n title: MultilingualLabel;\n explanation?: MultilingualLabel;\n session: number;\n};\n\nexport type WikiContentCard = {\n contentDetails: WikiContentCardDetails;\n points: Points;\n};\n\nexport type LiveCampaignScheduling = {\n type: 'flexible' | 'intense';\n extraDays: number;\n enabledWeekDays: number[];\n disabledDates: string[];\n sessionCount: number;\n};\n\nexport type LiveCampaignDetails = BaseCampaignCardDetails & LiveCampaignScheduling;\n\nexport type LiveCampaignAchievement = {\n playedSessions: number[];\n playedSessionsCount: number;\n lastSessionPlayed: number;\n lastPlayedAt: string;\n stars: Stars;\n points: Points;\n streaks?: Streaks;\n};\n\nexport type SessionInsight = {\n sessionNumber: number;\n gameTypes: GameType[];\n};\n\nexport type StreakSession = {\n day: 1 | 2 | 3 | 4 | 5 | 6 | 7;\n status: CalendarStatus;\n streakCount?: number;\n};\n\nexport type LiveCampaign = {\n details: LiveCampaignDetails;\n achievement: LiveCampaignAchievement;\n /** @deprecated to avoid breaking changes */\n sessionInsights: SessionInsight[];\n leaderPlayer?: PlayerProfile;\n streakSessions?: StreakSession[];\n};\n\nexport type CalendarStatus = 'played' | 'playable' | 'pending' | 'missed';\n\nexport type Calendar = {\n order: number;\n status: CalendarStatus;\n date: Date;\n};\n\nexport type CampaignDetails = {\n id: number;\n coverImage?: Image;\n name: MultilingualLabel;\n mode: 'manual' | 'random';\n launchDate: string;\n endDate: string;\n enabledWeekDays: number[];\n disabledDates: Date[];\n lastNotificationDate: Date;\n nbPlayers: number;\n nbSessions: number;\n nbQuestions: number;\n players: PlayerWithParticipation[];\n stats: CampaignStats;\n};\n\nexport const isCampaignSchedulingRandom = (scheduling: CampaignScheduling): scheduling is RandomCampaignScheduling =>\n scheduling.mode === 'random';\n\nexport const isCampaignSchedulingManual = (scheduling: CampaignScheduling): scheduling is ManualCampaignScheduling =>\n scheduling.mode === 'manual';\n\nexport const isWikiCard = (item: unknown): item is WikiCard =>\n typeof item === 'object' && item !== null && 'details' in item && 'playerInteraction' in item;\n"],"names":[],"mappings":";;;;AAyJO,MAAM,0BAA0B,GAAG,CAAC,UAA8B,KACvE,UAAU,CAAC,IAAI,KAAK,SAAS;AAExB,MAAM,0BAA0B,GAAG,CAAC,UAA8B,KACvE,UAAU,CAAC,IAAI,KAAK,SAAS;AAElB,MAAA,UAAU,GAAG,CAAC,IAAa,KACtC,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,SAAS,IAAI,IAAI,IAAI,mBAAmB,IAAI;;;;;;"}
1
+ {"version":3,"file":"campaign.js","sources":["../../../src/business/types/campaign.ts"],"sourcesContent":["import type { CampaignStats } from './achievement';\nimport { ActivityStatus } from './activity';\nimport type { Content, GameType } from './content';\nimport type { Image } from './media';\nimport type { MultilingualLabel } from './multilingual';\nimport type { PlayerProfile, PlayerWithParticipation } from './player';\nimport type { LiveCampaignPoints, Points, Stars, Streaks } from './score';\n\nexport type WithCampaignContentId<T> = T & { campaignContentId: number };\n\nexport type CampaignInformations = {\n coverImage: Image;\n name: MultilingualLabel;\n description: MultilingualLabel;\n disclaimer?: MultilingualLabel;\n lastSave: Date;\n};\n\nexport type BaseCampaignScheduling = {\n type: 'flexible' | 'intense';\n launchDate: string;\n endDate?: string;\n extraDays: number;\n enabledWeekDays: number[];\n disabledDates: string[];\n};\n\nexport type ManualCampaignScheduling = BaseCampaignScheduling & {\n mode: 'manual';\n orderedSessions: Content[][];\n};\n\nexport type RandomCampaignScheduling = BaseCampaignScheduling & {\n mode: 'random';\n nbSessions: number;\n contents: Content[];\n};\n\nexport type CampaignScheduling = ManualCampaignScheduling | RandomCampaignScheduling;\n\nexport type Campaign = {\n id: number;\n informations: CampaignInformations;\n scheduling: CampaignScheduling;\n type: 'campaign';\n};\n\nexport type BaseCampaignCardDetails = {\n id: number;\n status: ActivityStatus;\n cover: string;\n title: MultilingualLabel;\n description: MultilingualLabel;\n disclaimer?: MultilingualLabel;\n utcStartDate: string;\n utcEndDate: string;\n contentCount: number;\n sessionContentDistribution: number[];\n isRandom: boolean;\n playableDays?: Date[];\n};\n\nexport type WikiCardDetails = BaseCampaignCardDetails;\n\nexport type WikiCardPlayerInteraction = {\n contentPlayedIds: number[];\n favorite: boolean;\n};\n\nexport type WikiCard = {\n details: WikiCardDetails;\n playerInteraction: WikiCardPlayerInteraction;\n};\n\nexport type WikiContentCardDetails = {\n id: number;\n campaignContentId: number;\n coverImage: string;\n title: MultilingualLabel;\n explanation?: MultilingualLabel;\n session: number;\n};\n\nexport type WikiContentCard = {\n contentDetails: WikiContentCardDetails;\n points: Points;\n};\n\nexport type LiveCampaignScheduling = {\n type: 'flexible' | 'intense';\n extraDays: number;\n enabledWeekDays: number[];\n disabledDates: string[];\n sessionCount: number;\n};\n\nexport type LiveCampaignDetails = BaseCampaignCardDetails & LiveCampaignScheduling;\n\nexport type LiveCampaignAchievement = {\n playedSessions: number[];\n playedSessionsCount: number;\n lastSessionPlayed: number;\n lastPlayedAt: string;\n stars: Stars;\n points: LiveCampaignPoints;\n streaks?: Streaks;\n};\n\nexport type SessionInsight = {\n sessionNumber: number;\n gameTypes: GameType[];\n};\n\nexport type StreakSession = {\n day: 1 | 2 | 3 | 4 | 5 | 6 | 7;\n status: CalendarStatus;\n streakCount?: number;\n};\n\nexport type LiveCampaign = {\n details: LiveCampaignDetails;\n achievement: LiveCampaignAchievement;\n /** @deprecated to avoid breaking changes */\n sessionInsights: SessionInsight[];\n leaderPlayer?: PlayerProfile;\n streakSessions?: StreakSession[];\n};\n\nexport type CalendarStatus = 'played' | 'playable' | 'pending' | 'missed';\n\nexport type Calendar = {\n order: number;\n status: CalendarStatus;\n date: Date;\n};\n\nexport type CampaignDetails = {\n id: number;\n coverImage?: Image;\n name: MultilingualLabel;\n mode: 'manual' | 'random';\n launchDate: string;\n endDate: string;\n enabledWeekDays: number[];\n disabledDates: Date[];\n lastNotificationDate: Date;\n nbPlayers: number;\n nbSessions: number;\n nbQuestions: number;\n players: PlayerWithParticipation[];\n stats: CampaignStats;\n};\n\nexport const isCampaignSchedulingRandom = (scheduling: CampaignScheduling): scheduling is RandomCampaignScheduling =>\n scheduling.mode === 'random';\n\nexport const isCampaignSchedulingManual = (scheduling: CampaignScheduling): scheduling is ManualCampaignScheduling =>\n scheduling.mode === 'manual';\n\nexport const isWikiCard = (item: unknown): item is WikiCard =>\n typeof item === 'object' && item !== null && 'details' in item && 'playerInteraction' in item;\n"],"names":[],"mappings":";;;;AAyJO,MAAM,0BAA0B,GAAG,CAAC,UAA8B,KACvE,UAAU,CAAC,IAAI,KAAK,SAAS;AAExB,MAAM,0BAA0B,GAAG,CAAC,UAA8B,KACvE,UAAU,CAAC,IAAI,KAAK,SAAS;AAElB,MAAA,UAAU,GAAG,CAAC,IAAa,KACtC,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,SAAS,IAAI,IAAI,IAAI,mBAAmB,IAAI;;;;;;"}
@@ -3,6 +3,12 @@ export type Points = {
3
3
  chrono: number;
4
4
  bonus: number;
5
5
  };
6
+ export type LiveCampaignPoints = {
7
+ question: number;
8
+ chrono: number;
9
+ bonus: number;
10
+ adaptive: number;
11
+ };
6
12
  export type Stars = {
7
13
  question: number;
8
14
  chrono: number;
@@ -26,6 +32,7 @@ export type BaseScore = {
26
32
  createdAt: Date;
27
33
  };
28
34
  export type CampaignScore = BaseScore & {
35
+ points: LiveCampaignPoints;
29
36
  campaignId: number;
30
37
  campaignContentId: number;
31
38
  sessionNumber?: number;
@@ -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 Streaks = {\n totalPoints: number;\n streaksCount: number;\n streaksCountHistory: 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 campaignContentId: number;\n sessionNumber?: number; // TODO: should be required after conversion\n};\n\nexport type WikiScore = BaseScore & {\n wikiId: number;\n campaignContentId: 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":";;;;AAkDO,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;;;;;;"}
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 LiveCampaignPoints = {\n question: number;\n chrono: number;\n bonus: number;\n adaptive: number;\n};\n\nexport type Stars = {\n question: number;\n chrono: number;\n bonus: number;\n};\n\nexport type Streaks = {\n totalPoints: number;\n streaksCount: number;\n streaksCountHistory: 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 points: LiveCampaignPoints;\n campaignId: number;\n campaignContentId: number;\n sessionNumber?: number; // TODO: should be required after conversion\n};\n\nexport type WikiScore = BaseScore & {\n wikiId: number;\n campaignContentId: 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":";;;;AA0DO,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.93",
3
+ "version": "1.8.0",
4
4
  "repository": "git@github.com:Sparted/shared-library.git",
5
5
  "author": {
6
6
  "name": "Sparted",