@sportsbroker/firebase-structure 9.3.1 → 9.5.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.
@@ -6,11 +6,30 @@ export type Fixture = {
6
6
  homeTeam: MatchTeam;
7
7
  awayTeam: MatchTeam;
8
8
  status: FixtureStatus;
9
+ /** The match clock every game counts on from. Absent before the first reading of the match. */
10
+ clock?: FixtureClock;
11
+ };
12
+
13
+ /**
14
+ * The match time, the same for every game and operator of the match. A reader computes the time now as
15
+ * `seconds + (now - readAt) × pace` while `running`, and `seconds` while it is not. It moves only when a
16
+ * reading disagrees with that prediction, when the clock stops or starts, or with the shown minute.
17
+ */
18
+ export type FixtureClock = {
19
+ /** Match time played at `readAt`, in seconds, as the sport counts it; null for a sport without a match clock. */
20
+ seconds: number | null;
21
+ /** When the source read the clock (ISO 8601). */
22
+ readAt: ISODate;
23
+ /** False before kick-off, at breaks between periods, while suspended and after full time. */
24
+ running: boolean;
25
+ /** Match seconds per wall-clock second: 1 for a real match, the playback speed of a showcase. */
26
+ pace: number;
9
27
  };
10
28
 
11
29
  export type MatchTeam = {
12
30
  id: UUID;
13
31
  name: string;
32
+ /** Shared team shirt URL. Display: pool override -> fixture logo -> built-in shirt. */
14
33
  logo: string | null;
15
34
  score: number;
16
35
  };
@@ -29,35 +29,24 @@ export type Pool = {
29
29
  prizeDistributionStrategy: PrizeDistributionStrategyEnum;
30
30
  track?: PoolTrack;
31
31
  teamKits?: PoolTeamKits;
32
+ /**
33
+ * The provider brand the pool serves, for an operator that keeps pools per brand: an aggregator (Bragg)
34
+ * whose one operator serves many casinos. Players of two brands never share a pool, so a client of a
35
+ * brand session lists only the pools of its own brand, `where('brand', '==', brand)` next to the
36
+ * operator filter. Each such list query needs its composite index in the Firebase project.
37
+ *
38
+ * Absent for every other operator, and for their documents nothing changes. Omitting it is safe under
39
+ * the merge write that `teamKits` has to guard against: a pool keeps the brand it was created with for
40
+ * its whole life, so no document is ever left holding a brand it lost.
41
+ */
42
+ brand?: string;
32
43
  };
33
44
 
34
45
  /**
35
- * The shirts to draw for the teams taking part in this pool.
36
- *
37
- * One entry per team that HAS a shirt, never an entry per team. A pool is not one match - a
38
- * prediction or score-predictor pool runs over several fixtures and therefore over several teams -
39
- * so this covers all of them at once. The ids are the same ones the `Fixtures` documents named
40
- * under `matchIds`, so a client joins what it already read.
41
- *
42
- * It lives on the POOL and not on the fixture because a shirt is one operator's choice: a fixture
43
- * document is shared by every operator running that match, and could not carry a per-operator
44
- * answer. The pool is the only document that knows whose it is.
45
- *
46
- * A LIST and not a map, which is a storage fact rather than a taste. Pool documents are written
47
- * with a merge, and a merge DEEP-merges a nested map: a shirt that was removed, repointed at
48
- * another team, or keyed to a team that has since left a hand-entered fixture would stay in that
49
- * map for ever, because a write that stops naming a key does not remove it. A list is replaced
50
- * whole, so what was written last is what a player sees. A client that wants lookup by id builds
51
- * its own map once.
52
- *
53
- * Optional to READ, always written. A team with no shirt has no entry, and a pool whose teams have
54
- * none carries an EMPTY list rather than no field: a write that simply stopped sending the field
55
- * would leave the previous list in place, for the same merge reason as above. So presence means
56
- * nothing and length means everything - a client checks whether the list has an entry for the team
57
- * it is drawing, and draws what it drew before when it has not. It stays optional on the type
58
- * because documents written before this field existed have none.
59
-
60
- * Nothing here is a promise that a team has a shirt.
46
+ * Explicit team overrides of this pool's operator, ordered by team id.
47
+ * Display: pool override -> Fixtures side logo -> built-in shirt.
48
+ * Shared kits are never copied here. An empty list clears removed overrides
49
+ * because Firestore merge replaces arrays rather than merging their entries.
61
50
  */
62
51
  export type PoolTeamKits = PoolTeamKit[];
63
52
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sportsbroker/firebase-structure",
3
- "version": "9.3.1",
3
+ "version": "9.5.0",
4
4
  "description": "Firebase structure typings",
5
5
  "main": "index.d.ts",
6
6
  "repository": {