@ttt-productions/q-core 0.1.16 → 0.1.18

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.
Files changed (275) hide show
  1. package/dist/constants/business.d.ts.map +1 -1
  2. package/dist/constants/business.js +25 -5
  3. package/dist/constants/business.js.map +1 -1
  4. package/dist/constants/sports.d.ts.map +1 -1
  5. package/dist/constants/sports.js +2 -2
  6. package/dist/constants/sports.js.map +1 -1
  7. package/dist/doc-schemas/admin-notifications.d.ts +1 -1
  8. package/dist/doc-schemas/admin-notifications.d.ts.map +1 -1
  9. package/dist/doc-schemas/admin-notifications.js +4 -1
  10. package/dist/doc-schemas/admin-notifications.js.map +1 -1
  11. package/dist/doc-schemas/aggregate-stats.d.ts.map +1 -1
  12. package/dist/doc-schemas/aggregate-stats.js +4 -1
  13. package/dist/doc-schemas/aggregate-stats.js.map +1 -1
  14. package/dist/doc-schemas/atoms.d.ts.map +1 -1
  15. package/dist/doc-schemas/atoms.js +2 -2
  16. package/dist/doc-schemas/atoms.js.map +1 -1
  17. package/dist/doc-schemas/audit-event.d.ts.map +1 -1
  18. package/dist/doc-schemas/audit-event.js +8 -4
  19. package/dist/doc-schemas/audit-event.js.map +1 -1
  20. package/dist/doc-schemas/award-group-grant.d.ts.map +1 -1
  21. package/dist/doc-schemas/award-group-grant.js +11 -3
  22. package/dist/doc-schemas/award-group-grant.js.map +1 -1
  23. package/dist/doc-schemas/catalogs.js +1 -1
  24. package/dist/doc-schemas/catalogs.js.map +1 -1
  25. package/dist/doc-schemas/gallery.js +1 -1
  26. package/dist/doc-schemas/gallery.js.map +1 -1
  27. package/dist/doc-schemas/game-stat-history.d.ts.map +1 -1
  28. package/dist/doc-schemas/game-stat-history.js.map +1 -1
  29. package/dist/doc-schemas/game-stats.d.ts.map +1 -1
  30. package/dist/doc-schemas/game-stats.js +10 -2
  31. package/dist/doc-schemas/game-stats.js.map +1 -1
  32. package/dist/doc-schemas/league-team.js +1 -1
  33. package/dist/doc-schemas/league-team.js.map +1 -1
  34. package/dist/doc-schemas/membership-roster-sync.d.ts.map +1 -1
  35. package/dist/doc-schemas/membership-roster-sync.js +2 -1
  36. package/dist/doc-schemas/membership-roster-sync.js.map +1 -1
  37. package/dist/doc-schemas/migration-console.js +1 -1
  38. package/dist/doc-schemas/migration-console.js.map +1 -1
  39. package/dist/doc-schemas/pending-media.d.ts.map +1 -1
  40. package/dist/doc-schemas/pending-media.js.map +1 -1
  41. package/dist/doc-schemas/picture-retirement.d.ts.map +1 -1
  42. package/dist/doc-schemas/picture-retirement.js +5 -1
  43. package/dist/doc-schemas/picture-retirement.js.map +1 -1
  44. package/dist/doc-schemas/registry.d.ts +1 -1
  45. package/dist/doc-schemas/registry.d.ts.map +1 -1
  46. package/dist/doc-schemas/registry.js +1 -1
  47. package/dist/doc-schemas/registry.js.map +1 -1
  48. package/dist/doc-schemas/sport-game.d.ts.map +1 -1
  49. package/dist/doc-schemas/sport-game.js.map +1 -1
  50. package/dist/doc-schemas/sport-league.d.ts.map +1 -1
  51. package/dist/doc-schemas/sport-league.js +10 -2
  52. package/dist/doc-schemas/sport-league.js.map +1 -1
  53. package/dist/doc-schemas/status-reconcile-queue.d.ts.map +1 -1
  54. package/dist/doc-schemas/status-reconcile-queue.js.map +1 -1
  55. package/dist/doc-schemas/sweep-state.d.ts.map +1 -1
  56. package/dist/doc-schemas/sweep-state.js +10 -2
  57. package/dist/doc-schemas/sweep-state.js.map +1 -1
  58. package/dist/doc-schemas/system.d.ts.map +1 -1
  59. package/dist/doc-schemas/system.js.map +1 -1
  60. package/dist/doc-schemas/user-profile.d.ts.map +1 -1
  61. package/dist/doc-schemas/user-profile.js +1 -1
  62. package/dist/doc-schemas/user-profile.js.map +1 -1
  63. package/dist/doc-schemas/waivers-and-hardware.d.ts.map +1 -1
  64. package/dist/doc-schemas/waivers-and-hardware.js +15 -3
  65. package/dist/doc-schemas/waivers-and-hardware.js.map +1 -1
  66. package/dist/domain-events/domain-events.d.ts.map +1 -1
  67. package/dist/domain-events/domain-events.js +88 -24
  68. package/dist/domain-events/domain-events.js.map +1 -1
  69. package/dist/ids/notification-ids.d.ts.map +1 -1
  70. package/dist/ids/notification-ids.js.map +1 -1
  71. package/dist/ids/picture-ids.d.ts.map +1 -1
  72. package/dist/ids/picture-ids.js.map +1 -1
  73. package/dist/ids/stat-event-ids.d.ts.map +1 -1
  74. package/dist/ids/stat-event-ids.js.map +1 -1
  75. package/dist/ids/waiver-template-ids.d.ts.map +1 -1
  76. package/dist/ids/waiver-template-ids.js.map +1 -1
  77. package/dist/index.d.ts +4 -9
  78. package/dist/index.d.ts.map +1 -1
  79. package/dist/index.js +6 -9
  80. package/dist/index.js.map +1 -1
  81. package/dist/input-formats/{index.d.ts → input-formats.d.ts} +1 -1
  82. package/dist/input-formats/input-formats.d.ts.map +1 -0
  83. package/dist/input-formats/{index.js → input-formats.js} +1 -1
  84. package/dist/input-formats/input-formats.js.map +1 -0
  85. package/dist/media/file-origins.d.ts.map +1 -1
  86. package/dist/media/file-origins.js +30 -6
  87. package/dist/media/file-origins.js.map +1 -1
  88. package/dist/migration-console/action-ids.d.ts.map +1 -1
  89. package/dist/migration-console/action-ids.js.map +1 -1
  90. package/dist/migration-console/manifest.d.ts.map +1 -1
  91. package/dist/migration-console/manifest.js +42 -7
  92. package/dist/migration-console/manifest.js.map +1 -1
  93. package/dist/migration-console/run-state.d.ts.map +1 -1
  94. package/dist/migration-console/run-state.js.map +1 -1
  95. package/dist/notifications/admin-notification-config.d.ts.map +1 -1
  96. package/dist/notifications/admin-notification-config.js +5 -3
  97. package/dist/notifications/admin-notification-config.js.map +1 -1
  98. package/dist/notifications/occurrences.d.ts.map +1 -1
  99. package/dist/notifications/occurrences.js.map +1 -1
  100. package/dist/paths/path-builders.d.ts.map +1 -1
  101. package/dist/paths/path-builders.js +60 -15
  102. package/dist/paths/path-builders.js.map +1 -1
  103. package/dist/paths/picture-owner-paths.d.ts.map +1 -1
  104. package/dist/paths/picture-owner-paths.js.map +1 -1
  105. package/dist/paths/storage-paths.d.ts.map +1 -1
  106. package/dist/paths/storage-paths.js.map +1 -1
  107. package/dist/schemas/admin-notifications.d.ts.map +1 -1
  108. package/dist/schemas/admin-notifications.js +8 -4
  109. package/dist/schemas/admin-notifications.js.map +1 -1
  110. package/dist/schemas/app-config.js +1 -1
  111. package/dist/schemas/app-config.js.map +1 -1
  112. package/dist/schemas/atoms.d.ts +0 -1
  113. package/dist/schemas/atoms.d.ts.map +1 -1
  114. package/dist/schemas/atoms.js +3 -5
  115. package/dist/schemas/atoms.js.map +1 -1
  116. package/dist/schemas/awards.d.ts.map +1 -1
  117. package/dist/schemas/awards.js +13 -5
  118. package/dist/schemas/awards.js.map +1 -1
  119. package/dist/schemas/dead-letters.d.ts.map +1 -1
  120. package/dist/schemas/dead-letters.js +6 -3
  121. package/dist/schemas/dead-letters.js.map +1 -1
  122. package/dist/schemas/game-locations.d.ts.map +1 -1
  123. package/dist/schemas/game-locations.js +1 -1
  124. package/dist/schemas/game-locations.js.map +1 -1
  125. package/dist/schemas/hardware-loan-contracts.d.ts.map +1 -1
  126. package/dist/schemas/hardware-loan-contracts.js +11 -4
  127. package/dist/schemas/hardware-loan-contracts.js.map +1 -1
  128. package/dist/schemas/leagues.d.ts +2 -2
  129. package/dist/schemas/leagues.d.ts.map +1 -1
  130. package/dist/schemas/leagues.js +12 -3
  131. package/dist/schemas/leagues.js.map +1 -1
  132. package/dist/schemas/migration-console.d.ts.map +1 -1
  133. package/dist/schemas/migration-console.js +3 -6
  134. package/dist/schemas/migration-console.js.map +1 -1
  135. package/dist/schemas/pictures.d.ts.map +1 -1
  136. package/dist/schemas/pictures.js +6 -2
  137. package/dist/schemas/pictures.js.map +1 -1
  138. package/dist/schemas/schedules.d.ts +8 -8
  139. package/dist/schemas/schedules.d.ts.map +1 -1
  140. package/dist/schemas/schedules.js +9 -3
  141. package/dist/schemas/schedules.js.map +1 -1
  142. package/dist/schemas/scoring.d.ts +12 -12
  143. package/dist/schemas/scoring.d.ts.map +1 -1
  144. package/dist/schemas/scoring.js +11 -4
  145. package/dist/schemas/scoring.js.map +1 -1
  146. package/dist/schemas/signed-waivers.d.ts.map +1 -1
  147. package/dist/schemas/signed-waivers.js +5 -3
  148. package/dist/schemas/signed-waivers.js.map +1 -1
  149. package/dist/schemas/stats.d.ts.map +1 -1
  150. package/dist/schemas/stats.js +27 -8
  151. package/dist/schemas/stats.js.map +1 -1
  152. package/dist/schemas/team-joining.d.ts.map +1 -1
  153. package/dist/schemas/team-joining.js +13 -5
  154. package/dist/schemas/team-joining.js.map +1 -1
  155. package/dist/schemas/teams.d.ts.map +1 -1
  156. package/dist/schemas/teams.js +19 -6
  157. package/dist/schemas/teams.js.map +1 -1
  158. package/dist/schemas/uploads.d.ts.map +1 -1
  159. package/dist/schemas/uploads.js +12 -5
  160. package/dist/schemas/uploads.js.map +1 -1
  161. package/dist/schemas/users.d.ts.map +1 -1
  162. package/dist/schemas/users.js +22 -8
  163. package/dist/schemas/users.js.map +1 -1
  164. package/dist/schemas/waiver-templates.js +1 -1
  165. package/dist/schemas/waiver-templates.js.map +1 -1
  166. package/dist/sports/basketball-scoring.d.ts.map +1 -1
  167. package/dist/sports/basketball-scoring.js +67 -16
  168. package/dist/sports/basketball-scoring.js.map +1 -1
  169. package/dist/sports/basketball.d.ts.map +1 -1
  170. package/dist/sports/basketball.js +34 -7
  171. package/dist/sports/basketball.js.map +1 -1
  172. package/dist/sports/column-catalog.d.ts.map +1 -1
  173. package/dist/sports/column-catalog.js +4 -1
  174. package/dist/sports/column-catalog.js.map +1 -1
  175. package/dist/sports/contribution.d.ts.map +1 -1
  176. package/dist/sports/contribution.js +10 -3
  177. package/dist/sports/contribution.js.map +1 -1
  178. package/dist/sports/curling-scoring.d.ts.map +1 -1
  179. package/dist/sports/curling-scoring.js +30 -8
  180. package/dist/sports/curling-scoring.js.map +1 -1
  181. package/dist/sports/curling.d.ts.map +1 -1
  182. package/dist/sports/curling.js +1 -1
  183. package/dist/sports/curling.js.map +1 -1
  184. package/dist/sports/finalized-record.d.ts.map +1 -1
  185. package/dist/sports/finalized-record.js.map +1 -1
  186. package/dist/sports/football-scoring.d.ts.map +1 -1
  187. package/dist/sports/football-scoring.js +28 -8
  188. package/dist/sports/football-scoring.js.map +1 -1
  189. package/dist/sports/football.d.ts.map +1 -1
  190. package/dist/sports/football.js +1 -1
  191. package/dist/sports/football.js.map +1 -1
  192. package/dist/sports/index.d.ts +2 -2
  193. package/dist/sports/index.d.ts.map +1 -1
  194. package/dist/sports/index.js +1 -1
  195. package/dist/sports/index.js.map +1 -1
  196. package/dist/sports/ledger-continuity.d.ts.map +1 -1
  197. package/dist/sports/ledger-continuity.js.map +1 -1
  198. package/dist/sports/rankings.d.ts.map +1 -1
  199. package/dist/sports/rankings.js +5 -1
  200. package/dist/sports/rankings.js.map +1 -1
  201. package/dist/sports/replay.d.ts.map +1 -1
  202. package/dist/sports/replay.js +4 -1
  203. package/dist/sports/replay.js.map +1 -1
  204. package/dist/sports/rollup-check.d.ts.map +1 -1
  205. package/dist/sports/rollup-check.js +15 -3
  206. package/dist/sports/rollup-check.js.map +1 -1
  207. package/dist/sports/score-mirror.d.ts.map +1 -1
  208. package/dist/sports/score-mirror.js.map +1 -1
  209. package/dist/sports/scoring-display.d.ts.map +1 -1
  210. package/dist/sports/scoring-display.js.map +1 -1
  211. package/dist/sports/scoring.d.ts.map +1 -1
  212. package/dist/sports/scoring.js.map +1 -1
  213. package/dist/sports/sport-adapter.d.ts.map +1 -1
  214. package/dist/sports/sport-adapter.js.map +1 -1
  215. package/dist/sports/store-driver.d.ts.map +1 -1
  216. package/dist/sports/store-driver.js +18 -7
  217. package/dist/sports/store-driver.js.map +1 -1
  218. package/dist/types/audit.d.ts.map +1 -1
  219. package/dist/types/audit.js +16 -3
  220. package/dist/types/audit.js.map +1 -1
  221. package/dist/types/index.d.ts +0 -1
  222. package/dist/types/index.d.ts.map +1 -1
  223. package/dist/types/index.js +0 -1
  224. package/dist/types/index.js.map +1 -1
  225. package/dist/types/notifications.d.ts.map +1 -1
  226. package/dist/types/notifications.js +9 -13
  227. package/dist/types/notifications.js.map +1 -1
  228. package/dist/types/schedules.d.ts.map +1 -1
  229. package/dist/types/schedules.js.map +1 -1
  230. package/dist/types/sports.d.ts.map +1 -1
  231. package/dist/types/sports.js +9 -2
  232. package/dist/types/sports.js.map +1 -1
  233. package/dist/types/stats.d.ts.map +1 -1
  234. package/dist/types/stats.js +45 -9
  235. package/dist/types/stats.js.map +1 -1
  236. package/dist/types/unions.d.ts.map +1 -1
  237. package/dist/types/unions.js +32 -6
  238. package/dist/types/unions.js.map +1 -1
  239. package/dist/upload-variables/picture-upload-variables.d.ts.map +1 -1
  240. package/dist/upload-variables/picture-upload-variables.js +4 -2
  241. package/dist/upload-variables/picture-upload-variables.js.map +1 -1
  242. package/dist/upload-variables/sign-hardware-contract-variables.d.ts.map +1 -1
  243. package/dist/upload-variables/sign-hardware-contract-variables.js +4 -2
  244. package/dist/upload-variables/sign-hardware-contract-variables.js.map +1 -1
  245. package/dist/upload-variables/sign-waiver-variables.d.ts.map +1 -1
  246. package/dist/upload-variables/sign-waiver-variables.js +5 -3
  247. package/dist/upload-variables/sign-waiver-variables.js.map +1 -1
  248. package/dist/utils/app-config.d.ts.map +1 -1
  249. package/dist/utils/app-config.js +5 -1
  250. package/dist/utils/app-config.js.map +1 -1
  251. package/dist/utils/app-routes.d.ts.map +1 -1
  252. package/dist/utils/app-routes.js +6 -1
  253. package/dist/utils/app-routes.js.map +1 -1
  254. package/dist/utils/league-calendar.d.ts.map +1 -1
  255. package/dist/utils/league-calendar.js +4 -1
  256. package/dist/utils/league-calendar.js.map +1 -1
  257. package/dist/utils/league-join-warning.d.ts.map +1 -1
  258. package/dist/utils/league-join-warning.js +15 -5
  259. package/dist/utils/league-join-warning.js.map +1 -1
  260. package/dist/utils/schedules.d.ts.map +1 -1
  261. package/dist/utils/schedules.js +6 -2
  262. package/dist/utils/schedules.js.map +1 -1
  263. package/dist/utils/team-member-actions.d.ts.map +1 -1
  264. package/dist/utils/team-member-actions.js.map +1 -1
  265. package/package.json +5 -17
  266. package/dist/input-formats/index.d.ts.map +0 -1
  267. package/dist/input-formats/index.js.map +0 -1
  268. package/dist/migration-console/index.d.ts +0 -4
  269. package/dist/migration-console/index.d.ts.map +0 -1
  270. package/dist/migration-console/index.js +0 -5
  271. package/dist/migration-console/index.js.map +0 -1
  272. package/dist/types/documents.d.ts +0 -24
  273. package/dist/types/documents.d.ts.map +0 -1
  274. package/dist/types/documents.js +0 -5
  275. package/dist/types/documents.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"football.js","sourceRoot":"","sources":["../../src/sports/football.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,0FAA0F;AAC1F,mDAAmD;AAEnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EACL,yBAAyB,EACzB,6BAA6B,EAC7B,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAG7G,MAAM,mBAAmB,GAAG,CAAC,mBAAmB,CAAC,CAAC;AAElD,MAAM,CAAC,MAAM,gBAAgB,GAA6B;IACxD,UAAU,EAAE,UAAU;IACtB,QAAQ,EAAE,wBAAwB,CAAC,QAAQ;IAC3C,UAAU,EAAE,6BAA6B;IACzC,YAAY,EAAE,uBAAuB;IACrC,cAAc,EAAE,yBAAyB;IACzC,UAAU,EAAE,KAAK;IACjB,kBAAkB,EAAE,KAAK;IAC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AI,EAAE,EAAE,CAAC,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,qBAAqB,EAAE,CAAC,CAAC,CAAC;QAC9F,WAAW,EAAE,EAAE;KAChB,CAAC;IACF,SAAS,EAAE,mBAAmB;CAC/B,CAAC","sourcesContent":["// The football adapter: team-scored, with no individual stats — every present roster entry is\n// credited a game played — no finish rule, and no hall of fame. Its scoring, display, and\n// bulk-entry members are in ./football-scoring.ts.\n\nimport { SPORT_LINE_SCHEMAS } from '../doc-schemas/aggregate-stats.js';\nimport {\n FOOTBALL_PLAYER_STAT_KEYS,\n FOOTBALL_STAT_EVENT_TYPE_KEYS,\n FOOTBALL_TEAM_STAT_KEYS,\n SPORT_KEY_BY_LEAGUE_TYPE,\n} from '../types/sports.js';\nimport {\n FOOTBALL_BULK_ENTRY,\n FOOTBALL_EVENT_LABELS,\n FOOTBALL_FIELD_LABELS,\n FOOTBALL_SCOREBOARD,\n FOOTBALL_SCORING,\n FOOTBALL_SCORING_PANEL,\n describeFootballEvent,\n emptyFootballTeamLine,\n} from './football-scoring.js';\nimport { lifetimeSummaryFromColumns } from './lifetime-summary.js';\nimport { GAMES_PLAYED_COLUMN, TEAM_SEASON_BASE_COLUMN, TEAM_SEASON_BASE_COLUMNS } from './shared-columns.js';\nimport type { SportAdapter } from './sport-adapter.js';\n\nconst playerTotalsColumns = [GAMES_PLAYED_COLUMN];\n\nexport const FOOTBALL_ADAPTER: SportAdapter<'Football'> = {\n leagueType: 'Football',\n sportKey: SPORT_KEY_BY_LEAGUE_TYPE.Football,\n eventTypes: FOOTBALL_STAT_EVENT_TYPE_KEYS,\n teamStatKeys: FOOTBALL_TEAM_STAT_KEYS,\n playerStatKeys: FOOTBALL_PLAYER_STAT_KEYS,\n hallOfFame: false,\n historicalBaseline: false,\n lineSchemas: SPORT_LINE_SCHEMAS.Football,\n ...FOOTBALL_SCORING,\n display: {\n label: 'Football',\n iconKey: 'footballBall',\n lifetimeSummary: lifetimeSummaryFromColumns(playerTotalsColumns),\n eventLabels: FOOTBALL_EVENT_LABELS,\n fieldLabels: FOOTBALL_FIELD_LABELS,\n describeEvent: describeFootballEvent,\n scoreboard: FOOTBALL_SCOREBOARD,\n scoringPanel: FOOTBALL_SCORING_PANEL,\n },\n columns: {\n playerTotals: {\n columns: playerTotalsColumns,\n defaultSort: [{ columnId: GAMES_PLAYED_COLUMN.id, direction: 'desc' }],\n defaultLayout: [GAMES_PLAYED_COLUMN.id],\n },\n // No player game line, so the game page renders no player table.\n gamePlayer: { columns: [], defaultSort: [], defaultLayout: [] },\n teamSeason: {\n columns: TEAM_SEASON_BASE_COLUMNS,\n defaultSort: [\n { columnId: TEAM_SEASON_BASE_COLUMN.wins.id, direction: 'desc' },\n { columnId: TEAM_SEASON_BASE_COLUMN.losses.id, direction: 'asc' },\n { columnId: TEAM_SEASON_BASE_COLUMN.pointDifferential.id, direction: 'desc' },\n ],\n defaultLayout: [\n TEAM_SEASON_BASE_COLUMN.wins.id,\n TEAM_SEASON_BASE_COLUMN.losses.id,\n TEAM_SEASON_BASE_COLUMN.ties.id,\n TEAM_SEASON_BASE_COLUMN.pointsFor.id,\n TEAM_SEASON_BASE_COLUMN.pointsAgainst.id,\n ],\n },\n },\n emptyStats: (game) => ({\n teamStats: Object.fromEntries(game.teamIds.map((teamId) => [teamId, emptyFootballTeamLine()])),\n playerStats: {},\n }),\n bulkEntry: FOOTBALL_BULK_ENTRY,\n};\n"]}
1
+ {"version":3,"file":"football.js","sourceRoot":"","sources":["../../src/sports/football.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,0FAA0F;AAC1F,mDAAmD;AAEnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EACL,yBAAyB,EACzB,6BAA6B,EAC7B,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,oB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C/D,UAAU,EAAE;YACV,OAAO,EAAE,wBAAwB;YACjC,WAAW,EAAE;gBACX,EAAE,QAAQ,EAAE,uBAAuB,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE;gBAChE,EAAE,QAAQ,EAAE,uBAAuB,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;gBACjE,EAAE,QAAQ,EAAE,uBAAuB,CAAC,iBAAiB,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE;aAC9E;YACD,aAAa,EAAE;gBACb,uBAAuB,CAAC,IAAI,CAAC,EAAE;gBAC/B,uBAAuB,CAAC,MAAM,CAAC,EAAE;gBACjC,uBAAuB,CAAC,IAAI,CAAC,EAAE;gBAC/B,uBAAuB,CAAC,SAAS,CAAC,EAAE;gBACpC,uBAAuB,CAAC,aAAa,CAAC,EAAE;aACzC;SACF;KACF;IACD,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,qBAAqB,EAAE,CAAC,CAAC,CAAC;QAC9F,WAAW,EAAE,EAAE;KAChB,CAAC;IACF,SAAS,EAAE,mBAAmB;CAC/B,CAAC","sourcesContent":["// The football adapter: team-scored, with no individual stats — every present roster entry is\n// credited a game played — no finish rule, and no hall of fame. Its scoring, display, and\n// bulk-entry members are in ./football-scoring.ts.\n\nimport { SPORT_LINE_SCHEMAS } from '../doc-schemas/aggregate-stats.js';\nimport {\n FOOTBALL_PLAYER_STAT_KEYS,\n FOOTBALL_STAT_EVENT_TYPE_KEYS,\n FOOTBALL_TEAM_STAT_KEYS,\n SPORT_KEY_BY_LEAGUE_TYPE,\n} from '../types/sports.js';\nimport {\n FOOTBALL_BULK_ENTRY,\n FOOTBALL_EVENT_LABELS,\n FOOTBALL_FIELD_LABELS,\n FOOTBALL_SCOREBOARD,\n FOOTBALL_SCORING,\n FOOTBALL_SCORING_PANEL,\n describeFootballEvent,\n emptyFootballTeamLine,\n} from './football-scoring.js';\nimport { lifetimeSummaryFromColumns } from './lifetime-summary.js';\nimport {\n GAMES_PLAYED_COLUMN,\n TEAM_SEASON_BASE_COLUMN,\n TEAM_SEASON_BASE_COLUMNS,\n} from './shared-columns.js';\nimport type { SportAdapter } from './sport-adapter.js';\n\nconst playerTotalsColumns = [GAMES_PLAYED_COLUMN];\n\nexport const FOOTBALL_ADAPTER: SportAdapter<'Football'> = {\n leagueType: 'Football',\n sportKey: SPORT_KEY_BY_LEAGUE_TYPE.Football,\n eventTypes: FOOTBALL_STAT_EVENT_TYPE_KEYS,\n teamStatKeys: FOOTBALL_TEAM_STAT_KEYS,\n playerStatKeys: FOOTBALL_PLAYER_STAT_KEYS,\n hallOfFame: false,\n historicalBaseline: false,\n lineSchemas: SPORT_LINE_SCHEMAS.Football,\n ...FOOTBALL_SCORING,\n display: {\n label: 'Football',\n iconKey: 'footballBall',\n lifetimeSummary: lifetimeSummaryFromColumns(playerTotalsColumns),\n eventLabels: FOOTBALL_EVENT_LABELS,\n fieldLabels: FOOTBALL_FIELD_LABELS,\n describeEvent: describeFootballEvent,\n scoreboard: FOOTBALL_SCOREBOARD,\n scoringPanel: FOOTBALL_SCORING_PANEL,\n },\n columns: {\n playerTotals: {\n columns: playerTotalsColumns,\n defaultSort: [{ columnId: GAMES_PLAYED_COLUMN.id, direction: 'desc' }],\n defaultLayout: [GAMES_PLAYED_COLUMN.id],\n },\n // No player game line, so the game page renders no player table.\n gamePlayer: { columns: [], defaultSort: [], defaultLayout: [] },\n teamSeason: {\n columns: TEAM_SEASON_BASE_COLUMNS,\n defaultSort: [\n { columnId: TEAM_SEASON_BASE_COLUMN.wins.id, direction: 'desc' },\n { columnId: TEAM_SEASON_BASE_COLUMN.losses.id, direction: 'asc' },\n { columnId: TEAM_SEASON_BASE_COLUMN.pointDifferential.id, direction: 'desc' },\n ],\n defaultLayout: [\n TEAM_SEASON_BASE_COLUMN.wins.id,\n TEAM_SEASON_BASE_COLUMN.losses.id,\n TEAM_SEASON_BASE_COLUMN.ties.id,\n TEAM_SEASON_BASE_COLUMN.pointsFor.id,\n TEAM_SEASON_BASE_COLUMN.pointsAgainst.id,\n ],\n },\n },\n emptyStats: (game) => ({\n teamStats: Object.fromEntries(game.teamIds.map((teamId) => [teamId, emptyFootballTeamLine()])),\n playerStats: {},\n }),\n bulkEntry: FOOTBALL_BULK_ENTRY,\n};\n"]}
@@ -11,8 +11,8 @@ export * from './contribution.js';
11
11
  export * from './finalized-record.js';
12
12
  export * from './rankings.js';
13
13
  export * from './rollup-check.js';
14
- export type { LifetimeSummary, LifetimeSummaryAverage, LifetimeSummaryTotal } from './lifetime-summary.js';
14
+ export type { LifetimeSummary, LifetimeSummaryAverage, LifetimeSummaryTotal, } from './lifetime-summary.js';
15
15
  export { basketballFantasyPoints } from './basketball-scoring.js';
16
- export { SPORT_ADAPTERS, SPORT_ADAPTER_LIST, UnknownSportError, getSportAdapter } from './registry.js';
16
+ export { SPORT_ADAPTERS, SPORT_ADAPTER_LIST, UnknownSportError, getSportAdapter, } from './registry.js';
17
17
  export { gameScoreMirror } from './score-mirror.js';
18
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sports/index.ts"],"names":[],"mappings":"AAGA,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,YAAY,EAAE,eAAe,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC3G,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACvG,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sports/index.ts"],"names":[],"mappings":"AAGA,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,YAAY,EACV,eAAe,EACf,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,GAChB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
@@ -14,6 +14,6 @@ export * from './finalized-record.js';
14
14
  export * from './rankings.js';
15
15
  export * from './rollup-check.js';
16
16
  export { basketballFantasyPoints } from './basketball-scoring.js';
17
- export { SPORT_ADAPTERS, SPORT_ADAPTER_LIST, UnknownSportError, getSportAdapter } from './registry.js';
17
+ export { SPORT_ADAPTERS, SPORT_ADAPTER_LIST, UnknownSportError, getSportAdapter, } from './registry.js';
18
18
  export { gameScoreMirror } from './score-mirror.js';
19
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sports/index.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,6BAA6B;AAE7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAElC,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACvG,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["// The sport adapters. A sport is selected only through the registry (SPORT-002), so the individual\n// adapters are not exported.\n\nexport * from './column-catalog.js';\nexport * from './sport-adapter.js';\nexport * from './shared-columns.js';\nexport * from './scoring.js';\nexport * from './scoring-display.js';\nexport * from './bulk-entry.js';\nexport * from './replay.js';\nexport * from './ledger-continuity.js';\nexport * from './store-driver.js';\nexport * from './contribution.js';\nexport * from './finalized-record.js';\nexport * from './rankings.js';\nexport * from './rollup-check.js';\nexport type { LifetimeSummary, LifetimeSummaryAverage, LifetimeSummaryTotal } from './lifetime-summary.js';\nexport { basketballFantasyPoints } from './basketball-scoring.js';\nexport { SPORT_ADAPTERS, SPORT_ADAPTER_LIST, UnknownSportError, getSportAdapter } from './registry.js';\nexport { gameScoreMirror } from './score-mirror.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sports/index.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,6BAA6B;AAE7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAMlC,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,GAChB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["// The sport adapters. A sport is selected only through the registry (SPORT-002), so the individual\n// adapters are not exported.\n\nexport * from './column-catalog.js';\nexport * from './sport-adapter.js';\nexport * from './shared-columns.js';\nexport * from './scoring.js';\nexport * from './scoring-display.js';\nexport * from './bulk-entry.js';\nexport * from './replay.js';\nexport * from './ledger-continuity.js';\nexport * from './store-driver.js';\nexport * from './contribution.js';\nexport * from './finalized-record.js';\nexport * from './rankings.js';\nexport * from './rollup-check.js';\nexport type {\n LifetimeSummary,\n LifetimeSummaryAverage,\n LifetimeSummaryTotal,\n} from './lifetime-summary.js';\nexport { basketballFantasyPoints } from './basketball-scoring.js';\nexport {\n SPORT_ADAPTERS,\n SPORT_ADAPTER_LIST,\n UnknownSportError,\n getSportAdapter,\n} from './registry.js';\nexport { gameScoreMirror } from './score-mirror.js';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ledger-continuity.d.ts","sourceRoot":"","sources":["../../src/sports/ledger-continuity.ts"],"names":[],"mappings":"AAKA,iGAAiG;AACjG,MAAM,MAAM,qBAAqB,GAC7B;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;CAAE,GAC1D;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D,oHAAoH;AACpH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS;IAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,EAAE,GAAG,qBAAqB,GAAG,IAAI,CAUxH"}
1
+ {"version":3,"file":"ledger-continuity.d.ts","sourceRoot":"","sources":["../../src/sports/ledger-continuity.ts"],"names":[],"mappings":"AAKA,iGAAiG;AACjG,MAAM,MAAM,qBAAqB,GAC7B;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;CAAE,GAC1D;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D,oHAAoH;AACpH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,SAAS;IAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,EAAE,GAC/C,qBAAqB,GAAG,IAAI,CAU9B"}
@@ -1 +1 @@
1
- {"version":3,"file":"ledger-continuity.js","sourceRoot":"","sources":["../../src/sports/ledger-continuity.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,mGAAmG;AACnG,kGAAkG;AAClG,+DAA+D;AAO/D,oHAAoH;AACpH,MAAM,UAAU,yBAAyB,CAAC,MAAgD;IACxF,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC;IAC5F,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACzD,MAAM,QAAQ,GAAG,KAAK,GAAG,CAAC,CAAC;QAC3B,MAAM,QAAQ,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;QAClC,IAAI,QAAQ,KAAK,QAAQ;YAAE,SAAS;QACpC,IAAI,KAAK,GAAG,CAAC,IAAI,QAAQ,KAAK,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC;YAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;QAC3F,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,CAAC;IACpD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["// Whether a game's event ledger holds exactly the sequences 1..n. `statEventSequence` is both the\n// number of events and the last sequence given, so a gap or a duplicate is out-of-band damage: the\n// check reports it, and finalize and the restore refuse it. The event documents are the source of\n// truth (SPORT-101), so nothing renumbers them to close a gap.\n\n/** The first place a ledger departs from 1..n: a sequence missing, or one held by two events. */\nexport type LedgerContinuityBreak =\n | { readonly kind: 'gap'; readonly missingSequence: number }\n | { readonly kind: 'duplicate'; readonly sequence: number };\n\n/** `null` when the events hold exactly the sequences 1..n (an empty ledger included); otherwise the first break. */\nexport function findLedgerContinuityBreak(events: readonly { readonly sequence: number }[]): LedgerContinuityBreak | null {\n const sequences = events.map((event) => event.sequence).sort((left, right) => left - right);\n for (let index = 0; index < sequences.length; index += 1) {\n const expected = index + 1;\n const sequence = sequences[index];\n if (sequence === expected) continue;\n if (index > 0 && sequence === sequences[index - 1]) return { kind: 'duplicate', sequence };\n return { kind: 'gap', missingSequence: expected };\n }\n return null;\n}\n"]}
1
+ {"version":3,"file":"ledger-continuity.js","sourceRoot":"","sources":["../../src/sports/ledger-continuity.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,mGAAmG;AACnG,kGAAkG;AAClG,+DAA+D;AAO/D,oHAAoH;AACpH,MAAM,UAAU,yBAAyB,CACvC,MAAgD;IAEhD,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC;IAC5F,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACzD,MAAM,QAAQ,GAAG,KAAK,GAAG,CAAC,CAAC;QAC3B,MAAM,QAAQ,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;QAClC,IAAI,QAAQ,KAAK,QAAQ;YAAE,SAAS;QACpC,IAAI,KAAK,GAAG,CAAC,IAAI,QAAQ,KAAK,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC;YAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;QAC3F,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,CAAC;IACpD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["// Whether a game's event ledger holds exactly the sequences 1..n. `statEventSequence` is both the\n// number of events and the last sequence given, so a gap or a duplicate is out-of-band damage: the\n// check reports it, and finalize and the restore refuse it. The event documents are the source of\n// truth (SPORT-101), so nothing renumbers them to close a gap.\n\n/** The first place a ledger departs from 1..n: a sequence missing, or one held by two events. */\nexport type LedgerContinuityBreak =\n | { readonly kind: 'gap'; readonly missingSequence: number }\n | { readonly kind: 'duplicate'; readonly sequence: number };\n\n/** `null` when the events hold exactly the sequences 1..n (an empty ledger included); otherwise the first break. */\nexport function findLedgerContinuityBreak(\n events: readonly { readonly sequence: number }[],\n): LedgerContinuityBreak | null {\n const sequences = events.map((event) => event.sequence).sort((left, right) => left - right);\n for (let index = 0; index < sequences.length; index += 1) {\n const expected = index + 1;\n const sequence = sequences[index];\n if (sequence === expected) continue;\n if (index > 0 && sequence === sequences[index - 1]) return { kind: 'duplicate', sequence };\n return { kind: 'gap', missingSequence: expected };\n }\n return null;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"rankings.d.ts","sourceRoot":"","sources":["../../src/sports/rankings.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D,kHAAkH;AAClH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;CAC/B;AAED,kGAAkG;AAClG,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,SAAS;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAAA;CAAE,EAAE,GACnH,UAAU,EAAE,CAId;AAED,oEAAoE;AACpE,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED;;;GAGG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,SAAS;IACd,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;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;IACd,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;CAC7B,EAAE,GACF,UAAU,EAAE,CAcd;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,SAAS,aAAa,EAAE,GAC9B,UAAU,EAAE,CASd"}
@@ -19,7 +19,11 @@ export function playedWeeks(games) {
19
19
  for (const game of games) {
20
20
  if (game.status !== COMPLETED_GAME_STATUS || weeks.has(game.weekId))
21
21
  continue;
22
- weeks.set(game.weekId, { weekId: game.weekId, weekTitle: game.weekTitle, weekStartDate: game.weekStartDate });
22
+ weeks.set(game.weekId, {
23
+ weekId: game.weekId,
24
+ weekTitle: game.weekTitle,
25
+ weekStartDate: game.weekStartDate,
26
+ });
23
27
  }
24
28
  return [...weeks.values()].sort((left, right) => left.weekStartDate - right.weekStartDate || left.weekId.localeCompare(right.weekId));
25
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"rankings.js","sourceRoot":"","sources":["../../src/sports/rankings.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,wDAAwD;AACxD,mGAAmG;AACnG,iGAAiG;AACjG,qCAAqC;AAErC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAYzD,kGAAkG;AAClG,MAAM,UAAU,iBAAiB,CAC/B,KAAoH;IAEpH,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,iBAAiB,EAAE,EAAE,EAAE,CACrD,MAAM,CAAC,OAAO,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC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E,IAAI,CAAC,EAAE,EAAE;QACvE,MAAM,KAAK,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAC;QAC/C,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IACtF,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// The league's player rankings: one row per team a player played for, for the whole season or for\n// one saved week. The season rows are the teams' stored\n// per-membership rows; a week's rows are derived at read, never stored — the contributions of that\n// week's completed games summed through the same mapping finalize applies, so a week's rows over\n// every week add up to the season's.\n\nimport { COMPLETED_GAME_STATUS } from '../types/unions.js';\nimport type { GameStatus } from '../types/unions.js';\nimport { parseGameRosterPlayerId } from '../ids/compound-ids.js';\nimport { sumGameContributions } from './contribution.js';\nimport type { FinalizedGame } from './contribution.js';\nimport type { StatLineValues } from './scoring.js';\nimport type { AnySportAdapter } from './sport-adapter.js';\n\n/** One rankings row: a person's games for one team, keyed by the membership the team, league, and person name. */\nexport interface RankingRow {\n readonly teamId: string;\n readonly userId: string;\n readonly line: StatLineValues;\n}\n\n/** The season rows: every team's stored per-membership rows, one per team a player played for. */\nexport function seasonRankingRows(\n teams: readonly { readonly teamId: string; readonly playerSeasonStats?: Readonly<Record<string, StatLineValues>> }[],\n): RankingRow[] {\n return teams.flatMap(({ teamId, playerSeasonStats }) =>\n Object.entries(playerSeasonStats ?? {}).map(([userId, line]) => ({ teamId, userId, line })),\n );\n}\n\n/** A saved schedule week as the rankings' week filter offers it. */\nexport interface PlayedWeek {\n readonly weekId: string;\n readonly weekTitle: string;\n readonly weekStartDate: number;\n}\n\n/**\n * The weeks the filter offers: every saved week holding at least one completed game, in the order\n * the weeks start, taken from the game documents the league schedule already loads.\n */\nexport function playedWeeks(\n games: readonly {\n readonly weekId: string;\n readonly weekTitle: string;\n readonly weekStartDate: number;\n readonly status: GameStatus;\n }[],\n): PlayedWeek[] {\n const weeks = new Map<string, PlayedWeek>();\n for (const game of games) {\n if (game.status !== COMPLETED_GAME_STATUS || weeks.has(game.weekId)) continue;\n weeks.set(game.weekId, { weekId: game.weekId, weekTitle: game.weekTitle, weekStartDate: game.weekStartDate });\n }\n return [...weeks.values()].sort(\n (left, right) => left.weekStartDate - right.weekStartDate || left.weekId.localeCompare(right.weekId),\n );\n}\n\n/**\n * One week's rows: the summed contributions of the week's completed games, each read from its\n * finalized record (`finalizedGameFromRecord`). A player who played both sides of a game that week\n * has a row on each team.\n */\nexport function weekRankingRows(adapter: AnySportAdapter, games: readonly FinalizedGame[]): RankingRow[] {\n const summed = sumGameContributions(\n adapter.deriveLine,\n games.map((game) => ({ contribution: adapter.contribution(game), sign: 1 as const })),\n );\n return Object.entries(summed.membershipRows).flatMap(([entryId, line]) => {\n const entry = parseGameRosterPlayerId(entryId);\n return entry === null ? [] : [{ teamId: entry.teamId, userId: entry.userId, line }];\n });\n}\n"]}
1
+ {"version":3,"file":"rankings.js","sourceRoot":"","sources":["../../src/sports/rankings.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,wDAAwD;AACxD,mGAAmG;AACnG,iGAAiG;AACjG,qCAAqC;AAErC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAYzD,kGAAkG;AAClG,MAAM,UAAU,iBAAiB,CAC/B,KAGG;IAEH,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,iBAAiB,EAAE,EAAE,EAAE,CACrD,MAAM,CAAC,OAAO,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,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AC,CAAC;QAC/C,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IACtF,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// The league's player rankings: one row per team a player played for, for the whole season or for\n// one saved week. The season rows are the teams' stored\n// per-membership rows; a week's rows are derived at read, never stored — the contributions of that\n// week's completed games summed through the same mapping finalize applies, so a week's rows over\n// every week add up to the season's.\n\nimport { COMPLETED_GAME_STATUS } from '../types/unions.js';\nimport type { GameStatus } from '../types/unions.js';\nimport { parseGameRosterPlayerId } from '../ids/compound-ids.js';\nimport { sumGameContributions } from './contribution.js';\nimport type { FinalizedGame } from './contribution.js';\nimport type { StatLineValues } from './scoring.js';\nimport type { AnySportAdapter } from './sport-adapter.js';\n\n/** One rankings row: a person's games for one team, keyed by the membership the team, league, and person name. */\nexport interface RankingRow {\n readonly teamId: string;\n readonly userId: string;\n readonly line: StatLineValues;\n}\n\n/** The season rows: every team's stored per-membership rows, one per team a player played for. */\nexport function seasonRankingRows(\n teams: readonly {\n readonly teamId: string;\n readonly playerSeasonStats?: Readonly<Record<string, StatLineValues>>;\n }[],\n): RankingRow[] {\n return teams.flatMap(({ teamId, playerSeasonStats }) =>\n Object.entries(playerSeasonStats ?? {}).map(([userId, line]) => ({ teamId, userId, line })),\n );\n}\n\n/** A saved schedule week as the rankings' week filter offers it. */\nexport interface PlayedWeek {\n readonly weekId: string;\n readonly weekTitle: string;\n readonly weekStartDate: number;\n}\n\n/**\n * The weeks the filter offers: every saved week holding at least one completed game, in the order\n * the weeks start, taken from the game documents the league schedule already loads.\n */\nexport function playedWeeks(\n games: readonly {\n readonly weekId: string;\n readonly weekTitle: string;\n readonly weekStartDate: number;\n readonly status: GameStatus;\n }[],\n): PlayedWeek[] {\n const weeks = new Map<string, PlayedWeek>();\n for (const game of games) {\n if (game.status !== COMPLETED_GAME_STATUS || weeks.has(game.weekId)) continue;\n weeks.set(game.weekId, {\n weekId: game.weekId,\n weekTitle: game.weekTitle,\n weekStartDate: game.weekStartDate,\n });\n }\n return [...weeks.values()].sort(\n (left, right) =>\n left.weekStartDate - right.weekStartDate || left.weekId.localeCompare(right.weekId),\n );\n}\n\n/**\n * One week's rows: the summed contributions of the week's completed games, each read from its\n * finalized record (`finalizedGameFromRecord`). A player who played both sides of a game that week\n * has a row on each team.\n */\nexport function weekRankingRows(\n adapter: AnySportAdapter,\n games: readonly FinalizedGame[],\n): RankingRow[] {\n const summed = sumGameContributions(\n adapter.deriveLine,\n games.map((game) => ({ contribution: adapter.contribution(game), sign: 1 as const })),\n );\n return Object.entries(summed.membershipRows).flatMap(([entryId, line]) => {\n const entry = parseGameRosterPlayerId(entryId);\n return entry === null ? [] : [{ teamId: entry.teamId, userId: entry.userId, line }];\n });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"replay.d.ts","sourceRoot":"","sources":["../../src/sports/replay.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAkC,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAClF,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEvE,qGAAqG;AACrG,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;gBAEb,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;CAK5C;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,GAAG,SAAS,CAI1G;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CA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@ export function withGameTeamLines(adapter, state, game) {
21
21
  if (game.teamIds.every((teamId) => state.teamStats[teamId] !== undefined))
22
22
  return state;
23
23
  const empty = adapter.emptyStats(game);
24
- return { teamStats: { ...empty.teamStats, ...state.teamStats }, playerStats: state.playerStats };
24
+ return {
25
+ teamStats: { ...empty.teamStats, ...state.teamStats },
26
+ playerStats: state.playerStats,
27
+ };
25
28
  }
26
29
  /**
27
30
  * `state` with one event folded in: a sport event or a correction applied, or a void's target
@@ -1 +1 @@
1
- {"version":3,"file":"replay.js","sourceRoot":"","sources":["../../src/sports/replay.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,sGAAsG;AACtG,mGAAmG;AACnG,qGAAqG;AACrG,qCAAqC;AAIrC,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAsB,MAAM,cAAc,CAAC;AAGlF,qGAAqG;AACrG,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAC/B,OAAO,CAAS;IAEzB,YAAY,OAAe,EAAE,KAAc;QACzC,KAAK,CAAC,cAAc,OAAO,wBAAwB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QACxH,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAwB,EAAE,KAAgB,EAAE,IAAiB;IAC7F,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,SAAS,CAAC;QAAE,OAAO,KAAK,CAAC;IACxF,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO,EAAE,SAAS,EAAE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,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,eAAe,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAClD,CAAC;QACD,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACnC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// The replay: a game's rollup rebuilt from its event documents, in `sequence` order, from the\n// sport's empty stats (SPORT-101). It is the one fold every path that derives a game's numbers runs —\n// the Functions, the client's queue, and the browser's week view — and the store driver folds each\n// new event it accepts through the same step, `foldStatEvent`, so the replay and the write can never\n// disagree about what an event does.\n\nimport type { GameStatEvent } from '../doc-schemas/game-stats.js';\nimport type { GameStats } from '../doc-schemas/sport-game.js';\nimport { isSportStatEventIn, isStatVoid, type StatEventBody } from './scoring.js';\nimport type { AnySportAdapter, GameTeamIds } from './sport-adapter.js';\n\n/** A stored event the replay could not fold — damage in the event store, never a designed answer. */\nexport class StatReplayError extends Error {\n readonly eventId: string;\n\n constructor(eventId: string, cause: unknown) {\n super(`Stat event ${eventId} cannot be replayed: ${cause instanceof Error ? cause.message : String(cause)}`, { cause });\n this.name = 'StatReplayError';\n this.eventId = eventId;\n }\n}\n\n/**\n * `state` with a team line for each of the game's teams, the missing ones from the sport's empty\n * stats — so a team's first stat is never refused as a team not in the game. No other line is touched.\n */\nexport function withGameTeamLines(adapter: AnySportAdapter, state: GameStats, game: GameTeamIds): GameStats {\n if (game.teamIds.every((teamId) => state.teamStats[teamId] !== undefined)) return state;\n const empty = adapter.emptyStats(game);\n return { teamStats: { ...empty.teamStats, ...state.teamStats }, playerStats: state.playerStats } as GameStats;\n}\n\n/**\n * `state` with one event folded in: a sport event or a correction applied, or a void's target\n * undone. `targetOf` answers from the events already folded; a void whose target is missing, a void,\n * or a correction throws.\n */\nexport function foldStatEvent(\n adapter: AnySportAdapter,\n state: GameStats,\n event: StatEventBody,\n targetOf: (eventId: string) => StatEventBody | undefined,\n): GameStats {\n if (isStatVoid(event)) {\n const target = targetOf(event.targetEventId);\n if (!isSportStatEventIn(adapter.eventTypes, target)) {\n throw new Error(`the void's target ${event.targetEventId} is not a ${adapter.leagueType} event folded before it`);\n }\n return adapter.undo(state, target);\n }\n return adapter.apply(state, event);\n}\n\n/** The rollup a game's events replay to: every line, derived fields included, and each team's score. */\nexport function replayGameStats(adapter: AnySportAdapter, game: GameTeamIds, events: readonly GameStatEvent[]): GameStats {\n const folded = new Map<string, GameStatEvent>();\n let state: GameStats = adapter.emptyStats(game);\n for (const event of [...events].sort((left, right) => left.sequence - right.sequence)) {\n try {\n state = foldStatEvent(adapter, state, event, (eventId) => folded.get(eventId));\n } catch (error) {\n throw new StatReplayError(event.eventId, error);\n }\n folded.set(event.eventId, event);\n }\n return state;\n}\n"]}
1
+ {"version":3,"file":"replay.js","sourceRoot":"","sources":["../../src/sports/replay.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,sGAAsG;AACtG,mGAAmG;AACnG,qGAAqG;AACrG,qCAAqC;AAIrC,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAsB,MAAM,cAAc,CAAC;AAGlF,qGAAqG;AACrG,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAC/B,OAAO,CAAS;IAEzB,YAAY,OAAe,EAAE,KAAc;QACzC,KAAK,CACH,cAAc,OAAO,wBAAwB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EACrG,EAAE,KAAK,EAAE,CACV,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAAwB,EACxB,KAAgB,EAChB,IAAiB;IAEjB,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAA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C,EAAE,CAAC;QACtF,IAAI,CAAC;YACH,KAAK,GAAG,aAAa,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;QACjF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,eAAe,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAClD,CAAC;QACD,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACnC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// The replay: a game's rollup rebuilt from its event documents, in `sequence` order, from the\n// sport's empty stats (SPORT-101). It is the one fold every path that derives a game's numbers runs —\n// the Functions, the client's queue, and the browser's week view — and the store driver folds each\n// new event it accepts through the same step, `foldStatEvent`, so the replay and the write can never\n// disagree about what an event does.\n\nimport type { GameStatEvent } from '../doc-schemas/game-stats.js';\nimport type { GameStats } from '../doc-schemas/sport-game.js';\nimport { isSportStatEventIn, isStatVoid, type StatEventBody } from './scoring.js';\nimport type { AnySportAdapter, GameTeamIds } from './sport-adapter.js';\n\n/** A stored event the replay could not fold — damage in the event store, never a designed answer. */\nexport class StatReplayError extends Error {\n readonly eventId: string;\n\n constructor(eventId: string, cause: unknown) {\n super(\n `Stat event ${eventId} cannot be replayed: ${cause instanceof Error ? cause.message : String(cause)}`,\n { cause },\n );\n this.name = 'StatReplayError';\n this.eventId = eventId;\n }\n}\n\n/**\n * `state` with a team line for each of the game's teams, the missing ones from the sport's empty\n * stats — so a team's first stat is never refused as a team not in the game. No other line is touched.\n */\nexport function withGameTeamLines(\n adapter: AnySportAdapter,\n state: GameStats,\n game: GameTeamIds,\n): GameStats {\n if (game.teamIds.every((teamId) => state.teamStats[teamId] !== undefined)) return state;\n const empty = adapter.emptyStats(game);\n return {\n teamStats: { ...empty.teamStats, ...state.teamStats },\n playerStats: state.playerStats,\n } as GameStats;\n}\n\n/**\n * `state` with one event folded in: a sport event or a correction applied, or a void's target\n * undone. `targetOf` answers from the events already folded; a void whose target is missing, a void,\n * or a correction throws.\n */\nexport function foldStatEvent(\n adapter: AnySportAdapter,\n state: GameStats,\n event: StatEventBody,\n targetOf: (eventId: string) => StatEventBody | undefined,\n): GameStats {\n if (isStatVoid(event)) {\n const target = targetOf(event.targetEventId);\n if (!isSportStatEventIn(adapter.eventTypes, target)) {\n throw new Error(\n `the void's target ${event.targetEventId} is not a ${adapter.leagueType} event folded before it`,\n );\n }\n return adapter.undo(state, target);\n }\n return adapter.apply(state, event);\n}\n\n/** The rollup a game's events replay to: every line, derived fields included, and each team's score. */\nexport function replayGameStats(\n adapter: AnySportAdapter,\n game: GameTeamIds,\n events: readonly GameStatEvent[],\n): GameStats {\n const folded = new Map<string, GameStatEvent>();\n let state: GameStats = adapter.emptyStats(game);\n for (const event of [...events].sort((left, right) => left.sequence - right.sequence)) {\n try {\n state = foldStatEvent(adapter, state, event, (eventId) => folded.get(eventId));\n } catch (error) {\n throw new StatReplayError(event.eventId, error);\n }\n folded.set(event.eventId, event);\n }\n return state;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"rollup-check.d.ts","sourceRoot":"","sources":["../../src/sports/rollup-check.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAI9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D,yEAAyE;AACzE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,gBAAgB,GAAG,qBAAqB,CAAC;IACxD,oFAAoF;IACpF,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,OAAO,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two stored line values alike: a number, or a list of round slots, slot by slot. */
11
11
  function sameValue(left, right) {
12
12
  if (Array.isArray(left) && Array.isArray(right)) {
13
- return left.length === right.length && left.every((slot, index) => Object.is(slot, right[index]));
13
+ return (left.length === right.length && left.every((slot, index) => Object.is(slot, right[index])));
14
14
  }
15
15
  return Object.is(left, right);
16
16
  }
@@ -36,7 +36,13 @@ export function rollupDifferences(adapter, game, replayed) {
36
36
  const replay = compared(replayedTeams[teamId], null);
37
37
  for (const field of new Set([...Object.keys(stored), ...Object.keys(replay)])) {
38
38
  if (!sameValue(stored[field], replay[field])) {
39
- differences.push({ kind: 'rollupMismatch', key: teamId, field, stored: stored[field], replayed: replay[field] });
39
+ differences.push({
40
+ kind: 'rollupMismatch',
41
+ key: teamId,
42
+ field,
43
+ stored: stored[field],
44
+ replayed: replay[field],
45
+ });
40
46
  }
41
47
  }
42
48
  }
@@ -50,7 +56,13 @@ export function rollupDifferences(adapter, game, replayed) {
50
56
  for (const field of counters) {
51
57
  const [left, right] = [stored[field] ?? 0, replay[field] ?? 0];
52
58
  if (left !== right)
53
- differences.push({ kind: 'rollupMismatch', key: entryId, field, stored: left, replayed: right });
59
+ differences.push({
60
+ kind: 'rollupMismatch',
61
+ key: entryId,
62
+ field,
63
+ stored: left,
64
+ replayed: right,
65
+ });
54
66
  }
55
67
  }
56
68
  const mirror = gameScoreMirror(replayed);
@@ -1 +1 @@
1
- {"version":3,"file":"rollup-check.js","sourceRoot":"","sources":["../../src/sports/rollup-check.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,qGAAqG;AACrG,qGAAqG;AACrG,oGAAoG;AACpG,EAAE;AACF,gGAAgG;AAChG,iEAAiE;AAGjE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAc7C,sFAAsF;AACtF,SAAS,SAAS,CAAC,IAAa,EAAE,KAAc;IAC9C,IAAI,KAAK,CAAC,OAAO,CA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CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC;QAC1D,MAAM,MAAM,GAAG,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC;QAC5D,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;YAC7B,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;YAC/D,IAAI,IAAI,KAAK,KAAK;gBAAE,WAAW,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;QACvH,CAAC;IACH,CAAC;IAED,MAAM,MAAM,GAAG,eAAe,CAAC,QAA4D,CAAC,CAAC;IAC7F,KAAK,MAAM,MAAM,IAAI,IAAI,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;QACnF,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;YAC1C,WAAW,CAAC,IAAI,CAAC;gBACf,IAAI,EAAE,qBAAqB;gBAC3B,GAAG,EAAE,MAAM;gBACX,KAAK,EAAE,OAAO;gBACd,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;gBAC1B,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC;aACzB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["// Whether a game's stored numbers are what produced them: the rollup's counters and the score mirror\n// against a replay — of the event documents for a live game, of the finalized record for a completed\n// one. Finalize, reopen, a ghost link, and validation ask this one comparison, so a hand edit to the\n// game document is found the same way everywhere and never adopted or discarded silently (ENG-009).\n//\n// Counters are compared, never a derived field: a stored FP a weight change left stale is not a\n// difference in what was recorded, and the writer re-derives it.\n\nimport type { GameStats } from '../doc-schemas/sport-game.js';\nimport { gameScoreMirror } from './score-mirror.js';\nimport { isAllZeroLine } from './scoring.js';\nimport type { StatLineValues } from './scoring.js';\nimport type { AnySportAdapter } from './sport-adapter.js';\n\n/** One place a stored rollup or score mirror differs from the replay. */\nexport interface RollupDifference {\n readonly kind: 'rollupMismatch' | 'scoreMirrorMismatch';\n /** The team id of a team line or score, or the roster-entry id of a player line. */\n readonly key: string;\n readonly field: string;\n readonly stored: unknown;\n readonly replayed: unknown;\n}\n\n/** Two stored line values alike: a number, or a list of round slots, slot by slot. */\nfunction sameValue(left: unknown, right: unknown): boolean {\n if (Array.isArray(left) && Array.isArray(right)) {\n return left.length === right.length && left.every((slot, index) => Object.is(slot, right[index]));\n }\n return Object.is(left, right);\n}\n\n/** The fields a line is compared on: every field of a team line, the counters of a player line. */\nfunction compared(line: StatLineValues | undefined, fields: readonly string[] | null): Record<string, unknown> {\n if (line === undefined) return {};\n const keys = fields ?? Object.keys(line);\n return Object.fromEntries(keys.filter((field) => line[field] !== undefined).map((field) => [field, line[field]]));\n}\n\n/**\n * Every difference between the stored rollup and score mirror and the replay. A player line that\n * holds nothing and one that is absent are alike; a team line is compared whole, its round slots\n * included, for each of the game's teams.\n */\nexport function rollupDifferences(\n adapter: AnySportAdapter,\n game: { readonly teamIds: readonly string[]; readonly stats: GameStats; readonly score: Readonly<Record<string, number>> },\n replayed: GameStats,\n): RollupDifference[] {\n const differences: RollupDifference[] = [];\n const storedTeams = game.stats.teamStats as Readonly<Record<string, StatLineValues>>;\n const replayedTeams = replayed.teamStats as Readonly<Record<string, StatLineValues>>;\n const teamKeys = new Set([...game.teamIds, ...Object.keys(storedTeams)]);\n for (const teamId of teamKeys) {\n const stored = compared(storedTeams[teamId], null);\n const replay = compared(replayedTeams[teamId], null);\n for (const field of new Set([...Object.keys(stored), ...Object.keys(replay)])) {\n if (!sameValue(stored[field], replay[field])) {\n differences.push({ kind: 'rollupMismatch', key: teamId, field, stored: stored[field], replayed: replay[field] });\n }\n }\n }\n\n const counters = adapter.playerStatKeys as readonly string[];\n const storedPlayers = game.stats.playerStats as Readonly<Record<string, StatLineValues>>;\n const replayedPlayers = replayed.playerStats as Readonly<Record<string, StatLineValues>>;\n const holding = (lines: Readonly<Record<string, StatLineValues>>) =>\n Object.keys(lines).filter((entryId) => !isAllZeroLine(lines[entryId] as StatLineValues, counters));\n for (const entryId of new Set([...holding(storedPlayers), ...holding(replayedPlayers)])) {\n const stored = compared(storedPlayers[entryId], counters);\n const replay = compared(replayedPlayers[entryId], counters);\n for (const field of counters) {\n const [left, right] = [stored[field] ?? 0, replay[field] ?? 0];\n if (left !== right) differences.push({ kind: 'rollupMismatch', key: entryId, field, stored: left, replayed: right });\n }\n }\n\n const mirror = gameScoreMirror(replayed as { teamStats: Record<string, { score: number }> });\n for (const teamId of new Set([...Object.keys(game.score), ...Object.keys(mirror)])) {\n if (game.score[teamId] !== mirror[teamId]) {\n differences.push({\n kind: 'scoreMirrorMismatch',\n key: teamId,\n field: 'score',\n stored: game.score[teamId],\n replayed: mirror[teamId],\n });\n }\n }\n return differences;\n}\n"]}
1
+ {"version":3,"file":"rollup-check.js","sourceRoot":"","sources":["../../src/sports/rollup-check.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,qGAAqG;AACrG,qGAAqG;AACrG,oGAAoG;AACpG,EAAE;AACF,gGAAgG;AAChG,iEAAiE;AAGjE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAc7C,sFAAsF;AACtF,SAAS,SAAS,CAAC,IAAa,EAAE,KAAc;IAC9C,IAAI,KAAK,CAAC,OAAO,CAA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G,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC;QAC1D,MAAM,MAAM,GAAG,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC;QAC5D,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;YAC7B,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;YAC/D,IAAI,IAAI,KAAK,KAAK;gBAChB,WAAW,CAAC,IAAI,CAAC;oBACf,IAAI,EAAE,gBAAgB;oBACtB,GAAG,EAAE,OAAO;oBACZ,KAAK;oBACL,MAAM,EAAE,IAAI;oBACZ,QAAQ,EAAE,KAAK;iBAChB,CAAC,CAAC;QACP,CAAC;IACH,CAAC;IAED,MAAM,MAAM,GAAG,eAAe,CAAC,QAA4D,CAAC,CAAC;IAC7F,KAAK,MAAM,MAAM,IAAI,IAAI,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;QACnF,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;YAC1C,WAAW,CAAC,IAAI,CAAC;gBACf,IAAI,EAAE,qBAAqB;gBAC3B,GAAG,EAAE,MAAM;gBACX,KAAK,EAAE,OAAO;gBACd,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;gBAC1B,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC;aACzB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["// Whether a game's stored numbers are what produced them: the rollup's counters and the score mirror\n// against a replay — of the event documents for a live game, of the finalized record for a completed\n// one. Finalize, reopen, a ghost link, and validation ask this one comparison, so a hand edit to the\n// game document is found the same way everywhere and never adopted or discarded silently (ENG-009).\n//\n// Counters are compared, never a derived field: a stored FP a weight change left stale is not a\n// difference in what was recorded, and the writer re-derives it.\n\nimport type { GameStats } from '../doc-schemas/sport-game.js';\nimport { gameScoreMirror } from './score-mirror.js';\nimport { isAllZeroLine } from './scoring.js';\nimport type { StatLineValues } from './scoring.js';\nimport type { AnySportAdapter } from './sport-adapter.js';\n\n/** One place a stored rollup or score mirror differs from the replay. */\nexport interface RollupDifference {\n readonly kind: 'rollupMismatch' | 'scoreMirrorMismatch';\n /** The team id of a team line or score, or the roster-entry id of a player line. */\n readonly key: string;\n readonly field: string;\n readonly stored: unknown;\n readonly replayed: unknown;\n}\n\n/** Two stored line values alike: a number, or a list of round slots, slot by slot. */\nfunction sameValue(left: unknown, right: unknown): boolean {\n if (Array.isArray(left) && Array.isArray(right)) {\n return (\n left.length === right.length && left.every((slot, index) => Object.is(slot, right[index]))\n );\n }\n return Object.is(left, right);\n}\n\n/** The fields a line is compared on: every field of a team line, the counters of a player line. */\nfunction compared(\n line: StatLineValues | undefined,\n fields: readonly string[] | null,\n): Record<string, unknown> {\n if (line === undefined) return {};\n const keys = fields ?? Object.keys(line);\n return Object.fromEntries(\n keys.filter((field) => line[field] !== undefined).map((field) => [field, line[field]]),\n );\n}\n\n/**\n * Every difference between the stored rollup and score mirror and the replay. A player line that\n * holds nothing and one that is absent are alike; a team line is compared whole, its round slots\n * included, for each of the game's teams.\n */\nexport function rollupDifferences(\n adapter: AnySportAdapter,\n game: {\n readonly teamIds: readonly string[];\n readonly stats: GameStats;\n readonly score: Readonly<Record<string, number>>;\n },\n replayed: GameStats,\n): RollupDifference[] {\n const differences: RollupDifference[] = [];\n const storedTeams = game.stats.teamStats as Readonly<Record<string, StatLineValues>>;\n const replayedTeams = replayed.teamStats as Readonly<Record<string, StatLineValues>>;\n const teamKeys = new Set([...game.teamIds, ...Object.keys(storedTeams)]);\n for (const teamId of teamKeys) {\n const stored = compared(storedTeams[teamId], null);\n const replay = compared(replayedTeams[teamId], null);\n for (const field of new Set([...Object.keys(stored), ...Object.keys(replay)])) {\n if (!sameValue(stored[field], replay[field])) {\n differences.push({\n kind: 'rollupMismatch',\n key: teamId,\n field,\n stored: stored[field],\n replayed: replay[field],\n });\n }\n }\n }\n\n const counters = adapter.playerStatKeys as readonly string[];\n const storedPlayers = game.stats.playerStats as Readonly<Record<string, StatLineValues>>;\n const replayedPlayers = replayed.playerStats as Readonly<Record<string, StatLineValues>>;\n const holding = (lines: Readonly<Record<string, StatLineValues>>) =>\n Object.keys(lines).filter(\n (entryId) => !isAllZeroLine(lines[entryId] as StatLineValues, counters),\n );\n for (const entryId of new Set([...holding(storedPlayers), ...holding(replayedPlayers)])) {\n const stored = compared(storedPlayers[entryId], counters);\n const replay = compared(replayedPlayers[entryId], counters);\n for (const field of counters) {\n const [left, right] = [stored[field] ?? 0, replay[field] ?? 0];\n if (left !== right)\n differences.push({\n kind: 'rollupMismatch',\n key: entryId,\n field,\n stored: left,\n replayed: right,\n });\n }\n }\n\n const mirror = gameScoreMirror(replayed as { teamStats: Record<string, { score: number }> });\n for (const teamId of new Set([...Object.keys(game.score), ...Object.keys(mirror)])) {\n if (game.score[teamId] !== mirror[teamId]) {\n differences.push({\n kind: 'scoreMirrorMismatch',\n key: teamId,\n field: 'score',\n stored: game.score[teamId],\n replayed: mirror[teamId],\n });\n }\n }\n return differences;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"score-mirror.d.ts","sourceRoot":"","sources":["../../src/sports/score-mirror.ts"],"names":[],"mappings":"AAIA,6FAA6F;AAC7F,wBAAgB,eAAe,CAAC,KAAK,EAAE;IACrC,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;CAC1E,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAEzB"}
1
+ {"version":3,"file":"score-mirror.d.ts","sourceRoot":"","sources":["../../src/sports/score-mirror.ts"],"names":[],"mappings":"AAIA,6FAA6F;AAC7F,wBAAgB,eAAe,CAAC,KAAK,EAAE;IACrC,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;CAC1E,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAIzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"score-mirror.js","sourceRoot":"","sources":["../../src/sports/score-mirror.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,qGAAqG;AACrG,qEAAqE;AAErE,6FAA6F;AAC7F,MAAM,UAAU,eAAe,CAAC,KAE/B;IACC,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC3G,CAAC","sourcesContent":["// A game's `score`: each team's score, mirrored from its `stats.teamStats` line so a schedule or list\n// reads the result without the stats. Every writer of a team line writes the mirror from the line it\n// wrote, in the same write, through this one derivation (SPORT-107).\n\n/** Every sport's team line carries its `score`; the mirror is keyed by the same team ids. */\nexport function gameScoreMirror(stats: {\n readonly teamStats: Readonly<Record<string, { readonly score: number }>>;\n}): Record<string, number> {\n return Object.fromEntries(Object.entries(stats.teamStats).map(([teamId, line]) => [teamId, line.score]));\n}\n"]}
1
+ {"version":3,"file":"score-mirror.js","sourceRoot":"","sources":["../../src/sports/score-mirror.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,qGAAqG;AACrG,qEAAqE;AAErE,6FAA6F;AAC7F,MAAM,UAAU,eAAe,CAAC,KAE/B;IACC,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAC9E,CAAC;AACJ,CAAC","sourcesContent":["// A game's `score`: each team's score, mirrored from its `stats.teamStats` line so a schedule or list\n// reads the result without the stats. Every writer of a team line writes the mirror from the line it\n// wrote, in the same write, through this one derivation (SPORT-107).\n\n/** Every sport's team line carries its `score`; the mirror is keyed by the same team ids. */\nexport function gameScoreMirror(stats: {\n readonly teamStats: Readonly<Record<string, { readonly score: number }>>;\n}): Record<string, number> {\n return Object.fromEntries(\n Object.entries(stats.teamStats).map(([teamId, line]) => [teamId, line.score]),\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"scoring-display.d.ts","sourceRoot":"","sources":["../../src/sports/scoring-display.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAGjE;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IAC5C,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CAC3C;AAED,2FAA2F;AAC3F,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAA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CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC;IAC9E,OAAO,GAAG,KAAK,iBAAiB,iBAAiB,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC;AAC/E,CAAC","sourcesContent":["// What the scoring screen, the scoreboard, and the play-by-play render for a sport, declared by its\n// adapter so no shared surface branches on a sport (SPORT-004, SPORT-106). Every label lives here or\n// in the adapter, never in a component (ENG-005).\n\nimport type { GameStatEvent, GameStatEventType } from '../doc-schemas/game-stats.js';\nimport type { StatCounterKey } from '../types/sports.js';\nimport type { ScoringPanelKind } from '../types/stats.js';\nimport type { GamePlayerLine, GameTeamLine } from './scoring.js';\nimport { isStatCorrection, isStatVoid } from './scoring.js';\n\n/**\n * Names read at render time (ARCH-103, SPORT-104): a person by user id — a removed ghost resolving to\n * \"removed player\" — and a team by team id. An event's stored name snapshot is never one of them.\n */\nexport interface StatEventNameResolver {\n readonly player: (userId: string) => string;\n readonly team: (teamId: string) => string;\n}\n\n/** An event type's button label on the scoring panel and its label in the play-by-play. */\nexport interface StatEventLabel {\n readonly button: string;\n readonly play: string;\n}\n\n/** Each field of a team line and of a player line, by label — what a correction row names. */\nexport interface StatFieldLabels<TeamField extends StatCounterKey, PlayerField extends StatCounterKey> {\n readonly team: Readonly<Record<TeamField, string>>;\n readonly player: Readonly<Record<PlayerField, string>>;\n}\n\n/** One figure a team card shows: from the team's game line and the player lines keyed to its side. */\nexport interface ScoreboardFigure {\n readonly id: string;\n readonly label: string;\n readonly value: (teamLine: GameTeamLine, sideLines: readonly GamePlayerLine[]) => number;\n}\n\n/**\n * The one scoreboard every game screen renders: each team's figures, the jump-ball marker where the\n * sport has one, and — for a sport played in rounds — each team's round-by-round grid.\n */\nexport interface Scoreboard {\n readonly figures: readonly ScoreboardFigure[];\n /**\n * Whether the sport has a jump-ball possession marker: the team cards show it, and the game's\n * scorers set it through its own writer, never a stat event.\n */\n readonly jumpBall: boolean;\n /**\n * Present only for a sport played in rounds: a team line's slot per round, `null` where the round\n * is not recorded, so the grid tells an unplayed round from a scoreless one.\n */\n readonly roundSlots?: (teamLine: GameTeamLine) => readonly (number | null)[];\n}\n\n/** A sport played in rounds: how many, and what one is called (\"Round n / 14\"). */\nexport interface RoundsDisplay {\n readonly count: number;\n readonly label: string;\n}\n\n/** Pick a present player, then tap one of their events; the team row carries the team's own. */\nexport interface PlayerEventsScoringPanel {\n readonly kind: Extract<ScoringPanelKind, 'playerEvents'>;\n readonly playerEventTypes: readonly GameStatEventType[];\n /** The events that open the assist picker: the team's other present players, and \"No assist\". */\n readonly assistableEventTypes: readonly GameStatEventType[];\n readonly teamEventTypes: readonly GameStatEventType[];\n}\n\n/** One button per event for each team. */\nexport interface TeamPointsScoringPanel {\n readonly kind: Extract<ScoringPanelKind, 'teamPoints'>;\n readonly eventTypes: readonly GameStatEventType[];\n}\n\n/** Each team's +1 through +`maxPoints` for the next round, and one button for a blank round. */\nexport interface RoundsScoringPanel {\n readonly kind: Extract<ScoringPanelKind, 'rounds'>;\n readonly scoreEventType: GameStatEventType;\n readonly blankEventType: GameStatEventType;\n readonly maxPoints: number;\n}\n\nexport type ScoringPanel = PlayerEventsScoringPanel | TeamPointsScoringPanel | RoundsScoringPanel;\n\n/** A signed change as a play shows it: `+3`, `-2`. */\nexport function formatSignedValue(value: number): string {\n return value > 0 ? `+${value}` : String(value);\n}\n\nexport const VOID_PLAY_DESCRIPTION = 'Undo of an earlier play';\n\n/**\n * The play-by-play line of a store-level event, the same for every sport: a correction names the\n * field it moved through the sport's field labels, and never reads as a play. `null` for a sport's\n * own event.\n */\nexport function describeStoreEvent(\n event: GameStatEvent,\n resolve: StatEventNameResolver,\n fieldLabels: { readonly team: Partial<Record<StatCounterKey, string>>; readonly player: Partial<Record<StatCounterKey, string>> },\n): string | null {\n if (isStatVoid(event)) return VOID_PLAY_DESCRIPTION;\n if (!isStatCorrection(event)) return null;\n const labels = event.playerUserId === undefined ? fieldLabels.team : fieldLabels.player;\n const field = labels[event.stat] ?? event.stat;\n const line =\n event.playerUserId === undefined\n ? resolve.team(event.teamId)\n : `${resolve.player(event.playerUserId)} (${resolve.team(event.teamId)})`;\n return `${field} corrected by ${formatSignedValue(event.value)} for ${line}`;\n}\n"]}
1
+ {"version":3,"file":"scoring-display.js","sourceRoot":"","sources":["../../src/sports/scoring-display.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,qGAAqG;AACrG,kDAAkD;AAMlD,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAkF5D,sDAAsD;AACtD,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,yBAAyB,CAAC;AAE/D;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAoB,EACpB,OAA8B,EAC9B,WAGC;IAED,IAAI,UAAU,CAAC,KAAK,CAAC;QAAE,OAAO,qBAAqB,CAAC;IACpD,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC1C,MAAM,MAAM,GAAG,KAAK,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC;IACxF,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC;IAC/C,MAAM,IAAI,GACR,KAAK,CAAC,YAAY,KAAK,SAAS;QAC9B,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;QAC5B,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC;IAC9E,OAAO,GAAG,KAAK,iBAAiB,iBAAiB,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC;AAC/E,CAAC","sourcesContent":["// What the scoring screen, the scoreboard, and the play-by-play render for a sport, declared by its\n// adapter so no shared surface branches on a sport (SPORT-004, SPORT-106). Every label lives here or\n// in the adapter, never in a component (ENG-005).\n\nimport type { GameStatEvent, GameStatEventType } from '../doc-schemas/game-stats.js';\nimport type { StatCounterKey } from '../types/sports.js';\nimport type { ScoringPanelKind } from '../types/stats.js';\nimport type { GamePlayerLine, GameTeamLine } from './scoring.js';\nimport { isStatCorrection, isStatVoid } from './scoring.js';\n\n/**\n * Names read at render time (ARCH-103, SPORT-104): a person by user id — a removed ghost resolving to\n * \"removed player\" — and a team by team id. An event's stored name snapshot is never one of them.\n */\nexport interface StatEventNameResolver {\n readonly player: (userId: string) => string;\n readonly team: (teamId: string) => string;\n}\n\n/** An event type's button label on the scoring panel and its label in the play-by-play. */\nexport interface StatEventLabel {\n readonly button: string;\n readonly play: string;\n}\n\n/** Each field of a team line and of a player line, by label — what a correction row names. */\nexport interface StatFieldLabels<\n TeamField extends StatCounterKey,\n PlayerField extends StatCounterKey,\n> {\n readonly team: Readonly<Record<TeamField, string>>;\n readonly player: Readonly<Record<PlayerField, string>>;\n}\n\n/** One figure a team card shows: from the team's game line and the player lines keyed to its side. */\nexport interface ScoreboardFigure {\n readonly id: string;\n readonly label: string;\n readonly value: (teamLine: GameTeamLine, sideLines: readonly GamePlayerLine[]) => number;\n}\n\n/**\n * The one scoreboard every game screen renders: each team's figures, the jump-ball marker where the\n * sport has one, and — for a sport played in rounds — each team's round-by-round grid.\n */\nexport interface Scoreboard {\n readonly figures: readonly ScoreboardFigure[];\n /**\n * Whether the sport has a jump-ball possession marker: the team cards show it, and the game's\n * scorers set it through its own writer, never a stat event.\n */\n readonly jumpBall: boolean;\n /**\n * Present only for a sport played in rounds: a team line's slot per round, `null` where the round\n * is not recorded, so the grid tells an unplayed round from a scoreless one.\n */\n readonly roundSlots?: (teamLine: GameTeamLine) => readonly (number | null)[];\n}\n\n/** A sport played in rounds: how many, and what one is called (\"Round n / 14\"). */\nexport interface RoundsDisplay {\n readonly count: number;\n readonly label: string;\n}\n\n/** Pick a present player, then tap one of their events; the team row carries the team's own. */\nexport interface PlayerEventsScoringPanel {\n readonly kind: Extract<ScoringPanelKind, 'playerEvents'>;\n readonly playerEventTypes: readonly GameStatEventType[];\n /** The events that open the assist picker: the team's other present players, and \"No assist\". */\n readonly assistableEventTypes: readonly GameStatEventType[];\n readonly teamEventTypes: readonly GameStatEventType[];\n}\n\n/** One button per event for each team. */\nexport interface TeamPointsScoringPanel {\n readonly kind: Extract<ScoringPanelKind, 'teamPoints'>;\n readonly eventTypes: readonly GameStatEventType[];\n}\n\n/** Each team's +1 through +`maxPoints` for the next round, and one button for a blank round. */\nexport interface RoundsScoringPanel {\n readonly kind: Extract<ScoringPanelKind, 'rounds'>;\n readonly scoreEventType: GameStatEventType;\n readonly blankEventType: GameStatEventType;\n readonly maxPoints: number;\n}\n\nexport type ScoringPanel = PlayerEventsScoringPanel | TeamPointsScoringPanel | RoundsScoringPanel;\n\n/** A signed change as a play shows it: `+3`, `-2`. */\nexport function formatSignedValue(value: number): string {\n return value > 0 ? `+${value}` : String(value);\n}\n\nexport const VOID_PLAY_DESCRIPTION = 'Undo of an earlier play';\n\n/**\n * The play-by-play line of a store-level event, the same for every sport: a correction names the\n * field it moved through the sport's field labels, and never reads as a play. `null` for a sport's\n * own event.\n */\nexport function describeStoreEvent(\n event: GameStatEvent,\n resolve: StatEventNameResolver,\n fieldLabels: {\n readonly team: Partial<Record<StatCounterKey, string>>;\n readonly player: Partial<Record<StatCounterKey, string>>;\n },\n): string | null {\n if (isStatVoid(event)) return VOID_PLAY_DESCRIPTION;\n if (!isStatCorrection(event)) return null;\n const labels = event.playerUserId === undefined ? fieldLabels.team : fieldLabels.player;\n const field = labels[event.stat] ?? event.stat;\n const line =\n event.playerUserId === undefined\n ? resolve.team(event.teamId)\n : `${resolve.player(event.playerUserId)} (${resolve.team(event.teamId)})`;\n return `${field} corrected by ${formatSignedValue(event.value)} for ${line}`;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"scoring.d.ts","sourceRoot":"","sources":["../../src/sports/scoring.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,KAAK,EACV,0BAA0B,EAC1B,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,YAAY,EACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,KAAK,gBAAgB,CAAC,CAAC,EAAE,CAAC,SAAS,WAAW,IAAI,CAAC,SAAS,OAAO,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC;AAEzF;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,gBAAgB,CAC1C,aAAa,EACb,SAAS,GAAG,YAAY,GAAG,sBAAsB,GAAG,sBAAsB,CAC3E,CAAC;AACF,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,aAAa,EAAE;IAAE,IAAI,EAAE,OAAO,oBAAoB,CAAA;CAAE,CAAC,CAAC;AACzF,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,aAAa,EAAE;IAA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EAAE,EAAE,IAAI,EAAE,CAAC;AAElE,MAAM,UAAU,eAAe,CAAC,IAA0B;IACxD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7B,CAAC;AAMD,MAAM,CAAC,MAAM,kBAAkB,GAA0B,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AA6CzE,0FAA0F;AAC1F,MAAM,UAAU,aAAa,CAAC,IAAoB,EAAE,WAA8B;IAChF,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,CAAC;AAChF,CAAC","sourcesContent":["// The scoring half of the sport adapter contract: the pure members the store driver, the replay, the\n// client's optimistic queue, and the aggregate cores call (SPORT-003). None issues a Firestore\n// operation or an increment, reads a clock, or mints an id.\n//\n// Every member is typed over every sport's shapes, so any registered adapter is called the same way.\n// The registry chose the adapter by the game's `leagueType`, which is what makes the rollup it is\n// handed that sport's (SPORT-002); an event of another sport is refused by `validate` and thrown on\n// by `apply` and `undo`, never guessed at.\n\nimport type { GameStatEvent } from '../doc-schemas/game-stats.js';\nimport type { GameStats } from '../doc-schemas/sport-game.js';\nimport type { StatCounterKey } from '../types/sports.js';\nimport { STAT_CORRECTION_EVENT_TYPE, STAT_VOID_EVENT_TYPE } from '../types/stats.js';\nimport type {\n FinalizationNotReadyReason,\n StatEventRecorderField,\n StatEventRefusalCode,\n StatEventSnapshotField,\n StatLineKind,\n} from '../types/stats.js';\nimport type { FinalizedGame, GameContribution } from './contribution.js';\nimport type { GameTeamIds } from './sport-adapter.js';\n\ntype DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;\n\n/**\n * What an event says happened — its type and its payload. Its id, its `recordedAt`, and what the\n * writing core stamps on it are not part of it, so a stored event, a queued one, and a drafted one\n * are all bodies.\n */\nexport type StatEventBody = DistributiveOmit<\n GameStatEvent,\n 'eventId' | 'recordedAt' | StatEventRecorderField | StatEventSnapshotField\n>;\nexport type StatVoidBody = Extract<StatEventBody, { type: typeof STAT_VOID_EVENT_TYPE }>;\nexport type StatCorrectionBody = Extract<StatEventBody, { type: typeof STAT_CORRECTION_EVENT_TYPE }>;\n/** One of a sport's own events, as opposed to the store-level void and correction. */\nexport type SportStatEventBody = Exclude<StatEventBody, StatVoidBody | StatCorrectionBody>;\n\nexport function isStatVoid(event: StatEventBody): event is StatVoidBody {\n return event.type === STAT_VOID_EVENT_TYPE;\n}\n\nexport function isStatCorrection(event: StatEventBody): event is StatCorrectionBody {\n return event.type === STAT_CORRECTION_EVENT_TYPE;\n}\n\n/** Whether `event` is one of the sport events `eventTypes` declares — never a void or a correction. */\nexport function isSportStatEventIn(\n eventTypes: readonly string[],\n event: StatEventBody | undefined,\n): event is SportStatEventBody {\n return event !== undefined && eventTypes.includes(event.type);\n}\n\n/** One team's line in a game's rollup, whichever sport it counts. */\nexport type GameTeamLine = GameStats['teamStats'][string];\n/** One roster entry's line in a game's rollup, whichever sport it counts. */\nexport type GamePlayerLine = GameStats['playerStats'][string];\n\n/** A stat line of any kind as `deriveLine` reads and returns it: its counters, derived fields, and ends. */\nexport type StatLineValues = { readonly [field: string]: number | readonly (number | null)[] };\n\n/** The game an event is validated against: its teams, and the roster entries the batch names. */\nexport interface StatEventRoster {\n /** A team of the game is one of these — never inferred from which team lines a rollup holds. */\n readonly teamIds: readonly string[];\n /** The roster entries the driver read for the batch — never the whole roster. */\n readonly rosterPlayerIds: ReadonlySet<string>;\n}\n\nexport type StatEventVerdict = { readonly ok: true } | { readonly ok: false; readonly code: StatEventRefusalCode };\n\nexport const STAT_EVENT_ACCEPTED: StatEventVerdict = { ok: true };\n\nexport function refuseStatEvent(code: StatEventRefusalCode): StatEventVerdict {\n return { ok: false, code };\n}\n\nexport type FinalizationReadiness =\n | { readonly ready: true }\n | { readonly ready: false; readonly reason: FinalizationNotReadyReason };\n\nexport const FINALIZATION_READY: FinalizationReadiness = { ready: true };\n\n/** The fields a `STAT_CORRECTION` may change, on a team line and on a player line. */\nexport interface CorrectableFields {\n readonly team: readonly StatCounterKey[];\n readonly player: readonly StatCounterKey[];\n}\n\nexport interface SportScoring {\n /**\n * Whether a new event may be recorded against `state`: its type is the sport's, its team is one\n * of the game's, every person it names is a roster entry of that team, and its values are a real\n * result. Only the store driver calls it, and only for a new event — a replay never re-validates\n * what was already accepted.\n */\n readonly validate: (state: GameStats, event: StatEventBody, roster: StatEventRoster) => StatEventVerdict;\n /**\n * `state` with one sport event or one `STAT_CORRECTION` applied. A missing line is created from\n * the sport's empty line (SPORT-105); a player line whose counters all return to zero is dropped;\n * a team line never is. Throws on a void, another sport's event, or a correction to a field not in\n * `correctableFields`.\n */\n readonly apply: (state: GameStats, event: StatEventBody) => GameStats;\n /** The exact inverse of `apply(target)` for one of the sport's own events (SPORT-103). */\n readonly undo: (state: GameStats, target: StatEventBody) => GameStats;\n /** `line` with every derived field of its kind; the only caller of any derivation formula. */\n readonly deriveLine: (kind: StatLineKind, line: StatLineValues) => StatLineValues;\n readonly correctableFields: CorrectableFields;\n /** The next round to record for a sport played in rounds, `null` once all are or for any other sport. */\n readonly nextRound: (state: GameStats) => number | null;\n /** Whether the game may be finalized (SPORT-202). */\n readonly finalizationReadiness: (state: GameStats, game: GameTeamIds) => FinalizationReadiness;\n /**\n * The games-played decision finalize stores: the roster entries credited no game played, from\n * each entry's own line and absence, in roster order (SPORT-204).\n */\n readonly participation: (\n state: GameStats,\n rosterPlayerIds: readonly string[],\n absentRosterPlayerIds: readonly string[],\n ) => string[];\n /** What a completed game adds to every derived destination (SPORT-207). */\n readonly contribution: (game: FinalizedGame) => GameContribution;\n}\n\n/** Whether every counter of a line is zero — a player line the rollup then leaves out. */\nexport function isAllZeroLine(line: StatLineValues, counterKeys: readonly string[]): boolean {\n return counterKeys.every((key) => line[key] === 0 || line[key] === undefined);\n}\n"]}
1
+ {"version":3,"file":"scoring.js","sourceRoot":"","sources":["../../src/sports/scoring.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,+FAA+F;AAC/F,4DAA4D;AAC5D,EAAE;AACF,qGAAqG;AACrG,kGAAkG;AAClG,oGAAoG;AACpG,2CAA2C;AAK3C,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AA8BrF,MAAM,UAAU,UAAU,CAAC,KAAoB;IAC7C,OAAO,KAAK,CAAC,IAAI,KAAK,oBAAoB,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAoB;IACnD,OAAO,KAAK,CAAC,IAAI,KAAK,0BAA0B,CAAC;AACnD,CAAC;AAED,uGAAuG;AACvG,MAAM,UAAU,kBAAkB,CAChC,UAA6B,EAC7B,KAAgC;IAEhC,OAAO,KAAK,KAAK,SAAS,IAAI,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAChE,CAAC;AAqBD,MAAM,CAAC,MAAM,mBAAmB,GAAqB,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AAElE,MAAM,UAAU,eAAe,CAAC,IAA0B;IACxD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7B,CAAC;AAKD,MAAM,CAAC,MAAM,kBAAkB,GAA0B,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAiDzE,0FAA0F;AAC1F,MAAM,UAAU,aAAa,CAAC,IAAoB,EAAE,WAA8B;IAChF,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,CAAC;AAChF,CAAC","sourcesContent":["// The scoring half of the sport adapter contract: the pure members the store driver, the replay, the\n// client's optimistic queue, and the aggregate cores call (SPORT-003). None issues a Firestore\n// operation or an increment, reads a clock, or mints an id.\n//\n// Every member is typed over every sport's shapes, so any registered adapter is called the same way.\n// The registry chose the adapter by the game's `leagueType`, which is what makes the rollup it is\n// handed that sport's (SPORT-002); an event of another sport is refused by `validate` and thrown on\n// by `apply` and `undo`, never guessed at.\n\nimport type { GameStatEvent } from '../doc-schemas/game-stats.js';\nimport type { GameStats } from '../doc-schemas/sport-game.js';\nimport type { StatCounterKey } from '../types/sports.js';\nimport { STAT_CORRECTION_EVENT_TYPE, STAT_VOID_EVENT_TYPE } from '../types/stats.js';\nimport type {\n FinalizationNotReadyReason,\n StatEventRecorderField,\n StatEventRefusalCode,\n StatEventSnapshotField,\n StatLineKind,\n} from '../types/stats.js';\nimport type { FinalizedGame, GameContribution } from './contribution.js';\nimport type { GameTeamIds } from './sport-adapter.js';\n\ntype DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;\n\n/**\n * What an event says happened — its type and its payload. Its id, its `recordedAt`, and what the\n * writing core stamps on it are not part of it, so a stored event, a queued one, and a drafted one\n * are all bodies.\n */\nexport type StatEventBody = DistributiveOmit<\n GameStatEvent,\n 'eventId' | 'recordedAt' | StatEventRecorderField | StatEventSnapshotField\n>;\nexport type StatVoidBody = Extract<StatEventBody, { type: typeof STAT_VOID_EVENT_TYPE }>;\nexport type StatCorrectionBody = Extract<\n StatEventBody,\n { type: typeof STAT_CORRECTION_EVENT_TYPE }\n>;\n/** One of a sport's own events, as opposed to the store-level void and correction. */\nexport type SportStatEventBody = Exclude<StatEventBody, StatVoidBody | StatCorrectionBody>;\n\nexport function isStatVoid(event: StatEventBody): event is StatVoidBody {\n return event.type === STAT_VOID_EVENT_TYPE;\n}\n\nexport function isStatCorrection(event: StatEventBody): event is StatCorrectionBody {\n return event.type === STAT_CORRECTION_EVENT_TYPE;\n}\n\n/** Whether `event` is one of the sport events `eventTypes` declares — never a void or a correction. */\nexport function isSportStatEventIn(\n eventTypes: readonly string[],\n event: StatEventBody | undefined,\n): event is SportStatEventBody {\n return event !== undefined && eventTypes.includes(event.type);\n}\n\n/** One team's line in a game's rollup, whichever sport it counts. */\nexport type GameTeamLine = GameStats['teamStats'][string];\n/** One roster entry's line in a game's rollup, whichever sport it counts. */\nexport type GamePlayerLine = GameStats['playerStats'][string];\n\n/** A stat line of any kind as `deriveLine` reads and returns it: its counters, derived fields, and ends. */\nexport type StatLineValues = { readonly [field: string]: number | readonly (number | null)[] };\n\n/** The game an event is validated against: its teams, and the roster entries the batch names. */\nexport interface StatEventRoster {\n /** A team of the game is one of these — never inferred from which team lines a rollup holds. */\n readonly teamIds: readonly string[];\n /** The roster entries the driver read for the batch — never the whole roster. */\n readonly rosterPlayerIds: ReadonlySet<string>;\n}\n\nexport type StatEventVerdict =\n { readonly ok: true } | { readonly ok: false; readonly code: StatEventRefusalCode };\n\nexport const STAT_EVENT_ACCEPTED: StatEventVerdict = { ok: true };\n\nexport function refuseStatEvent(code: StatEventRefusalCode): StatEventVerdict {\n return { ok: false, code };\n}\n\nexport type FinalizationReadiness =\n { readonly ready: true } | { readonly ready: false; readonly reason: FinalizationNotReadyReason };\n\nexport const FINALIZATION_READY: FinalizationReadiness = { ready: true };\n\n/** The fields a `STAT_CORRECTION` may change, on a team line and on a player line. */\nexport interface CorrectableFields {\n readonly team: readonly StatCounterKey[];\n readonly player: readonly StatCounterKey[];\n}\n\nexport interface SportScoring {\n /**\n * Whether a new event may be recorded against `state`: its type is the sport's, its team is one\n * of the game's, every person it names is a roster entry of that team, and its values are a real\n * result. Only the store driver calls it, and only for a new event — a replay never re-validates\n * what was already accepted.\n */\n readonly validate: (\n state: GameStats,\n event: StatEventBody,\n roster: StatEventRoster,\n ) => StatEventVerdict;\n /**\n * `state` with one sport event or one `STAT_CORRECTION` applied. A missing line is created from\n * the sport's empty line (SPORT-105); a player line whose counters all return to zero is dropped;\n * a team line never is. Throws on a void, another sport's event, or a correction to a field not in\n * `correctableFields`.\n */\n readonly apply: (state: GameStats, event: StatEventBody) => GameStats;\n /** The exact inverse of `apply(target)` for one of the sport's own events (SPORT-103). */\n readonly undo: (state: GameStats, target: StatEventBody) => GameStats;\n /** `line` with every derived field of its kind; the only caller of any derivation formula. */\n readonly deriveLine: (kind: StatLineKind, line: StatLineValues) => StatLineValues;\n readonly correctableFields: CorrectableFields;\n /** The next round to record for a sport played in rounds, `null` once all are or for any other sport. */\n readonly nextRound: (state: GameStats) => number | null;\n /** Whether the game may be finalized (SPORT-202). */\n readonly finalizationReadiness: (state: GameStats, game: GameTeamIds) => FinalizationReadiness;\n /**\n * The games-played decision finalize stores: the roster entries credited no game played, from\n * each entry's own line and absence, in roster order (SPORT-204).\n */\n readonly participation: (\n state: GameStats,\n rosterPlayerIds: readonly string[],\n absentRosterPlayerIds: readonly string[],\n ) => string[];\n /** What a completed game adds to every derived destination (SPORT-207). */\n readonly contribution: (game: FinalizedGame) => GameContribution;\n}\n\n/** Whether every counter of a line is zero — a player line the rollup then leaves out. */\nexport function isAllZeroLine(line: StatLineValues, counterKeys: readonly string[]): boolean {\n return counterKeys.every((key) => line[key] === 0 || line[key] === undefined);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sport-adapter.d.ts","sourceRoot":"","sources":["../../src/sports/sport-adapter.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,UAAU,EACV,wBAAwB,EACxB,YAAY,EACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,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IAC7B,UAAU,EAAE,YAAY;IACxB,UAAU,EAAE,YAAY;CACiC,CAAC","sourcesContent":["// The sport adapter contract: one adapter per sport owns everything about that sport, and every\n// shared surface asks it rather than branching on a sport (SPORT-003, SPORT-004). Every member is\n// pure — no Firestore operation, no clock, no minted id, no React — so both app roots run the one\n// copy (ARCH-101, ARCH-202).\n\nimport type { z } from 'zod';\nimport type { SPORT_LINE_SCHEMAS } from '../doc-schemas/aggregate-stats.js';\nimport type { SPORT_GAME_STATS_SCHEMAS } from '../doc-schemas/sport-game.js';\nimport type {\n BasketballPlayerStatKey,\n BasketballStatEventType,\n BasketballTeamStatKey,\n CurlingStatEventType,\n CurlingTeamStatKey,\n FootballStatEventType,\n FootballTeamStatKey,\n LeagueType,\n SPORT_KEY_BY_LEAGUE_TYPE,\n SportIconKey,\n} from '../types/sports.js';\nimport type { StatLineKind } from '../types/stats.js';\nimport type { GameStatEvent } from '../doc-schemas/game-stats.js';\nimport type { BulkEntry } from './bulk-entry.js';\nimport type { ColumnCatalog, ColumnCatalogKey } from './column-catalog.js';\nimport type { LifetimeSummary } from './lifetime-summary.js';\nimport type { SportScoring } from './scoring.js';\nimport type {\n RoundsDisplay,\n Scoreboard,\n ScoringPanel,\n StatEventLabel,\n StatEventNameResolver,\n StatFieldLabels,\n} from './scoring-display.js';\n\n// Each sport's declared vocabulary, keyed by `leagueType`. Its lines, and the game payload built\n// from them, come from `SPORT_LINE_SCHEMAS`.\nexport interface SportTypeMap {\n readonly Basketball: {\n readonly eventType: BasketballStatEventType;\n readonly teamStatKey: BasketballTeamStatKey;\n readonly playerStatKey: BasketballPlayerStatKey;\n };\n readonly Curling: {\n readonly eventType: CurlingStatEventType;\n readonly teamStatKey: CurlingTeamStatKey;\n readonly playerStatKey: never;\n };\n readonly Football: {\n readonly eventType: FootballStatEventType;\n readonly teamStatKey: FootballTeamStatKey;\n readonly playerStatKey: never;\n };\n}\n\n/**\n * The schema of each of the sport's stat lines, by kind. A stored line is read as this sport's line\n * through its schema — chosen by the adapter `leagueType` selected, never inferred from the line's\n * shape (SPORT-002).\n */\nexport type SportLineSchemas<L extends LeagueType> = (typeof SPORT_LINE_SCHEMAS)[L];\n\n/** `never` for a kind the sport keeps no line of. */\nexport type SportLine<L extends LeagueType, K extends StatLineKind> = z.infer<SportLineSchemas<L>[K]>;\n\n/** The game `stats` payload of one sport: its team lines and roster-entry lines. */\nexport type SportGameStats<L extends LeagueType> = z.infer<(typeof SPORT_GAME_STATS_SCHEMAS)[L]>;\n\n// The line kind each stats table reads its rows from. Standings rows are team season lines; the\n// game page's rows are player game lines; every player-totals table — league rankings, the team\n// page, the hall of fame — reads rows shaped as membership rows.\nexport const COLUMN_CATALOG_LINE_KINDS = {\n playerTotals: 'membershipRow',\n gamePlayer: 'gamePlayer',\n teamSeason: 'teamSeason',\n} as const satisfies Record<ColumnCatalogKey, StatLineKind>;\n\nexport type ColumnCatalogRow<L extends LeagueType, K extends ColumnCatalogKey> = SportLine<\n L,\n (typeof COLUMN_CATALOG_LINE_KINDS)[K]\n>;\n\n/** A sport's three column catalogs, each over its own row type; a sport missing one does not compile. */\nexport type SportColumnCatalogs<L extends LeagueType> = {\n readonly [K in ColumnCatalogKey]: ColumnCatalog<ColumnCatalogRow<L, K>>;\n};\n\n/** What shared surfaces render for the sport instead of branching on it (SPORT-004, SPORT-209). */\nexport interface SportDisplay<L extends LeagueType> {\n readonly label: string;\n readonly iconKey: SportIconKey;\n /** The profile's lifetime summary for the sport: its totals, and its per-game averages beneath. */\n readonly lifetimeSummary: LifetimeSummary<SportLine<L, 'lifetime'>>;\n /** Each of the sport's event types: its scoring-panel button and its play-by-play label. */\n readonly eventLabels: Readonly<Record<SportTypeMap[L]['eventType'], StatEventLabel>>;\n /** Each counter of a team line and of a player line — what a correction row and the Correct a game form name. */\n readonly fieldLabels: StatFieldLabels<SportTypeMap[L]['teamStatKey'], SportTypeMap[L]['playerStatKey']>;\n /** One play-by-play line for any stored event but a void, a correction included. */\n readonly describeEvent: (event: GameStatEvent, resolve: StatEventNameResolver) => string;\n /** Present only for a sport played in rounds: the header's round line and the scoreboard's grid. */\n readonly rounds?: RoundsDisplay;\n readonly scoreboard: Scoreboard;\n /** The one component of the scoring screen that is the sport's own, named by its kind. */\n readonly scoringPanel: ScoringPanel;\n}\n\n/** The game an empty rollup is built for: its real (non-bye) teams. */\nexport interface GameTeamIds {\n readonly teamIds: readonly string[];\n}\n\n/**\n * One sport's adapter: its facts, its scoring members, its display, its column catalogs, and its\n * bulk entry. The scoring members are typed over every sport, so any registered adapter is called\n * the same way.\n */\nexport interface SportAdapter<L extends LeagueType> extends SportScoring {\n readonly leagueType: L;\n /** The storage key: `sportHallOfFame/{sportKey}`, `historicalStats/{sportKey}`, `lifetimeStats.{sportKey}`. */\n readonly sportKey: (typeof SPORT_KEY_BY_LEAGUE_TYPE)[L];\n /** The sport's own event types; the store-level void and correction belong to every sport. */\n readonly eventTypes: readonly SportTypeMap[L]['eventType'][];\n /** The counters of a team line and of a player line — what the aggregates sum and a ghost link merges. */\n readonly teamStatKeys: readonly SportTypeMap[L]['teamStatKey'][];\n readonly playerStatKeys: readonly SportTypeMap[L]['playerStatKey'][];\n /** Whether the sport keeps `sportHallOfFame/{sportKey}` and the hall-of-fame page serves it. */\n readonly hallOfFame: boolean;\n /** Whether an admin may enter pre-Q-Sports career totals for the sport. */\n readonly historicalBaseline: boolean;\n readonly lineSchemas: SportLineSchemas<L>;\n readonly display: SportDisplay<L>;\n readonly columns: SportColumnCatalogs<L>;\n /**\n * The rollup of a game with no events (SPORT-105): a team line for each of the game's teams, and\n * no player lines. Every call returns new objects.\n */\n readonly emptyStats: (game: GameTeamIds) => SportGameStats<L>;\n /** The sport's bulk-entry form, whose rules `validate` enforces again on every event it becomes. */\n readonly bulkEntry: BulkEntry;\n}\n\n/** Every registered adapter, by `leagueType`. Indexing it with a generic sport keeps the sport. */\nexport type SportAdapterRegistry = { readonly [L in LeagueType]: SportAdapter<L> };\n\nexport type AnySportAdapter = SportAdapterRegistry[LeagueType];\n"]}
1
+ {"version":3,"file":"sport-adapter.js","sourceRoot":"","sources":["../../src/sports/sport-adapter.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,kGAAkG;AAClG,kGAAkG;AAClG,6BAA6B;AAmE7B,gGAAgG;AAChG,gGAAgG;AAChG,iEAAiE;AACjE,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,YAAY,EAAE,eAAe;IAC7B,UAAU,EAAE,YAAY;IACxB,UAAU,EAAE,YAAY;CACiC,CAAC","sourcesContent":["// The sport adapter contract: one adapter per sport owns everything about that sport, and every\n// shared surface asks it rather than branching on a sport (SPORT-003, SPORT-004). Every member is\n// pure — no Firestore operation, no clock, no minted id, no React — so both app roots run the one\n// copy (ARCH-101, ARCH-202).\n\nimport type { z } from 'zod';\nimport type { SPORT_LINE_SCHEMAS } from '../doc-schemas/aggregate-stats.js';\nimport type { SPORT_GAME_STATS_SCHEMAS } from '../doc-schemas/sport-game.js';\nimport type {\n BasketballPlayerStatKey,\n BasketballStatEventType,\n BasketballTeamStatKey,\n CurlingStatEventType,\n CurlingTeamStatKey,\n FootballStatEventType,\n FootballTeamStatKey,\n LeagueType,\n SPORT_KEY_BY_LEAGUE_TYPE,\n SportIconKey,\n} from '../types/sports.js';\nimport type { StatLineKind } from '../types/stats.js';\nimport type { GameStatEvent } from '../doc-schemas/game-stats.js';\nimport type { BulkEntry } from './bulk-entry.js';\nimport type { ColumnCatalog, ColumnCatalogKey } from './column-catalog.js';\nimport type { LifetimeSummary } from './lifetime-summary.js';\nimport type { SportScoring } from './scoring.js';\nimport type {\n RoundsDisplay,\n Scoreboard,\n ScoringPanel,\n StatEventLabel,\n StatEventNameResolver,\n StatFieldLabels,\n} from './scoring-display.js';\n\n// Each sport's declared vocabulary, keyed by `leagueType`. Its lines, and the game payload built\n// from them, come from `SPORT_LINE_SCHEMAS`.\nexport interface SportTypeMap {\n readonly Basketball: {\n readonly eventType: BasketballStatEventType;\n readonly teamStatKey: BasketballTeamStatKey;\n readonly playerStatKey: BasketballPlayerStatKey;\n };\n readonly Curling: {\n readonly eventType: CurlingStatEventType;\n readonly teamStatKey: CurlingTeamStatKey;\n readonly playerStatKey: never;\n };\n readonly Football: {\n readonly eventType: FootballStatEventType;\n readonly teamStatKey: FootballTeamStatKey;\n readonly playerStatKey: never;\n };\n}\n\n/**\n * The schema of each of the sport's stat lines, by kind. A stored line is read as this sport's line\n * through its schema — chosen by the adapter `leagueType` selected, never inferred from the line's\n * shape (SPORT-002).\n */\nexport type SportLineSchemas<L extends LeagueType> = (typeof SPORT_LINE_SCHEMAS)[L];\n\n/** `never` for a kind the sport keeps no line of. */\nexport type SportLine<L extends LeagueType, K extends StatLineKind> = z.infer<\n SportLineSchemas<L>[K]\n>;\n\n/** The game `stats` payload of one sport: its team lines and roster-entry lines. */\nexport type SportGameStats<L extends LeagueType> = z.infer<(typeof SPORT_GAME_STATS_SCHEMAS)[L]>;\n\n// The line kind each stats table reads its rows from. Standings rows are team season lines; the\n// game page's rows are player game lines; every player-totals table — league rankings, the team\n// page, the hall of fame — reads rows shaped as membership rows.\nexport const COLUMN_CATALOG_LINE_KINDS = {\n playerTotals: 'membershipRow',\n gamePlayer: 'gamePlayer',\n teamSeason: 'teamSeason',\n} as const satisfies Record<ColumnCatalogKey, StatLineKind>;\n\nexport type ColumnCatalogRow<L extends LeagueType, K extends ColumnCatalogKey> = SportLine<\n L,\n (typeof COLUMN_CATALOG_LINE_KINDS)[K]\n>;\n\n/** A sport's three column catalogs, each over its own row type; a sport missing one does not compile. */\nexport type SportColumnCatalogs<L extends LeagueType> = {\n readonly [K in ColumnCatalogKey]: ColumnCatalog<ColumnCatalogRow<L, K>>;\n};\n\n/** What shared surfaces render for the sport instead of branching on it (SPORT-004, SPORT-209). */\nexport interface SportDisplay<L extends LeagueType> {\n readonly label: string;\n readonly iconKey: SportIconKey;\n /** The profile's lifetime summary for the sport: its totals, and its per-game averages beneath. */\n readonly lifetimeSummary: LifetimeSummary<SportLine<L, 'lifetime'>>;\n /** Each of the sport's event types: its scoring-panel button and its play-by-play label. */\n readonly eventLabels: Readonly<Record<SportTypeMap[L]['eventType'], StatEventLabel>>;\n /** Each counter of a team line and of a player line — what a correction row and the Correct a game form name. */\n readonly fieldLabels: StatFieldLabels<\n SportTypeMap[L]['teamStatKey'],\n SportTypeMap[L]['playerStatKey']\n >;\n /** One play-by-play line for any stored event but a void, a correction included. */\n readonly describeEvent: (event: GameStatEvent, resolve: StatEventNameResolver) => string;\n /** Present only for a sport played in rounds: the header's round line and the scoreboard's grid. */\n readonly rounds?: RoundsDisplay;\n readonly scoreboard: Scoreboard;\n /** The one component of the scoring screen that is the sport's own, named by its kind. */\n readonly scoringPanel: ScoringPanel;\n}\n\n/** The game an empty rollup is built for: its real (non-bye) teams. */\nexport interface GameTeamIds {\n readonly teamIds: readonly string[];\n}\n\n/**\n * One sport's adapter: its facts, its scoring members, its display, its column catalogs, and its\n * bulk entry. The scoring members are typed over every sport, so any registered adapter is called\n * the same way.\n */\nexport interface SportAdapter<L extends LeagueType> extends SportScoring {\n readonly leagueType: L;\n /** The storage key: `sportHallOfFame/{sportKey}`, `historicalStats/{sportKey}`, `lifetimeStats.{sportKey}`. */\n readonly sportKey: (typeof SPORT_KEY_BY_LEAGUE_TYPE)[L];\n /** The sport's own event types; the store-level void and correction belong to every sport. */\n readonly eventTypes: readonly SportTypeMap[L]['eventType'][];\n /** The counters of a team line and of a player line — what the aggregates sum and a ghost link merges. */\n readonly teamStatKeys: readonly SportTypeMap[L]['teamStatKey'][];\n readonly playerStatKeys: readonly SportTypeMap[L]['playerStatKey'][];\n /** Whether the sport keeps `sportHallOfFame/{sportKey}` and the hall-of-fame page serves it. */\n readonly hallOfFame: boolean;\n /** Whether an admin may enter pre-Q-Sports career totals for the sport. */\n readonly historicalBaseline: boolean;\n readonly lineSchemas: SportLineSchemas<L>;\n readonly display: SportDisplay<L>;\n readonly columns: SportColumnCatalogs<L>;\n /**\n * The rollup of a game with no events (SPORT-105): a team line for each of the game's teams, and\n * no player lines. Every call returns new objects.\n */\n readonly emptyStats: (game: GameTeamIds) => SportGameStats<L>;\n /** The sport's bulk-entry form, whose rules `validate` enforces again on every event it becomes. */\n readonly bulkEntry: BulkEntry;\n}\n\n/** Every registered adapter, by `leagueType`. Indexing it with a generic sport keeps the sport. */\nexport type SportAdapterRegistry = { readonly [L in LeagueType]: SportAdapter<L> };\n\nexport type AnySportAdapter = SportAdapterRegistry[LeagueType];\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"store-driver.d.ts","sourceRoot":"","sources":["../../src/sports/store-driver.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,KAAK,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAExF,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEvE,iDAAiD;AACjD,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,mBAAmB,GAAG,MAAM,CAE7E;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,SAAS,mBAAmB,EAAE,GAAG,MAAM,EAAE,CAQxF;AAED,uGAAuG;AACvG,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,8FAA8F;IAC9F,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACpD;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAA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IAC5F,QAAQ,CAAC,QAAQ,EAAE,SAAS,iBAAiB,EAAE,CAAC;CACjD,GACD;IACE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;IACpC,qEAAqE;IACrE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEN,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG;QAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;QAAC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/F,0EAA0E;IAC1E,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,QAAQ,CAAC,WAAW,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACrD,iGAAiG;IACjG,QAAQ,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,aAAa,GAAG,SAAS,CAAC;CACtE;AAkED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,cAAc,GAAG,sBAAsB,CA4DlF"}
@@ -33,7 +33,10 @@ export function statEventIdsToRead(submissions) {
33
33
  return [...ids];
34
34
  }
35
35
  // The fields of a stored event the writing core derives, which a caller's re-send never carries.
36
- const DERIVED_FIELDS = new Set([...STAT_EVENT_RECORDER_FIELD_KEYS, ...STAT_EVENT_SNAPSHOT_FIELD_KEYS]);
36
+ const DERIVED_FIELDS = new Set([
37
+ ...STAT_EVENT_RECORDER_FIELD_KEYS,
38
+ ...STAT_EVENT_SNAPSHOT_FIELD_KEYS,
39
+ ]);
37
40
  function callerFields(event) {
38
41
  return Object.fromEntries(Object.entries(event).filter(([field, value]) => !DERIVED_FIELDS.has(field) && value !== undefined));
39
42
  }
@@ -41,7 +44,8 @@ function sameFields(left, right) {
41
44
  const leftFields = callerFields(left);
42
45
  const rightFields = callerFields(right);
43
46
  const keys = Object.keys(leftFields);
44
- return keys.length === Object.keys(rightFields).length && keys.every((key) => Object.is(leftFields[key], rightFields[key]));
47
+ return (keys.length === Object.keys(rightFields).length &&
48
+ keys.every((key) => Object.is(leftFields[key], rightFields[key])));
45
49
  }
46
50
  /**
47
51
  * Whether a submission is the event already held at its id. A void is the same void when it names
@@ -87,13 +91,20 @@ export function decideStatEventBatch(batch) {
87
91
  const placed = new Map();
88
92
  for (const submission of submissions) {
89
93
  const eventId = statEventSubmissionId(submission);
90
- const refuse = (code) => ({ ok: false, code, eventId });
94
+ const refuse = (code) => ({
95
+ ok: false,
96
+ code,
97
+ eventId,
98
+ });
91
99
  if (isStatCorrection(submission))
92
100
  return refuse('correctionNotAccepted');
93
- const held = placed.get(eventId) ?? (() => {
94
- const stored = storedEvent(eventId);
95
- return stored === undefined ? undefined : { event: stored, sequence: stored.sequence };
96
- })();
101
+ const held = placed.get(eventId) ??
102
+ (() => {
103
+ const stored = storedEvent(eventId);
104
+ return stored === undefined
105
+ ? undefined
106
+ : { event: stored, sequence: stored.sequence };
107
+ })();
97
108
  if (held !== undefined) {
98
109
  if (!isSameEvent(submission, held.event))
99
110
  return refuse('eventIdConflict');