@sparted/shared-library 1.7.80 → 1.7.81
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/campaign.d.ts +9 -1
- package/business/types/campaign.js.map +1 -1
- package/business/types/score.d.ts +4 -0
- package/business/types/score.js.map +1 -1
- package/date/get-start-of-day.d.ts +1 -0
- package/date/get-start-of-day.js +12 -0
- package/date/get-start-of-day.js.map +1 -0
- package/date/index.d.ts +2 -0
- package/date/index.js +4 -0
- package/date/index.js.map +1 -1
- package/date/to-utc-date-string.d.ts +1 -0
- package/date/to-utc-date-string.js +10 -0
- package/date/to-utc-date-string.js.map +1 -0
- package/index.js +4 -0
- package/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -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 } from './score';
|
|
7
|
+
import type { Points, Stars, Streaks } from './score';
|
|
8
8
|
export type WithCampaignContentId<T> = T & {
|
|
9
9
|
campaignContentId: number;
|
|
10
10
|
};
|
|
@@ -50,6 +50,7 @@ export type BaseCampaignCardDetails = {
|
|
|
50
50
|
utcEndDate: string;
|
|
51
51
|
contentCount: number;
|
|
52
52
|
isRandom: boolean;
|
|
53
|
+
playableDays?: Date[];
|
|
53
54
|
};
|
|
54
55
|
export type WikiCardDetails = BaseCampaignCardDetails;
|
|
55
56
|
export type WikiCardPlayerInteraction = {
|
|
@@ -85,16 +86,23 @@ export type LiveCampaignAchievement = {
|
|
|
85
86
|
lastPlayedAt: string;
|
|
86
87
|
stars: Stars;
|
|
87
88
|
points: Points;
|
|
89
|
+
streaks: Streaks;
|
|
88
90
|
};
|
|
89
91
|
export type SessionInsight = {
|
|
90
92
|
sessionNumber: number;
|
|
91
93
|
gameTypes: GameType[];
|
|
92
94
|
};
|
|
95
|
+
export type StreakSession = {
|
|
96
|
+
day: 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
97
|
+
status: CalendarStatus;
|
|
98
|
+
streakCount?: number;
|
|
99
|
+
};
|
|
93
100
|
export type LiveCampaign = {
|
|
94
101
|
details: LiveCampaignDetails;
|
|
95
102
|
achievement: LiveCampaignAchievement;
|
|
96
103
|
sessionInsights: SessionInsight[];
|
|
97
104
|
leaderPlayer?: PlayerProfile;
|
|
105
|
+
streakSessions: StreakSession[];
|
|
98
106
|
};
|
|
99
107
|
export type CalendarStatus = 'played' | 'playable' | 'pending' | 'missed';
|
|
100
108
|
export type Calendar = {
|
|
@@ -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 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 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"],"names":[],"mappings":";;;;
|
|
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 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 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 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":";;;;AAqJO,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 +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 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":";;;;
|
|
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};\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":";;;;AAiDO,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;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const startOfDay: (date: Date) => Date;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const startOfDay = (date) => {
|
|
6
|
+
const d = new Date(date);
|
|
7
|
+
d.setUTCHours(0, 0, 0, 0);
|
|
8
|
+
return d;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
exports.startOfDay = startOfDay;
|
|
12
|
+
//# sourceMappingURL=get-start-of-day.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-start-of-day.js","sources":["../../src/date/get-start-of-day.ts"],"sourcesContent":["export const startOfDay = (date: Date) => {\n const d = new Date(date);\n d.setUTCHours(0, 0, 0, 0);\n return d;\n};\n"],"names":[],"mappings":";;;;AAAa,MAAA,UAAU,GAAG,CAAC,IAAU,KAAI;AACvC,IAAA,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAC1B,IAAA,OAAO,CAAC,CAAC;AACX;;;;"}
|
package/date/index.d.ts
CHANGED
package/date/index.js
CHANGED
|
@@ -9,6 +9,8 @@ var getRemainingTime = require('./get-remaining-time.js');
|
|
|
9
9
|
var shiftDateBy = require('./shift-date-by.js');
|
|
10
10
|
var differenceInDays = require('./difference-in-days.js');
|
|
11
11
|
var addDays = require('./add-days.js');
|
|
12
|
+
var getStartOfDay = require('./get-start-of-day.js');
|
|
13
|
+
var toUtcDateString = require('./to-utc-date-string.js');
|
|
12
14
|
|
|
13
15
|
|
|
14
16
|
|
|
@@ -20,4 +22,6 @@ exports.getRemainingTimeInMsFromDate = getRemainingTime.getRemainingTimeInMsFrom
|
|
|
20
22
|
exports.shiftDateBy = shiftDateBy.shiftDateBy;
|
|
21
23
|
exports.differenceInDays = differenceInDays.differenceInDays;
|
|
22
24
|
exports.addDays = addDays.addDays;
|
|
25
|
+
exports.startOfDay = getStartOfDay.startOfDay;
|
|
26
|
+
exports.toUTCDateString = toUtcDateString.toUTCDateString;
|
|
23
27
|
//# sourceMappingURL=index.js.map
|
package/date/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const toUTCDateString: (date: Date) => string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const toUTCDateString = (date) => {
|
|
6
|
+
return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate())).toISOString().split('T')[0];
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
exports.toUTCDateString = toUTCDateString;
|
|
10
|
+
//# sourceMappingURL=to-utc-date-string.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-utc-date-string.js","sources":["../../src/date/to-utc-date-string.ts"],"sourcesContent":["export const toUTCDateString = (date: Date) => {\n return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate())).toISOString().split('T')[0];\n};\n"],"names":[],"mappings":";;;;AAAa,MAAA,eAAe,GAAG,CAAC,IAAU,KAAI;AAC5C,IAAA,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7G;;;;"}
|
package/index.js
CHANGED
|
@@ -47,6 +47,8 @@ var getRemainingTime = require('./date/get-remaining-time.js');
|
|
|
47
47
|
var shiftDateBy = require('./date/shift-date-by.js');
|
|
48
48
|
var differenceInDays = require('./date/difference-in-days.js');
|
|
49
49
|
var addDays = require('./date/add-days.js');
|
|
50
|
+
var getStartOfDay = require('./date/get-start-of-day.js');
|
|
51
|
+
var toUtcDateString = require('./date/to-utc-date-string.js');
|
|
50
52
|
|
|
51
53
|
|
|
52
54
|
|
|
@@ -103,4 +105,6 @@ exports.getRemainingTimeInMsFromDate = getRemainingTime.getRemainingTimeInMsFrom
|
|
|
103
105
|
exports.shiftDateBy = shiftDateBy.shiftDateBy;
|
|
104
106
|
exports.differenceInDays = differenceInDays.differenceInDays;
|
|
105
107
|
exports.addDays = addDays.addDays;
|
|
108
|
+
exports.startOfDay = getStartOfDay.startOfDay;
|
|
109
|
+
exports.toUTCDateString = toUtcDateString.toUTCDateString;
|
|
106
110
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|