@ttt-productions/q-core 0.1.28 → 0.1.30
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.
- package/dist/constants/admin-views.d.ts.map +1 -1
- package/dist/constants/admin-views.js +0 -3
- package/dist/constants/admin-views.js.map +1 -1
- package/dist/constants/business.d.ts.map +1 -1
- package/dist/constants/business.js +0 -52
- package/dist/constants/business.js.map +1 -1
- package/dist/constants/deployment.d.ts +0 -2
- package/dist/constants/deployment.d.ts.map +1 -1
- package/dist/constants/deployment.js +0 -2
- package/dist/constants/deployment.js.map +1 -1
- package/dist/constants/media.d.ts.map +1 -1
- package/dist/constants/media.js +4 -30
- package/dist/constants/media.js.map +1 -1
- package/dist/constants/scheduled-jobs.d.ts +0 -25
- package/dist/constants/scheduled-jobs.d.ts.map +1 -1
- package/dist/constants/scheduled-jobs.js +0 -26
- package/dist/constants/scheduled-jobs.js.map +1 -1
- package/dist/constants/sports.d.ts +1 -0
- package/dist/constants/sports.d.ts.map +1 -1
- package/dist/constants/sports.js +4 -25
- package/dist/constants/sports.js.map +1 -1
- package/dist/constants/storage-keys.d.ts +0 -38
- package/dist/constants/storage-keys.d.ts.map +1 -1
- package/dist/constants/storage-keys.js +0 -41
- package/dist/constants/storage-keys.js.map +1 -1
- package/dist/constants/telemetry.d.ts +0 -3
- package/dist/constants/telemetry.d.ts.map +1 -1
- package/dist/constants/telemetry.js +2 -11
- package/dist/constants/telemetry.js.map +1 -1
- package/dist/doc-schemas/admin-notifications.d.ts +1 -2
- package/dist/doc-schemas/admin-notifications.d.ts.map +1 -1
- package/dist/doc-schemas/admin-notifications.js +0 -41
- package/dist/doc-schemas/admin-notifications.js.map +1 -1
- package/dist/doc-schemas/aggregate-stats.d.ts.map +1 -1
- package/dist/doc-schemas/aggregate-stats.js +0 -35
- package/dist/doc-schemas/aggregate-stats.js.map +1 -1
- package/dist/doc-schemas/atoms.d.ts +0 -17
- package/dist/doc-schemas/atoms.d.ts.map +1 -1
- package/dist/doc-schemas/atoms.js +0 -36
- package/dist/doc-schemas/atoms.js.map +1 -1
- package/dist/doc-schemas/audit-event.d.ts +2 -0
- package/dist/doc-schemas/audit-event.d.ts.map +1 -1
- package/dist/doc-schemas/audit-event.js +0 -8
- package/dist/doc-schemas/audit-event.js.map +1 -1
- package/dist/doc-schemas/award-group-grant.d.ts +2 -8
- package/dist/doc-schemas/award-group-grant.d.ts.map +1 -1
- package/dist/doc-schemas/award-group-grant.js +0 -25
- package/dist/doc-schemas/award-group-grant.js.map +1 -1
- package/dist/doc-schemas/catalogs.d.ts.map +1 -1
- package/dist/doc-schemas/catalogs.js +0 -12
- package/dist/doc-schemas/catalogs.js.map +1 -1
- package/dist/doc-schemas/firestore-primitives.d.ts.map +1 -1
- package/dist/doc-schemas/firestore-primitives.js +0 -5
- package/dist/doc-schemas/firestore-primitives.js.map +1 -1
- package/dist/doc-schemas/gallery.d.ts.map +1 -1
- package/dist/doc-schemas/gallery.js +9 -18
- package/dist/doc-schemas/gallery.js.map +1 -1
- package/dist/doc-schemas/game-location.d.ts.map +1 -1
- package/dist/doc-schemas/game-location.js +2 -11
- package/dist/doc-schemas/game-location.js.map +1 -1
- package/dist/doc-schemas/game-stat-history.d.ts.map +1 -1
- package/dist/doc-schemas/game-stat-history.js +2 -11
- package/dist/doc-schemas/game-stat-history.js.map +1 -1
- package/dist/doc-schemas/game-stats.d.ts.map +1 -1
- package/dist/doc-schemas/game-stats.js +0 -56
- package/dist/doc-schemas/game-stats.js.map +1 -1
- package/dist/doc-schemas/league-team.d.ts.map +1 -1
- package/dist/doc-schemas/league-team.js +6 -29
- package/dist/doc-schemas/league-team.js.map +1 -1
- package/dist/doc-schemas/membership-roster-sync.d.ts.map +1 -1
- package/dist/doc-schemas/membership-roster-sync.js +0 -17
- package/dist/doc-schemas/membership-roster-sync.js.map +1 -1
- package/dist/doc-schemas/migration-console.d.ts +21 -15
- package/dist/doc-schemas/migration-console.d.ts.map +1 -1
- package/dist/doc-schemas/migration-console.js +0 -32
- package/dist/doc-schemas/migration-console.js.map +1 -1
- package/dist/doc-schemas/pending-media.d.ts.map +1 -1
- package/dist/doc-schemas/pending-media.js +8 -20
- package/dist/doc-schemas/pending-media.js.map +1 -1
- package/dist/doc-schemas/picture-retirement.d.ts.map +1 -1
- package/dist/doc-schemas/picture-retirement.js +8 -13
- package/dist/doc-schemas/picture-retirement.js.map +1 -1
- package/dist/doc-schemas/publicUser.d.ts.map +1 -1
- package/dist/doc-schemas/publicUser.js +0 -5
- package/dist/doc-schemas/publicUser.js.map +1 -1
- package/dist/doc-schemas/registration-start.d.ts.map +1 -1
- package/dist/doc-schemas/registration-start.js +2 -5
- package/dist/doc-schemas/registration-start.js.map +1 -1
- package/dist/doc-schemas/registry.d.ts +25 -14
- package/dist/doc-schemas/registry.d.ts.map +1 -1
- package/dist/doc-schemas/registry.js +0 -10
- package/dist/doc-schemas/registry.js.map +1 -1
- package/dist/doc-schemas/reserved-display-name.d.ts.map +1 -1
- package/dist/doc-schemas/reserved-display-name.js +0 -5
- package/dist/doc-schemas/reserved-display-name.js.map +1 -1
- package/dist/doc-schemas/sport-game.d.ts.map +1 -1
- package/dist/doc-schemas/sport-game.js +1 -29
- package/dist/doc-schemas/sport-game.js.map +1 -1
- package/dist/doc-schemas/sport-league.d.ts +0 -9
- package/dist/doc-schemas/sport-league.d.ts.map +1 -1
- package/dist/doc-schemas/sport-league.js +4 -26
- package/dist/doc-schemas/sport-league.js.map +1 -1
- package/dist/doc-schemas/stats-operation.d.ts +22 -18
- package/dist/doc-schemas/stats-operation.d.ts.map +1 -1
- package/dist/doc-schemas/stats-operation.js +7 -44
- package/dist/doc-schemas/stats-operation.js.map +1 -1
- package/dist/doc-schemas/status-reconcile-queue.d.ts +0 -6
- package/dist/doc-schemas/status-reconcile-queue.d.ts.map +1 -1
- package/dist/doc-schemas/status-reconcile-queue.js +0 -13
- package/dist/doc-schemas/status-reconcile-queue.js.map +1 -1
- package/dist/doc-schemas/sweep-state.d.ts.map +1 -1
- package/dist/doc-schemas/sweep-state.js +4 -20
- package/dist/doc-schemas/sweep-state.js.map +1 -1
- package/dist/doc-schemas/system.d.ts.map +1 -1
- package/dist/doc-schemas/system.js +1 -27
- package/dist/doc-schemas/system.js.map +1 -1
- package/dist/doc-schemas/team-membership.d.ts.map +1 -1
- package/dist/doc-schemas/team-membership.js +0 -10
- package/dist/doc-schemas/team-membership.js.map +1 -1
- package/dist/doc-schemas/user-profile.d.ts +0 -1
- package/dist/doc-schemas/user-profile.d.ts.map +1 -1
- package/dist/doc-schemas/user-profile.js +0 -28
- package/dist/doc-schemas/user-profile.js.map +1 -1
- package/dist/doc-schemas/waiver-template.d.ts.map +1 -1
- package/dist/doc-schemas/waiver-template.js +4 -25
- package/dist/doc-schemas/waiver-template.js.map +1 -1
- package/dist/doc-schemas/waivers-and-hardware.d.ts.map +1 -1
- package/dist/doc-schemas/waivers-and-hardware.js +0 -20
- package/dist/doc-schemas/waivers-and-hardware.js.map +1 -1
- package/dist/domain-events/domain-events.d.ts.map +1 -1
- package/dist/domain-events/domain-events.js +0 -67
- package/dist/domain-events/domain-events.js.map +1 -1
- package/dist/ids/award-grant-ids.d.ts.map +1 -1
- package/dist/ids/award-grant-ids.js +0 -7
- package/dist/ids/award-grant-ids.js.map +1 -1
- package/dist/ids/compound-ids.d.ts.map +1 -1
- package/dist/ids/compound-ids.js +0 -7
- package/dist/ids/compound-ids.js.map +1 -1
- package/dist/ids/minted-ids.d.ts.map +1 -1
- package/dist/ids/minted-ids.js +4 -14
- package/dist/ids/minted-ids.js.map +1 -1
- package/dist/ids/notification-ids.d.ts.map +1 -1
- package/dist/ids/notification-ids.js +0 -15
- package/dist/ids/notification-ids.js.map +1 -1
- package/dist/ids/picture-ids.d.ts +0 -5
- package/dist/ids/picture-ids.d.ts.map +1 -1
- package/dist/ids/picture-ids.js +0 -11
- package/dist/ids/picture-ids.js.map +1 -1
- package/dist/ids/stat-event-ids.d.ts +0 -6
- package/dist/ids/stat-event-ids.d.ts.map +1 -1
- package/dist/ids/stat-event-ids.js +0 -15
- package/dist/ids/stat-event-ids.js.map +1 -1
- package/dist/ids/stats-operation-ids.d.ts.map +1 -1
- package/dist/ids/stats-operation-ids.js +0 -7
- package/dist/ids/stats-operation-ids.js.map +1 -1
- package/dist/ids/waiver-template-ids.d.ts +0 -1
- package/dist/ids/waiver-template-ids.d.ts.map +1 -1
- package/dist/ids/waiver-template-ids.js +0 -2
- package/dist/ids/waiver-template-ids.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/input-formats/input-formats.d.ts +0 -80
- package/dist/input-formats/input-formats.d.ts.map +1 -1
- package/dist/input-formats/input-formats.js +0 -86
- package/dist/input-formats/input-formats.js.map +1 -1
- package/dist/media/file-origins.d.ts +0 -3
- package/dist/media/file-origins.d.ts.map +1 -1
- package/dist/media/file-origins.js +0 -26
- package/dist/media/file-origins.js.map +1 -1
- package/dist/media/picture-aspects.d.ts +0 -2
- package/dist/media/picture-aspects.d.ts.map +1 -1
- package/dist/media/picture-aspects.js +0 -5
- package/dist/media/picture-aspects.js.map +1 -1
- package/dist/media/picture-url.d.ts +0 -6
- package/dist/media/picture-url.d.ts.map +1 -1
- package/dist/media/picture-url.js +0 -9
- package/dist/media/picture-url.js.map +1 -1
- package/dist/media/upload-tray-display.d.ts +0 -3
- package/dist/media/upload-tray-display.d.ts.map +1 -1
- package/dist/media/upload-tray-display.js +0 -6
- package/dist/media/upload-tray-display.js.map +1 -1
- package/dist/migration-console/action-ids.d.ts +4 -1
- package/dist/migration-console/action-ids.d.ts.map +1 -1
- package/dist/migration-console/action-ids.js +8 -45
- package/dist/migration-console/action-ids.js.map +1 -1
- package/dist/migration-console/console-lock.d.ts +10 -0
- package/dist/migration-console/console-lock.d.ts.map +1 -0
- package/dist/migration-console/console-lock.js +14 -0
- package/dist/migration-console/console-lock.js.map +1 -0
- package/dist/migration-console/consumed-source.d.ts +4 -0
- package/dist/migration-console/consumed-source.d.ts.map +1 -0
- package/dist/migration-console/consumed-source.js +10 -0
- package/dist/migration-console/consumed-source.js.map +1 -0
- package/dist/migration-console/manifest.d.ts +2 -24
- package/dist/migration-console/manifest.d.ts.map +1 -1
- package/dist/migration-console/manifest.js +174 -61
- package/dist/migration-console/manifest.js.map +1 -1
- package/dist/migration-console/run-state.d.ts +2 -14
- package/dist/migration-console/run-state.d.ts.map +1 -1
- package/dist/migration-console/run-state.js +3 -16
- package/dist/migration-console/run-state.js.map +1 -1
- package/dist/notifications/admin-notification-config.d.ts +0 -11
- package/dist/notifications/admin-notification-config.d.ts.map +1 -1
- package/dist/notifications/admin-notification-config.js +2 -13
- package/dist/notifications/admin-notification-config.js.map +1 -1
- package/dist/notifications/archive-all.d.ts.map +1 -1
- package/dist/notifications/archive-all.js +0 -2
- package/dist/notifications/archive-all.js.map +1 -1
- package/dist/notifications/occurrences.d.ts +0 -3
- package/dist/notifications/occurrences.d.ts.map +1 -1
- package/dist/notifications/occurrences.js +0 -7
- package/dist/notifications/occurrences.js.map +1 -1
- package/dist/paths/app-routes.d.ts +0 -12
- package/dist/paths/app-routes.d.ts.map +1 -1
- package/dist/paths/app-routes.js +0 -18
- package/dist/paths/app-routes.js.map +1 -1
- package/dist/paths/collection-groups.d.ts.map +1 -1
- package/dist/paths/collection-groups.js +0 -5
- package/dist/paths/collection-groups.js.map +1 -1
- package/dist/paths/collection-refs.d.ts.map +1 -1
- package/dist/paths/collection-refs.js +0 -4
- package/dist/paths/collection-refs.js.map +1 -1
- package/dist/paths/collections.d.ts +0 -5
- package/dist/paths/collections.d.ts.map +1 -1
- package/dist/paths/collections.js +0 -68
- package/dist/paths/collections.js.map +1 -1
- package/dist/paths/path-builders.d.ts.map +1 -1
- package/dist/paths/path-builders.js +0 -16
- package/dist/paths/path-builders.js.map +1 -1
- package/dist/paths/picture-owner-paths.d.ts +0 -4
- package/dist/paths/picture-owner-paths.d.ts.map +1 -1
- package/dist/paths/picture-owner-paths.js +2 -11
- package/dist/paths/picture-owner-paths.js.map +1 -1
- package/dist/paths/storage-paths.d.ts +0 -18
- package/dist/paths/storage-paths.d.ts.map +1 -1
- package/dist/paths/storage-paths.js +0 -23
- package/dist/paths/storage-paths.js.map +1 -1
- package/dist/paths/utils.d.ts +0 -6
- package/dist/paths/utils.d.ts.map +1 -1
- package/dist/paths/utils.js +0 -9
- package/dist/paths/utils.js.map +1 -1
- package/dist/schemas/account-settings.d.ts.map +1 -1
- package/dist/schemas/account-settings.js +0 -7
- package/dist/schemas/account-settings.js.map +1 -1
- package/dist/schemas/admin-notifications.d.ts.map +1 -1
- package/dist/schemas/admin-notifications.js +0 -17
- package/dist/schemas/admin-notifications.js.map +1 -1
- package/dist/schemas/admin-stats.d.ts.map +1 -1
- package/dist/schemas/admin-stats.js +0 -9
- package/dist/schemas/admin-stats.js.map +1 -1
- package/dist/schemas/app-config.d.ts.map +1 -1
- package/dist/schemas/app-config.js +0 -10
- package/dist/schemas/app-config.js.map +1 -1
- package/dist/schemas/atoms.d.ts.map +1 -1
- package/dist/schemas/atoms.js +0 -10
- package/dist/schemas/atoms.js.map +1 -1
- package/dist/schemas/awards.d.ts +3 -3
- package/dist/schemas/awards.d.ts.map +1 -1
- package/dist/schemas/awards.js +0 -29
- package/dist/schemas/awards.js.map +1 -1
- package/dist/schemas/dead-letters.d.ts +0 -3
- package/dist/schemas/dead-letters.d.ts.map +1 -1
- package/dist/schemas/dead-letters.js +0 -15
- package/dist/schemas/dead-letters.js.map +1 -1
- package/dist/schemas/game-locations.d.ts.map +1 -1
- package/dist/schemas/game-locations.js +0 -6
- package/dist/schemas/game-locations.js.map +1 -1
- package/dist/schemas/hardware-loan-contracts.d.ts.map +1 -1
- package/dist/schemas/hardware-loan-contracts.js +0 -13
- package/dist/schemas/hardware-loan-contracts.js.map +1 -1
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +0 -2
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/leagues.d.ts.map +1 -1
- package/dist/schemas/leagues.js +0 -24
- package/dist/schemas/leagues.js.map +1 -1
- package/dist/schemas/migration-console.d.ts +58 -15
- package/dist/schemas/migration-console.d.ts.map +1 -1
- package/dist/schemas/migration-console.js +4 -34
- package/dist/schemas/migration-console.js.map +1 -1
- package/dist/schemas/pictures.d.ts.map +1 -1
- package/dist/schemas/pictures.js +0 -10
- package/dist/schemas/pictures.js.map +1 -1
- package/dist/schemas/schedules.d.ts.map +1 -1
- package/dist/schemas/schedules.js +0 -26
- package/dist/schemas/schedules.js.map +1 -1
- package/dist/schemas/scoring.d.ts +20 -26
- package/dist/schemas/scoring.d.ts.map +1 -1
- package/dist/schemas/scoring.js +0 -33
- package/dist/schemas/scoring.js.map +1 -1
- package/dist/schemas/signed-waivers.d.ts.map +1 -1
- package/dist/schemas/signed-waivers.js +0 -22
- package/dist/schemas/signed-waivers.js.map +1 -1
- package/dist/schemas/stats.d.ts +12 -0
- package/dist/schemas/stats.d.ts.map +1 -1
- package/dist/schemas/stats.js +21 -61
- package/dist/schemas/stats.js.map +1 -1
- package/dist/schemas/team-joining.d.ts.map +1 -1
- package/dist/schemas/team-joining.js +0 -30
- package/dist/schemas/team-joining.js.map +1 -1
- package/dist/schemas/teams.d.ts +0 -1
- package/dist/schemas/teams.d.ts.map +1 -1
- package/dist/schemas/teams.js +0 -83
- package/dist/schemas/teams.js.map +1 -1
- package/dist/schemas/uploads.d.ts +0 -8
- package/dist/schemas/uploads.d.ts.map +1 -1
- package/dist/schemas/uploads.js +0 -29
- package/dist/schemas/uploads.js.map +1 -1
- package/dist/schemas/users.d.ts +0 -1
- package/dist/schemas/users.d.ts.map +1 -1
- package/dist/schemas/users.js +0 -41
- package/dist/schemas/users.js.map +1 -1
- package/dist/schemas/waiver-templates.d.ts.map +1 -1
- package/dist/schemas/waiver-templates.js +0 -7
- package/dist/schemas/waiver-templates.js.map +1 -1
- package/dist/sports/basketball-scoring.d.ts +0 -4
- package/dist/sports/basketball-scoring.d.ts.map +1 -1
- package/dist/sports/basketball-scoring.js +0 -34
- package/dist/sports/basketball-scoring.js.map +1 -1
- package/dist/sports/basketball.d.ts.map +1 -1
- package/dist/sports/basketball.js +0 -5
- package/dist/sports/basketball.js.map +1 -1
- package/dist/sports/bulk-entry.d.ts +0 -22
- package/dist/sports/bulk-entry.d.ts.map +1 -1
- package/dist/sports/bulk-entry.js +0 -10
- package/dist/sports/bulk-entry.js.map +1 -1
- package/dist/sports/column-catalog.d.ts +0 -17
- package/dist/sports/column-catalog.d.ts.map +1 -1
- package/dist/sports/column-catalog.js +0 -10
- package/dist/sports/column-catalog.js.map +1 -1
- package/dist/sports/contribution.d.ts +2 -59
- package/dist/sports/contribution.d.ts.map +1 -1
- package/dist/sports/contribution.js +2 -45
- package/dist/sports/contribution.js.map +1 -1
- package/dist/sports/curling-scoring.d.ts +0 -1
- package/dist/sports/curling-scoring.d.ts.map +1 -1
- package/dist/sports/curling-scoring.js +0 -27
- package/dist/sports/curling-scoring.js.map +1 -1
- package/dist/sports/curling.d.ts.map +1 -1
- package/dist/sports/curling.js +0 -4
- package/dist/sports/curling.js.map +1 -1
- package/dist/sports/finalized-record.d.ts +2 -19
- package/dist/sports/finalized-record.d.ts.map +1 -1
- package/dist/sports/finalized-record.js +21 -22
- package/dist/sports/finalized-record.js.map +1 -1
- package/dist/sports/football-scoring.d.ts.map +1 -1
- package/dist/sports/football-scoring.js +0 -21
- package/dist/sports/football-scoring.js.map +1 -1
- package/dist/sports/football.d.ts.map +1 -1
- package/dist/sports/football.js +0 -4
- package/dist/sports/football.js.map +1 -1
- package/dist/sports/index.d.ts.map +1 -1
- package/dist/sports/index.js +0 -2
- package/dist/sports/index.js.map +1 -1
- package/dist/sports/ledger-continuity.d.ts +0 -2
- package/dist/sports/ledger-continuity.d.ts.map +1 -1
- package/dist/sports/ledger-continuity.js +0 -5
- package/dist/sports/ledger-continuity.js.map +1 -1
- package/dist/sports/lifetime-summary.d.ts +0 -6
- package/dist/sports/lifetime-summary.d.ts.map +1 -1
- package/dist/sports/lifetime-summary.js +0 -7
- package/dist/sports/lifetime-summary.js.map +1 -1
- package/dist/sports/rankings.d.ts +0 -12
- package/dist/sports/rankings.d.ts.map +1 -1
- package/dist/sports/rankings.js +0 -15
- package/dist/sports/rankings.js.map +1 -1
- package/dist/sports/registry.d.ts +0 -10
- package/dist/sports/registry.d.ts.map +1 -1
- package/dist/sports/registry.js +0 -9
- package/dist/sports/registry.js.map +1 -1
- package/dist/sports/replay.d.ts +0 -11
- package/dist/sports/replay.d.ts.map +1 -1
- package/dist/sports/replay.js +0 -16
- package/dist/sports/replay.js.map +1 -1
- package/dist/sports/rollup-check.d.ts +0 -7
- package/dist/sports/rollup-check.d.ts.map +1 -1
- package/dist/sports/rollup-check.js +0 -14
- package/dist/sports/rollup-check.js.map +1 -1
- package/dist/sports/score-mirror.d.ts +0 -1
- package/dist/sports/score-mirror.d.ts.map +1 -1
- package/dist/sports/score-mirror.js +0 -4
- package/dist/sports/score-mirror.js.map +1 -1
- package/dist/sports/scoring-display.d.ts +0 -30
- package/dist/sports/scoring-display.d.ts.map +1 -1
- package/dist/sports/scoring-display.js +0 -9
- package/dist/sports/scoring-display.js.map +1 -1
- package/dist/sports/scoring.d.ts +0 -36
- package/dist/sports/scoring.d.ts.map +1 -1
- package/dist/sports/scoring.js +0 -10
- package/dist/sports/scoring.js.map +1 -1
- package/dist/sports/shared-columns.d.ts +0 -1
- package/dist/sports/shared-columns.d.ts.map +1 -1
- package/dist/sports/shared-columns.js +0 -7
- package/dist/sports/shared-columns.js.map +1 -1
- package/dist/sports/sport-adapter.d.ts +0 -32
- package/dist/sports/sport-adapter.d.ts.map +1 -1
- package/dist/sports/sport-adapter.js +0 -7
- package/dist/sports/sport-adapter.js.map +1 -1
- package/dist/sports/store-driver.d.ts +0 -28
- package/dist/sports/store-driver.d.ts.map +1 -1
- package/dist/sports/store-driver.js +0 -38
- package/dist/sports/store-driver.js.map +1 -1
- package/dist/types/audit.d.ts +1 -1
- package/dist/types/audit.d.ts.map +1 -1
- package/dist/types/audit.js +1 -67
- package/dist/types/audit.js.map +1 -1
- package/dist/types/claims.d.ts +0 -10
- package/dist/types/claims.d.ts.map +1 -1
- package/dist/types/claims.js +0 -16
- package/dist/types/claims.js.map +1 -1
- package/dist/types/notifications.d.ts.map +1 -1
- package/dist/types/notifications.js +7 -25
- package/dist/types/notifications.js.map +1 -1
- package/dist/types/picture-owners.d.ts +0 -1
- package/dist/types/picture-owners.d.ts.map +1 -1
- package/dist/types/picture-owners.js +0 -6
- package/dist/types/picture-owners.js.map +1 -1
- package/dist/types/schedules.d.ts.map +1 -1
- package/dist/types/schedules.js +0 -9
- package/dist/types/schedules.js.map +1 -1
- package/dist/types/sports.d.ts.map +1 -1
- package/dist/types/sports.js +0 -24
- package/dist/types/sports.js.map +1 -1
- package/dist/types/stats.d.ts.map +1 -1
- package/dist/types/stats.js +0 -65
- package/dist/types/stats.js.map +1 -1
- package/dist/types/unions.d.ts +0 -2
- package/dist/types/unions.d.ts.map +1 -1
- package/dist/types/unions.js +3 -91
- package/dist/types/unions.js.map +1 -1
- package/dist/types/uploads.d.ts.map +1 -1
- package/dist/types/uploads.js +0 -7
- package/dist/types/uploads.js.map +1 -1
- package/dist/upload-variables/on-progress.d.ts.map +1 -1
- package/dist/upload-variables/on-progress.js +2 -5
- package/dist/upload-variables/on-progress.js.map +1 -1
- package/dist/upload-variables/picture-upload-variables.d.ts +0 -1
- package/dist/upload-variables/picture-upload-variables.d.ts.map +1 -1
- package/dist/upload-variables/picture-upload-variables.js +0 -4
- package/dist/upload-variables/picture-upload-variables.js.map +1 -1
- package/dist/upload-variables/sign-hardware-contract-variables.d.ts.map +1 -1
- package/dist/upload-variables/sign-hardware-contract-variables.js +0 -2
- package/dist/upload-variables/sign-hardware-contract-variables.js.map +1 -1
- package/dist/upload-variables/sign-waiver-variables.d.ts.map +1 -1
- package/dist/upload-variables/sign-waiver-variables.js +0 -4
- package/dist/upload-variables/sign-waiver-variables.js.map +1 -1
- package/dist/utils/account-status.d.ts.map +1 -1
- package/dist/utils/account-status.js +0 -4
- package/dist/utils/account-status.js.map +1 -1
- package/dist/utils/app-config.d.ts +0 -53
- package/dist/utils/app-config.d.ts.map +1 -1
- package/dist/utils/app-config.js +0 -62
- package/dist/utils/app-config.js.map +1 -1
- package/dist/utils/display-name.d.ts +0 -7
- package/dist/utils/display-name.d.ts.map +1 -1
- package/dist/utils/display-name.js +0 -8
- package/dist/utils/display-name.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/league-calendar.d.ts +0 -11
- package/dist/utils/league-calendar.d.ts.map +1 -1
- package/dist/utils/league-calendar.js +7 -19
- package/dist/utils/league-calendar.js.map +1 -1
- package/dist/utils/league-join-warning.d.ts +0 -11
- package/dist/utils/league-join-warning.d.ts.map +1 -1
- package/dist/utils/league-join-warning.js +0 -28
- package/dist/utils/league-join-warning.js.map +1 -1
- package/dist/utils/league-joining.d.ts +0 -1
- package/dist/utils/league-joining.d.ts.map +1 -1
- package/dist/utils/league-joining.js +0 -7
- package/dist/utils/league-joining.js.map +1 -1
- package/dist/utils/league-mode.d.ts +0 -1
- package/dist/utils/league-mode.d.ts.map +1 -1
- package/dist/utils/league-mode.js +0 -4
- package/dist/utils/league-mode.js.map +1 -1
- package/dist/utils/schedules.d.ts +0 -15
- package/dist/utils/schedules.d.ts.map +1 -1
- package/dist/utils/schedules.js +0 -19
- package/dist/utils/schedules.js.map +1 -1
- package/dist/utils/stats-operation-request.d.ts +20 -0
- package/dist/utils/stats-operation-request.d.ts.map +1 -0
- package/dist/utils/stats-operation-request.js +10 -0
- package/dist/utils/stats-operation-request.js.map +1 -0
- package/dist/utils/team-creation.d.ts +0 -2
- package/dist/utils/team-creation.d.ts.map +1 -1
- package/dist/utils/team-creation.js +0 -6
- package/dist/utils/team-creation.js.map +1 -1
- package/dist/utils/team-member-actions.d.ts +0 -6
- package/dist/utils/team-member-actions.d.ts.map +1 -1
- package/dist/utils/team-member-actions.js +0 -12
- package/dist/utils/team-member-actions.js.map +1 -1
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basketball.js","sourceRoot":"","sources":["../../src/sports/basketball.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,gGAAgG;AAChG,2BAA2B;AAE3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAMvE,OAAO,EACL,2BAA2B,EAC3B,+BAA+B,EAC/B,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,EAClB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,qBAAqB,CAAC;AAG7B,4FAA4F;AAC5F,MAAM,MAAM,GAAG,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAW,CAAC;AAC7E,MAAM,eAAe,GAAG;IACtB,EAAE,EAAE,eAAe;IACnB,KAAK,EAAE,iBAAiB;IACxB,UAAU,EAAE,KAAK;CACT,CAAC;AACX,MAAM,QAAQ,GAAG,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAW,CAAC;AACnF,MAAM,iBAAiB,GAAG;IACxB,EAAE,EAAE,iBAAiB;IACrB,KAAK,EAAE,mBAAmB;IAC1B,UAAU,EAAE,KAAK;CACT,CAAC;AACX,MAAM,OAAO,GAAG,EAAE,EAAE,E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D,aAAa,EAAE;gBACb,uBAAuB,CAAC,IAAI,CAAC,EAAE;gBAC/B,uBAAuB,CAAC,MAAM,CAAC,EAAE;gBACjC,uBAAuB,CAAC,SAAS,CAAC,EAAE;gBACpC,uBAAuB,CAAC,aAAa,CAAC,EAAE;gBACxC,uBAAuB,CAAC,iBAAiB,CAAC,EAAE;gBAC5C,QAAQ,CAAC,EAAE;gBACX,OAAO,CAAC,EAAE;aACX;SACF;KACF;IACD,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC,WAAW,CAC3B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,uBAAuB,EAAE,CAAC,CAAC,CAClE;QACD,WAAW,EAAE,EAAE;KAChB,CAAC;IACF,SAAS,EAAE,qBAAqB;CACjC,CAAC","sourcesContent":["// The basketball adapter: player-scored — a team's score is the sum of its players' points — with\n// a hall of fame and a historical baseline. Its scoring, display, and bulk-entry members are in\n// ./basketball-scoring.ts.\n\nimport { SPORT_LINE_SCHEMAS } from '../doc-schemas/aggregate-stats.js';\nimport type {\n BasketballPlayerTotals,\n BasketballTeamSeasonStats,\n} from '../doc-schemas/aggregate-stats.js';\nimport type { BasketballPlayerStats } from '../doc-schemas/game-stats.js';\nimport {\n BASKETBALL_PLAYER_STAT_KEYS,\n BASKETBALL_STAT_EVENT_TYPE_KEYS,\n BASKETBALL_TEAM_STAT_KEYS,\n SPORT_KEY_BY_LEAGUE_TYPE,\n} from '../types/sports.js';\nimport {\n BASKETBALL_BULK_ENTRY,\n BASKETBALL_EVENT_LABELS,\n BASKETBALL_FIELD_LABELS,\n BASKETBALL_SCOREBOARD,\n BASKETBALL_SCORING,\n BASKETBALL_SCORING_PANEL,\n describeBasketballEvent,\n emptyBasketballTeamLine,\n} from './basketball-scoring.js';\nimport type { ColumnSort, StatColumn } from './column-catalog.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\n// Each figure's copy, declared once and shared by the player and team columns that show it.\nconst POINTS = { id: 'points', label: 'Points', shortLabel: 'PTS' } as const;\nconst POINTS_PER_GAME = {\n id: 'pointsPerGame',\n label: 'Points per game',\n shortLabel: 'PPG',\n} as const;\nconst REBOUNDS = { id: 'rebounds', label: 'Rebounds', shortLabel: 'REB' } as const;\nconst REBOUNDS_PER_GAME = {\n id: 'reboundsPerGame',\n label: 'Rebounds per game',\n shortLabel: 'RPG',\n} as const;\nconst ASSISTS = { id: 'assists', label: 'Assists', shortLabel: 'AST' } as const;\nconst ASSISTS_PER_GAME = {\n id: 'assistsPerGame',\n label: 'Assists per game',\n shortLabel: 'APG',\n} as const;\n// FP is stored on every player line, never computed for display (`deriveLine` writes it).\nconst FANTASY_POINTS = { id: 'fantasyPoints', label: 'Fantasy points', shortLabel: 'FP' } as const;\nconst FANTASY_POINTS_PER_GAME = {\n id: 'fantasyPointsPerGame',\n label: 'Fantasy points per game',\n shortLabel: 'FP/G',\n} as const;\n\nconst BY_POINTS: readonly ColumnSort[] = [{ columnId: POINTS.id, direction: 'desc' }];\n\nconst playerTotalsColumns: readonly StatColumn<BasketballPlayerTotals>[] = [\n GAMES_PLAYED_COLUMN,\n { ...POINTS, value: (line) => line.points, perGame: POINTS_PER_GAME, sort: 'desc' },\n { ...REBOUNDS, value: (line) => line.rebounds, perGame: REBOUNDS_PER_GAME, sort: 'desc' },\n { ...ASSISTS, value: (line) => line.assists, perGame: ASSISTS_PER_GAME, sort: 'desc' },\n {\n ...FANTASY_POINTS,\n value: (line) => line.fantasyPoints,\n perGame: FANTASY_POINTS_PER_GAME,\n sort: 'desc',\n },\n];\n\nconst gamePlayerColumns: readonly StatColumn<BasketballPlayerStats>[] = [\n { ...POINTS, value: (line) => line.points, sort: 'desc' },\n { ...REBOUNDS, value: (line) => line.rebounds, sort: 'desc' },\n { ...ASSISTS, value: (line) => line.assists, sort: 'desc' },\n { ...FANTASY_POINTS, value: (line) => line.fantasyPoints, sort: 'desc' },\n];\n\nconst teamSeasonColumns: readonly StatColumn<BasketballTeamSeasonStats>[] = [\n ...TEAM_SEASON_BASE_COLUMNS,\n { ...REBOUNDS, value: (line) => line.rebounds, perGame: REBOUNDS_PER_GAME, sort: 'desc' },\n { ...ASSISTS, value: (line) => line.assists, perGame: ASSISTS_PER_GAME, sort: 'desc' },\n];\n\nexport const BASKETBALL_ADAPTER: SportAdapter<'Basketball'> = {\n leagueType: 'Basketball',\n sportKey: SPORT_KEY_BY_LEAGUE_TYPE.Basketball,\n eventTypes: BASKETBALL_STAT_EVENT_TYPE_KEYS,\n teamStatKeys: BASKETBALL_TEAM_STAT_KEYS,\n playerStatKeys: BASKETBALL_PLAYER_STAT_KEYS,\n hallOfFame: true,\n historicalBaseline: true,\n lineSchemas: SPORT_LINE_SCHEMAS.Basketball,\n ...BASKETBALL_SCORING,\n display: {\n label: 'Basketball',\n iconKey: 'basketballBall',\n lifetimeSummary: lifetimeSummaryFromColumns(playerTotalsColumns),\n eventLabels: BASKETBALL_EVENT_LABELS,\n fieldLabels: BASKETBALL_FIELD_LABELS,\n describeEvent: describeBasketballEvent,\n scoreboard: BASKETBALL_SCOREBOARD,\n scoringPanel: BASKETBALL_SCORING_PANEL,\n },\n columns: {\n playerTotals: {\n columns: playerTotalsColumns,\n defaultSort: BY_POINTS,\n presets: [\n {\n id: 'totals',\n label: 'Totals',\n columnIds: [\n GAMES_PLAYED_COLUMN.id,\n POINTS.id,\n REBOUNDS.id,\n ASSISTS.id,\n FANTASY_POINTS.id,\n ],\n },\n {\n id: 'perGame',\n label: 'Per game',\n columnIds: [\n GAMES_PLAYED_COLUMN.id,\n POINTS_PER_GAME.id,\n REBOUNDS_PER_GAME.id,\n ASSISTS_PER_GAME.id,\n FANTASY_POINTS_PER_GAME.id,\n ],\n },\n ],\n },\n gamePlayer: {\n columns: gamePlayerColumns,\n defaultSort: BY_POINTS,\n defaultLayout: [POINTS.id, REBOUNDS.id, ASSISTS.id, FANTASY_POINTS.id],\n },\n teamSeason: {\n columns: teamSeasonColumns,\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.pointsFor.id,\n TEAM_SEASON_BASE_COLUMN.pointsAgainst.id,\n TEAM_SEASON_BASE_COLUMN.pointDifferential.id,\n REBOUNDS.id,\n ASSISTS.id,\n ],\n },\n },\n emptyStats: (game) => ({\n teamStats: Object.fromEntries(\n game.teamIds.map((teamId) => [teamId, emptyBasketballTeamLine()]),\n ),\n playerStats: {},\n }),\n bulkEntry: BASKETBALL_BULK_ENTRY,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"basketball.js","sourceRoot":"","sources":["../../src/sports/basketball.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAMvE,OAAO,EACL,2BAA2B,EAC3B,+BAA+B,EAC/B,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,EAClB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,qBAAqB,CAAC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;YACtB,aAAa,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,cAAc,CAAC,EAAE,CAAC;SACvE;QACD,UAAU,EAAE;YACV,OAAO,EAAE,iBAAiB;YAC1B,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,SAAS,CAAC,EAAE;gBACpC,uBAAuB,CAAC,aAAa,CAAC,EAAE;gBACxC,uBAAuB,CAAC,iBAAiB,CAAC,EAAE;gBAC5C,QAAQ,CAAC,EAAE;gBACX,OAAO,CAAC,EAAE;aACX;SACF;KACF;IACD,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC,WAAW,CAC3B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,uBAAuB,EAAE,CAAC,CAAC,CAClE;QACD,WAAW,EAAE,EAAE;KAChB,CAAC;IACF,SAAS,EAAE,qBAAqB;CACjC,CAAC","sourcesContent":["import { SPORT_LINE_SCHEMAS } from '../doc-schemas/aggregate-stats.js';\nimport type {\n BasketballPlayerTotals,\n BasketballTeamSeasonStats,\n} from '../doc-schemas/aggregate-stats.js';\nimport type { BasketballPlayerStats } from '../doc-schemas/game-stats.js';\nimport {\n BASKETBALL_PLAYER_STAT_KEYS,\n BASKETBALL_STAT_EVENT_TYPE_KEYS,\n BASKETBALL_TEAM_STAT_KEYS,\n SPORT_KEY_BY_LEAGUE_TYPE,\n} from '../types/sports.js';\nimport {\n BASKETBALL_BULK_ENTRY,\n BASKETBALL_EVENT_LABELS,\n BASKETBALL_FIELD_LABELS,\n BASKETBALL_SCOREBOARD,\n BASKETBALL_SCORING,\n BASKETBALL_SCORING_PANEL,\n describeBasketballEvent,\n emptyBasketballTeamLine,\n} from './basketball-scoring.js';\nimport type { ColumnSort, StatColumn } from './column-catalog.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 POINTS = { id: 'points', label: 'Points', shortLabel: 'PTS' } as const;\nconst POINTS_PER_GAME = {\n id: 'pointsPerGame',\n label: 'Points per game',\n shortLabel: 'PPG',\n} as const;\nconst REBOUNDS = { id: 'rebounds', label: 'Rebounds', shortLabel: 'REB' } as const;\nconst REBOUNDS_PER_GAME = {\n id: 'reboundsPerGame',\n label: 'Rebounds per game',\n shortLabel: 'RPG',\n} as const;\nconst ASSISTS = { id: 'assists', label: 'Assists', shortLabel: 'AST' } as const;\nconst ASSISTS_PER_GAME = {\n id: 'assistsPerGame',\n label: 'Assists per game',\n shortLabel: 'APG',\n} as const;\nconst FANTASY_POINTS = { id: 'fantasyPoints', label: 'Fantasy points', shortLabel: 'FP' } as const;\nconst FANTASY_POINTS_PER_GAME = {\n id: 'fantasyPointsPerGame',\n label: 'Fantasy points per game',\n shortLabel: 'FP/G',\n} as const;\n\nconst BY_POINTS: readonly ColumnSort[] = [{ columnId: POINTS.id, direction: 'desc' }];\n\nconst playerTotalsColumns: readonly StatColumn<BasketballPlayerTotals>[] = [\n GAMES_PLAYED_COLUMN,\n { ...POINTS, value: (line) => line.points, perGame: POINTS_PER_GAME, sort: 'desc' },\n { ...REBOUNDS, value: (line) => line.rebounds, perGame: REBOUNDS_PER_GAME, sort: 'desc' },\n { ...ASSISTS, value: (line) => line.assists, perGame: ASSISTS_PER_GAME, sort: 'desc' },\n {\n ...FANTASY_POINTS,\n value: (line) => line.fantasyPoints,\n perGame: FANTASY_POINTS_PER_GAME,\n sort: 'desc',\n },\n];\n\nconst gamePlayerColumns: readonly StatColumn<BasketballPlayerStats>[] = [\n { ...POINTS, value: (line) => line.points, sort: 'desc' },\n { ...REBOUNDS, value: (line) => line.rebounds, sort: 'desc' },\n { ...ASSISTS, value: (line) => line.assists, sort: 'desc' },\n { ...FANTASY_POINTS, value: (line) => line.fantasyPoints, sort: 'desc' },\n];\n\nconst teamSeasonColumns: readonly StatColumn<BasketballTeamSeasonStats>[] = [\n ...TEAM_SEASON_BASE_COLUMNS,\n { ...REBOUNDS, value: (line) => line.rebounds, perGame: REBOUNDS_PER_GAME, sort: 'desc' },\n { ...ASSISTS, value: (line) => line.assists, perGame: ASSISTS_PER_GAME, sort: 'desc' },\n];\n\nexport const BASKETBALL_ADAPTER: SportAdapter<'Basketball'> = {\n leagueType: 'Basketball',\n sportKey: SPORT_KEY_BY_LEAGUE_TYPE.Basketball,\n eventTypes: BASKETBALL_STAT_EVENT_TYPE_KEYS,\n teamStatKeys: BASKETBALL_TEAM_STAT_KEYS,\n playerStatKeys: BASKETBALL_PLAYER_STAT_KEYS,\n hallOfFame: true,\n historicalBaseline: true,\n lineSchemas: SPORT_LINE_SCHEMAS.Basketball,\n ...BASKETBALL_SCORING,\n display: {\n label: 'Basketball',\n iconKey: 'basketballBall',\n lifetimeSummary: lifetimeSummaryFromColumns(playerTotalsColumns),\n eventLabels: BASKETBALL_EVENT_LABELS,\n fieldLabels: BASKETBALL_FIELD_LABELS,\n describeEvent: describeBasketballEvent,\n scoreboard: BASKETBALL_SCOREBOARD,\n scoringPanel: BASKETBALL_SCORING_PANEL,\n },\n columns: {\n playerTotals: {\n columns: playerTotalsColumns,\n defaultSort: BY_POINTS,\n presets: [\n {\n id: 'totals',\n label: 'Totals',\n columnIds: [\n GAMES_PLAYED_COLUMN.id,\n POINTS.id,\n REBOUNDS.id,\n ASSISTS.id,\n FANTASY_POINTS.id,\n ],\n },\n {\n id: 'perGame',\n label: 'Per game',\n columnIds: [\n GAMES_PLAYED_COLUMN.id,\n POINTS_PER_GAME.id,\n REBOUNDS_PER_GAME.id,\n ASSISTS_PER_GAME.id,\n FANTASY_POINTS_PER_GAME.id,\n ],\n },\n ],\n },\n gamePlayer: {\n columns: gamePlayerColumns,\n defaultSort: BY_POINTS,\n defaultLayout: [POINTS.id, REBOUNDS.id, ASSISTS.id, FANTASY_POINTS.id],\n },\n teamSeason: {\n columns: teamSeasonColumns,\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.pointsFor.id,\n TEAM_SEASON_BASE_COLUMN.pointsAgainst.id,\n TEAM_SEASON_BASE_COLUMN.pointDifferential.id,\n REBOUNDS.id,\n ASSISTS.id,\n ],\n },\n },\n emptyStats: (game) => ({\n teamStats: Object.fromEntries(\n game.teamIds.map((teamId) => [teamId, emptyBasketballTeamLine()]),\n ),\n playerStats: {},\n }),\n bulkEntry: BASKETBALL_BULK_ENTRY,\n};\n"]}
|
|
@@ -3,60 +3,38 @@ import type { GameStats } from '../doc-schemas/sport-game.js';
|
|
|
3
3
|
import type { BulkEntryKind } from '../types/stats.js';
|
|
4
4
|
import type { SportStatEventBody, StatVoidBody } from './scoring.js';
|
|
5
5
|
import type { GameTeamIds } from './sport-adapter.js';
|
|
6
|
-
/** A recorded round's live event — one no void voids — so an edit of that round can void it. */
|
|
7
6
|
export interface LiveRoundEvent {
|
|
8
7
|
readonly eventId: string;
|
|
9
8
|
readonly roundNumber: number;
|
|
10
9
|
}
|
|
11
|
-
/** What the form edits: the game, the scorer's current state, and the game's roster. */
|
|
12
10
|
export interface BulkEntryContext {
|
|
13
11
|
readonly game: GameTeamIds;
|
|
14
|
-
/** The scorer's optimistic rollup, the queue's pending events applied. */
|
|
15
12
|
readonly state: GameStats;
|
|
16
|
-
/** Every roster entry of the game, grouped by team in the order the form lists them. */
|
|
17
13
|
readonly rosterPlayerIds: readonly string[];
|
|
18
14
|
readonly absentRosterPlayerIds: readonly string[];
|
|
19
|
-
/** For a sport played in rounds, the game's unvoided round events; empty for any other sport. */
|
|
20
15
|
readonly liveRoundEvents: readonly LiveRoundEvent[];
|
|
21
16
|
}
|
|
22
|
-
/**
|
|
23
|
-
* One event of a submission, in batch order: a sport event's type and payload, or the target of a
|
|
24
|
-
* void. At submit — the tap — the dialog mints each sport event's id and stamps its `recordedAt`, and
|
|
25
|
-
* the queue sends the drafts as one unit it never splits across calls.
|
|
26
|
-
*/
|
|
27
17
|
export type StatEventDraft = SportStatEventBody | StatVoidBody;
|
|
28
18
|
export interface BulkEntryForm<K extends BulkEntryKind, Values> {
|
|
29
19
|
readonly kind: K;
|
|
30
|
-
/** The form's resolver: its rules for this game and state. */
|
|
31
20
|
readonly formSchema: (context: BulkEntryContext) => z.ZodType<Values>;
|
|
32
21
|
readonly formDefaults: (context: BulkEntryContext) => Values;
|
|
33
|
-
/** The drafts a submission becomes; empty when nothing changed. */
|
|
34
22
|
readonly toEvents: (values: Values, context: BulkEntryContext) => readonly StatEventDraft[];
|
|
35
23
|
}
|
|
36
|
-
/** Each roster entry's player counters, by roster entry id. */
|
|
37
24
|
export interface PlayerLinesValues {
|
|
38
25
|
readonly lines: Readonly<Record<string, Readonly<Record<string, number>>>>;
|
|
39
26
|
}
|
|
40
|
-
/** Each team's final score, by team id. */
|
|
41
27
|
export interface TeamScoresValues {
|
|
42
28
|
readonly scores: Readonly<Record<string, number>>;
|
|
43
29
|
}
|
|
44
|
-
/** Each round, first to last: every team's points by team id, `null` where the round is not recorded. */
|
|
45
30
|
export interface RoundsValues {
|
|
46
31
|
readonly rounds: readonly Readonly<Record<string, number | null>>[];
|
|
47
32
|
}
|
|
48
33
|
export type PlayerLinesBulkEntry = BulkEntryForm<'playerLines', PlayerLinesValues>;
|
|
49
34
|
export type TeamScoresBulkEntry = BulkEntryForm<'teamScores', TeamScoresValues>;
|
|
50
35
|
export type RoundsBulkEntry = BulkEntryForm<'rounds', RoundsValues>;
|
|
51
|
-
/** The dialog picks its form body by `kind`, from an exhaustive map over the kind union. */
|
|
52
36
|
export type BulkEntry = PlayerLinesBulkEntry | TeamScoresBulkEntry | RoundsBulkEntry;
|
|
53
|
-
/** The form's refusal when a submission would pass the per-write event cap. */
|
|
54
37
|
export declare const BULK_ENTRY_TOO_LARGE_MESSAGE = "This entry changes more stats than one save can hold. Save part of it, then enter the rest.";
|
|
55
|
-
/** The form's refusal of a value that is not a whole number of zero or more. */
|
|
56
38
|
export declare const BULK_ENTRY_COUNT_MESSAGE = "Enter a whole number, zero or more.";
|
|
57
|
-
/**
|
|
58
|
-
* Every bulk-entry cell that holds a count: the count atom's check, answered with the one message the
|
|
59
|
-
* form shows for any failure of it — which the atom's own issues cannot carry.
|
|
60
|
-
*/
|
|
61
39
|
export declare const bulkEntryCountField: z.ZodCustom<number, number>;
|
|
62
40
|
//# sourceMappingURL=bulk-entry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bulk-entry.d.ts","sourceRoot":"","sources":["../../src/sports/bulk-entry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bulk-entry.d.ts","sourceRoot":"","sources":["../../src/sports/bulk-entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8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,CAAC;CAC5E;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACnD;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC;CACrE;AAED,MAAM,MAAM,oBAAoB,GAAG,aAAa,CAAC,aAAa,EAAE,iBAAiB,CAAC,CAAC;AACnF,MAAM,MAAM,mBAAmB,GAAG,aAAa,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;AAChF,MAAM,MAAM,eAAe,GAAG,aAAa,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AAEpE,MAAM,MAAM,SAAS,GAAG,oBAAoB,GAAG,mBAAmB,GAAG,eAAe,CAAC;AAErF,eAAO,MAAM,4BAA4B,gGACsD,CAAC;AAEhG,eAAO,MAAM,wBAAwB,wCAAwC,CAAC;AAE9E,eAAO,MAAM,mBAAmB,6BAG/B,CAAC"}
|
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
// A sport's bulk entry: the form the shared bulk-entry dialog renders for the sport's kind, and the
|
|
2
|
-
// events a submission becomes. The form's rules are built from the sport's constants, and every one
|
|
3
|
-
// of them is also an event rule the adapter's `validate` enforces, because the callable sees events,
|
|
4
|
-
// never form values, and captains use it (RULE-QS-SPORT-906).
|
|
5
1
|
import { z } from 'zod';
|
|
6
2
|
import { countSchema } from '../doc-schemas/atoms.js';
|
|
7
|
-
/** The form's refusal when a submission would pass the per-write event cap. */
|
|
8
3
|
export const BULK_ENTRY_TOO_LARGE_MESSAGE = 'This entry changes more stats than one save can hold. Save part of it, then enter the rest.';
|
|
9
|
-
/** The form's refusal of a value that is not a whole number of zero or more. */
|
|
10
4
|
export const BULK_ENTRY_COUNT_MESSAGE = 'Enter a whole number, zero or more.';
|
|
11
|
-
/**
|
|
12
|
-
* Every bulk-entry cell that holds a count: the count atom's check, answered with the one message the
|
|
13
|
-
* form shows for any failure of it — which the atom's own issues cannot carry.
|
|
14
|
-
*/
|
|
15
5
|
export const bulkEntryCountField = z.custom((value) => countSchema.safeParse(value).success, BULK_ENTRY_COUNT_MESSAGE);
|
|
16
6
|
//# sourceMappingURL=bulk-entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bulk-entry.js","sourceRoot":"","sources":["../../src/sports/bulk-entry.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"bulk-entry.js","sourceRoot":"","sources":["../../src/sports/bulk-entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AA8CtD,MAAM,CAAC,MAAM,4BAA4B,GACvC,6FAA6F,CAAC;AAEhG,MAAM,CAAC,MAAM,wBAAwB,GAAG,qCAAqC,CAAC;AAE9E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CACzC,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,EAC/C,wBAAwB,CACzB,CAAC","sourcesContent":["import { z } from 'zod';\nimport { countSchema } from '../doc-schemas/atoms.js';\nimport type { GameStats } from '../doc-schemas/sport-game.js';\nimport type { BulkEntryKind } from '../types/stats.js';\nimport type { SportStatEventBody, StatVoidBody } from './scoring.js';\nimport type { GameTeamIds } from './sport-adapter.js';\n\nexport interface LiveRoundEvent {\n readonly eventId: string;\n readonly roundNumber: number;\n}\n\nexport interface BulkEntryContext {\n readonly game: GameTeamIds;\n readonly state: GameStats;\n readonly rosterPlayerIds: readonly string[];\n readonly absentRosterPlayerIds: readonly string[];\n readonly liveRoundEvents: readonly LiveRoundEvent[];\n}\n\nexport type StatEventDraft = SportStatEventBody | StatVoidBody;\n\nexport interface BulkEntryForm<K extends BulkEntryKind, Values> {\n readonly kind: K;\n readonly formSchema: (context: BulkEntryContext) => z.ZodType<Values>;\n readonly formDefaults: (context: BulkEntryContext) => Values;\n readonly toEvents: (values: Values, context: BulkEntryContext) => readonly StatEventDraft[];\n}\n\nexport interface PlayerLinesValues {\n readonly lines: Readonly<Record<string, Readonly<Record<string, number>>>>;\n}\n\nexport interface TeamScoresValues {\n readonly scores: Readonly<Record<string, number>>;\n}\n\nexport interface RoundsValues {\n readonly rounds: readonly Readonly<Record<string, number | null>>[];\n}\n\nexport type PlayerLinesBulkEntry = BulkEntryForm<'playerLines', PlayerLinesValues>;\nexport type TeamScoresBulkEntry = BulkEntryForm<'teamScores', TeamScoresValues>;\nexport type RoundsBulkEntry = BulkEntryForm<'rounds', RoundsValues>;\n\nexport type BulkEntry = PlayerLinesBulkEntry | TeamScoresBulkEntry | RoundsBulkEntry;\n\nexport const BULK_ENTRY_TOO_LARGE_MESSAGE =\n 'This entry changes more stats than one save can hold. Save part of it, then enter the rest.';\n\nexport const BULK_ENTRY_COUNT_MESSAGE = 'Enter a whole number, zero or more.';\n\nexport const bulkEntryCountField = z.custom<number>(\n (value) => countSchema.safeParse(value).success,\n BULK_ENTRY_COUNT_MESSAGE,\n);\n"]}
|
|
@@ -1,54 +1,38 @@
|
|
|
1
1
|
export declare const SORT_DIRECTION_KEYS: readonly ["asc", "desc"];
|
|
2
2
|
export type SortDirection = (typeof SORT_DIRECTION_KEYS)[number];
|
|
3
|
-
/** A line that can be averaged per game. */
|
|
4
3
|
export interface GamesPlayedRow {
|
|
5
4
|
readonly gamesPlayed: number;
|
|
6
5
|
}
|
|
7
|
-
/** A column's per-game variant. Its own id lets a layout show it beside the total or instead of it. */
|
|
8
6
|
export interface PerGameColumn {
|
|
9
7
|
readonly id: string;
|
|
10
8
|
readonly label: string;
|
|
11
9
|
readonly shortLabel: string;
|
|
12
10
|
}
|
|
13
11
|
export interface StatColumn<Row> {
|
|
14
|
-
/** Presets, default layouts, and a table's View state name the column by this id. */
|
|
15
12
|
readonly id: string;
|
|
16
|
-
/** The full label: wide density and the accessible name. */
|
|
17
13
|
readonly label: string;
|
|
18
|
-
/** The header's label in compact and regular density (PTS). */
|
|
19
14
|
readonly shortLabel: string;
|
|
20
|
-
/** A stored field of the row or a derivation over it; nothing is stored for a column. */
|
|
21
15
|
readonly value: (row: Row) => number;
|
|
22
|
-
/**
|
|
23
|
-
* Offered only where the rows carry `gamesPlayed`; its figure is
|
|
24
|
-
* `perGameAverage(value(row), row.gamesPlayed)`. On any other row type the member is `never`.
|
|
25
|
-
*/
|
|
26
16
|
readonly perGame?: [Row] extends [GamesPlayedRow] ? PerGameColumn : never;
|
|
27
|
-
/** The direction of the column's first sort: `desc`, or `asc` where fewer is better. */
|
|
28
17
|
readonly sort: SortDirection;
|
|
29
18
|
}
|
|
30
|
-
/** One tiebreak of a catalog's default order. */
|
|
31
19
|
export interface ColumnSort {
|
|
32
20
|
readonly columnId: string;
|
|
33
21
|
readonly direction: SortDirection;
|
|
34
22
|
}
|
|
35
|
-
/** A named column set the View menu offers as one tap. `columnIds` may name per-game ids. */
|
|
36
23
|
export interface ColumnPreset {
|
|
37
24
|
readonly id: string;
|
|
38
25
|
readonly label: string;
|
|
39
26
|
readonly columnIds: readonly string[];
|
|
40
27
|
}
|
|
41
28
|
export interface ColumnCatalogBase<Row> {
|
|
42
|
-
/** Catalog order: where a Custom layout inserts a column it has never seen. */
|
|
43
29
|
readonly columns: readonly StatColumn<Row>[];
|
|
44
30
|
readonly defaultSort: readonly ColumnSort[];
|
|
45
31
|
}
|
|
46
|
-
/** A catalog whose coded default layout is its first preset. */
|
|
47
32
|
export interface PresetColumnCatalog<Row> extends ColumnCatalogBase<Row> {
|
|
48
33
|
readonly presets: readonly [ColumnPreset, ...ColumnPreset[]];
|
|
49
34
|
readonly defaultLayout?: never;
|
|
50
35
|
}
|
|
51
|
-
/** A catalog with no presets: its coded default layout is the ordered visible column ids. */
|
|
52
36
|
export interface DefaultLayoutColumnCatalog<Row> extends ColumnCatalogBase<Row> {
|
|
53
37
|
readonly defaultLayout: readonly string[];
|
|
54
38
|
readonly presets?: never;
|
|
@@ -58,6 +42,5 @@ export declare const COLUMN_CATALOG_KEYS: readonly ["playerTotals", "gamePlayer"
|
|
|
58
42
|
export type ColumnCatalogKey = (typeof COLUMN_CATALOG_KEYS)[number];
|
|
59
43
|
export declare const GAMES_PLAYED_CATALOG_KEYS: readonly ["playerTotals", "teamSeason"];
|
|
60
44
|
export type GamesPlayedCatalogKey = (typeof GAMES_PLAYED_CATALOG_KEYS)[number];
|
|
61
|
-
/** The one per-game derivation: every per-game figure the app shows comes from here. */
|
|
62
45
|
export declare function perGameAverage(total: number, gamesPlayed: number): number | null;
|
|
63
46
|
//# sourceMappingURL=column-catalog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"column-catalog.d.ts","sourceRoot":"","sources":["../../src/sports/column-catalog.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"column-catalog.d.ts","sourceRoot":"","sources":["../../src/sports/column-catalog.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,0BAA2B,CAAC;AAC5D,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,UAAU,CAAC,GAAG;IAC7B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,M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F,eAAO,MAAM,mBAAmB,uDAAwD,CAAC;AACzF,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE,eAAO,MAAM,yBAAyB,yCAGU,CAAC;AACjD,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/E,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAEhF"}
|
|
@@ -1,19 +1,9 @@
|
|
|
1
|
-
// The column contract the one stats table renders. The table knows nothing about a sport: it takes
|
|
2
|
-
// a catalog of these columns and rows of the catalog's line type, and every per-game figure it
|
|
3
|
-
// shows comes from `perGameAverage`.
|
|
4
1
|
export const SORT_DIRECTION_KEYS = ['asc', 'desc'];
|
|
5
|
-
// The catalogs every sport declares, one per kind of stats table: `playerTotals` (league player
|
|
6
|
-
// rankings, the team page, the hall of fame), `gamePlayer` (the game page), `teamSeason`
|
|
7
|
-
// (standings — its `defaultSort` is the sport's standings order, which the rank and the playoff line
|
|
8
|
-
// follow). A stats table names the catalog it renders by this key.
|
|
9
2
|
export const COLUMN_CATALOG_KEYS = ['playerTotals', 'gamePlayer', 'teamSeason'];
|
|
10
|
-
// The catalogs whose rows carry games played, so a per-game column can average them. A game's player
|
|
11
|
-
// line counts one game, so `gamePlayer` is not among them.
|
|
12
3
|
export const GAMES_PLAYED_CATALOG_KEYS = [
|
|
13
4
|
'playerTotals',
|
|
14
5
|
'teamSeason',
|
|
15
6
|
];
|
|
16
|
-
/** The one per-game derivation: every per-game figure the app shows comes from here. */
|
|
17
7
|
export function perGameAverage(total, gamesPlayed) {
|
|
18
8
|
return gamesPlayed === 0 ? null : total / gamesPlayed;
|
|
19
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"column-catalog.js","sourceRoot":"","sources":["../../src/sports/column-catalog.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"column-catalog.js","sourceRoot":"","sources":["../../src/sports/column-catalog.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,MAAM,CAAU,CAAC;AAkD5D,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,cAAc,EAAE,YAAY,EAAE,YAAY,CAAU,CAAC;AAGzF,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,cAAc;IACd,YAAY;CACkC,CAAC;AAGjD,MAAM,UAAU,cAAc,CAAC,KAAa,EAAE,WAAmB;IAC/D,OAAO,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,WAAW,CAAC;AACxD,CAAC","sourcesContent":["export const SORT_DIRECTION_KEYS = ['asc', 'desc'] as const;\nexport type SortDirection = (typeof SORT_DIRECTION_KEYS)[number];\n\nexport interface GamesPlayedRow {\n readonly gamesPlayed: number;\n}\n\nexport interface PerGameColumn {\n readonly id: string;\n readonly label: string;\n readonly shortLabel: string;\n}\n\nexport interface StatColumn<Row> {\n readonly id: string;\n readonly label: string;\n readonly shortLabel: string;\n readonly value: (row: Row) => number;\n readonly perGame?: [Row] extends [GamesPlayedRow] ? PerGameColumn : never;\n readonly sort: SortDirection;\n}\n\nexport interface ColumnSort {\n readonly columnId: string;\n readonly direction: SortDirection;\n}\n\nexport interface ColumnPreset {\n readonly id: string;\n readonly label: string;\n readonly columnIds: readonly string[];\n}\n\nexport interface ColumnCatalogBase<Row> {\n readonly columns: readonly StatColumn<Row>[];\n readonly defaultSort: readonly ColumnSort[];\n}\n\nexport interface PresetColumnCatalog<Row> extends ColumnCatalogBase<Row> {\n readonly presets: readonly [ColumnPreset, ...ColumnPreset[]];\n readonly defaultLayout?: never;\n}\n\nexport interface DefaultLayoutColumnCatalog<Row> extends ColumnCatalogBase<Row> {\n readonly defaultLayout: readonly string[];\n readonly presets?: never;\n}\n\nexport type ColumnCatalog<Row> = PresetColumnCatalog<Row> | DefaultLayoutColumnCatalog<Row>;\n\nexport const COLUMN_CATALOG_KEYS = ['playerTotals', 'gamePlayer', 'teamSeason'] as const;\nexport type ColumnCatalogKey = (typeof COLUMN_CATALOG_KEYS)[number];\n\nexport const GAMES_PLAYED_CATALOG_KEYS = [\n 'playerTotals',\n 'teamSeason',\n] as const satisfies readonly ColumnCatalogKey[];\nexport type GamesPlayedCatalogKey = (typeof GAMES_PLAYED_CATALOG_KEYS)[number];\n\nexport function perGameAverage(total: number, gamesPlayed: number): number | null {\n return gamesPlayed === 0 ? null : total / gamesPlayed;\n}\n"]}
|
|
@@ -2,11 +2,6 @@ import type { GameStats } from '../doc-schemas/sport-game.js';
|
|
|
2
2
|
import type { LeagueType } from '../types/sports.js';
|
|
3
3
|
import type { StatLineKind } from '../types/stats.js';
|
|
4
4
|
import type { StatLineValues } from './scoring.js';
|
|
5
|
-
/**
|
|
6
|
-
* A completed game as its finalized record holds it: the record's events replayed to lines, and the
|
|
7
|
-
* first page's sport, teams, and participation snapshot. Finalize builds it from the game it is
|
|
8
|
-
* finalizing; every later path builds it from the record, never from the game document (RULE-QS-SPORT-924).
|
|
9
|
-
*/
|
|
10
5
|
export interface FinalizedGame {
|
|
11
6
|
readonly leagueType: LeagueType;
|
|
12
7
|
readonly teamIds: readonly string[];
|
|
@@ -15,79 +10,28 @@ export interface FinalizedGame {
|
|
|
15
10
|
readonly absentRosterPlayerIds: readonly string[];
|
|
16
11
|
readonly nonScoringRosterPlayerIds: readonly string[];
|
|
17
12
|
}
|
|
18
|
-
/**
|
|
19
|
-
* What one completed game adds to each destination, before the caller's sign. Every line carries its
|
|
20
|
-
* derived fields through the sport's `deriveLine`.
|
|
21
|
-
*/
|
|
22
13
|
export interface GameContribution {
|
|
23
|
-
/** Per team id: the team's standings line (`teamSeason`). A team with no opponent has none. */
|
|
24
14
|
readonly teamLines: Readonly<Record<string, StatLineValues>>;
|
|
25
|
-
/** Per roster-entry id: that membership's row (`membershipRow`), credited to the team in its key. */
|
|
26
15
|
readonly membershipRows: Readonly<Record<string, StatLineValues>>;
|
|
27
|
-
/**
|
|
28
|
-
* Per person who is not a ghost: the sum of that person's rows, games played included — what the
|
|
29
|
-
* game adds to `lifetimeStats.{sportKey}` and, where the sport keeps one, the hall of fame
|
|
30
|
-
* (`lifetime`). A person on both teams of the game counts both sides (RULE-QS-SPORT-928 keeps ghosts out).
|
|
31
|
-
*/
|
|
32
16
|
readonly personLines: Readonly<Record<string, StatLineValues>>;
|
|
33
17
|
}
|
|
34
18
|
export declare const EMPTY_GAME_CONTRIBUTION: GameContribution;
|
|
35
|
-
/** One sport's aggregate mapping, declared once by its adapter (RULE-QS-SPORT-927). */
|
|
36
19
|
export interface ContributionSpec {
|
|
37
|
-
/** The counters of a player line that a membership row, a lifetime line, and the hall of fame sum. */
|
|
38
20
|
readonly playerStatKeys: readonly string[];
|
|
39
|
-
/** The player counters summed onto the team's standings line from the lines keyed to that team. */
|
|
40
21
|
readonly teamSeasonPlayerSums: readonly string[];
|
|
41
|
-
/**
|
|
42
|
-
* Whether a present entry whose line holds nothing is credited no game played. Basketball's rule:
|
|
43
|
-
* zero points, rebounds, and assists — zero points alone is not exclusion. Without it only absence
|
|
44
|
-
* withholds a game played.
|
|
45
|
-
*/
|
|
46
22
|
readonly zeroLineIsNonScoring: boolean;
|
|
47
23
|
readonly deriveLine: (kind: StatLineKind, line: StatLineValues) => StatLineValues;
|
|
48
24
|
}
|
|
49
|
-
/** Whether every number a line holds is zero: a derived line that sums to nothing. */
|
|
50
25
|
export declare function isZeroStatLine(line: StatLineValues): boolean;
|
|
51
|
-
/**
|
|
52
|
-
* The games-played decision for every roster entry: the entries credited no game played. An absent
|
|
53
|
-
* entry is never credited; under `zeroLineIsNonScoring` a present entry whose line holds nothing is
|
|
54
|
-
* not either. Stored on the completed game as `nonScoringRosterPlayerIds` and read, never decided
|
|
55
|
-
* again, by every later path (RULE-QS-SPORT-924). Returned in roster order.
|
|
56
|
-
*/
|
|
57
26
|
export declare function decideParticipation(spec: Pick<ContributionSpec, 'playerStatKeys' | 'zeroLineIsNonScoring'>, stats: GameStats, rosterPlayerIds: readonly string[], absentRosterPlayerIds: readonly string[]): string[];
|
|
58
|
-
/** Whether the stored decision credits the entry a game played. */
|
|
59
27
|
export declare function isCreditedGamePlayed(game: Pick<FinalizedGame, 'absentRosterPlayerIds' | 'nonScoringRosterPlayerIds'>, entryId: string): boolean;
|
|
60
|
-
/** `left` with every number of `right` added `sign` times; a field only one holds is kept. */
|
|
61
28
|
export declare function addStatLines(left: StatLineValues, right: StatLineValues, sign?: 1 | -1): Record<string, number>;
|
|
62
|
-
/**
|
|
63
|
-
* The contribution of one completed game under a sport's mapping. Every line derives from the
|
|
64
|
-
* replayed lines and the stored decision only, never from a stored total (RULE-QS-SPORT-922, RULE-QS-SPORT-924):
|
|
65
|
-
*
|
|
66
|
-
* - each team with an opponent: one game, a win, loss, or tie decided from the two replayed scores,
|
|
67
|
-
* its points for and against, and the spec's player counters summed from the lines keyed to it;
|
|
68
|
-
* - each roster entry of such a team — and any line keyed to one, rostered or not, so no recorded
|
|
69
|
-
* stat is lost — its row: games played per the stored decision, and the sport's counters, credited
|
|
70
|
-
* to the team in its key;
|
|
71
|
-
* - each person who is not a ghost: the sum of their rows.
|
|
72
|
-
*
|
|
73
|
-
* A row or person line that sums to nothing is left out.
|
|
74
|
-
*/
|
|
75
29
|
export declare function buildGameContribution(spec: ContributionSpec, game: FinalizedGame): GameContribution;
|
|
76
|
-
/** A contribution and the sign it is applied with: +1 to add a game, −1 to take it back. */
|
|
77
30
|
export interface SignedContribution {
|
|
78
31
|
readonly contribution: GameContribution;
|
|
79
32
|
readonly sign: 1 | -1;
|
|
80
33
|
}
|
|
81
|
-
/**
|
|
82
|
-
* Several signed contributions folded into one, every line through the sport's `deriveLine` and a
|
|
83
|
-
* line that sums to nothing left out — the week view's rows, a rebuild's totals, and a ghost link's
|
|
84
|
-
* reversal of the old entries beside the merged one, all through the same arithmetic.
|
|
85
|
-
*/
|
|
86
34
|
export declare function sumGameContributions(deriveLine: ContributionSpec['deriveLine'], signed: readonly SignedContribution[]): GameContribution;
|
|
87
|
-
/**
|
|
88
|
-
* A stored line moved by a delta: the line after, `null` when it sums to nothing, or the field that
|
|
89
|
-
* would go below zero.
|
|
90
|
-
*/
|
|
91
35
|
export type StatLineChange = {
|
|
92
36
|
readonly ok: true;
|
|
93
37
|
readonly after: StatLineValues | null;
|
|
@@ -96,9 +40,8 @@ export type StatLineChange = {
|
|
|
96
40
|
readonly field: string;
|
|
97
41
|
};
|
|
98
42
|
/**
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* no longer holds what the games put there.
|
|
43
|
+
* A counter that would go below zero is refused, never clamped: it means the stored line no longer
|
|
44
|
+
* holds what the games put there.
|
|
102
45
|
*/
|
|
103
46
|
export declare function applyStatLineDelta(deriveLine: ContributionSpec['deriveLine'], kind: StatLineKind, before: StatLineValues | undefined, delta: StatLineValues, sign: 1 | -1): StatLineChange;
|
|
104
47
|
//# sourceMappingURL=contribution.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contribution.d.ts","sourceRoot":"","sources":["../../src/sports/contribution.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contribution.d.ts","sourceRoot":"","sources":["../../src/sports/contribution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAG9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CA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,2BAA2B,CAAC,EAChF,OAAO,EAAE,MAAM,GACd,OAAO,CAKT;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,cAAc,EACrB,IAAI,GAAE,CAAC,GAAG,CAAC,CAAK,GACf,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CASxB;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,gBAAgB,EACtB,IAAI,EAAE,aAAa,GAClB,gBAAgB,CAgDlB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,YAAY,EAAE,gBAAgB,CAAC;IACxC,QAAQ,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACvB;AAED,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,gBAAgB,CAAC,YAAY,CAAC,EAC1C,MAAM,EAAE,SAAS,kBAAkB,EAAE,GACpC,gBAAgB,CAuBlB;AAED,MAAM,MAAM,cAAc,GACtB;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAA;CAAE,GAC5D;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnD;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,gBAAgB,CAAC,YAAY,CAAC,EAC1C,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,cAAc,GAAG,SAAS,EAClC,KAAK,EAAE,cAAc,EACrB,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,GACX,cAAc,CAOhB"}
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
// The aggregate half of the sport adapter contract: who a completed game credits a game played, and
|
|
2
|
-
// what the game adds to every derived destination (RULE-QS-SPORT-921, RULE-QS-SPORT-924, RULE-QS-SPORT-927). Each sport
|
|
3
|
-
// declares its mapping once, as a `ContributionSpec`; the two members built from it — `participation`
|
|
4
|
-
// and `contribution` — are the only place a game's effect on standings, per-membership rows, lifetime
|
|
5
|
-
// lines, and the hall of fame is decided. Finalize, reopen, a ghost link, every rebuild, validation,
|
|
6
|
-
// and the week view all derive through them, so no two paths can disagree about what a game adds.
|
|
7
|
-
//
|
|
8
|
-
// Everything here is pure: no Firestore operation, no clock, no id minted (RULE-STD-ARCH-202). The aggregate
|
|
9
|
-
// writer in Functions applies a contribution; the browser sums contributions for the week view.
|
|
10
|
-
//
|
|
11
|
-
// A stored derived line that sums to nothing — every counter and games played zero — is the same as
|
|
12
|
-
// no line at all, as an all-zero player line is in a game's rollup: a contribution leaves one out,
|
|
13
|
-
// and applying a contribution removes a line it returns to zero. That is what makes finalize followed
|
|
14
|
-
// by reopen leave every destination exactly as it was.
|
|
15
1
|
import { parseGameRosterPlayerId } from '../ids/compound-ids.js';
|
|
16
2
|
import { isGhostUserId } from '../ids/minted-ids.js';
|
|
17
3
|
import { isAllZeroLine } from './scoring.js';
|
|
@@ -20,21 +6,13 @@ export const EMPTY_GAME_CONTRIBUTION = {
|
|
|
20
6
|
membershipRows: {},
|
|
21
7
|
personLines: {},
|
|
22
8
|
};
|
|
23
|
-
/** The value of a counter on a stored line, absent read as zero. */
|
|
24
9
|
function counter(line, field) {
|
|
25
10
|
const value = line?.[field];
|
|
26
11
|
return typeof value === 'number' ? value : 0;
|
|
27
12
|
}
|
|
28
|
-
/** Whether every number a line holds is zero: a derived line that sums to nothing. */
|
|
29
13
|
export function isZeroStatLine(line) {
|
|
30
14
|
return Object.values(line).every((value) => typeof value !== 'number' || value === 0);
|
|
31
15
|
}
|
|
32
|
-
/**
|
|
33
|
-
* The games-played decision for every roster entry: the entries credited no game played. An absent
|
|
34
|
-
* entry is never credited; under `zeroLineIsNonScoring` a present entry whose line holds nothing is
|
|
35
|
-
* not either. Stored on the completed game as `nonScoringRosterPlayerIds` and read, never decided
|
|
36
|
-
* again, by every later path (RULE-QS-SPORT-924). Returned in roster order.
|
|
37
|
-
*/
|
|
38
16
|
export function decideParticipation(spec, stats, rosterPlayerIds, absentRosterPlayerIds) {
|
|
39
17
|
if (!spec.zeroLineIsNonScoring)
|
|
40
18
|
return [];
|
|
@@ -47,12 +25,10 @@ export function decideParticipation(spec, stats, rosterPlayerIds, absentRosterPl
|
|
|
47
25
|
return line === undefined || isAllZeroLine(line, spec.playerStatKeys);
|
|
48
26
|
});
|
|
49
27
|
}
|
|
50
|
-
/** Whether the stored decision credits the entry a game played. */
|
|
51
28
|
export function isCreditedGamePlayed(game, entryId) {
|
|
52
29
|
return (!game.absentRosterPlayerIds.includes(entryId) &&
|
|
53
30
|
!game.nonScoringRosterPlayerIds.includes(entryId));
|
|
54
31
|
}
|
|
55
|
-
/** `left` with every number of `right` added `sign` times; a field only one holds is kept. */
|
|
56
32
|
export function addStatLines(left, right, sign = 1) {
|
|
57
33
|
const sum = {};
|
|
58
34
|
for (const field of new Set([...Object.keys(left), ...Object.keys(right)])) {
|
|
@@ -63,19 +39,6 @@ export function addStatLines(left, right, sign = 1) {
|
|
|
63
39
|
}
|
|
64
40
|
return sum;
|
|
65
41
|
}
|
|
66
|
-
/**
|
|
67
|
-
* The contribution of one completed game under a sport's mapping. Every line derives from the
|
|
68
|
-
* replayed lines and the stored decision only, never from a stored total (RULE-QS-SPORT-922, RULE-QS-SPORT-924):
|
|
69
|
-
*
|
|
70
|
-
* - each team with an opponent: one game, a win, loss, or tie decided from the two replayed scores,
|
|
71
|
-
* its points for and against, and the spec's player counters summed from the lines keyed to it;
|
|
72
|
-
* - each roster entry of such a team — and any line keyed to one, rostered or not, so no recorded
|
|
73
|
-
* stat is lost — its row: games played per the stored decision, and the sport's counters, credited
|
|
74
|
-
* to the team in its key;
|
|
75
|
-
* - each person who is not a ghost: the sum of their rows.
|
|
76
|
-
*
|
|
77
|
-
* A row or person line that sums to nothing is left out.
|
|
78
|
-
*/
|
|
79
42
|
export function buildGameContribution(spec, game) {
|
|
80
43
|
const teamStats = game.stats.teamStats;
|
|
81
44
|
const playerStats = game.stats.playerStats;
|
|
@@ -127,11 +90,6 @@ export function buildGameContribution(spec, game) {
|
|
|
127
90
|
personLines[userId] = spec.deriveLine('lifetime', line);
|
|
128
91
|
return { teamLines, membershipRows, personLines };
|
|
129
92
|
}
|
|
130
|
-
/**
|
|
131
|
-
* Several signed contributions folded into one, every line through the sport's `deriveLine` and a
|
|
132
|
-
* line that sums to nothing left out — the week view's rows, a rebuild's totals, and a ghost link's
|
|
133
|
-
* reversal of the old entries beside the merged one, all through the same arithmetic.
|
|
134
|
-
*/
|
|
135
93
|
export function sumGameContributions(deriveLine, signed) {
|
|
136
94
|
const fold = (pick, kind) => {
|
|
137
95
|
const totals = new Map();
|
|
@@ -155,9 +113,8 @@ export function sumGameContributions(deriveLine, signed) {
|
|
|
155
113
|
};
|
|
156
114
|
}
|
|
157
115
|
/**
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
* no longer holds what the games put there.
|
|
116
|
+
* A counter that would go below zero is refused, never clamped: it means the stored line no longer
|
|
117
|
+
* holds what the games put there.
|
|
161
118
|
*/
|
|
162
119
|
export function applyStatLineDelta(deriveLine, kind, before, delta, sign) {
|
|
163
120
|
// A derived field is recomputed from the moved counters, never moved itself, so a stale stored FP
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contribution.js","sourceRoot":"","sources":["../../src/sports/contribution.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,wHAAwH;AACxH,sGAAsG;AACtG,sGAAsG;AACtG,qGAAqG;AACrG,kGAAkG;AAClG,EAAE;AACF,6GAA6G;AAC7G,gGAAgG;AAChG,EAAE;AACF,oGAAoG;AACpG,mGAAmG;AACnG,sGAAsG;AACtG,uDAAuD;AAGvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD,OAAO,EAAE,aAAa,EAAE,MAAM,cA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AE,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,YAAY,CAAC;QACvE,cAAc,EAAE,IAAI,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,CAAC,cAAc,EAAE,eAAe,CAAC;QACpF,WAAW,EAAE,IAAI,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,UAAU,CAAC;KAC1E,CAAC;AACJ,CAAC;AAUD;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAChC,UAA0C,EAC1C,IAAkB,EAClB,MAAkC,EAClC,KAAqB,EACrB,IAAY;IAEZ,kGAAkG;IAClG,yCAAyC;IACzC,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,EAAE,YAAY,CAAC,MAAM,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IACxE,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC;IAChG,IAAI,KAAK;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IACjD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;AACnE,CAAC","sourcesContent":["// The aggregate half of the sport adapter contract: who a completed game credits a game played, and\n// what the game adds to every derived destination (RULE-QS-SPORT-921, RULE-QS-SPORT-924, RULE-QS-SPORT-927). Each sport\n// declares its mapping once, as a `ContributionSpec`; the two members built from it — `participation`\n// and `contribution` — are the only place a game's effect on standings, per-membership rows, lifetime\n// lines, and the hall of fame is decided. Finalize, reopen, a ghost link, every rebuild, validation,\n// and the week view all derive through them, so no two paths can disagree about what a game adds.\n//\n// Everything here is pure: no Firestore operation, no clock, no id minted (RULE-STD-ARCH-202). The aggregate\n// writer in Functions applies a contribution; the browser sums contributions for the week view.\n//\n// A stored derived line that sums to nothing — every counter and games played zero — is the same as\n// no line at all, as an all-zero player line is in a game's rollup: a contribution leaves one out,\n// and applying a contribution removes a line it returns to zero. That is what makes finalize followed\n// by reopen leave every destination exactly as it was.\n\nimport type { GameStats } from '../doc-schemas/sport-game.js';\nimport { parseGameRosterPlayerId } from '../ids/compound-ids.js';\nimport { isGhostUserId } from '../ids/minted-ids.js';\nimport type { LeagueType } from '../types/sports.js';\nimport type { StatLineKind } from '../types/stats.js';\nimport { isAllZeroLine } from './scoring.js';\nimport type { StatLineValues } from './scoring.js';\n\n/**\n * A completed game as its finalized record holds it: the record's events replayed to lines, and the\n * first page's sport, teams, and participation snapshot. Finalize builds it from the game it is\n * finalizing; every later path builds it from the record, never from the game document (RULE-QS-SPORT-924).\n */\nexport interface FinalizedGame {\n readonly leagueType: LeagueType;\n readonly teamIds: readonly string[];\n readonly stats: GameStats;\n readonly rosterPlayerIds: readonly string[];\n readonly absentRosterPlayerIds: readonly string[];\n readonly nonScoringRosterPlayerIds: readonly string[];\n}\n\n/**\n * What one completed game adds to each destination, before the caller's sign. Every line carries its\n * derived fields through the sport's `deriveLine`.\n */\nexport interface GameContribution {\n /** Per team id: the team's standings line (`teamSeason`). A team with no opponent has none. */\n readonly teamLines: Readonly<Record<string, StatLineValues>>;\n /** Per roster-entry id: that membership's row (`membershipRow`), credited to the team in its key. */\n readonly membershipRows: Readonly<Record<string, StatLineValues>>;\n /**\n * Per person who is not a ghost: the sum of that person's rows, games played included — what the\n * game adds to `lifetimeStats.{sportKey}` and, where the sport keeps one, the hall of fame\n * (`lifetime`). A person on both teams of the game counts both sides (RULE-QS-SPORT-928 keeps ghosts out).\n */\n readonly personLines: Readonly<Record<string, StatLineValues>>;\n}\n\nexport const EMPTY_GAME_CONTRIBUTION: GameContribution = {\n teamLines: {},\n membershipRows: {},\n personLines: {},\n};\n\n/** One sport's aggregate mapping, declared once by its adapter (RULE-QS-SPORT-927). */\nexport interface ContributionSpec {\n /** The counters of a player line that a membership row, a lifetime line, and the hall of fame sum. */\n readonly playerStatKeys: readonly string[];\n /** The player counters summed onto the team's standings line from the lines keyed to that team. */\n readonly teamSeasonPlayerSums: readonly string[];\n /**\n * Whether a present entry whose line holds nothing is credited no game played. Basketball's rule:\n * zero points, rebounds, and assists — zero points alone is not exclusion. Without it only absence\n * withholds a game played.\n */\n readonly zeroLineIsNonScoring: boolean;\n readonly deriveLine: (kind: StatLineKind, line: StatLineValues) => StatLineValues;\n}\n\n/** The value of a counter on a stored line, absent read as zero. */\nfunction counter(line: StatLineValues | undefined, field: string): number {\n const value = line?.[field];\n return typeof value === 'number' ? value : 0;\n}\n\n/** Whether every number a line holds is zero: a derived line that sums to nothing. */\nexport function isZeroStatLine(line: StatLineValues): boolean {\n return Object.values(line).every((value) => typeof value !== 'number' || value === 0);\n}\n\n/**\n * The games-played decision for every roster entry: the entries credited no game played. An absent\n * entry is never credited; under `zeroLineIsNonScoring` a present entry whose line holds nothing is\n * not either. Stored on the completed game as `nonScoringRosterPlayerIds` and read, never decided\n * again, by every later path (RULE-QS-SPORT-924). Returned in roster order.\n */\nexport function decideParticipation(\n spec: Pick<ContributionSpec, 'playerStatKeys' | 'zeroLineIsNonScoring'>,\n stats: GameStats,\n rosterPlayerIds: readonly string[],\n absentRosterPlayerIds: readonly string[],\n): string[] {\n if (!spec.zeroLineIsNonScoring) return [];\n const absent = new Set(absentRosterPlayerIds);\n const playerStats = stats.playerStats as Readonly<Record<string, StatLineValues>>;\n return rosterPlayerIds.filter((entryId) => {\n if (absent.has(entryId)) return true;\n const line = playerStats[entryId];\n return line === undefined || isAllZeroLine(line, spec.playerStatKeys);\n });\n}\n\n/** Whether the stored decision credits the entry a game played. */\nexport function isCreditedGamePlayed(\n game: Pick<FinalizedGame, 'absentRosterPlayerIds' | 'nonScoringRosterPlayerIds'>,\n entryId: string,\n): boolean {\n return (\n !game.absentRosterPlayerIds.includes(entryId) &&\n !game.nonScoringRosterPlayerIds.includes(entryId)\n );\n}\n\n/** `left` with every number of `right` added `sign` times; a field only one holds is kept. */\nexport function addStatLines(\n left: StatLineValues,\n right: StatLineValues,\n sign: 1 | -1 = 1,\n): Record<string, number> {\n const sum: Record<string, number> = {};\n for (const field of new Set([...Object.keys(left), ...Object.keys(right)])) {\n const [a, b] = [left[field], right[field]];\n if ((a !== undefined && typeof a !== 'number') || (b !== undefined && typeof b !== 'number'))\n continue;\n sum[field] = (a ?? 0) + sign * (b ?? 0);\n }\n return sum;\n}\n\n/**\n * The contribution of one completed game under a sport's mapping. Every line derives from the\n * replayed lines and the stored decision only, never from a stored total (RULE-QS-SPORT-922, RULE-QS-SPORT-924):\n *\n * - each team with an opponent: one game, a win, loss, or tie decided from the two replayed scores,\n * its points for and against, and the spec's player counters summed from the lines keyed to it;\n * - each roster entry of such a team — and any line keyed to one, rostered or not, so no recorded\n * stat is lost — its row: games played per the stored decision, and the sport's counters, credited\n * to the team in its key;\n * - each person who is not a ghost: the sum of their rows.\n *\n * A row or person line that sums to nothing is left out.\n */\nexport function buildGameContribution(\n spec: ContributionSpec,\n game: FinalizedGame,\n): GameContribution {\n const teamStats = game.stats.teamStats as Readonly<Record<string, StatLineValues>>;\n const playerStats = game.stats.playerStats as Readonly<Record<string, StatLineValues>>;\n const opponentOf = (teamId: string): string | undefined =>\n game.teamIds.find((other) => other !== teamId);\n const counted = new Set(game.teamIds.filter((teamId) => opponentOf(teamId) !== undefined));\n\n const teamLines: Record<string, StatLineValues> = {};\n for (const teamId of counted) {\n const scored = counter(teamStats[teamId], 'score');\n const allowed = counter(teamStats[opponentOf(teamId) as string], 'score');\n const line: Record<string, number> = {\n gamesPlayed: 1,\n wins: scored > allowed ? 1 : 0,\n losses: scored < allowed ? 1 : 0,\n ties: scored === allowed ? 1 : 0,\n pointsFor: scored,\n pointsAgainst: allowed,\n };\n for (const field of spec.teamSeasonPlayerSums) line[field] = 0;\n for (const [entryId, playerLine] of Object.entries(playerStats)) {\n if (parseGameRosterPlayerId(entryId)?.teamId !== teamId) continue;\n for (const field of spec.teamSeasonPlayerSums)\n line[field] = (line[field] ?? 0) + counter(playerLine, field);\n }\n teamLines[teamId] = spec.deriveLine('teamSeason', line);\n }\n\n const membershipRows: Record<string, StatLineValues> = {};\n const personTotals = new Map<string, Record<string, number>>();\n const entryIds = [...new Set([...game.rosterPlayerIds, ...Object.keys(playerStats)])].sort();\n for (const entryId of entryIds) {\n const entry = parseGameRosterPlayerId(entryId);\n if (entry === null || !counted.has(entry.teamId)) continue;\n const row: Record<string, number> = {\n gamesPlayed: isCreditedGamePlayed(game, entryId) ? 1 : 0,\n };\n for (const field of spec.playerStatKeys) row[field] = counter(playerStats[entryId], field);\n if (isZeroStatLine(row)) continue;\n membershipRows[entryId] = spec.deriveLine('membershipRow', row);\n if (isGhostUserId(entry.userId)) continue;\n personTotals.set(entry.userId, addStatLines(personTotals.get(entry.userId) ?? {}, row));\n }\n\n const personLines: Record<string, StatLineValues> = {};\n for (const [userId, line] of personTotals)\n personLines[userId] = spec.deriveLine('lifetime', line);\n return { teamLines, membershipRows, personLines };\n}\n\n/** A contribution and the sign it is applied with: +1 to add a game, −1 to take it back. */\nexport interface SignedContribution {\n readonly contribution: GameContribution;\n readonly sign: 1 | -1;\n}\n\n/**\n * Several signed contributions folded into one, every line through the sport's `deriveLine` and a\n * line that sums to nothing left out — the week view's rows, a rebuild's totals, and a ghost link's\n * reversal of the old entries beside the merged one, all through the same arithmetic.\n */\nexport function sumGameContributions(\n deriveLine: ContributionSpec['deriveLine'],\n signed: readonly SignedContribution[],\n): GameContribution {\n const fold = (\n pick: (contribution: GameContribution) => Readonly<Record<string, StatLineValues>>,\n kind: StatLineKind,\n ) => {\n const totals = new Map<string, Record<string, number>>();\n for (const { contribution, sign } of signed) {\n for (const [key, line] of Object.entries(pick(contribution))) {\n totals.set(key, addStatLines(totals.get(key) ?? {}, line, sign));\n }\n }\n const lines: Record<string, StatLineValues> = {};\n for (const [key, line] of totals) {\n const derived = deriveLine(kind, line);\n if (!isZeroStatLine(derived)) lines[key] = derived;\n }\n return lines;\n };\n return {\n teamLines: fold((contribution) => contribution.teamLines, 'teamSeason'),\n membershipRows: fold((contribution) => contribution.membershipRows, 'membershipRow'),\n personLines: fold((contribution) => contribution.personLines, 'lifetime'),\n };\n}\n\n/**\n * A stored line moved by a delta: the line after, `null` when it sums to nothing, or the field that\n * would go below zero.\n */\nexport type StatLineChange =\n | { readonly ok: true; readonly after: StatLineValues | null }\n | { readonly ok: false; readonly field: string };\n\n/**\n * `before` (absent read as no line) moved by `delta` times `sign`, through the sport's `deriveLine`\n * for `kind`. A counter that would go below zero is refused, never clamped: it means the stored line\n * no longer holds what the games put there.\n */\nexport function applyStatLineDelta(\n deriveLine: ContributionSpec['deriveLine'],\n kind: StatLineKind,\n before: StatLineValues | undefined,\n delta: StatLineValues,\n sign: 1 | -1,\n): StatLineChange {\n // A derived field is recomputed from the moved counters, never moved itself, so a stale stored FP\n // can neither go below zero nor survive.\n const after = deriveLine(kind, addStatLines(before ?? {}, delta, sign));\n const below = Object.entries(after).find(([, value]) => typeof value === 'number' && value < 0);\n if (below) return { ok: false, field: below[0] };\n return { ok: true, after: isZeroStatLine(after) ? null : after };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"contribution.js","sourceRoot":"","sources":["../../src/sports/contribution.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAkB7C,MAAM,CAAC,MAAM,uBAAuB,GAAqB;IACvD,SAAS,EAAE,EAAE;IACb,cAAc,EAAE,EAAE;IAClB,WAAW,EAAE,EAAE;CAChB,CAAC;AASF,SAAS,OAAO,CAA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AMD;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAChC,UAA0C,EAC1C,IAAkB,EAClB,MAAkC,EAClC,KAAqB,EACrB,IAAY;IAEZ,kGAAkG;IAClG,yCAAyC;IACzC,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,EAAE,YAAY,CAAC,MAAM,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IACxE,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC;IAChG,IAAI,KAAK;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IACjD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;AACnE,CAAC","sourcesContent":["import type { GameStats } from '../doc-schemas/sport-game.js';\nimport { parseGameRosterPlayerId } from '../ids/compound-ids.js';\nimport { isGhostUserId } from '../ids/minted-ids.js';\nimport type { LeagueType } from '../types/sports.js';\nimport type { StatLineKind } from '../types/stats.js';\nimport { isAllZeroLine } from './scoring.js';\nimport type { StatLineValues } from './scoring.js';\n\nexport interface FinalizedGame {\n readonly leagueType: LeagueType;\n readonly teamIds: readonly string[];\n readonly stats: GameStats;\n readonly rosterPlayerIds: readonly string[];\n readonly absentRosterPlayerIds: readonly string[];\n readonly nonScoringRosterPlayerIds: readonly string[];\n}\n\nexport interface GameContribution {\n readonly teamLines: Readonly<Record<string, StatLineValues>>;\n readonly membershipRows: Readonly<Record<string, StatLineValues>>;\n readonly personLines: Readonly<Record<string, StatLineValues>>;\n}\n\nexport const EMPTY_GAME_CONTRIBUTION: GameContribution = {\n teamLines: {},\n membershipRows: {},\n personLines: {},\n};\n\nexport interface ContributionSpec {\n readonly playerStatKeys: readonly string[];\n readonly teamSeasonPlayerSums: readonly string[];\n readonly zeroLineIsNonScoring: boolean;\n readonly deriveLine: (kind: StatLineKind, line: StatLineValues) => StatLineValues;\n}\n\nfunction counter(line: StatLineValues | undefined, field: string): number {\n const value = line?.[field];\n return typeof value === 'number' ? value : 0;\n}\n\nexport function isZeroStatLine(line: StatLineValues): boolean {\n return Object.values(line).every((value) => typeof value !== 'number' || value === 0);\n}\n\nexport function decideParticipation(\n spec: Pick<ContributionSpec, 'playerStatKeys' | 'zeroLineIsNonScoring'>,\n stats: GameStats,\n rosterPlayerIds: readonly string[],\n absentRosterPlayerIds: readonly string[],\n): string[] {\n if (!spec.zeroLineIsNonScoring) return [];\n const absent = new Set(absentRosterPlayerIds);\n const playerStats = stats.playerStats as Readonly<Record<string, StatLineValues>>;\n return rosterPlayerIds.filter((entryId) => {\n if (absent.has(entryId)) return true;\n const line = playerStats[entryId];\n return line === undefined || isAllZeroLine(line, spec.playerStatKeys);\n });\n}\n\nexport function isCreditedGamePlayed(\n game: Pick<FinalizedGame, 'absentRosterPlayerIds' | 'nonScoringRosterPlayerIds'>,\n entryId: string,\n): boolean {\n return (\n !game.absentRosterPlayerIds.includes(entryId) &&\n !game.nonScoringRosterPlayerIds.includes(entryId)\n );\n}\n\nexport function addStatLines(\n left: StatLineValues,\n right: StatLineValues,\n sign: 1 | -1 = 1,\n): Record<string, number> {\n const sum: Record<string, number> = {};\n for (const field of new Set([...Object.keys(left), ...Object.keys(right)])) {\n const [a, b] = [left[field], right[field]];\n if ((a !== undefined && typeof a !== 'number') || (b !== undefined && typeof b !== 'number'))\n continue;\n sum[field] = (a ?? 0) + sign * (b ?? 0);\n }\n return sum;\n}\n\nexport function buildGameContribution(\n spec: ContributionSpec,\n game: FinalizedGame,\n): GameContribution {\n const teamStats = game.stats.teamStats as Readonly<Record<string, StatLineValues>>;\n const playerStats = game.stats.playerStats as Readonly<Record<string, StatLineValues>>;\n const opponentOf = (teamId: string): string | undefined =>\n game.teamIds.find((other) => other !== teamId);\n const counted = new Set(game.teamIds.filter((teamId) => opponentOf(teamId) !== undefined));\n\n const teamLines: Record<string, StatLineValues> = {};\n for (const teamId of counted) {\n const scored = counter(teamStats[teamId], 'score');\n const allowed = counter(teamStats[opponentOf(teamId) as string], 'score');\n const line: Record<string, number> = {\n gamesPlayed: 1,\n wins: scored > allowed ? 1 : 0,\n losses: scored < allowed ? 1 : 0,\n ties: scored === allowed ? 1 : 0,\n pointsFor: scored,\n pointsAgainst: allowed,\n };\n for (const field of spec.teamSeasonPlayerSums) line[field] = 0;\n for (const [entryId, playerLine] of Object.entries(playerStats)) {\n if (parseGameRosterPlayerId(entryId)?.teamId !== teamId) continue;\n for (const field of spec.teamSeasonPlayerSums)\n line[field] = (line[field] ?? 0) + counter(playerLine, field);\n }\n teamLines[teamId] = spec.deriveLine('teamSeason', line);\n }\n\n const membershipRows: Record<string, StatLineValues> = {};\n const personTotals = new Map<string, Record<string, number>>();\n const entryIds = [...new Set([...game.rosterPlayerIds, ...Object.keys(playerStats)])].sort();\n for (const entryId of entryIds) {\n const entry = parseGameRosterPlayerId(entryId);\n if (entry === null || !counted.has(entry.teamId)) continue;\n const row: Record<string, number> = {\n gamesPlayed: isCreditedGamePlayed(game, entryId) ? 1 : 0,\n };\n for (const field of spec.playerStatKeys) row[field] = counter(playerStats[entryId], field);\n if (isZeroStatLine(row)) continue;\n membershipRows[entryId] = spec.deriveLine('membershipRow', row);\n if (isGhostUserId(entry.userId)) continue;\n personTotals.set(entry.userId, addStatLines(personTotals.get(entry.userId) ?? {}, row));\n }\n\n const personLines: Record<string, StatLineValues> = {};\n for (const [userId, line] of personTotals)\n personLines[userId] = spec.deriveLine('lifetime', line);\n return { teamLines, membershipRows, personLines };\n}\n\nexport interface SignedContribution {\n readonly contribution: GameContribution;\n readonly sign: 1 | -1;\n}\n\nexport function sumGameContributions(\n deriveLine: ContributionSpec['deriveLine'],\n signed: readonly SignedContribution[],\n): GameContribution {\n const fold = (\n pick: (contribution: GameContribution) => Readonly<Record<string, StatLineValues>>,\n kind: StatLineKind,\n ) => {\n const totals = new Map<string, Record<string, number>>();\n for (const { contribution, sign } of signed) {\n for (const [key, line] of Object.entries(pick(contribution))) {\n totals.set(key, addStatLines(totals.get(key) ?? {}, line, sign));\n }\n }\n const lines: Record<string, StatLineValues> = {};\n for (const [key, line] of totals) {\n const derived = deriveLine(kind, line);\n if (!isZeroStatLine(derived)) lines[key] = derived;\n }\n return lines;\n };\n return {\n teamLines: fold((contribution) => contribution.teamLines, 'teamSeason'),\n membershipRows: fold((contribution) => contribution.membershipRows, 'membershipRow'),\n personLines: fold((contribution) => contribution.personLines, 'lifetime'),\n };\n}\n\nexport type StatLineChange =\n | { readonly ok: true; readonly after: StatLineValues | null }\n | { readonly ok: false; readonly field: string };\n\n/**\n * A counter that would go below zero is refused, never clamped: it means the stored line no longer\n * holds what the games put there.\n */\nexport function applyStatLineDelta(\n deriveLine: ContributionSpec['deriveLine'],\n kind: StatLineKind,\n before: StatLineValues | undefined,\n delta: StatLineValues,\n sign: 1 | -1,\n): StatLineChange {\n // A derived field is recomputed from the moved counters, never moved itself, so a stale stored FP\n // can neither go below zero nor survive.\n const after = deriveLine(kind, addStatLines(before ?? {}, delta, sign));\n const below = Object.entries(after).find(([, value]) => typeof value === 'number' && value < 0);\n if (below) return { ok: false, field: below[0] };\n return { ok: true, after: isZeroStatLine(after) ? null : after };\n}\n"]}
|
|
@@ -2,7 +2,6 @@ import type { CurlingTeamStats, GameStatEvent } from '../doc-schemas/game-stats.
|
|
|
2
2
|
import { type RoundsBulkEntry } from './bulk-entry.js';
|
|
3
3
|
import { type SportScoring } from './scoring.js';
|
|
4
4
|
import { type RoundsDisplay, type RoundsScoringPanel, type Scoreboard, type StatEventNameResolver } from './scoring-display.js';
|
|
5
|
-
/** Every round unrecorded — `null`, where a blank round is `0`. */
|
|
6
5
|
export declare function emptyCurlingTeamLine(): CurlingTeamStats;
|
|
7
6
|
export declare const CURLING_SCORING: SportScoring;
|
|
8
7
|
export declare const CURLING_ROUNDS: RoundsDisplay;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"curling-scoring.d.ts","sourceRoot":"","sources":["../../src/sports/curling-scoring.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"curling-scoring.d.ts","sourceRoot":"","sources":["../../src/sports/curling-scoring.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AASpF,OAAO,EAIL,KAAK,eAAe,EAGrB,MAAM,iBAAiB,CAAC;AAMzB,OAAO,EASL,KAAK,YAAY,EAGlB,MAAM,cAAc,CAAC;AACtB,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,UAAU,EAEf,KAAK,qBAAqB,EAE3B,MAAM,sBAAsB,CAAC;AAsB9B,wBAAgB,oBAAoB,IAAI,gBAAgB,CAGvD;AAkED,eAAO,MAAM,eAAe,EAAE,YAoB7B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,aAA8D,CAAC;AAE5F,eAAO,MAAM,oBAAoB;;;;;;;;;CAGgC,CAAC;AAElE,eAAO,MAAM,oBAAoB;;;;;CAG8B,CAAC;AAEhE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,qBAAqB,GAAG,MAAM,CAQjG;AAED,eAAO,MAAM,kBAAkB,EAAE,UAIhC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,kBAKnC,CAAC;AAEF,eAAO,MAAM,4BAA4B,oCAA8D,CAAC;AACxG,eAAO,MAAM,gCAAgC,mGACqD,CAAC;AACnG,eAAO,MAAM,gCAAgC,qEACuB,CAAC;AA4ErE,eAAO,MAAM,kBAAkB,EAAE,eA0ChC,CAAC"}
|