@sportsbroker/firebase-structure 3.53.3 → 3.54.1

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.
@@ -0,0 +1,22 @@
1
+ {
2
+ "workbench.colorCustomizations": {
3
+ "activityBar.activeBackground": "#1f6fd0",
4
+ "activityBar.background": "#1f6fd0",
5
+ "activityBar.foreground": "#e7e7e7",
6
+ "activityBar.inactiveForeground": "#e7e7e799",
7
+ "activityBarBadge.background": "#ee90bb",
8
+ "activityBarBadge.foreground": "#15202b",
9
+ "commandCenter.border": "#e7e7e799",
10
+ "sash.hoverBorder": "#1f6fd0",
11
+ "statusBar.background": "#1857a4",
12
+ "statusBar.foreground": "#e7e7e7",
13
+ "statusBarItem.hoverBackground": "#1f6fd0",
14
+ "statusBarItem.remoteBackground": "#1857a4",
15
+ "statusBarItem.remoteForeground": "#e7e7e7",
16
+ "titleBar.activeBackground": "#1857a4",
17
+ "titleBar.activeForeground": "#e7e7e7",
18
+ "titleBar.inactiveBackground": "#1857a499",
19
+ "titleBar.inactiveForeground": "#e7e7e799"
20
+ },
21
+ "peacock.color": "#1857a4"
22
+ }
@@ -1,3 +1,8 @@
1
1
  export * from "./common";
2
2
  export * from "./user-status";
3
3
  export * from "./match";
4
+ export * from "./match-commentary";
5
+ export * from "./match-event";
6
+ export * from "./match-h2h-stats";
7
+ export * from "./match-lineup";
8
+ export * from "./match-stats";
@@ -0,0 +1,28 @@
1
+ import { MatchPeriod } from "./match";
2
+
3
+ export interface MatchCommentary {
4
+ commentaryId: string;
5
+ period: MatchPeriod;
6
+ content: string;
7
+ type: CommentaryType;
8
+ time: {
9
+ minutes: number;
10
+ seconds: number;
11
+ additionalMinutes: number;
12
+ };
13
+ }
14
+
15
+ export type CommentaryType =
16
+ | "assist"
17
+ | "comment"
18
+ | "full time"
19
+ | "goal"
20
+ | "half time"
21
+ | "comment_important"
22
+ | "kick off"
23
+ | "penalty"
24
+ | "red card"
25
+ | "second_yellow red card"
26
+ | "substitution"
27
+ | "var"
28
+ | "yellow card";
@@ -0,0 +1,88 @@
1
+ import { PlayerID, TeamID } from "..";
2
+ import { MatchPeriod } from "./match";
3
+
4
+ export type MatchEvent =
5
+ | YellowCardEvent
6
+ | RedCardEvent
7
+ | GoalEvent
8
+ | MissedPenaltyEvent
9
+ | SubstitutionEvent
10
+ | PenaltyShootoutShotEvent;
11
+
12
+ export type EventType =
13
+ | "YELLOW_CARD"
14
+ | "RED_CARD"
15
+ | "GOAL"
16
+ | "SUBSTITUTION"
17
+ | "MISSED_PENALTY"
18
+ | "PENALTY_SHOOTOUT_GOAL"
19
+ | "PENALTY_SHOOTOUT_MISS";
20
+
21
+ export type EventTime = {
22
+ minutes: number;
23
+ seconds: number;
24
+ additionalMinutes: number;
25
+ };
26
+
27
+ type BaseEvent = {
28
+ type: EventType;
29
+ time: EventTime;
30
+ teamId: TeamID;
31
+ period: MatchPeriod;
32
+ };
33
+
34
+ export type RedCardEvent = BaseEvent & {
35
+ type: "RED_CARD";
36
+ isSecondYellow?: boolean;
37
+ playerName: string;
38
+ playerShirtName: string;
39
+ playerUniform: string;
40
+ };
41
+
42
+ export type YellowCardEvent = BaseEvent & {
43
+ type: "YELLOW_CARD";
44
+ playerName: string;
45
+ playerShirtName: string;
46
+ playerUniform: string;
47
+ };
48
+
49
+ export type GoalEvent = BaseEvent & {
50
+ type: "GOAL";
51
+ assistingPlayerId?: PlayerID;
52
+ assistingPlayerName?: string;
53
+ assistingPlayerShirtName?: string;
54
+ assistingPlayerUniform?: string;
55
+ goalNumber: number;
56
+ penalty?: boolean;
57
+ ownGoal?: boolean;
58
+ playerName: string;
59
+ playerShirtName: string;
60
+ playerUniform: string;
61
+ };
62
+
63
+ export type PenaltyShootoutShotEvent = BaseEvent & {
64
+ type: "PENALTY_SHOOTOUT_GOAL" | "PENALTY_SHOOTOUT_MISS";
65
+ playerName: string;
66
+ playerShirtName: string;
67
+ playerUniform: string;
68
+ teamPenaltyNumber: number;
69
+ };
70
+
71
+ export type MissedPenaltyEvent = BaseEvent & {
72
+ type: "MISSED_PENALTY";
73
+ playerName: string;
74
+ playerShirtName: string;
75
+ playerUniform: string;
76
+ };
77
+
78
+ export type SubstitutionEvent = BaseEvent & {
79
+ type: "SUBSTITUTION";
80
+ playerInId?: PlayerID;
81
+ playerInName?: string;
82
+ playerInShirtName?: string;
83
+ playerInUniform?: string;
84
+ playerOutId: PlayerID;
85
+ playerOutName: string;
86
+ playerOutShirtName: string;
87
+ playerOutUniform: string;
88
+ };
@@ -0,0 +1,13 @@
1
+ export type MatchHeadToHeadStats = {
2
+ teamsData: TeamsHeadToHeadStats;
3
+ draws: number;
4
+ };
5
+
6
+ export type TeamHeadToHeadStats = {
7
+ wins: number;
8
+ goals: number;
9
+ };
10
+
11
+ export type TeamsHeadToHeadStats = {
12
+ [teamId: string]: TeamHeadToHeadStats;
13
+ };
@@ -0,0 +1,31 @@
1
+ import { UUID } from "./common";
2
+
3
+ export type MatchLineup = {
4
+ [teamId: string]: TeamLineup;
5
+ };
6
+
7
+ export type FieldPositionType =
8
+ | "attacker"
9
+ | "midfielder"
10
+ | "defender"
11
+ | "goalkeeper"
12
+ | "unknown";
13
+
14
+ export type Player = {
15
+ playerId: UUID;
16
+ displayName: string;
17
+ shirtName: string;
18
+ uniform: string;
19
+ position: FieldPositionType;
20
+ startingLineup: boolean;
21
+ isOnPitch: boolean;
22
+ formation?: number | null;
23
+ };
24
+
25
+ export type TeamLineup = {
26
+ formation?: string | null;
27
+ coach?: string | null;
28
+ players: {
29
+ [playerID: string]: Player;
30
+ };
31
+ };
@@ -0,0 +1,113 @@
1
+ import { MatchSides } from "./match";
2
+
3
+ /**
4
+ * @see: https://sportsbroker.slite.com/app/channels/VOZ0prjzHu/notes/tOQ3uR_FUT
5
+ */
6
+ export type MatchStats = SoccerStats | NFLStats;
7
+
8
+ export type SoccerStats = {
9
+ // possession
10
+ possessionPercentageLast15: MatchSides<number>;
11
+ possessionPercentageLast30: MatchSides<number>;
12
+ possession: MatchSides<number>;
13
+ possessionLosses: MatchSides<number>;
14
+ possessionWonAttThird: MatchSides<number>;
15
+ possessionWonDefThird: MatchSides<number>;
16
+ possessionWonMidThird: MatchSides<number>;
17
+
18
+ // shots
19
+ bigChanceCreated: MatchSides<number>;
20
+ bigChanceMissed: MatchSides<number>;
21
+ bigChanceScored: MatchSides<number>;
22
+ crossbarHits: MatchSides<number>;
23
+ postHitsLeft: MatchSides<number>;
24
+ postHitsRight: MatchSides<number>;
25
+ shots: MatchSides<number>;
26
+ shotsOffTarget: MatchSides<number>;
27
+ shotsOnTarget: MatchSides<number>;
28
+ woodwork: MatchSides<number>;
29
+
30
+ // attacking
31
+ goalAssists: MatchSides<number>;
32
+ freeKickAwarded: MatchSides<number>;
33
+ fastbreak: MatchSides<number>;
34
+ corners: MatchSides<number>;
35
+ throws: MatchSides<number>;
36
+ offsides: MatchSides<number>;
37
+
38
+ // defensive
39
+ fouls: MatchSides<number>;
40
+ saves: MatchSides<number>;
41
+ penaltySave: MatchSides<number>;
42
+ ownGoals: MatchSides<number>;
43
+ interceptionsInBox: MatchSides<number>;
44
+ clearance: MatchSides<number>;
45
+ interceptions: MatchSides<number>;
46
+ crossBlocked: MatchSides<number>;
47
+ shotBlocked: MatchSides<number>;
48
+ tackles: MatchSides<number>;
49
+
50
+ //passing
51
+ passes: MatchSides<number>;
52
+ backwardPass: MatchSides<number>;
53
+ forwardPass: MatchSides<number>;
54
+ successfulCrosses: MatchSides<number>;
55
+ unsuccessfulCrosses: MatchSides<number>;
56
+ successfulPasses: MatchSides<number>;
57
+ unsuccessfulPasses: MatchSides<number>;
58
+ successfulLongBalls: MatchSides<number>;
59
+ unsuccessfulLongBalls: MatchSides<number>;
60
+ penaltyAreaEntries: MatchSides<number>;
61
+
62
+ // 1vs1
63
+ duelsWon: MatchSides<number>;
64
+ duelsLost: MatchSides<number>;
65
+ groundDuelsWon: MatchSides<number>;
66
+ groundDuelsLost: MatchSides<number>;
67
+ aerialDuelsWon: MatchSides<number>;
68
+ aerialDuelsLost: MatchSides<number>;
69
+ oneOnOneShotAttempt: MatchSides<number>;
70
+
71
+ // discipline
72
+ yellowCards: MatchSides<number>;
73
+ redCards: MatchSides<number>;
74
+ penaltyGoal: MatchSides<number>;
75
+ penaltyConceded: MatchSides<number>;
76
+ penaltyTaken: MatchSides<number>;
77
+ };
78
+
79
+ export type NFLStats = {
80
+ firstDowns: MatchSides<number>;
81
+ firstDownsPassing: MatchSides<number>;
82
+ firstDownsRushing: MatchSides<number>;
83
+ firstDownsFromPenalties: MatchSides<number>;
84
+ thirdDownEfficiency: MatchSides<number>;
85
+ fourthDownEfficiency: MatchSides<number>;
86
+ totalPlays: MatchSides<number>;
87
+ totalYards: MatchSides<number>;
88
+ totalDrives: MatchSides<number>;
89
+ yardsPerPlay: MatchSides<number>;
90
+ passing: MatchSides<number>;
91
+ passingCompletions: MatchSides<number>;
92
+ passingAttempts: MatchSides<number>;
93
+ yardsPerPass: MatchSides<number>;
94
+ interceptionsThrown: MatchSides<number>;
95
+ rushing: MatchSides<number>;
96
+ rushingAttempts: MatchSides<number>;
97
+ yardsPerRush: MatchSides<number>;
98
+ redZone: MatchSides<number>;
99
+ turnovers: MatchSides<number>;
100
+ fumblesLost: MatchSides<number>;
101
+ possession: MatchSides<number>;
102
+ thirdDownEfficiencySuccess: MatchSides<number>;
103
+ thirdDownEfficiencyAttempts: MatchSides<number>;
104
+ fourthDownEfficiencySuccess: MatchSides<number>;
105
+ fourthDownEfficiencyAttempts: MatchSides<number>;
106
+ redZoneAttempts: MatchSides<number>;
107
+ redZoneSuccess: MatchSides<number>;
108
+ penaltiesYards: MatchSides<number>;
109
+ specialTeamsTDs: MatchSides<number>;
110
+ sackYardLostSacks: MatchSides<number>;
111
+ sackYardLostSackYards: MatchSides<number>;
112
+ penaltiesTotal: MatchSides<number>;
113
+ };
@@ -1,5 +1,9 @@
1
1
  import { ISODate, UUID, Image, Doc } from "./common";
2
- import { Sport } from '../models/global';
2
+ import { MatchCommentary } from "./match-commentary";
3
+ import { MatchEvent } from "./match-event";
4
+ import { MatchHeadToHeadStats } from "./match-h2h-stats";
5
+ import { MatchLineup } from "./match-lineup";
6
+ import { MatchStats } from "./match-stats";
3
7
 
4
8
  export type MatchDoc = MatchData & Doc;
5
9
 
@@ -10,16 +14,29 @@ export type MatchData = {
10
14
  teams?: MatchSides<MatchTeam>;
11
15
  roundNb: number;
12
16
  season: string;
13
- eventStatus: EventStatus;
17
+ status: MatchStatus;
14
18
  tournamentType: TournamentType;
15
19
  stage?: MatchStage;
16
20
  group?: MatchGroup;
17
21
  score?: MatchScores;
18
22
  previousMatches?: MatchSides<PreviousMatch[]>;
23
+ commentaries?: MatchCommentary[];
24
+ events?: MatchEvent[];
25
+ headToHeadStats?: MatchHeadToHeadStats;
26
+ lineup?: MatchLineup;
27
+ shares?: MatchSides<TeamSharesData>;
28
+ stats?: MatchStats;
29
+ };
30
+
31
+ export type TeamSharesData = {
32
+ preMatchPrice?: number;
33
+ postMatchPrice?: number;
19
34
  };
20
35
 
21
36
  export type MatchResult = "WON" | "DRAW" | "LOST";
22
37
 
38
+ export type Sport = "soccer" | "nfl";
39
+
23
40
  export type TournamentType =
24
41
  | "DOMESTIC_LEAGUE"
25
42
  | "DOMESTIC_CUP"
@@ -28,9 +45,11 @@ export type TournamentType =
28
45
  export type MatchScores = {
29
46
  home: number | null;
30
47
  away: number | null;
31
- periods: Record<string, MatchSides<number | null>>;
48
+ periods: MatchPeriodsScores;
32
49
  };
33
50
 
51
+ export type MatchPeriodsScores = Record<string, MatchSides<number | null>>;
52
+
34
53
  export type MatchTeamSide = "home" | "away" | "none";
35
54
 
36
55
  export type PreviousMatch = {
@@ -56,11 +75,6 @@ export type MatchGroup = {
56
75
  name?: string;
57
76
  };
58
77
 
59
- export type MatchTeams = {
60
- home?: MatchTeam;
61
- away?: MatchTeam;
62
- };
63
-
64
78
  export type MatchTeam = {
65
79
  id: UUID;
66
80
  name: string;
@@ -69,8 +83,9 @@ export type MatchTeam = {
69
83
  logo?: Image;
70
84
  };
71
85
 
72
- export type EventStatus = {
73
- matchStatus: MatchStatus;
86
+ export type MatchStatus = {
87
+ matchStatus: MatchStatusType;
88
+ // FIXME: period unification for soccer and NFL (MatchTime.periodId ???) we need to know what match periods are possible
74
89
  period: MatchPeriod;
75
90
  isActive: boolean;
76
91
  matchTime: MatchTime;
@@ -84,11 +99,12 @@ export type MatchPeriod =
84
99
  | "SECOND_OVERTIME_HALF"
85
100
  | "SHOOTOUT";
86
101
 
87
- export type MatchStatus = "PENDING" | "STARTED" | "FINISHED" | "POSTPONED";
102
+ export type MatchStatusType = "PENDING" | "STARTED" | "FINISHED" | "POSTPONED";
88
103
 
89
104
  export type MatchTime = {
90
105
  minutes: number;
91
106
  additionalMinutes: number;
107
+ periodId: number;
92
108
  };
93
109
 
94
110
  export type Opponent = {
@@ -1,5 +1,3 @@
1
- import { ISODate } from '../../global';
2
-
3
1
  export interface CommentaryItem {
4
2
  period: number;
5
3
  content: string;
@@ -9,7 +7,6 @@ export interface CommentaryItem {
9
7
  seconds: number;
10
8
  additionalMinutes: number;
11
9
  };
12
- timestamp?: ISODate;
13
10
  }
14
11
 
15
12
  export type CommentaryType =
@@ -1,3 +1,5 @@
1
+ import { TeamID, SportID, SeasonID } from "../../global";
2
+
1
3
  /**
2
4
  * sportId: SportID
3
5
  * seasonId: SeasonID
@@ -1,5 +1,7 @@
1
+ import { GroupID, SeasonID, SportID } from "../../global";
2
+
1
3
  /**
2
- * sportID: Sport
4
+ * sportID: SportID
3
5
  * seasonID: SeasonID
4
6
  * groupID: GroupID
5
7
  */
@@ -1,4 +1,4 @@
1
- import { Image, Sport, TeamID, WithSeasons } from "../../global";
1
+ import {Image, TeamID, WithSeasons} from "../../global";
2
2
 
3
3
  export interface TeamOverview extends WithSeasons {
4
4
  id: TeamID;
@@ -8,9 +8,14 @@ export interface TeamOverview extends WithSeasons {
8
8
  logo?: Image;
9
9
  isCurrentlyPlaying: boolean;
10
10
  currentlyPlayedMatch?: string;
11
- sport: Sport;
12
11
  }
13
12
 
13
+ /**
14
+ * sportId: SportID
15
+ * teamId: TeamID
16
+ */
14
17
  export interface Overviews {
15
- [teamId: string]: TeamOverview;
18
+ [sportId: string]: {
19
+ [teamId: string]: TeamOverview;
20
+ };
16
21
  }
@@ -41,7 +41,6 @@ export interface Order {
41
41
  totalPrice: number;
42
42
  preciseSharesValue: number;
43
43
  abortReason: OrderAbortReason | null;
44
- sportId?: string; // TODO to be removed
45
44
  vatPercentage?: number;
46
45
  vatProcessed?: number;
47
46
  childId?: OrderID;
@@ -1,4 +1,4 @@
1
- import { ISODate } from "../../global";
1
+ import {ISODate, MatchID, SportID, TeamSide} from "../../global";
2
2
 
3
3
  export interface UserOwnedShares {
4
4
  amount: number;
@@ -7,7 +7,6 @@ export interface UserOwnedShares {
7
7
  processedTotalMoney: number;
8
8
  averagePricePerShare: number;
9
9
  fee: number;
10
- sportId?: string; // TODO to be removed
11
10
  splits?: OwnedSharesSplits;
12
11
  }
13
12
 
@@ -19,7 +19,10 @@ export type TeamID = UUID;
19
19
  */
20
20
  export type ISODate = string;
21
21
 
22
- export type Sport = "soccer" | "nfl";
22
+ /**
23
+ * Currently support only soccer
24
+ */
25
+ export type SportID = "soccer" | "nfl" | string;
23
26
 
24
27
  export type Language = "en" | "de" | string;
25
28
 
@@ -1,5 +1,7 @@
1
+ import { SportID, SeasonID } from "../global";
2
+
1
3
  /**
2
- * sportId: Sport
4
+ * sportId: SportID
3
5
  * seasonId: SeasonID
4
6
  */
5
7
  export interface ActiveSeasons {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sportsbroker/firebase-structure",
3
- "version": "3.53.3",
3
+ "version": "3.54.1",
4
4
  "description": "Firebase structure typings",
5
5
  "main": "index.d.ts",
6
6
  "repository": {