@sportsbroker/firebase-structure 9.9.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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sportsbroker/firebase-structure",
3
- "version": "9.9.0",
3
+ "version": "9.10.0",
4
4
  "description": "Firebase structure typings",
5
5
  "main": "index.d.ts",
6
6
  "repository": {