@sportsbroker/firebase-structure 9.8.0 → 9.10.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.
@@ -41,19 +41,30 @@ export type EventQuestion = {
41
41
  pointsForCorrectResult: number;
42
42
  pointsForWrongAnswer: number;
43
43
  /**
44
- * How the question is decided, for the types that need a rule. Present on `occurred-or-not`, which is
45
- * settled by comparing a stat against a threshold; absent on the types whose answer IS the stat.
44
+ * How the question is decided, for the types that need a rule. `occurred-or-not` always carries an
45
+ * occurrence rule (a stat compared with a threshold). `total-occurrence-count` may carry a count rule
46
+ * naming the team it counts; without one it counts both teams. The other types carry none.
46
47
  */
47
48
  questionConfig?: EventQuestionConfig;
48
49
  };
49
50
 
50
- /** An aggregate over one live stat, compared with a threshold. */
51
- export type EventQuestionConfig = {
52
- aggregate: "sum" | "home" | "away";
51
+ /** Which side of a live stat a question reads: both teams added up, the home team or the away team. */
52
+ export type EventQuestionAggregate = "sum" | "home" | "away";
53
+
54
+ /** `occurred-or-not`: an aggregate over one live stat, compared with a threshold. */
55
+ export type EventOccurrenceRule = {
56
+ aggregate: EventQuestionAggregate;
53
57
  operator: ">=" | ">" | "===" | "<=" | "<";
54
58
  threshold: number;
55
59
  };
56
60
 
61
+ /** `total-occurrence-count`: the team the count is for. The answer is that count. */
62
+ export type EventCountRule = {
63
+ aggregate: EventQuestionAggregate;
64
+ };
65
+
66
+ export type EventQuestionConfig = EventOccurrenceRule | EventCountRule;
67
+
57
68
  export type EventResultsData = {
58
69
  [eventQuestionId: UUID]: EventResultData;
59
70
  } | null;
@@ -8,6 +8,30 @@ export type Fixture = {
8
8
  status: FixtureStatus;
9
9
  /** The match clock every game counts on from. Absent before the first reading of the match. */
10
10
  clock?: FixtureClock;
11
+ /** The score of each stage the match reached. Absent before kick-off and on documents projected before it existed. */
12
+ stageScores?: FixtureStageScores;
13
+ };
14
+
15
+ /**
16
+ * One key per stage the match reached: a stage appears when it starts, and its score follows the match until the
17
+ * stage ends. A stage the match did not reach is absent: no extra time means no `extraTime`, no shootout means no
18
+ * `penalties`. A match can go from `fullTime` straight to `penalties`.
19
+ */
20
+ export type FixtureStageScores = {
21
+ /**
22
+ * Regulation time: the two halves with their stoppage time. The games count this score; it is final once
23
+ * `status.fullTimeFinished` is true.
24
+ */
25
+ fullTime?: FixtureScore;
26
+ /** Extra time, counted from kick-off: the goals of regulation time are included. */
27
+ extraTime?: FixtureScore;
28
+ /** The penalty shootout alone. */
29
+ penalties?: FixtureScore;
30
+ };
31
+
32
+ export type FixtureScore = {
33
+ home: number;
34
+ away: number;
11
35
  };
12
36
 
13
37
  /**
@@ -31,6 +55,7 @@ export type MatchTeam = {
31
55
  name: string;
32
56
  /** Shared team shirt URL. Display: pool override -> fixture logo -> built-in shirt. */
33
57
  logo: string | null;
58
+ /** Goals in the whole match, extra time included. The penalty shootout is not counted. */
34
59
  score: number;
35
60
  };
36
61
 
@@ -41,6 +66,7 @@ export type FixtureStatus = {
41
66
  periodId: number;
42
67
  minutes: number;
43
68
  additionalMinutes: number;
69
+ /** True from the end of regulation time (the second half with its stoppage time). The games end here. */
44
70
  fullTimeFinished: boolean;
45
71
  };
46
72
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sportsbroker/firebase-structure",
3
- "version": "9.8.0",
3
+ "version": "9.10.0",
4
4
  "description": "Firebase structure typings",
5
5
  "main": "index.d.ts",
6
6
  "repository": {