@sportsbroker/firebase-structure 9.4.0 → 9.6.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
  };
@@ -40,35 +40,30 @@ export type Pool = {
40
40
  * its whole life, so no document is ever left holding a brand it lost.
41
41
  */
42
42
  brand?: string;
43
+ /**
44
+ * The option of the operator's offer that this pool sells: one stake level of the game, with its own entry
45
+ * fee and seed. One event can hold one pool per option, so a client groups the pools of an event by this ID,
46
+ * sends it with a join, and finds the option of a bet through `bet.poolId`.
47
+ *
48
+ * Absent on documents written before options existed: read it as `"default"`, the only option those pools
49
+ * had.
50
+ */
51
+ commercialOptionId?: string;
52
+ /**
53
+ * Whether the pool itself still takes entries: false once it is locked, settled or cancelled - for example
54
+ * when ops cancel the pool of one option while the others still sell - so a client can hide that option.
55
+ * The event's own window (`event.status`) still applies.
56
+ *
57
+ * Absent on documents written before the field existed: rely on `event.status`, as before.
58
+ */
59
+ acceptsEntries?: boolean;
43
60
  };
44
61
 
45
62
  /**
46
- * The shirts to draw for the teams taking part in this pool.
47
- *
48
- * One entry per team that HAS a shirt, never an entry per team. A pool is not one match - a
49
- * prediction or score-predictor pool runs over several fixtures and therefore over several teams -
50
- * so this covers all of them at once. The ids are the same ones the `Fixtures` documents named
51
- * under `matchIds`, so a client joins what it already read.
52
- *
53
- * It lives on the POOL and not on the fixture because a shirt is one operator's choice: a fixture
54
- * document is shared by every operator running that match, and could not carry a per-operator
55
- * answer. The pool is the only document that knows whose it is.
56
- *
57
- * A LIST and not a map, which is a storage fact rather than a taste. Pool documents are written
58
- * with a merge, and a merge DEEP-merges a nested map: a shirt that was removed, repointed at
59
- * another team, or keyed to a team that has since left a hand-entered fixture would stay in that
60
- * map for ever, because a write that stops naming a key does not remove it. A list is replaced
61
- * whole, so what was written last is what a player sees. A client that wants lookup by id builds
62
- * its own map once.
63
- *
64
- * Optional to READ, always written. A team with no shirt has no entry, and a pool whose teams have
65
- * none carries an EMPTY list rather than no field: a write that simply stopped sending the field
66
- * would leave the previous list in place, for the same merge reason as above. So presence means
67
- * nothing and length means everything - a client checks whether the list has an entry for the team
68
- * it is drawing, and draws what it drew before when it has not. It stays optional on the type
69
- * because documents written before this field existed have none.
70
-
71
- * Nothing here is a promise that a team has a shirt.
63
+ * Explicit team overrides of this pool's operator, ordered by team id.
64
+ * Display: pool override -> Fixtures side logo -> built-in shirt.
65
+ * Shared kits are never copied here. An empty list clears removed overrides
66
+ * because Firestore merge replaces arrays rather than merging their entries.
72
67
  */
73
68
  export type PoolTeamKits = PoolTeamKit[];
74
69
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sportsbroker/firebase-structure",
3
- "version": "9.4.0",
3
+ "version": "9.6.0",
4
4
  "description": "Firebase structure typings",
5
5
  "main": "index.d.ts",
6
6
  "repository": {