@sparted/shared-library 1.7.65 → 1.7.67

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.
@@ -6,7 +6,7 @@ import type { MultilingualLabel } from './multilingual';
6
6
  import type { PlayerProfile, PlayerWithParticipation } from './player';
7
7
  import type { Points, Stars } from './score';
8
8
  export type WithCampaignContentId<T> = T & {
9
- campaignContentId?: number;
9
+ campaignContentId: number;
10
10
  };
11
11
  export type CampaignInformations = {
12
12
  coverImage: Image;
@@ -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 } 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 isRandom: boolean;\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 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 lastSessionPlayed: number;\n lastPlayedAt: string;\n stars: Stars;\n points: Points;\n};\n\nexport type SessionInsight = {\n sessionNumber: number;\n gameTypes: GameType[];\n};\n\nexport type LiveCampaign = {\n details: LiveCampaignDetails;\n achievement: LiveCampaignAchievement;\n sessionInsights: SessionInsight[];\n leaderPlayer?: PlayerProfile;\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\nexport const computeIntenseCalendar = (card: LiveCampaign): Date[] => {\n const { details } = card;\n\n const startDate = new Date(details.utcStartDate);\n const endDate = new Date(details.utcEndDate);\n\n const calculateIntenseCalendarAux = (date: Date, calendar: Date[]): Date[] => {\n if (date > endDate) {\n return calendar;\n }\n\n const jsDay = date.getDay();\n const day = jsDay === 0 ? 7 : jsDay;\n\n if (details.enabledWeekDays.includes(day) && !details.disabledDates.includes(date.toISOString().slice(0, 10))) {\n calendar.push(new Date(date));\n }\n\n date.setDate(date.getDate() + 1);\n\n return calculateIntenseCalendarAux(date, calendar);\n };\n\n return calculateIntenseCalendarAux(startDate, []);\n};\n\nexport const computeCurrentSession = (card: LiveCampaign): number => {\n const { details, achievement } = card;\n\n if (details.type === 'flexible') {\n return Math.min(achievement.lastSessionPlayed + 1, details.sessionCount);\n }\n\n const today = new Date();\n\n if (today <= new Date(details.utcStartDate)) {\n return 1;\n }\n\n if (today >= new Date(details.utcEndDate)) {\n return details.sessionCount;\n }\n\n const calendar = computeIntenseCalendar(card);\n\n const todayDate = today.toISOString().slice(0, 10);\n const currentSession = calendar.findIndex((date) => date.toISOString().slice(0, 10) >= todayDate);\n\n if (currentSession === -1) {\n throw new Error('Current session not found');\n }\n\n return currentSession + 1;\n};\n\nexport const checkTodayPlayable = (card: LiveCampaign): boolean => {\n const today = new Date();\n\n const { details } = card;\n\n const startDate = new Date(details.utcStartDate);\n const endDate = new Date(details.utcEndDate);\n\n if (today < startDate || today > endDate) {\n return false;\n }\n\n const jsDay = today.getDay();\n const day = jsDay === 0 ? 7 : jsDay;\n\n if (!details.enabledWeekDays.includes(day)) {\n return false;\n }\n\n if (details.disabledDates.includes(today.toISOString().slice(0, 10))) {\n return false;\n }\n\n return true;\n};\n"],"names":[],"mappings":";;;;AA2IO,MAAM,0BAA0B,GAAG,CAAC,UAA8B,KACvE,UAAU,CAAC,IAAI,KAAK,SAAS;AAExB,MAAM,0BAA0B,GAAG,CAAC,UAA8B,KACv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AAS,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IACjD,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE7C,IAAA,IAAI,KAAK,GAAG,SAAS,IAAI,KAAK,GAAG,OAAO,EAAE;AACxC,QAAA,OAAO,KAAK,CAAC;AACd,KAAA;AAED,IAAA,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;AAC7B,IAAA,MAAM,GAAG,GAAG,KAAK,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAEpC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;AAC1C,QAAA,OAAO,KAAK,CAAC;AACd,KAAA;AAED,IAAA,IAAI,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE;AACpE,QAAA,OAAO,KAAK,CAAC;AACd,KAAA;AAED,IAAA,OAAO,IAAI,CAAC;AACd;;;;;;;;;"}
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 } 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 isRandom: boolean;\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 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 lastSessionPlayed: number;\n lastPlayedAt: string;\n stars: Stars;\n points: Points;\n};\n\nexport type SessionInsight = {\n sessionNumber: number;\n gameTypes: GameType[];\n};\n\nexport type LiveCampaign = {\n details: LiveCampaignDetails;\n achievement: LiveCampaignAchievement;\n sessionInsights: SessionInsight[];\n leaderPlayer?: PlayerProfile;\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\nexport const computeIntenseCalendar = (card: LiveCampaign): Date[] => {\n const { details } = card;\n\n const startDate = new Date(details.utcStartDate);\n const endDate = new Date(details.utcEndDate);\n\n const calculateIntenseCalendarAux = (date: Date, calendar: Date[]): Date[] => {\n if (date > endDate) {\n return calendar;\n }\n\n const jsDay = date.getDay();\n const day = jsDay === 0 ? 7 : jsDay;\n\n if (details.enabledWeekDays.includes(day) && !details.disabledDates.includes(date.toISOString().slice(0, 10))) {\n calendar.push(new Date(date));\n }\n\n date.setDate(date.getDate() + 1);\n\n return calculateIntenseCalendarAux(date, calendar);\n };\n\n return calculateIntenseCalendarAux(startDate, []);\n};\n\nexport const computeCurrentSession = (card: LiveCampaign): number => {\n const { details, achievement } = card;\n\n if (details.type === 'flexible') {\n return Math.min(achievement.lastSessionPlayed + 1, details.sessionCount);\n }\n\n const today = new Date();\n\n if (today <= new Date(details.utcStartDate)) {\n return 1;\n }\n\n if (today >= new Date(details.utcEndDate)) {\n return details.sessionCount;\n }\n\n const calendar = computeIntenseCalendar(card);\n\n const todayDate = today.toISOString().slice(0, 10);\n const currentSession = calendar.findIndex((date) => date.toISOString().slice(0, 10) >= todayDate);\n\n if (currentSession === -1) {\n throw new Error('Current session not found');\n }\n\n return currentSession + 1;\n};\n\nexport const checkTodayPlayable = (card: LiveCampaign): boolean => {\n const today = new Date();\n\n const { details } = card;\n\n const startDate = new Date(details.utcStartDate);\n const endDate = new Date(details.utcEndDate);\n\n if (today < startDate || today > endDate) {\n return false;\n }\n\n const jsDay = today.getDay();\n const day = jsDay === 0 ? 7 : jsDay;\n\n if (!details.enabledWeekDays.includes(day)) {\n return false;\n }\n\n if (details.disabledDates.includes(today.toISOString().slice(0, 10))) {\n return false;\n }\n\n return true;\n};\n"],"names":[],"mappings":";;;;AA2IO,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,KAAK;AAEnF,MAAA,sBAAsB,GAAG,CAAC,IAAkB,KAAY;AACnE,IAAA,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAEzB,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IACjD,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE7C,IAAA,MAAM,2BAA2B,GAAG,CAAC,IAAU,EAAE,QAAgB,KAAY;QAC3E,IAAI,IAAI,GAAG,OAAO,EAAE;AAClB,YAAA,OAAO,QAAQ,CAAC;AACjB,SAAA;AAED,QAAA,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;AAC5B,QAAA,MAAM,GAAG,GAAG,KAAK,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEpC,QAAA,IAAI,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK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E,EAAE,CAAC,IAAI,SAAS,CAAC,CAAC;AAElG,IAAA,IAAI,cAAc,KAAK,CAAC,CAAC,EAAE;AACzB,QAAA,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;AAC9C,KAAA;IAED,OAAO,cAAc,GAAG,CAAC,CAAC;AAC5B,EAAE;AAEW,MAAA,kBAAkB,GAAG,CAAC,IAAkB,KAAa;AAChE,IAAA,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC;AAEzB,IAAA,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAEzB,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IACjD,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE7C,IAAA,IAAI,KAAK,GAAG,SAAS,IAAI,KAAK,GAAG,OAAO,EAAE;AACxC,QAAA,OAAO,KAAK,CAAC;AACd,KAAA;AAED,IAAA,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;AAC7B,IAAA,MAAM,GAAG,GAAG,KAAK,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAEpC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;AAC1C,QAAA,OAAO,KAAK,CAAC;AACd,KAAA;AAED,IAAA,IAAI,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE;AACpE,QAAA,OAAO,KAAK,CAAC;AACd,KAAA;AAED,IAAA,OAAO,IAAI,CAAC;AACd;;;;;;;;;"}
@@ -16,17 +16,18 @@ export type BaseScore = {
16
16
  id?: number;
17
17
  playerId: number;
18
18
  contentId: number;
19
- campaignContentId?: number;
20
19
  points: Points;
21
20
  timer: Timer;
22
21
  createdAt: Date;
23
22
  };
24
23
  export type CampaignScore = BaseScore & {
25
24
  campaignId: number;
25
+ campaignContentId: number;
26
26
  sessionNumber?: number;
27
27
  };
28
28
  export type WikiScore = BaseScore & {
29
29
  wikiId: number;
30
+ campaignContentId: number;
30
31
  sessionNumber?: number;
31
32
  };
32
33
  export type BattleScore = BaseScore & {
@@ -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 campaignContentId?: 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":";;;;AA2CO,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 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 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":";;;;AA4CO,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.65",
3
+ "version": "1.7.67",
4
4
  "repository": "git@github.com:Sparted/shared-library.git",
5
5
  "author": {
6
6
  "name": "Sparted",