@ttt-productions/q-core 0.1.20 → 0.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/dist/constants/business.js +2 -2
  2. package/dist/constants/business.js.map +1 -1
  3. package/dist/constants/media.js +1 -1
  4. package/dist/constants/media.js.map +1 -1
  5. package/dist/constants/sports.js +1 -1
  6. package/dist/constants/sports.js.map +1 -1
  7. package/dist/constants/telemetry.js +3 -3
  8. package/dist/constants/telemetry.js.map +1 -1
  9. package/dist/doc-schemas/admin-notifications.js +3 -3
  10. package/dist/doc-schemas/admin-notifications.js.map +1 -1
  11. package/dist/doc-schemas/aggregate-stats.js +3 -3
  12. package/dist/doc-schemas/aggregate-stats.js.map +1 -1
  13. package/dist/doc-schemas/atoms.d.ts +1 -1
  14. package/dist/doc-schemas/atoms.js +3 -3
  15. package/dist/doc-schemas/atoms.js.map +1 -1
  16. package/dist/doc-schemas/audit-event.js +2 -2
  17. package/dist/doc-schemas/audit-event.js.map +1 -1
  18. package/dist/doc-schemas/firestore-primitives.js +1 -1
  19. package/dist/doc-schemas/firestore-primitives.js.map +1 -1
  20. package/dist/doc-schemas/game-location.js +2 -2
  21. package/dist/doc-schemas/game-location.js.map +1 -1
  22. package/dist/doc-schemas/game-stat-history.js +1 -1
  23. package/dist/doc-schemas/game-stat-history.js.map +1 -1
  24. package/dist/doc-schemas/game-stats.js +6 -6
  25. package/dist/doc-schemas/game-stats.js.map +1 -1
  26. package/dist/doc-schemas/league-team.js +4 -4
  27. package/dist/doc-schemas/league-team.js.map +1 -1
  28. package/dist/doc-schemas/membership-roster-sync.js +2 -2
  29. package/dist/doc-schemas/membership-roster-sync.js.map +1 -1
  30. package/dist/doc-schemas/pending-media.d.ts +6 -6
  31. package/dist/doc-schemas/publicUser.js +1 -1
  32. package/dist/doc-schemas/publicUser.js.map +1 -1
  33. package/dist/doc-schemas/registration-start.js +1 -1
  34. package/dist/doc-schemas/registration-start.js.map +1 -1
  35. package/dist/doc-schemas/registry.d.ts +3 -3
  36. package/dist/doc-schemas/sport-game.js +4 -4
  37. package/dist/doc-schemas/sport-game.js.map +1 -1
  38. package/dist/doc-schemas/sport-league.js +1 -1
  39. package/dist/doc-schemas/sport-league.js.map +1 -1
  40. package/dist/doc-schemas/stats-operation.js +2 -2
  41. package/dist/doc-schemas/stats-operation.js.map +1 -1
  42. package/dist/doc-schemas/status-reconcile-queue.js +1 -1
  43. package/dist/doc-schemas/status-reconcile-queue.js.map +1 -1
  44. package/dist/doc-schemas/sweep-state.js +2 -2
  45. package/dist/doc-schemas/sweep-state.js.map +1 -1
  46. package/dist/doc-schemas/team-membership.js +1 -1
  47. package/dist/doc-schemas/team-membership.js.map +1 -1
  48. package/dist/doc-schemas/user-profile.js +1 -1
  49. package/dist/doc-schemas/user-profile.js.map +1 -1
  50. package/dist/doc-schemas/waiver-template.js +1 -1
  51. package/dist/doc-schemas/waiver-template.js.map +1 -1
  52. package/dist/doc-schemas/waivers-and-hardware.js +3 -3
  53. package/dist/doc-schemas/waivers-and-hardware.js.map +1 -1
  54. package/dist/domain-events/domain-events.js +2 -2
  55. package/dist/domain-events/domain-events.js.map +1 -1
  56. package/dist/ids/award-grant-ids.js +1 -1
  57. package/dist/ids/award-grant-ids.js.map +1 -1
  58. package/dist/ids/compound-ids.js +1 -1
  59. package/dist/ids/compound-ids.js.map +1 -1
  60. package/dist/ids/minted-ids.js +1 -1
  61. package/dist/ids/minted-ids.js.map +1 -1
  62. package/dist/ids/notification-ids.js +1 -1
  63. package/dist/ids/notification-ids.js.map +1 -1
  64. package/dist/ids/stat-event-ids.d.ts +1 -1
  65. package/dist/ids/stat-event-ids.js +2 -2
  66. package/dist/ids/stat-event-ids.js.map +1 -1
  67. package/dist/ids/stats-operation-ids.js +1 -1
  68. package/dist/ids/stats-operation-ids.js.map +1 -1
  69. package/dist/index.js +1 -1
  70. package/dist/index.js.map +1 -1
  71. package/dist/input-formats/input-formats.js +1 -1
  72. package/dist/input-formats/input-formats.js.map +1 -1
  73. package/dist/media/file-origins.js +1 -1
  74. package/dist/media/file-origins.js.map +1 -1
  75. package/dist/media/picture-url.js +1 -1
  76. package/dist/media/picture-url.js.map +1 -1
  77. package/dist/migration-console/action-ids.js +1 -1
  78. package/dist/migration-console/action-ids.js.map +1 -1
  79. package/dist/migration-console/manifest.js +1 -1
  80. package/dist/migration-console/manifest.js.map +1 -1
  81. package/dist/notifications/admin-notification-config.js +1 -1
  82. package/dist/notifications/admin-notification-config.js.map +1 -1
  83. package/dist/notifications/occurrences.js +1 -1
  84. package/dist/notifications/occurrences.js.map +1 -1
  85. package/dist/paths/collections.js +3 -3
  86. package/dist/paths/collections.js.map +1 -1
  87. package/dist/paths/picture-owner-paths.js +1 -1
  88. package/dist/paths/picture-owner-paths.js.map +1 -1
  89. package/dist/paths/storage-paths.d.ts +1 -1
  90. package/dist/paths/storage-paths.js +1 -1
  91. package/dist/paths/storage-paths.js.map +1 -1
  92. package/dist/paths/utils.d.ts +1 -1
  93. package/dist/paths/utils.js +1 -1
  94. package/dist/paths/utils.js.map +1 -1
  95. package/dist/schemas/admin-notifications.js +1 -1
  96. package/dist/schemas/admin-notifications.js.map +1 -1
  97. package/dist/schemas/app-config.js +1 -1
  98. package/dist/schemas/app-config.js.map +1 -1
  99. package/dist/schemas/awards.js +1 -1
  100. package/dist/schemas/awards.js.map +1 -1
  101. package/dist/schemas/dead-letters.js +2 -2
  102. package/dist/schemas/dead-letters.js.map +1 -1
  103. package/dist/schemas/leagues.js +1 -1
  104. package/dist/schemas/leagues.js.map +1 -1
  105. package/dist/schemas/migration-console.js +1 -1
  106. package/dist/schemas/migration-console.js.map +1 -1
  107. package/dist/schemas/pictures.js +1 -1
  108. package/dist/schemas/pictures.js.map +1 -1
  109. package/dist/schemas/schedules.js +2 -2
  110. package/dist/schemas/schedules.js.map +1 -1
  111. package/dist/schemas/scoring.js +1 -1
  112. package/dist/schemas/scoring.js.map +1 -1
  113. package/dist/schemas/signed-waivers.js +1 -1
  114. package/dist/schemas/signed-waivers.js.map +1 -1
  115. package/dist/schemas/stats.js +6 -6
  116. package/dist/schemas/stats.js.map +1 -1
  117. package/dist/schemas/team-joining.js +3 -3
  118. package/dist/schemas/team-joining.js.map +1 -1
  119. package/dist/schemas/teams.js +7 -7
  120. package/dist/schemas/teams.js.map +1 -1
  121. package/dist/schemas/users.js +3 -3
  122. package/dist/schemas/users.js.map +1 -1
  123. package/dist/sports/basketball-scoring.js +4 -4
  124. package/dist/sports/basketball-scoring.js.map +1 -1
  125. package/dist/sports/bulk-entry.js +1 -1
  126. package/dist/sports/bulk-entry.js.map +1 -1
  127. package/dist/sports/contribution.d.ts +5 -5
  128. package/dist/sports/contribution.d.ts.map +1 -1
  129. package/dist/sports/contribution.js +4 -4
  130. package/dist/sports/contribution.js.map +1 -1
  131. package/dist/sports/curling-scoring.js +2 -2
  132. package/dist/sports/curling-scoring.js.map +1 -1
  133. package/dist/sports/football-scoring.js +2 -2
  134. package/dist/sports/football-scoring.js.map +1 -1
  135. package/dist/sports/index.js +1 -1
  136. package/dist/sports/index.js.map +1 -1
  137. package/dist/sports/ledger-continuity.js +1 -1
  138. package/dist/sports/ledger-continuity.js.map +1 -1
  139. package/dist/sports/registry.js +2 -2
  140. package/dist/sports/registry.js.map +1 -1
  141. package/dist/sports/replay.js +1 -1
  142. package/dist/sports/replay.js.map +1 -1
  143. package/dist/sports/rollup-check.js +1 -1
  144. package/dist/sports/rollup-check.js.map +1 -1
  145. package/dist/sports/score-mirror.js +1 -1
  146. package/dist/sports/score-mirror.js.map +1 -1
  147. package/dist/sports/scoring-display.d.ts +1 -1
  148. package/dist/sports/scoring-display.js +2 -2
  149. package/dist/sports/scoring-display.js.map +1 -1
  150. package/dist/sports/scoring.d.ts +5 -5
  151. package/dist/sports/scoring.d.ts.map +1 -1
  152. package/dist/sports/scoring.js +2 -2
  153. package/dist/sports/scoring.js.map +1 -1
  154. package/dist/sports/sport-adapter.d.ts +3 -3
  155. package/dist/sports/sport-adapter.d.ts.map +1 -1
  156. package/dist/sports/sport-adapter.js +2 -2
  157. package/dist/sports/sport-adapter.js.map +1 -1
  158. package/dist/sports/store-driver.d.ts +1 -1
  159. package/dist/sports/store-driver.d.ts.map +1 -1
  160. package/dist/sports/store-driver.js +2 -2
  161. package/dist/sports/store-driver.js.map +1 -1
  162. package/dist/types/audit.js +4 -4
  163. package/dist/types/audit.js.map +1 -1
  164. package/dist/types/claims.js +1 -1
  165. package/dist/types/claims.js.map +1 -1
  166. package/dist/types/picture-owners.js +1 -1
  167. package/dist/types/picture-owners.js.map +1 -1
  168. package/dist/types/schedules.js +1 -1
  169. package/dist/types/schedules.js.map +1 -1
  170. package/dist/types/sports.js +2 -2
  171. package/dist/types/sports.js.map +1 -1
  172. package/dist/types/stats.js +5 -5
  173. package/dist/types/stats.js.map +1 -1
  174. package/dist/types/unions.js +2 -2
  175. package/dist/types/unions.js.map +1 -1
  176. package/dist/types/uploads.js +1 -1
  177. package/dist/types/uploads.js.map +1 -1
  178. package/dist/upload-variables/sign-hardware-contract-variables.js +1 -1
  179. package/dist/upload-variables/sign-hardware-contract-variables.js.map +1 -1
  180. package/dist/upload-variables/sign-waiver-variables.js +1 -1
  181. package/dist/upload-variables/sign-waiver-variables.js.map +1 -1
  182. package/dist/utils/account-status.js +1 -1
  183. package/dist/utils/account-status.js.map +1 -1
  184. package/dist/utils/app-routes.js +1 -1
  185. package/dist/utils/app-routes.js.map +1 -1
  186. package/dist/utils/league-join-warning.js +1 -1
  187. package/dist/utils/league-join-warning.js.map +1 -1
  188. package/dist/utils/league-joining.js +1 -1
  189. package/dist/utils/league-joining.js.map +1 -1
  190. package/dist/utils/league-mode.js +1 -1
  191. package/dist/utils/league-mode.js.map +1 -1
  192. package/dist/utils/team-creation.js +1 -1
  193. package/dist/utils/team-creation.js.map +1 -1
  194. package/dist/utils/team-member-actions.js +1 -1
  195. package/dist/utils/team-member-actions.js.map +1 -1
  196. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"stats-operation.js","sourceRoot":"","sources":["../../src/doc-schemas/stats-operation.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,oGAAoG;AACpG,mGAAmG;AACnG,oGAAoG;AACpG,sDAAsD;AACtD,EAAE;AACF,uFAAuF;AACvF,0FAA0F;AAC1F,EAAE;AACF,oGAAoG;AACpG,oGAAoG;AACpG,yEAAyE;AACzE,+CAA+C;AAE/C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,kCAAkC,EAClC,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,WAAW,EACX,aAAa,EACb,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,YAAY,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAEzD,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,YAAY,CAAC;IACvD,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,WAAW;IACpB,OAAO,EAAE,WAAW;CACrB,CAAC,CAAC;AAGH,MAAM,aAAa,GAAG;IACpB,eAAe,EAAE,YAAY;IAC7B,SAAS,EAAE,aAAa;IACxB,SAAS,EAAE,aAAa;IACxB,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,2BAA2B,CAAC;IAC3C,2EAA2E;IAC3E,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACzC,MAAM,EAAE,0BAA0B;CACnC,CAAC;AAEF,oGAAoG;AACpG,uFAAuF;AACvF,MAAM,aAAa,GAAG;IACpB,GAAG,aAAa;IAChB,MAAM,EAAE,kBAAkB;IAC1B,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC;CACxC,CAAC;AAEF,MAAM,SAAS,GAAG,CAA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C,qBAAqB,CAAC,CAAC,QAAQ,EAAE;IACtD,kBAAkB,EAAE,CAAC,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC,QAAQ,EAAE;IACpE,gGAAgG;IAChG,iBAAiB,EAAE,CAAC,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC,QAAQ,EAAE;CACzE,CAAC;KACD,SAAS,CAAC,CAAC,SAAS,EAAE,EAAE;IACvB,IAAI,SAAS,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC7F,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,aAAa,EAAE,GAAG,SAAS,CAAC;IACxD,OAAO,aAAa,CAAC;AACvB,CAAC,CAAC,CAAC;AAGL,6FAA6F;AAC7F,+DAA+D;AAC/D,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,YAAY,CAAC;IACxD,GAAG,aAAa;IAChB,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,cAA2C,CAAC;IAC5D,KAAK,EAAE,SAAS;CACjB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC/D,iCAAiC;IACjC,mCAAmC;IACnC,gCAAgC;IAChC,8BAA8B;IAC9B,kCAAkC;IAClC,qCAAqC;IACrC,oCAAoC;IACpC,+BAA+B;IAC/B,2BAA2B;CAC5B,CAAC,CAAC","sourcesContent":["// `statsOperations/{operationId}` — one logical run of a stats action: a rebuild, a validation, a\n// game's correction or recalculation, a historical-baseline update, a ghost's stats half, or a game\n// deletion. The stats cores write it in the same commit as each page it records, so an interrupted\n// run resumes the same operation instead of starting a second one, and a retried single-game action\n// finds its operation `complete` and is acknowledged.\n//\n// It is also the hold on a game: while a multi-page operation works a game, the game's\n// `statsOperationId` names this document, and every other writer of that game refuses it.\n//\n// The id is minted by the client when the admin starts the action, except two the server derives: a\n// ghost's, from the team and the ghost, so a ghost has one operation for its links and its removal;\n// and a game deletion's, from the game (`buildGameDeletionOperationId`).\n// Admin read; written only by the stats cores.\n\nimport { z } from 'zod';\nimport {\n GHOST_LINK_MEMBERSHIP_OUTCOME_KEYS,\n STATS_OPERATION_STATUS_KEYS,\n STATS_VALIDATION_PHASE_KEYS,\n} from '../types/stats.js';\nimport type { GhostStatsOperationAction, StatsOperationKind } from '../types/stats.js';\nimport {\n countSchema,\n epochMsSchema,\n gameIdSchema,\n leagueIdSchema,\n repairReasonSchema,\n sportKeySchema,\n teamIdSchema,\n userIdSchema,\n} from './atoms.js';\nimport { StatsValidationScopeSchema } from './system.js';\n\nexport const StatsOperationCountsSchema = z.strictObject({\n read: countSchema,\n changed: countSchema,\n skipped: countSchema,\n});\nexport type StatsOperationCounts = z.infer<typeof StatsOperationCountsSchema>;\n\nconst operationBase = {\n startedByUserId: userIdSchema,\n startedAt: epochMsSchema,\n updatedAt: epochMsSchema,\n status: z.enum(STATS_OPERATION_STATUS_KEYS),\n // The last document id a paged run finished; absent before its first page.\n resumeAfter: z.string().min(1).optional(),\n counts: StatsOperationCountsSchema,\n};\n\n// A rebuild replaces a destination whole and never rebuilds from a game whose record disagrees with\n// its rollup; it names each such game and rebuilds everything that game does not feed.\nconst rebuildFields = {\n ...operationBase,\n reason: repairReasonSchema,\n stoppedOnGameIds: z.array(gameIdSchema),\n};\n\nconst gameScope = z.strictObject({ gameId: gameIdSchema });\n\nexport const LeagueStatsRebuildOperationSchema = z.strictObject({\n ...rebuildFields,\n kind: z.literal('leagueStatsRebuild' satisfies StatsOperationKind),\n // Absent: every league.\n scope: z.strictObject({ leagueId: leagueIdSchema.optional() }),\n});\n\nexport const LifetimeStatsRebuildOperationSchema = z.strictObject({\n ...rebuildFields,\n kind: z.literal('lifetimeStatsRebuild' satisfies StatsOperationKind),\n // Absent: every user.\n scope: z.strictObject({ userId: userIdSchema.optional() }),\n});\n\nexport const HallOfFameRebuildOperationSchema = z.strictObject({\n ...rebuildFields,\n kind: z.literal('hallOfFameRebuild' satisfies StatsOperationKind),\n // Absent user: the whole sport.\n scope: z.strictObject({ sportKey: sportKeySchema, userId: userIdSchema.optional() }),\n});\n\n// A validation writes no stat, so it takes no reason.\nexport const StatsValidationOperationSchema = z.strictObject({\n ...operationBase,\n kind: z.literal('statsValidation' satisfies StatsOperationKind),\n // One game, one league, or — with neither — everything.\n scope: StatsValidationScopeSchema,\n phase: z.enum(STATS_VALIDATION_PHASE_KEYS),\n});\n\nexport const GameStatsCorrectionOperationSchema = z.strictObject({\n ...operationBase,\n kind: z.literal('gameStatsCorrection' satisfies StatsOperationKind),\n scope: gameScope,\n reason: repairReasonSchema,\n});\n\nexport const GameStatsRecalculationOperationSchema = z.strictObject({\n ...operationBase,\n kind: z.literal('gameStatsRecalculation' satisfies StatsOperationKind),\n scope: gameScope,\n reason: repairReasonSchema,\n});\n\nexport const HistoricalStatsUpdateOperationSchema = z.strictObject({\n ...operationBase,\n kind: z.literal('historicalStatsUpdate' satisfies StatsOperationKind),\n scope: z.strictObject({ userId: userIdSchema, sportKey: sportKeySchema }),\n reason: repairReasonSchema,\n});\n\n// One completed game a never-played ghost's removal took the ghost's entry off, with what the stored\n// participation decision said of the entry before: absent, and credited no game played. The per-game\n// transaction that removes the entry records it, so the removal's audit event names every one.\nexport const GhostRemovedFinishedEntrySchema = z.strictObject({\n gameId: gameIdSchema,\n wasAbsent: z.boolean(),\n wasNonScoring: z.boolean(),\n});\nexport type GhostRemovedFinishedEntry = z.infer<typeof GhostRemovedFinishedEntrySchema>;\n\n// One game a ghost link moved the ghost's entry on, whether the game was completed when it did, and\n// whether the account already held an entry there that the ghost's merged into. The per-game\n// transaction records it, so the link's audit event names every one.\nexport const GhostLinkedGameSchema = z.strictObject({\n gameId: gameIdSchema,\n completed: z.boolean(),\n merged: z.boolean(),\n});\nexport type GhostLinkedGame = z.infer<typeof GhostLinkedGameSchema>;\n\n// One derived line a stats action moved — a team's standings line, a per-membership row, a lifetime\n// line, or a hall-of-fame entry — with its value before the action's first change to it and after\n// its latest, `null` where there was or is no line. Every repair's audit event records them, and a\n// dry run lists them without writing (BACKEND-212).\nexport const StatsDestinationChangeSchema = z.strictObject({\n ref: z.string().min(1),\n field: z.string().min(1),\n before: z.record(z.string(), z.number()).nullable(),\n after: z.record(z.string(), z.number()).nullable(),\n});\nexport type StatsDestinationChange = z.infer<typeof StatsDestinationChangeSchema>;\n\n// The ghost's one operation records the account a link chose, or the removal, so a call naming a\n// different account — or a removal against a link — is refused, and the same call resumes. Neither\n// takes a reason: a link is chosen and confirmed, and its audit event records who linked which ghost\n// to whom and what moved (BACKEND-212).\nexport const GhostPlayerStatsOperationSchema = z\n .strictObject({\n ...operationBase,\n kind: z.literal('ghostPlayerStats' satisfies StatsOperationKind),\n scope: z.discriminatedUnion('action', [\n z.strictObject({\n action: z.literal('link' satisfies GhostStatsOperationAction),\n teamId: teamIdSchema,\n ghostUserId: userIdSchema,\n userId: userIdSchema,\n }),\n z.strictObject({\n action: z.literal('removal' satisfies GhostStatsOperationAction),\n teamId: teamIdSchema,\n ghostUserId: userIdSchema,\n }),\n ]),\n // A reason stored by a link or a removal recorded while they still took one; no operation\n // writes one now. A removal's is dropped on read; a link's is kept, so its stored operation\n // still resumes.\n reason: repairReasonSchema.optional(),\n // A removal's finished-game entries, in the order it removed them; absent on a link.\n removedFinishedGameEntries: z.array(GhostRemovedFinishedEntrySchema).optional(),\n // A link's games moved so far, in the order it moved them, and every derived line it changed;\n // absent on a removal.\n linkedGames: z.array(GhostLinkedGameSchema).optional(),\n destinationChanges: z.array(StatsDestinationChangeSchema).optional(),\n // What a completed link did with the team's memberships, so a call after completion answers it.\n membershipOutcome: z.enum(GHOST_LINK_MEMBERSHIP_OUTCOME_KEYS).optional(),\n })\n .overwrite((operation) => {\n if (operation.scope.action !== 'removal' || operation.reason === undefined) return operation;\n const { reason: _reason, ...withoutReason } = operation;\n return withoutReason;\n });\nexport type GhostPlayerStatsOperation = z.infer<typeof GhostPlayerStatsOperationSchema>;\n\n// A game deletion pages out the game's events and roster under the hold and removes the game\n// document last; running it again on a held game continues it.\nexport const GameDeletionOperationSchema = z.strictObject({\n ...operationBase,\n kind: z.literal('gameDeletion' satisfies StatsOperationKind),\n scope: gameScope,\n});\n\nexport const StatsOperationSchema = z.discriminatedUnion('kind', [\n LeagueStatsRebuildOperationSchema,\n LifetimeStatsRebuildOperationSchema,\n HallOfFameRebuildOperationSchema,\n StatsValidationOperationSchema,\n GameStatsCorrectionOperationSchema,\n GameStatsRecalculationOperationSchema,\n HistoricalStatsUpdateOperationSchema,\n GhostPlayerStatsOperationSchema,\n GameDeletionOperationSchema,\n]);\nexport type StatsOperation = z.infer<typeof StatsOperationSchema>;\n"]}
1
+ {"version":3,"file":"stats-operation.js","sourceRoot":"","sources":["../../src/doc-schemas/stats-operation.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,oGAAoG;AACpG,mGAAmG;AACnG,oGAAoG;AACpG,sDAAsD;AACtD,EAAE;AACF,uFAAuF;AACvF,0FAA0F;AAC1F,EAAE;AACF,oGAAoG;AACpG,oGAAoG;AACpG,yEAAyE;AACzE,+CAA+C;AAE/C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,kCAAkC,EAClC,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,WAAW,EACX,aAAa,EACb,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,YAAY,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAEzD,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,YAAY,CAAC;IACvD,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,WAAW;IACpB,OAAO,EAAE,WAAW;CACrB,CAAC,CAAC;AAGH,MAAM,aAAa,GAAG;IACpB,eA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kB,CAAC,MAAM,EAAE;IAC/D,iCAAiC;IACjC,mCAAmC;IACnC,gCAAgC;IAChC,8BAA8B;IAC9B,kCAAkC;IAClC,qCAAqC;IACrC,oCAAoC;IACpC,+BAA+B;IAC/B,2BAA2B;CAC5B,CAAC,CAAC","sourcesContent":["// `statsOperations/{operationId}` — one logical run of a stats action: a rebuild, a validation, a\n// game's correction or recalculation, a historical-baseline update, a ghost's stats half, or a game\n// deletion. The stats cores write it in the same commit as each page it records, so an interrupted\n// run resumes the same operation instead of starting a second one, and a retried single-game action\n// finds its operation `complete` and is acknowledged.\n//\n// It is also the hold on a game: while a multi-page operation works a game, the game's\n// `statsOperationId` names this document, and every other writer of that game refuses it.\n//\n// The id is minted by the client when the admin starts the action, except two the server derives: a\n// ghost's, from the team and the ghost, so a ghost has one operation for its links and its removal;\n// and a game deletion's, from the game (`buildGameDeletionOperationId`).\n// Admin read; written only by the stats cores.\n\nimport { z } from 'zod';\nimport {\n GHOST_LINK_MEMBERSHIP_OUTCOME_KEYS,\n STATS_OPERATION_STATUS_KEYS,\n STATS_VALIDATION_PHASE_KEYS,\n} from '../types/stats.js';\nimport type { GhostStatsOperationAction, StatsOperationKind } from '../types/stats.js';\nimport {\n countSchema,\n epochMsSchema,\n gameIdSchema,\n leagueIdSchema,\n repairReasonSchema,\n sportKeySchema,\n teamIdSchema,\n userIdSchema,\n} from './atoms.js';\nimport { StatsValidationScopeSchema } from './system.js';\n\nexport const StatsOperationCountsSchema = z.strictObject({\n read: countSchema,\n changed: countSchema,\n skipped: countSchema,\n});\nexport type StatsOperationCounts = z.infer<typeof StatsOperationCountsSchema>;\n\nconst operationBase = {\n startedByUserId: userIdSchema,\n startedAt: epochMsSchema,\n updatedAt: epochMsSchema,\n status: z.enum(STATS_OPERATION_STATUS_KEYS),\n // The last document id a paged run finished; absent before its first page.\n resumeAfter: z.string().min(1).optional(),\n counts: StatsOperationCountsSchema,\n};\n\n// A rebuild replaces a destination whole and never rebuilds from a game whose record disagrees with\n// its rollup; it names each such game and rebuilds everything that game does not feed.\nconst rebuildFields = {\n ...operationBase,\n reason: repairReasonSchema,\n stoppedOnGameIds: z.array(gameIdSchema),\n};\n\nconst gameScope = z.strictObject({ gameId: gameIdSchema });\n\nexport const LeagueStatsRebuildOperationSchema = z.strictObject({\n ...rebuildFields,\n kind: z.literal('leagueStatsRebuild' satisfies StatsOperationKind),\n // Absent: every league.\n scope: z.strictObject({ leagueId: leagueIdSchema.optional() }),\n});\n\nexport const LifetimeStatsRebuildOperationSchema = z.strictObject({\n ...rebuildFields,\n kind: z.literal('lifetimeStatsRebuild' satisfies StatsOperationKind),\n // Absent: every user.\n scope: z.strictObject({ userId: userIdSchema.optional() }),\n});\n\nexport const HallOfFameRebuildOperationSchema = z.strictObject({\n ...rebuildFields,\n kind: z.literal('hallOfFameRebuild' satisfies StatsOperationKind),\n // Absent user: the whole sport.\n scope: z.strictObject({ sportKey: sportKeySchema, userId: userIdSchema.optional() }),\n});\n\n// A validation writes no stat, so it takes no reason.\nexport const StatsValidationOperationSchema = z.strictObject({\n ...operationBase,\n kind: z.literal('statsValidation' satisfies StatsOperationKind),\n // One game, one league, or — with neither — everything.\n scope: StatsValidationScopeSchema,\n phase: z.enum(STATS_VALIDATION_PHASE_KEYS),\n});\n\nexport const GameStatsCorrectionOperationSchema = z.strictObject({\n ...operationBase,\n kind: z.literal('gameStatsCorrection' satisfies StatsOperationKind),\n scope: gameScope,\n reason: repairReasonSchema,\n});\n\nexport const GameStatsRecalculationOperationSchema = z.strictObject({\n ...operationBase,\n kind: z.literal('gameStatsRecalculation' satisfies StatsOperationKind),\n scope: gameScope,\n reason: repairReasonSchema,\n});\n\nexport const HistoricalStatsUpdateOperationSchema = z.strictObject({\n ...operationBase,\n kind: z.literal('historicalStatsUpdate' satisfies StatsOperationKind),\n scope: z.strictObject({ userId: userIdSchema, sportKey: sportKeySchema }),\n reason: repairReasonSchema,\n});\n\n// One completed game a never-played ghost's removal took the ghost's entry off, with what the stored\n// participation decision said of the entry before: absent, and credited no game played. The per-game\n// transaction that removes the entry records it, so the removal's audit event names every one.\nexport const GhostRemovedFinishedEntrySchema = z.strictObject({\n gameId: gameIdSchema,\n wasAbsent: z.boolean(),\n wasNonScoring: z.boolean(),\n});\nexport type GhostRemovedFinishedEntry = z.infer<typeof GhostRemovedFinishedEntrySchema>;\n\n// One game a ghost link moved the ghost's entry on, whether the game was completed when it did, and\n// whether the account already held an entry there that the ghost's merged into. The per-game\n// transaction records it, so the link's audit event names every one.\nexport const GhostLinkedGameSchema = z.strictObject({\n gameId: gameIdSchema,\n completed: z.boolean(),\n merged: z.boolean(),\n});\nexport type GhostLinkedGame = z.infer<typeof GhostLinkedGameSchema>;\n\n// One derived line a stats action moved — a team's standings line, a per-membership row, a lifetime\n// line, or a hall-of-fame entry — with its value before the action's first change to it and after\n// its latest, `null` where there was or is no line. Every repair's audit event records them, and a\n// dry run lists them without writing (RULE-STD-BACKEND-212).\nexport const StatsDestinationChangeSchema = z.strictObject({\n ref: z.string().min(1),\n field: z.string().min(1),\n before: z.record(z.string(), z.number()).nullable(),\n after: z.record(z.string(), z.number()).nullable(),\n});\nexport type StatsDestinationChange = z.infer<typeof StatsDestinationChangeSchema>;\n\n// The ghost's one operation records the account a link chose, or the removal, so a call naming a\n// different account — or a removal against a link — is refused, and the same call resumes. Neither\n// takes a reason: a link is chosen and confirmed, and its audit event records who linked which ghost\n// to whom and what moved (RULE-STD-BACKEND-212).\nexport const GhostPlayerStatsOperationSchema = z\n .strictObject({\n ...operationBase,\n kind: z.literal('ghostPlayerStats' satisfies StatsOperationKind),\n scope: z.discriminatedUnion('action', [\n z.strictObject({\n action: z.literal('link' satisfies GhostStatsOperationAction),\n teamId: teamIdSchema,\n ghostUserId: userIdSchema,\n userId: userIdSchema,\n }),\n z.strictObject({\n action: z.literal('removal' satisfies GhostStatsOperationAction),\n teamId: teamIdSchema,\n ghostUserId: userIdSchema,\n }),\n ]),\n // A reason stored by a link or a removal recorded while they still took one; no operation\n // writes one now. A removal's is dropped on read; a link's is kept, so its stored operation\n // still resumes.\n reason: repairReasonSchema.optional(),\n // A removal's finished-game entries, in the order it removed them; absent on a link.\n removedFinishedGameEntries: z.array(GhostRemovedFinishedEntrySchema).optional(),\n // A link's games moved so far, in the order it moved them, and every derived line it changed;\n // absent on a removal.\n linkedGames: z.array(GhostLinkedGameSchema).optional(),\n destinationChanges: z.array(StatsDestinationChangeSchema).optional(),\n // What a completed link did with the team's memberships, so a call after completion answers it.\n membershipOutcome: z.enum(GHOST_LINK_MEMBERSHIP_OUTCOME_KEYS).optional(),\n })\n .overwrite((operation) => {\n if (operation.scope.action !== 'removal' || operation.reason === undefined) return operation;\n const { reason: _reason, ...withoutReason } = operation;\n return withoutReason;\n });\nexport type GhostPlayerStatsOperation = z.infer<typeof GhostPlayerStatsOperationSchema>;\n\n// A game deletion pages out the game's events and roster under the hold and removes the game\n// document last; running it again on a held game continues it.\nexport const GameDeletionOperationSchema = z.strictObject({\n ...operationBase,\n kind: z.literal('gameDeletion' satisfies StatsOperationKind),\n scope: gameScope,\n});\n\nexport const StatsOperationSchema = z.discriminatedUnion('kind', [\n LeagueStatsRebuildOperationSchema,\n LifetimeStatsRebuildOperationSchema,\n HallOfFameRebuildOperationSchema,\n StatsValidationOperationSchema,\n GameStatsCorrectionOperationSchema,\n GameStatsRecalculationOperationSchema,\n HistoricalStatsUpdateOperationSchema,\n GhostPlayerStatsOperationSchema,\n GameDeletionOperationSchema,\n]);\nexport type StatsOperation = z.infer<typeof StatsOperationSchema>;\n"]}
@@ -1,5 +1,5 @@
1
1
  // `statusReconcileQueue/{userId}` — the backend-only retry queue for an account's post-commit
2
- // Firebase Auth effects (QUALITY-104, BACKEND-302). One entry per account, id = the userId, whichever
2
+ // Firebase Auth effects (RULE-STD-QUALITY-104, RULE-STD-BACKEND-302). One entry per account, id = the userId, whichever
3
3
  // effect queued it. A status change writes its entry in the status transaction itself; a role-claim
4
4
  // entry is written when a roster change committed but its claim write failed. The drain re-converges
5
5
  // every Auth-side mirror of the account from its canonical documents and deletes the entry once it
@@ -1 +1 @@
1
- {"version":3,"file":"status-reconcile-queue.js","sourceRoot":"","sources":["../../src/doc-schemas/status-reconcile-queue.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,sGAAsG;AACtG,oGAAoG;AACpG,qGAAqG;AACrG,mGAAmG;AACnG,iGAAiG;AACjG,qDAAqD;AAErD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACpF,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnG,MAAM,6BAA6B,GAAG;IACpC,UAAU,EAAE,aAAa;IACzB,aAAa,EAAE,aAAa,CAAC,QAAQ,EAAE;IACvC,YAAY,EAAE,WAAW;CAC1B,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,4CAA4C,GAAG,CAAC,CAAC,YAAY,CAAC;IACzE,GAAG,6BAA6B;IAChC,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,0BAA0B,CAAC;IACjD,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAAC;IACxC,YAAY,EAAE,gBAAgB;IAC9B,OAAO,EAAE,uBAAuB;CACjC,CAAC,CAAC;AAKH,sEAAsE;AACtE,MAAM,CAAC,MAAM,yCAAyC,GAAG,CAAC,CAAC,YAAY,CAAC;IACtE,GAAG,6BAA6B;IAChC,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC;IACzC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,4BAA4B,CAAC;CAChD,CAAC,CAAC;AAKH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,kBAAkB,CAAC,YAAY,EAAE;IAChF,4CAA4C;IAC5C,yCAAyC;CAC1C,CAAC,CAAC","sourcesContent":["// `statusReconcileQueue/{userId}` — the backend-only retry queue for an account's post-commit\n// Firebase Auth effects (QUALITY-104, BACKEND-302). One entry per account, id = the userId, whichever\n// effect queued it. A status change writes its entry in the status transaction itself; a role-claim\n// entry is written when a roster change committed but its claim write failed. The drain re-converges\n// every Auth-side mirror of the account from its canonical documents and deletes the entry once it\n// has, so the entry names why the account was queued, never what to apply. Only the retry ledger\n// (`attemptCount`, `lastAttemptAt`) is written back.\n\nimport { z } from 'zod';\nimport { ACCOUNT_STATUS_AUTH_EFFECT, ROLE_CLAIMS_EFFECT } from '../types/unions.js';\nimport { countSchema, documentIdSegmentSchema, epochMsSchema, userStatusSchema } from './atoms.js';\n\nconst statusReconcileQueueEntryBase = {\n enqueuedAt: epochMsSchema,\n lastAttemptAt: epochMsSchema.optional(),\n attemptCount: countSchema,\n};\n\n/**\n * A status change's Auth effect, owed until it lands. `writeId` names the status change that wrote\n * it: a removal compares it, so finishing an older change never removes the entry a newer change\n * wrote. The drain converges the account on its canonical status, never on `targetStatus`.\n */\nexport const StatusReconcileQueueAccountStatusEntrySchema = z.strictObject({\n ...statusReconcileQueueEntryBase,\n authEffect: z.literal(ACCOUNT_STATUS_AUTH_EFFECT),\n reason: z.literal('statusChangePending'),\n targetStatus: userStatusSchema,\n writeId: documentIdSegmentSchema,\n});\nexport type StatusReconcileQueueAccountStatusEntry = z.infer<\n typeof StatusReconcileQueueAccountStatusEntrySchema\n>;\n\n/** A failed `admin` / `referee` claim write. It carries no status. */\nexport const StatusReconcileQueueRoleClaimsEntrySchema = z.strictObject({\n ...statusReconcileQueueEntryBase,\n authEffect: z.literal(ROLE_CLAIMS_EFFECT),\n reason: z.literal('postCommitAuthEffectFailed'),\n});\nexport type StatusReconcileQueueRoleClaimsEntry = z.infer<\n typeof StatusReconcileQueueRoleClaimsEntrySchema\n>;\n\nexport const StatusReconcileQueueEntrySchema = z.discriminatedUnion('authEffect', [\n StatusReconcileQueueAccountStatusEntrySchema,\n StatusReconcileQueueRoleClaimsEntrySchema,\n]);\nexport type StatusReconcileQueueEntry = z.infer<typeof StatusReconcileQueueEntrySchema>;\n"]}
1
+ {"version":3,"file":"status-reconcile-queue.js","sourceRoot":"","sources":["../../src/doc-schemas/status-reconcile-queue.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,wHAAwH;AACxH,oGAAoG;AACpG,qGAAqG;AACrG,mGAAmG;AACnG,iGAAiG;AACjG,qDAAqD;AAErD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACpF,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnG,MAAM,6BAA6B,GAAG;IACpC,UAAU,EAAE,aAAa;IACzB,aAAa,EAAE,aAAa,CAAC,QAAQ,EAAE;IACvC,YAAY,EAAE,WAAW;CAC1B,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,4CAA4C,GAAG,CAAC,CAAC,YAAY,CAAC;IACzE,GAAG,6BAA6B;IAChC,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,0BAA0B,CAAC;IACjD,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAAC;IACxC,YAAY,EAAE,gBAAgB;IAC9B,OAAO,EAAE,uBAAuB;CACjC,CAAC,CAAC;AAKH,sEAAsE;AACtE,MAAM,CAAC,MAAM,yCAAyC,GAAG,CAAC,CAAC,YAAY,CAAC;IACtE,GAAG,6BAA6B;IAChC,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC;IACzC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,4BAA4B,CAAC;CAChD,CAAC,CAAC;AAKH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,kBAAkB,CAAC,YAAY,EAAE;IAChF,4CAA4C;IAC5C,yCAAyC;CAC1C,CAAC,CAAC","sourcesContent":["// `statusReconcileQueue/{userId}` — the backend-only retry queue for an account's post-commit\n// Firebase Auth effects (RULE-STD-QUALITY-104, RULE-STD-BACKEND-302). One entry per account, id = the userId, whichever\n// effect queued it. A status change writes its entry in the status transaction itself; a role-claim\n// entry is written when a roster change committed but its claim write failed. The drain re-converges\n// every Auth-side mirror of the account from its canonical documents and deletes the entry once it\n// has, so the entry names why the account was queued, never what to apply. Only the retry ledger\n// (`attemptCount`, `lastAttemptAt`) is written back.\n\nimport { z } from 'zod';\nimport { ACCOUNT_STATUS_AUTH_EFFECT, ROLE_CLAIMS_EFFECT } from '../types/unions.js';\nimport { countSchema, documentIdSegmentSchema, epochMsSchema, userStatusSchema } from './atoms.js';\n\nconst statusReconcileQueueEntryBase = {\n enqueuedAt: epochMsSchema,\n lastAttemptAt: epochMsSchema.optional(),\n attemptCount: countSchema,\n};\n\n/**\n * A status change's Auth effect, owed until it lands. `writeId` names the status change that wrote\n * it: a removal compares it, so finishing an older change never removes the entry a newer change\n * wrote. The drain converges the account on its canonical status, never on `targetStatus`.\n */\nexport const StatusReconcileQueueAccountStatusEntrySchema = z.strictObject({\n ...statusReconcileQueueEntryBase,\n authEffect: z.literal(ACCOUNT_STATUS_AUTH_EFFECT),\n reason: z.literal('statusChangePending'),\n targetStatus: userStatusSchema,\n writeId: documentIdSegmentSchema,\n});\nexport type StatusReconcileQueueAccountStatusEntry = z.infer<\n typeof StatusReconcileQueueAccountStatusEntrySchema\n>;\n\n/** A failed `admin` / `referee` claim write. It carries no status. */\nexport const StatusReconcileQueueRoleClaimsEntrySchema = z.strictObject({\n ...statusReconcileQueueEntryBase,\n authEffect: z.literal(ROLE_CLAIMS_EFFECT),\n reason: z.literal('postCommitAuthEffectFailed'),\n});\nexport type StatusReconcileQueueRoleClaimsEntry = z.infer<\n typeof StatusReconcileQueueRoleClaimsEntrySchema\n>;\n\nexport const StatusReconcileQueueEntrySchema = z.discriminatedUnion('authEffect', [\n StatusReconcileQueueAccountStatusEntrySchema,\n StatusReconcileQueueRoleClaimsEntrySchema,\n]);\nexport type StatusReconcileQueueEntry = z.infer<typeof StatusReconcileQueueEntrySchema>;\n"]}
@@ -1,5 +1,5 @@
1
1
  // `sweepState/{sweepName}` — where a scheduled pass over a bounded, ordered source keeps its
2
- // position (BACKEND-112), one document per `SWEEP_STATE_NAMES` name. Backend-only: no client reads
2
+ // position (RULE-STD-BACKEND-112), one document per `SWEEP_STATE_NAMES` name. Backend-only: no client reads
3
3
  // or writes it.
4
4
  import { z } from 'zod';
5
5
  import { SWEEP_STATE_MAX_DEFERRED } from '../constants/scheduled-jobs.js';
@@ -41,7 +41,7 @@ export const SweepRollingCursorSchema = z
41
41
  }
42
42
  });
43
43
  // A row the cursor moved past without clearing it (a failed read or write). The pass retries it from
44
- // here once it is due instead of stopping at it, so one failing row never pins the window (BACKEND-309).
44
+ // here once it is due instead of stopping at it, so one failing row never pins the window (RULE-STD-BACKEND-309).
45
45
  export const SweepDeferredRowSchema = z
46
46
  .object({
47
47
  key: z.string().min(1),
@@ -1 +1 @@
1
- {"version":3,"file":"sweep-state.js","sourceRoot":"","sources":["../../src/doc-schemas/sweep-state.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,mGAAmG;AACnG,gBAAgB;AAEhB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,qCAAqC;AACrC,wEAAwE;AACxE,gGAAgG;AAChG,8FAA8F;AAC9F,mGAAmG;AACnG,oGAAoG;AACpG,iGAAiG;AACjG,kGAAkG;AAClG,+EAA+E;AAC/E,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC;KACtC,kBAAkB,CAAC,OAAO,EAAE;IAC3B,CAAC;SACE,MAAM,CAAC;QACN,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;QAC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AwB,CAAC,QAAQ,EAAE;IAClD,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC,QAAQ,EAAE;IAClF,SAAS,EAAE,aAAa;CACzB,CAAC;KACD,WAAW,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IAC1B,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QAC5C,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACtB,GAAG,CAAC,QAAQ,CAAC;gBACX,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC;gBAChC,OAAO,EAAE,gCAAgC;aAC1C,CAAC,CAAC;QACL,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACpB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["// `sweepState/{sweepName}` — where a scheduled pass over a bounded, ordered source keeps its\n// position (BACKEND-112), one document per `SWEEP_STATE_NAMES` name. Backend-only: no client reads\n// or writes it.\n\nimport { z } from 'zod';\nimport { SWEEP_STATE_MAX_DEFERRED } from '../constants/scheduled-jobs.js';\nimport { epochMsSchema } from './atoms.js';\n\n// Where a pass stands in its source.\n// absent — no lap has run: the next pass starts one at the beginning.\n// inLap — the next page starts strictly after the last row the lap moved past. `afterKey` is\n// that row's document id; `afterValue` is its value of the numeric field the query\n// orders by first, when it orders by one. The query orders by the field and then by the\n// key and resumes after both, never `field > value`, which skips every row tied with it.\n// done — the last lap reached the end of its source. The pass that exhausted it records that\n// here rather than starting page one again in the same run; the next pass starts a new\n// lap, so rows added behind the cursor are reached on the next lap.\nexport const SweepRollingCursorSchema = z\n .discriminatedUnion('state', [\n z\n .object({\n state: z.literal('inLap'),\n afterKey: z.string().min(1),\n afterValue: z.number().optional(),\n lapStartedAt: epochMsSchema,\n })\n .strict(),\n z\n .object({\n state: z.literal('done'),\n lapStartedAt: epochMsSchema,\n lapCompletedAt: epochMsSchema,\n })\n .strict(),\n ])\n .superRefine((value, ctx) => {\n if (value.state === 'done' && value.lapCompletedAt < value.lapStartedAt) {\n ctx.addIssue({\n code: 'custom',\n path: ['lapCompletedAt'],\n message: 'a lap completes no earlier than it started',\n });\n }\n });\nexport type SweepRollingCursor = z.infer<typeof SweepRollingCursorSchema>;\n\n// A row the cursor moved past without clearing it (a failed read or write). The pass retries it from\n// here once it is due instead of stopping at it, so one failing row never pins the window (BACKEND-309).\nexport const SweepDeferredRowSchema = z\n .object({\n key: z.string().min(1),\n value: z.number().optional(),\n /** Epoch ms from which a pass may retry it. */\n nextAttemptAt: epochMsSchema,\n /** Passes that examined it without clearing it; the pass that deferred it is the first. */\n attemptCount: z.number().int().positive(),\n })\n .strict();\nexport type SweepDeferredRow = z.infer<typeof SweepDeferredRowSchema>;\n\nexport const SweepStateSchema = z\n .object({\n /** Wall-clock ms the last full sign-in account scan ran (absent = never). */\n fullScanLastRunAt: epochMsSchema.optional(),\n rollingCursor: SweepRollingCursorSchema.optional(),\n deferred: z.array(SweepDeferredRowSchema).max(SWEEP_STATE_MAX_DEFERRED).optional(),\n updatedAt: epochMsSchema,\n })\n .superRefine((value, ctx) => {\n const seen = new Set<string>();\n (value.deferred ?? []).forEach((row, index) => {\n if (seen.has(row.key)) {\n ctx.addIssue({\n code: 'custom',\n path: ['deferred', index, 'key'],\n message: 'a row is deferred at most once',\n });\n }\n seen.add(row.key);\n });\n });\nexport type SweepState = z.infer<typeof SweepStateSchema>;\n"]}
1
+ {"version":3,"file":"sweep-state.js","sourceRoot":"","sources":["../../src/doc-schemas/sweep-state.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,4GAA4G;AA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ounded, ordered source keeps its\n// position (RULE-STD-BACKEND-112), one document per `SWEEP_STATE_NAMES` name. Backend-only: no client reads\n// or writes it.\n\nimport { z } from 'zod';\nimport { SWEEP_STATE_MAX_DEFERRED } from '../constants/scheduled-jobs.js';\nimport { epochMsSchema } from './atoms.js';\n\n// Where a pass stands in its source.\n// absent — no lap has run: the next pass starts one at the beginning.\n// inLap — the next page starts strictly after the last row the lap moved past. `afterKey` is\n// that row's document id; `afterValue` is its value of the numeric field the query\n// orders by first, when it orders by one. The query orders by the field and then by the\n// key and resumes after both, never `field > value`, which skips every row tied with it.\n// done — the last lap reached the end of its source. The pass that exhausted it records that\n// here rather than starting page one again in the same run; the next pass starts a new\n// lap, so rows added behind the cursor are reached on the next lap.\nexport const SweepRollingCursorSchema = z\n .discriminatedUnion('state', [\n z\n .object({\n state: z.literal('inLap'),\n afterKey: z.string().min(1),\n afterValue: z.number().optional(),\n lapStartedAt: epochMsSchema,\n })\n .strict(),\n z\n .object({\n state: z.literal('done'),\n lapStartedAt: epochMsSchema,\n lapCompletedAt: epochMsSchema,\n })\n .strict(),\n ])\n .superRefine((value, ctx) => {\n if (value.state === 'done' && value.lapCompletedAt < value.lapStartedAt) {\n ctx.addIssue({\n code: 'custom',\n path: ['lapCompletedAt'],\n message: 'a lap completes no earlier than it started',\n });\n }\n });\nexport type SweepRollingCursor = z.infer<typeof SweepRollingCursorSchema>;\n\n// A row the cursor moved past without clearing it (a failed read or write). The pass retries it from\n// here once it is due instead of stopping at it, so one failing row never pins the window (RULE-STD-BACKEND-309).\nexport const SweepDeferredRowSchema = z\n .object({\n key: z.string().min(1),\n value: z.number().optional(),\n /** Epoch ms from which a pass may retry it. */\n nextAttemptAt: epochMsSchema,\n /** Passes that examined it without clearing it; the pass that deferred it is the first. */\n attemptCount: z.number().int().positive(),\n })\n .strict();\nexport type SweepDeferredRow = z.infer<typeof SweepDeferredRowSchema>;\n\nexport const SweepStateSchema = z\n .object({\n /** Wall-clock ms the last full sign-in account scan ran (absent = never). */\n fullScanLastRunAt: epochMsSchema.optional(),\n rollingCursor: SweepRollingCursorSchema.optional(),\n deferred: z.array(SweepDeferredRowSchema).max(SWEEP_STATE_MAX_DEFERRED).optional(),\n updatedAt: epochMsSchema,\n })\n .superRefine((value, ctx) => {\n const seen = new Set<string>();\n (value.deferred ?? []).forEach((row, index) => {\n if (seen.has(row.key)) {\n ctx.addIssue({\n code: 'custom',\n path: ['deferred', index, 'key'],\n message: 'a row is deferred at most once',\n });\n }\n seen.add(row.key);\n });\n });\nexport type SweepState = z.infer<typeof SweepStateSchema>;\n"]}
@@ -1,5 +1,5 @@
1
1
  // The documents that put a user on a team: the membership itself and the three ways to reach one.
2
- // Every one of them stores user ids only — names resolve from `publicUsers` (ARCH-103).
2
+ // Every one of them stores user ids only — names resolve from `publicUsers` (RULE-STD-ARCH-103).
3
3
  import { z } from 'zod';
4
4
  import { epochMsSchema, teamJoinRequestStatusSchema, leagueIdSchema, teamIdSchema, teamInvitationStatusSchema, teamJoinMethodSchema, teamMembershipStatusSchema, teamRoleSchema, userIdSchema, } from './atoms.js';
5
5
  // `teamMemberships/{leagueId}_{teamId}_{userId}` — canonical membership and team role. The id is
@@ -1 +1 @@
1
- {"version":3,"file":"team-membership.js","sourceRoot":"","sources":["../../src/doc-schemas/team-membership.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,wFAAwF;AAExF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,aAAa,EACb,2BAA2B,EAC3B,cAAc,EACd,YAAY,EACZ,0BAA0B,EAC1B,oBAAoB,EACpB,0BAA0B,EAC1B,cAAc,EACd,YAAY,GACb,MAAM,YAAY,CAAC;AAEpB,iGAAiG;AACjG,yFAAyF;AACzF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,QAAQ,EAAE,cAAc;IACxB,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,IAAI,EAAE,cAAc;IACpB,MAAM,EAAE,0BAA0B;IAClC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,SAAS,EAAE,oBAAoB,CAAC,QAAQ,EAAE;IAC1C,sEAAsE;IACtE,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACvC,sFAAsF;IACtF,qBAAqB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5C,QAAQ,EAAE,aAAa;IACvB,SAAS,EAAE,aAAa;CACzB,CAAC,CAAC;AAGH,2EAA2E;AAC3E,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,QAAQ,EAAE,cAAc;IACxB,MAAM,EAAE,YAAY;IACpB,aAAa,EAAE,YAAY;IAC3B,eAAe,EAAE,YAAY;IAC7B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,MAAM,EAAE,0BAA0B;IAClC,SAAS,EAAE,aAAa;IACxB,WAAW,EAAE,aAAa,CAAC,QAAQ,EAAE;CACtC,CAAC,CAAC;AAGH,iEAAiE;AACjE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,QAAQ,EAAE,cAAc;IACxB,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,MAAM,EAAE,2BAA2B;IACnC,SAAS,EAAE,aAAa;CACzB,CAAC,CAAC;AAGH,8FAA8F;AAC9F,iGAAiG;AACjG,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,QAAQ,EAAE,cAAc;IACxB,MAAM,EAAE,YAAY;IACpB,SAAS,EAAE,aAAa;CACzB,CAAC,CAAC","sourcesContent":["// The documents that put a user on a team: the membership itself and the three ways to reach one.\n// Every one of them stores user ids only — names resolve from `publicUsers` (ARCH-103).\n\nimport { z } from 'zod';\nimport {\n epochMsSchema,\n teamJoinRequestStatusSchema,\n leagueIdSchema,\n teamIdSchema,\n teamInvitationStatusSchema,\n teamJoinMethodSchema,\n teamMembershipStatusSchema,\n teamRoleSchema,\n userIdSchema,\n} from './atoms.js';\n\n// `teamMemberships/{leagueId}_{teamId}_{userId}` — canonical membership and team role. The id is\n// load-bearing: rules and callables read a membership by id to decide captain authority.\nexport const TeamMembershipSchema = z.object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n userId: userIdSchema,\n role: teamRoleSchema,\n status: teamMembershipStatusSchema,\n isGhost: z.boolean(),\n joinedVia: teamJoinMethodSchema.optional(),\n // The invite this membership came from, when `joinedVia` is `invite`.\n teamInvitationId: z.string().optional(),\n // The ghost id this real user's membership replaced, when a ghost was linked to them.\n linkedFromGhostUserId: z.string().optional(),\n joinedAt: epochMsSchema,\n updatedAt: epochMsSchema,\n});\nexport type TeamMembership = z.infer<typeof TeamMembershipSchema>;\n\n// `teamInvitations/{inviteId}` — a captain invites a user onto their team.\nexport const TeamInvitationSchema = z.object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n invitedUserId: userIdSchema,\n invitedByUserId: userIdSchema,\n message: z.string(),\n status: teamInvitationStatusSchema,\n createdAt: epochMsSchema,\n respondedAt: epochMsSchema.optional(),\n});\nexport type TeamInvitation = z.infer<typeof TeamInvitationSchema>;\n\n// `teamJoinRequests/{requestId}` — a player asks to join a team.\nexport const TeamJoinRequestSchema = z.object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n userId: userIdSchema,\n message: z.string(),\n status: teamJoinRequestStatusSchema,\n createdAt: epochMsSchema,\n});\nexport type TeamJoinRequest = z.infer<typeof TeamJoinRequestSchema>;\n\n// `leagueFreeAgents/{leagueId}_{userId}` — a player available for assignment in a league. The\n// document exists while the player is available and is deleted when they are placed or withdraw.\nexport const LeagueFreeAgentSchema = z.object({\n leagueId: leagueIdSchema,\n userId: userIdSchema,\n createdAt: epochMsSchema,\n});\nexport type LeagueFreeAgent = z.infer<typeof LeagueFreeAgentSchema>;\n"]}
1
+ {"version":3,"file":"team-membership.js","sourceRoot":"","sources":["../../src/doc-schemas/team-membership.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,iGAAiG;AAEjG,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,aAAa,EACb,2BAA2B,EAC3B,cAAc,EACd,YAAY,EACZ,0BAA0B,EAC1B,oBAAoB,EACpB,0BAA0B,EAC1B,cAAc,EACd,YAAY,GACb,MAAM,YAAY,CAAC;AAEpB,iGAAiG;AACjG,yFAAyF;AACzF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,QAAQ,EAAE,cAAc;IACxB,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,IAAI,EAAE,cAAc;IACpB,MAAM,EAAE,0BAA0B;IAClC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,SAAS,EAAE,oBAAoB,CAAC,QAAQ,EAAE;IAC1C,sEAAsE;IACtE,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACvC,sFAAsF;IACtF,qBAAqB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5C,QAAQ,EAAE,aAAa;IACvB,SAAS,EAAE,aAAa;CACzB,CAAC,CAAC;AAGH,2EAA2E;AAC3E,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,QAAQ,EAAE,cAAc;IACxB,MAAM,EAAE,YAAY;IACpB,aAAa,EAAE,YAAY;IAC3B,eAAe,EAAE,YAAY;IAC7B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,MAAM,EAAE,0BAA0B;IAClC,SAAS,EAAE,aAAa;IACxB,WAAW,EAAE,aAAa,CAAC,QAAQ,EAAE;CACtC,CAAC,CAAC;AAGH,iEAAiE;AACjE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,QAAQ,EAAE,cAAc;IACxB,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,MAAM,EAAE,2BAA2B;IACnC,SAAS,EAAE,aAAa;CACzB,CAAC,CAAC;AAGH,8FAA8F;AAC9F,iGAAiG;AACjG,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,QAAQ,EAAE,cAAc;IACxB,MAAM,EAAE,YAAY;IACpB,SAAS,EAAE,aAAa;CACzB,CAAC,CAAC","sourcesContent":["// The documents that put a user on a team: the membership itself and the three ways to reach one.\n// Every one of them stores user ids only — names resolve from `publicUsers` (RULE-STD-ARCH-103).\n\nimport { z } from 'zod';\nimport {\n epochMsSchema,\n teamJoinRequestStatusSchema,\n leagueIdSchema,\n teamIdSchema,\n teamInvitationStatusSchema,\n teamJoinMethodSchema,\n teamMembershipStatusSchema,\n teamRoleSchema,\n userIdSchema,\n} from './atoms.js';\n\n// `teamMemberships/{leagueId}_{teamId}_{userId}` — canonical membership and team role. The id is\n// load-bearing: rules and callables read a membership by id to decide captain authority.\nexport const TeamMembershipSchema = z.object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n userId: userIdSchema,\n role: teamRoleSchema,\n status: teamMembershipStatusSchema,\n isGhost: z.boolean(),\n joinedVia: teamJoinMethodSchema.optional(),\n // The invite this membership came from, when `joinedVia` is `invite`.\n teamInvitationId: z.string().optional(),\n // The ghost id this real user's membership replaced, when a ghost was linked to them.\n linkedFromGhostUserId: z.string().optional(),\n joinedAt: epochMsSchema,\n updatedAt: epochMsSchema,\n});\nexport type TeamMembership = z.infer<typeof TeamMembershipSchema>;\n\n// `teamInvitations/{inviteId}` — a captain invites a user onto their team.\nexport const TeamInvitationSchema = z.object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n invitedUserId: userIdSchema,\n invitedByUserId: userIdSchema,\n message: z.string(),\n status: teamInvitationStatusSchema,\n createdAt: epochMsSchema,\n respondedAt: epochMsSchema.optional(),\n});\nexport type TeamInvitation = z.infer<typeof TeamInvitationSchema>;\n\n// `teamJoinRequests/{requestId}` — a player asks to join a team.\nexport const TeamJoinRequestSchema = z.object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n userId: userIdSchema,\n message: z.string(),\n status: teamJoinRequestStatusSchema,\n createdAt: epochMsSchema,\n});\nexport type TeamJoinRequest = z.infer<typeof TeamJoinRequestSchema>;\n\n// `leagueFreeAgents/{leagueId}_{userId}` — a player available for assignment in a league. The\n// document exists while the player is available and is deleted when they are placed or withdraw.\nexport const LeagueFreeAgentSchema = z.object({\n leagueId: leagueIdSchema,\n userId: userIdSchema,\n createdAt: epochMsSchema,\n});\nexport type LeagueFreeAgent = z.infer<typeof LeagueFreeAgentSchema>;\n"]}
@@ -1,6 +1,6 @@
1
1
  // `userProfiles/{userId}` — the account's profile, one per Firebase Auth uid. Ghosts have none.
2
2
  // It is publicly readable (a profile page renders signed out), so it holds nothing personal:
3
- // email and contact details live in its owner-only `privateData/{userId}` document (BACKEND-105).
3
+ // email and contact details live in its owner-only `privateData/{userId}` document (RULE-STD-BACKEND-105).
4
4
  // Plus its `historicalStats/{sportKey}` subcollection.
5
5
  import { z } from 'zod';
6
6
  import { THEME_NAMES } from '@ttt-productions/theme-core';
@@ -1 +1 @@
1
- {"version":3,"file":"user-profile.js","sourceRoot":"","sources":["../../src/doc-schemas/user-profile.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,6FAA6F;AAC7F,kGAAkG;AAClG,uDAAuD;AAEvD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,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C,QAAQ,EAAE;IACjD,6DAA6D;IAC7D,mBAAmB,EAAE,eAAe,CAAC,0BAA0B,CAAC,CAAC,QAAQ,EAAE;IAC3E,0FAA0F;IAC1F,gEAAgE;IAChE,KAAK,EAAE,eAAe,CAAC,QAAQ,EAAE;IACjC,aAAa,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACrC,SAAS,EAAE,aAAa;CACzB,CAAC,CAAC;AAGH,mGAAmG;AACnG,sGAAsG;AACtG,+FAA+F;AAC/F,yCAAyC;AACzC,MAAM,CAAC,MAAM,qBAAqB,GAAG,4BAA4B,CAAC,IAAI,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;AAGhG,sGAAsG;AACtG,8BAA8B;AAC9B,MAAM,qBAAqB,GAAwC;IACjE,WAAW,EAAE,IAAI;IACjB,MAAM,EAAE,IAAI;IACZ,QAAQ,EAAE,IAAI;IACd,OAAO,EAAE,IAAI;CACd,CAAC;AAEF,8DAA8D;AAC9D,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,IAAI,CAC7C,qBAAqB,CACgB,CAAC","sourcesContent":["// `userProfiles/{userId}` — the account's profile, one per Firebase Auth uid. Ghosts have none.\n// It is publicly readable (a profile page renders signed out), so it holds nothing personal:\n// email and contact details live in its owner-only `privateData/{userId}` document (BACKEND-105).\n// Plus its `historicalStats/{sportKey}` subcollection.\n\nimport { z } from 'zod';\nimport { THEME_NAMES } from '@ttt-productions/theme-core';\nimport { CONTACT_PHONE_INPUT_FORMAT } from '../input-formats/input-formats.js';\nimport { BasketballPlayerTotalsSchema, UserLifetimeStatsSchema } from './aggregate-stats.js';\nimport { epochMsSchema, textFieldSchema, userStatusSchema } from './atoms.js';\nimport { awardIdSchema } from './catalogs.js';\n\n// A saved theme, typed by theme-core's theme set — the one declaration its provider renders from.\nexport const themeNameSchema = z.enum(THEME_NAMES);\n\n// An award granted to this user. Name and imagery resolve from `awardDefinitions/{awardId}`.\nexport const GrantedAwardSchema = z.object({\n awardId: awardIdSchema,\n grantedAt: epochMsSchema,\n});\nexport type GrantedAward = z.infer<typeof GrantedAwardSchema>;\n\nexport const UserProfileSchema = z.object({\n displayName: z.string(),\n displayName_lowercase: z.string(),\n // Written `active` at registration and by the profile copy; nothing else writes it.\n userStatus: userStatusSchema,\n // Per sport, the career line; career games played is the sum of their games played, derived at\n // read and never stored.\n lifetimeStats: UserLifetimeStatsSchema.optional(),\n grantedAwards: z.array(GrantedAwardSchema).optional(),\n // The awards the account shows beside its name, each one it holds.\n primaryAwardId: awardIdSchema.optional(),\n secondaryAwardId: awardIdSchema.optional(),\n createdAt: epochMsSchema,\n updatedAt: epochMsSchema,\n});\nexport type UserProfile = z.infer<typeof UserProfileSchema>;\n\n// `userProfiles/{userId}/privateData/{userId}` — readable by its owner and by admins; written only\n// by callables.\nexport const UserPrivateDataSchema = z.object({\n email: z.string(),\n // When this login's registration started (`createRegistrationStart`); `registerUser` refuses\n // without it. Absent on an account copied from V1, which registered before the step existed.\n registrationStartedAt: epochMsSchema.optional(),\n // When the orphan-registration cleanup decided to delete this uid's login. Written in the\n // cleanup's eligibility transaction BEFORE the Auth delete, and both registration steps answer\n // `registrationExpired` in their own transactions while it is present, so no registration\n // completes into a login that is about to be deleted. Backend-only.\n orphanDeletionClaimedAt: epochMsSchema.optional(),\n // Pre-fills the contact phone when this user creates a team.\n defaultContactPhone: textFieldSchema(CONTACT_PHONE_INPUT_FORMAT).optional(),\n // The account's copy of the viewer's settings, synced with the device's. Absent means the\n // account has saved nothing and the device's own choice stands.\n theme: themeNameSchema.optional(),\n reducedMotion: z.boolean().optional(),\n updatedAt: epochMsSchema,\n});\nexport type UserPrivateData = z.infer<typeof UserPrivateDataSchema>;\n\n// `userProfiles/{userId}/historicalStats/{sportKey}` — pre-Q-Sports career totals an admin enters,\n// folded into lifetime and hall-of-fame recalculation. Absolute totals, not increments. Basketball is\n// the sport with a baseline, so it is the basketball totals line without FP, which the rebuild\n// derives when it folds the baseline in.\nexport const HistoricalStatsSchema = BasketballPlayerTotalsSchema.omit({ fantasyPoints: true });\nexport type HistoricalStats = z.infer<typeof HistoricalStatsSchema>;\n\n// Every field of a baseline, keyed so the record cannot miss one or name one the schema lacks, in the\n// order an admin enters them.\nconst HISTORICAL_STAT_ENTRY: Record<keyof HistoricalStats, true> = {\n gamesPlayed: true,\n points: true,\n rebounds: true,\n assists: true,\n};\n\n/** A baseline's totals, in the order an admin enters them. */\nexport const HISTORICAL_STAT_KEYS = Object.keys(\n HISTORICAL_STAT_ENTRY,\n) as readonly (keyof HistoricalStats)[];\n"]}
1
+ {"version":3,"file":"user-profile.js","sourceRoot":"","sources":["../../src/doc-schemas/user-profile.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,6FAA6F;AAC7F,2GAA2G;AAC3G,uDAAuD;AAEvD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,4BAA4B,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC7F,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,kGAAkG;AAClG,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AAEnD,6FAA6F;AAC7F,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,OAAO,EAAE,aAAa;IACtB,SAAS,EAAE,aAAa;CACzB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,qBAAqB,EAAE,CA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,IAAI;IACZ,QAAQ,EAAE,IAAI;IACd,OAAO,EAAE,IAAI;CACd,CAAC;AAEF,8DAA8D;AAC9D,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,IAAI,CAC7C,qBAAqB,CACgB,CAAC","sourcesContent":["// `userProfiles/{userId}` — the account's profile, one per Firebase Auth uid. Ghosts have none.\n// It is publicly readable (a profile page renders signed out), so it holds nothing personal:\n// email and contact details live in its owner-only `privateData/{userId}` document (RULE-STD-BACKEND-105).\n// Plus its `historicalStats/{sportKey}` subcollection.\n\nimport { z } from 'zod';\nimport { THEME_NAMES } from '@ttt-productions/theme-core';\nimport { CONTACT_PHONE_INPUT_FORMAT } from '../input-formats/input-formats.js';\nimport { BasketballPlayerTotalsSchema, UserLifetimeStatsSchema } from './aggregate-stats.js';\nimport { epochMsSchema, textFieldSchema, userStatusSchema } from './atoms.js';\nimport { awardIdSchema } from './catalogs.js';\n\n// A saved theme, typed by theme-core's theme set — the one declaration its provider renders from.\nexport const themeNameSchema = z.enum(THEME_NAMES);\n\n// An award granted to this user. Name and imagery resolve from `awardDefinitions/{awardId}`.\nexport const GrantedAwardSchema = z.object({\n awardId: awardIdSchema,\n grantedAt: epochMsSchema,\n});\nexport type GrantedAward = z.infer<typeof GrantedAwardSchema>;\n\nexport const UserProfileSchema = z.object({\n displayName: z.string(),\n displayName_lowercase: z.string(),\n // Written `active` at registration and by the profile copy; nothing else writes it.\n userStatus: userStatusSchema,\n // Per sport, the career line; career games played is the sum of their games played, derived at\n // read and never stored.\n lifetimeStats: UserLifetimeStatsSchema.optional(),\n grantedAwards: z.array(GrantedAwardSchema).optional(),\n // The awards the account shows beside its name, each one it holds.\n primaryAwardId: awardIdSchema.optional(),\n secondaryAwardId: awardIdSchema.optional(),\n createdAt: epochMsSchema,\n updatedAt: epochMsSchema,\n});\nexport type UserProfile = z.infer<typeof UserProfileSchema>;\n\n// `userProfiles/{userId}/privateData/{userId}` — readable by its owner and by admins; written only\n// by callables.\nexport const UserPrivateDataSchema = z.object({\n email: z.string(),\n // When this login's registration started (`createRegistrationStart`); `registerUser` refuses\n // without it. Absent on an account copied from V1, which registered before the step existed.\n registrationStartedAt: epochMsSchema.optional(),\n // When the orphan-registration cleanup decided to delete this uid's login. Written in the\n // cleanup's eligibility transaction BEFORE the Auth delete, and both registration steps answer\n // `registrationExpired` in their own transactions while it is present, so no registration\n // completes into a login that is about to be deleted. Backend-only.\n orphanDeletionClaimedAt: epochMsSchema.optional(),\n // Pre-fills the contact phone when this user creates a team.\n defaultContactPhone: textFieldSchema(CONTACT_PHONE_INPUT_FORMAT).optional(),\n // The account's copy of the viewer's settings, synced with the device's. Absent means the\n // account has saved nothing and the device's own choice stands.\n theme: themeNameSchema.optional(),\n reducedMotion: z.boolean().optional(),\n updatedAt: epochMsSchema,\n});\nexport type UserPrivateData = z.infer<typeof UserPrivateDataSchema>;\n\n// `userProfiles/{userId}/historicalStats/{sportKey}` — pre-Q-Sports career totals an admin enters,\n// folded into lifetime and hall-of-fame recalculation. Absolute totals, not increments. Basketball is\n// the sport with a baseline, so it is the basketball totals line without FP, which the rebuild\n// derives when it folds the baseline in.\nexport const HistoricalStatsSchema = BasketballPlayerTotalsSchema.omit({ fantasyPoints: true });\nexport type HistoricalStats = z.infer<typeof HistoricalStatsSchema>;\n\n// Every field of a baseline, keyed so the record cannot miss one or name one the schema lacks, in the\n// order an admin enters them.\nconst HISTORICAL_STAT_ENTRY: Record<keyof HistoricalStats, true> = {\n gamesPlayed: true,\n points: true,\n rebounds: true,\n assists: true,\n};\n\n/** A baseline's totals, in the order an admin enters them. */\nexport const HISTORICAL_STAT_KEYS = Object.keys(\n HISTORICAL_STAT_ENTRY,\n) as readonly (keyof HistoricalStats)[];\n"]}
@@ -37,7 +37,7 @@ export const WaiverTemplateSchema = z
37
37
  // `_serverData/waiverTemplateRegistry` — the fence of the offered-template cap. Template creation counts
38
38
  // the templates not retired in its transaction against MAX_OFFERED_WAIVER_TEMPLATES, and a query does
39
39
  // not lock against an insert, so each creation advances `templateRevision` here: two creations at the
40
- // cap conflict instead of both passing (BACKEND-116). Only its changing matters; absent until the first
40
+ // cap conflict instead of both passing (RULE-STD-BACKEND-116). Only its changing matters; absent until the first
41
41
  // creation.
42
42
  export const WaiverTemplateRegistrySchema = z.strictObject({
43
43
  templateRevision: countSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"waiver-template.js","sourceRoot":"","sources":["../../src/doc-schemas/waiver-template.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,EAAE;AACF,mGAAmG;AACnG,+FAA+F;AAC/F,+FAA+F;AAC/F,sDAAsD;AAEtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/F,MAAM,CAAC,MAAM,sBAAsB,GAAG,uBAAuB,CAAC;AAC9D,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAEzE,4FAA4F;AAC5F,gCAAgC;AAChC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC;KAClC,MAAM,CAAC;IACN,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,OAAO,EAAE,iCAAiC;IAC1C,SAAS,EAAE,aAAa;IACxB,SAAS,EAAE,aAAa;IACxB,6FAA6F;IAC7F,6FAA6F;IAC7F,sBAAsB;IACtB,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,+FAA+F;IAC/F,6FAA6F;IAC7F,sDAAsD;IACtD,SAAS,EAAE,aAAa,CAAC,QAAQ,EAAE;IACnC,kGAAkG;IAClG,kGAAkG;IAClG,kEAAkE;IAClE,YAAY,EAAE,aAAa,CAAC,QAAQ,EAAE;CACvC,CAAC;KACD,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,KAAK,CAAC,QAAQ,CAAC,SAAS,KAAK,SAAS,CAAC,EAAE;IAC7E,OAAO,EAAE,oEAAoE;IAC7E,IAAI,EAAE,CAAC,SAAS,CAAC;CAClB,CAAC,CAAC;AAGL,yGAAyG;AACzG,sGAAsG;AACtG,sGAAsG;AACtG,wGAAwG;AACxG,YAAY;AACZ,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,YAAY,CAAC;IACzD,gBAAgB,EAAE,WAAW;CAC9B,CAAC,CAAC;AAGH,mGAAmG;AACnG,kCAAkC;AAClC,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD,OAAO,EAAE,iCAAiC;IAC1C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,uDAAuD;IACvD,iBAAiB,EAAE,YAAY,CAAC,QAAQ,EAAE;IAC1C,WAAW,EAAE,aAAa;CAC3B,CAAC,CAAC","sourcesContent":["// Waiver templates: the wording an admin authors for a league's players to sign.\n//\n// The wording is versioned. Every save that changes it publishes a new version, and each published\n// version is its own immutable document — so the exact wording in force when any signature was\n// captured still exists however the template has changed since. A signature also keeps its own\n// copy of what the signer saw (`SignedWaiverSchema`).\n\nimport { z } from 'zod';\nimport { countSchema, documentIdSegmentSchema, epochMsSchema, userIdSchema } from './atoms.js';\n\nexport const waiverTemplateIdSchema = documentIdSegmentSchema;\nexport const waiverTemplateVersionNumberSchema = z.number().int().min(1);\n\n// `waiverTemplates/{waiverTemplateId}` — the template as it reads now: its latest published\n// version's wording and number.\nexport const WaiverTemplateSchema = z\n .object({\n title: z.string(),\n waiverText: z.string(),\n version: waiverTemplateVersionNumberSchema,\n createdAt: epochMsSchema,\n updatedAt: epochMsSchema,\n // Whether the template is retired, so the templates offered to a league are one query filter\n // (`retired == false`) rather than a download of every template ever kept. True exactly when\n // `retiredAt` is set.\n retired: z.boolean(),\n // Set when an admin deletes a template a signature or a closed league still names, or one with\n // more versions than a delete removes: it is kept for them and offered to no league again. A\n // template nothing names is deleted outright instead.\n retiredAt: epochMsSchema.optional(),\n // When a league last came to require the template. The league save that chooses it writes this in\n // its own transaction so a delete's read of this document conflicts with that save; it is its own\n // field so `updatedAt` keeps meaning the template itself changed.\n lastChosenAt: epochMsSchema.optional(),\n })\n .refine((template) => template.retired === (template.retiredAt !== undefined), {\n message: 'A template is retired exactly when it records when it was retired.',\n path: ['retired'],\n });\nexport type WaiverTemplate = z.infer<typeof WaiverTemplateSchema>;\n\n// `_serverData/waiverTemplateRegistry` — the fence of the offered-template cap. Template creation counts\n// the templates not retired in its transaction against MAX_OFFERED_WAIVER_TEMPLATES, and a query does\n// not lock against an insert, so each creation advances `templateRevision` here: two creations at the\n// cap conflict instead of both passing (BACKEND-116). Only its changing matters; absent until the first\n// creation.\nexport const WaiverTemplateRegistrySchema = z.strictObject({\n templateRevision: countSchema,\n});\nexport type WaiverTemplateRegistry = z.infer<typeof WaiverTemplateRegistrySchema>;\n\n// `waiverTemplates/{waiverTemplateId}/waiverTemplateVersions/{versionId}` — one published version,\n// created once and never changed.\nexport const WaiverTemplateVersionSchema = z.object({\n version: waiverTemplateVersionNumberSchema,\n title: z.string(),\n waiverText: z.string(),\n // Absent on a version whose author was never recorded.\n publishedByUserId: userIdSchema.optional(),\n publishedAt: epochMsSchema,\n});\nexport type WaiverTemplateVersion = z.infer<typeof WaiverTemplateVersionSchema>;\n"]}
1
+ {"version":3,"file":"waiver-template.js","sourceRoot":"","sources":["../../src/doc-schemas/waiver-template.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,EAAE;AACF,mGAAmG;AACnG,+FAA+F;AAC/F,+FAA+F;AAC/F,sDAAsD;AAEtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,aAAa,E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AiC;IAC1C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,uDAAuD;IACvD,iBAAiB,EAAE,YAAY,CAAC,QAAQ,EAAE;IAC1C,WAAW,EAAE,aAAa;CAC3B,CAAC,CAAC","sourcesContent":["// Waiver templates: the wording an admin authors for a league's players to sign.\n//\n// The wording is versioned. Every save that changes it publishes a new version, and each published\n// version is its own immutable document — so the exact wording in force when any signature was\n// captured still exists however the template has changed since. A signature also keeps its own\n// copy of what the signer saw (`SignedWaiverSchema`).\n\nimport { z } from 'zod';\nimport { countSchema, documentIdSegmentSchema, epochMsSchema, userIdSchema } from './atoms.js';\n\nexport const waiverTemplateIdSchema = documentIdSegmentSchema;\nexport const waiverTemplateVersionNumberSchema = z.number().int().min(1);\n\n// `waiverTemplates/{waiverTemplateId}` — the template as it reads now: its latest published\n// version's wording and number.\nexport const WaiverTemplateSchema = z\n .object({\n title: z.string(),\n waiverText: z.string(),\n version: waiverTemplateVersionNumberSchema,\n createdAt: epochMsSchema,\n updatedAt: epochMsSchema,\n // Whether the template is retired, so the templates offered to a league are one query filter\n // (`retired == false`) rather than a download of every template ever kept. True exactly when\n // `retiredAt` is set.\n retired: z.boolean(),\n // Set when an admin deletes a template a signature or a closed league still names, or one with\n // more versions than a delete removes: it is kept for them and offered to no league again. A\n // template nothing names is deleted outright instead.\n retiredAt: epochMsSchema.optional(),\n // When a league last came to require the template. The league save that chooses it writes this in\n // its own transaction so a delete's read of this document conflicts with that save; it is its own\n // field so `updatedAt` keeps meaning the template itself changed.\n lastChosenAt: epochMsSchema.optional(),\n })\n .refine((template) => template.retired === (template.retiredAt !== undefined), {\n message: 'A template is retired exactly when it records when it was retired.',\n path: ['retired'],\n });\nexport type WaiverTemplate = z.infer<typeof WaiverTemplateSchema>;\n\n// `_serverData/waiverTemplateRegistry` — the fence of the offered-template cap. Template creation counts\n// the templates not retired in its transaction against MAX_OFFERED_WAIVER_TEMPLATES, and a query does\n// not lock against an insert, so each creation advances `templateRevision` here: two creations at the\n// cap conflict instead of both passing (RULE-STD-BACKEND-116). Only its changing matters; absent until the first\n// creation.\nexport const WaiverTemplateRegistrySchema = z.strictObject({\n templateRevision: countSchema,\n});\nexport type WaiverTemplateRegistry = z.infer<typeof WaiverTemplateRegistrySchema>;\n\n// `waiverTemplates/{waiverTemplateId}/waiverTemplateVersions/{versionId}` — one published version,\n// created once and never changed.\nexport const WaiverTemplateVersionSchema = z.object({\n version: waiverTemplateVersionNumberSchema,\n title: z.string(),\n waiverText: z.string(),\n // Absent on a version whose author was never recorded.\n publishedByUserId: userIdSchema.optional(),\n publishedAt: epochMsSchema,\n});\nexport type WaiverTemplateVersion = z.infer<typeof WaiverTemplateVersionSchema>;\n"]}
@@ -23,13 +23,13 @@ export const SignedWaiverSchema = z
23
23
  signedAt: epochMsSchema,
24
24
  // A ghost player's waiver is signed by a witness for the ghost's team: the witness's account,
25
25
  // the authority they signed under, and the ghost's name at signing — a named snapshot, so the
26
- // record still says whom it was for after the ghost's public identity is gone (ARCH-103).
26
+ // record still says whom it was for after the ghost's public identity is gone (RULE-STD-ARCH-103).
27
27
  teamId: teamIdSchema.optional(),
28
28
  witnessUserId: userIdSchema.optional(),
29
29
  witnessAuthority: waiverWitnessAuthoritySchema.optional(),
30
30
  subjectDisplayNameSnapshot: z.string().optional(),
31
31
  // A V1 witnessed waiver recorded the witness's name as it was at signing, and never the authority
32
- // or the ghost's name; the copy keeps that name as a named snapshot (ARCH-103) and guesses neither.
32
+ // or the ghost's name; the copy keeps that name as a named snapshot (RULE-STD-ARCH-103) and guesses neither.
33
33
  witnessDisplayNameSnapshot: z.string().optional(),
34
34
  })
35
35
  .refine((waiver) => {
@@ -60,7 +60,7 @@ export const HardwareItemSchema = z.strictObject({
60
60
  });
61
61
  // `hardwareLoanContracts/{contractId}` — equipment loaned to a referee: who holds it, what they hold,
62
62
  // and their signature on the loan agreement, a legal artifact. Names resolve from `publicUsers` at
63
- // read time (ARCH-103). `pending` until the referee signs; `loaned` from the signing, which keeps the
63
+ // read time (RULE-STD-ARCH-103). `pending` until the referee signs; `loaned` from the signing, which keeps the
64
64
  // signature for good; `returned` once an admin records the equipment back, the signature retained.
65
65
  export const HardwareLoanContractSchema = z
66
66
  .strictObject({
@@ -1 +1 @@
1
- {"version":3,"file":"waivers-and-hardware.js","sourceRoot":"","sources":["../../src/doc-schemas/waivers-and-hardware.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,mGAAmG;AACnG,4BAA4B;AAE5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,aAAa,EACb,gCAAgC,EAChC,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,4BAA4B,GAC7B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,qCAAqC,EACrC,sCAAsC,GACvC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,iCAAiC,EAAE,MAAM,sBAAsB,CAAC;AAEjG,iGAAiG;AACjG,gGAAgG;AAChG,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC;KAChC,MAAM,CAAC;IACN,QAAQ,EAAE,cAAc;IACxB,MAAM,EAAE,YAAY;IACpB,gBAAgB,EAAE,sBAAsB;IACxC,8FAA8F;IAC9F,2DAA2D;IAC3D,qBAAqB,EAAE,iCAAiC,CAAC,QAAQ,EAAE;IACnE,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE;IAC/B,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE;IAC9B,yFAAyF;IACzF,aAAa,EAAE,sBAAsB;IACrC,QAAQ,EAAE,aAAa;IACvB,8FAA8F;IAC9F,8FAA8F;IAC9F,0FAA0F;IAC1F,MAAM,EAAE,YAAY,CAAC,QAAQ,EAAE;IAC/B,aAAa,EAAE,YAAY,CAAC,QAAQ,EAAE;IACtC,g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\n// carries the exact wording the signer saw, as named snapshots. The templates they are signed from\n// are ./waiver-template.ts.\n\nimport { z } from 'zod';\nimport {\n epochMsSchema,\n hardwareLoanContractStatusSchema,\n leagueIdSchema,\n teamIdSchema,\n userIdSchema,\n waiverWitnessAuthoritySchema,\n} from './atoms.js';\nimport {\n PENDING_HARDWARE_LOAN_CONTRACT_STATUS,\n RETURNED_HARDWARE_LOAN_CONTRACT_STATUS,\n} from '../types/unions.js';\nimport { StorageObjectRefSchema } from './pending-media.js';\nimport { waiverTemplateIdSchema, waiverTemplateVersionNumberSchema } from './waiver-template.js';\n\n// `signedWaivers/{leagueId}_{userId}` — one signed waiver per player per league, never replaced,\n// moved, or deleted: a ghost's stays under the ghost's id after the ghost is removed or linked.\nexport const SignedWaiverSchema = z\n .object({\n leagueId: leagueIdSchema,\n userId: userIdSchema,\n waiverTemplateId: waiverTemplateIdSchema,\n // The published version of the template the signature was captured under. A record that names\n // no version has its wording snapshot as its whole record.\n waiverTemplateVersion: waiverTemplateVersionNumberSchema.optional(),\n waiverTitleSnapshot: z.string(),\n waiverTextSnapshot: z.string(),\n // The kept signature image. Read only through the signature-read callable, never by URL.\n signatureFile: StorageObjectRefSchema,\n signedAt: epochMsSchema,\n // A ghost player's waiver is signed by a witness for the ghost's team: the witness's account,\n // the authority they signed under, and the ghost's name at signing — a named snapshot, so the\n // record still says whom it was for after the ghost's public identity is gone (ARCH-103).\n teamId: teamIdSchema.optional(),\n witnessUserId: userIdSchema.optional(),\n witnessAuthority: waiverWitnessAuthoritySchema.optional(),\n subjectDisplayNameSnapshot: z.string().optional(),\n // A V1 witnessed waiver recorded the witness's name as it was at signing, and never the authority\n // or the ghost's name; the copy keeps that name as a named snapshot (ARCH-103) and guesses neither.\n witnessDisplayNameSnapshot: z.string().optional(),\n })\n .refine(\n (waiver) => {\n const full = [\n waiver.teamId,\n waiver.witnessUserId,\n waiver.witnessAuthority,\n waiver.subjectDisplayNameSnapshot,\n ];\n const legacy = [waiver.teamId, waiver.witnessUserId, waiver.witnessDisplayNameSnapshot];\n const present = (fields: readonly unknown[]) =>\n fields.filter((field) => field !== undefined).length;\n if (present([...full, waiver.witnessDisplayNameSnapshot]) === 0) return true;\n if (present(full) === full.length) return waiver.witnessDisplayNameSnapshot === undefined;\n return (\n present(legacy) === legacy.length &&\n waiver.witnessAuthority === undefined &&\n waiver.subjectDisplayNameSnapshot === undefined\n );\n },\n {\n message:\n \"A ghost's waiver carries its team, witness, authority, and name together; or, copied from V1, its team, witness, and the witness's recorded name; or none of them.\",\n path: ['witnessUserId'],\n },\n );\nexport type SignedWaiver = z.infer<typeof SignedWaiverSchema>;\n\n// One loaned item, as the contract was created with it: its catalog id and name. A contract keeps\n// what it loaned even if the catalog later changes.\nexport const HardwareItemSchema = z.strictObject({\n id: z.string().min(1),\n name: z.string().min(1),\n});\nexport type HardwareItem = z.infer<typeof HardwareItemSchema>;\n\n// `hardwareLoanContracts/{contractId}` — equipment loaned to a referee: who holds it, what they hold,\n// and their signature on the loan agreement, a legal artifact. Names resolve from `publicUsers` at\n// read time (ARCH-103). `pending` until the referee signs; `loaned` from the signing, which keeps the\n// signature for good; `returned` once an admin records the equipment back, the signature retained.\nexport const HardwareLoanContractSchema = z\n .strictObject({\n refereeUserId: userIdSchema,\n createdByUserId: userIdSchema,\n hardware: z.array(HardwareItemSchema).min(1),\n status: hardwareLoanContractStatusSchema,\n // The kept signature image. Read only through the signature-read callables, never by URL.\n signatureFile: StorageObjectRefSchema.optional(),\n createdAt: epochMsSchema,\n loanedAt: epochMsSchema.optional(),\n returnedAt: epochMsSchema.optional(),\n })\n .refine(\n (contract) =>\n contract.status === PENDING_HARDWARE_LOAN_CONTRACT_STATUS\n ? contract.signatureFile === undefined && contract.loanedAt === undefined\n : contract.signatureFile !== undefined && contract.loanedAt !== undefined,\n {\n message: 'A contract carries its signature and loan date exactly once it is signed.',\n path: ['signatureFile'],\n },\n )\n .refine(\n (contract) =>\n (contract.status === RETURNED_HARDWARE_LOAN_CONTRACT_STATUS) ===\n (contract.returnedAt !== undefined),\n {\n message: 'A contract carries its return date exactly while it is returned.',\n path: ['returnedAt'],\n },\n );\nexport type HardwareLoanContract = z.infer<typeof HardwareLoanContractSchema>;\n"]}
1
+ {"version":3,"file":"waivers-and-hardware.js","sourceRoot":"","sources":["../../src/doc-schemas/waivers-and-hardware.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,mGAAmG;AACnG,4BAA4B;AAE5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,aAAa,EACb,gCAAgC,EAChC,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,4BAA4B,GAC7B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,qCAAqC,EACrC,sCAAsC,GACvC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,iCAAiC,EAAE,MAAM,sBAAsB,CAAC;AAEjG,iGAAiG;AACjG,gGAAgG;AAChG,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC;KAChC,MAAM,CAAC;IACN,QAAQ,EAAE,cAAc;IACxB,MAAM,EAAE,YAAY;IACpB,gBAAgB,EAAE,sBAAsB;IACxC,8FAA8F;IAC9F,2DAA2D;IAC3D,qBAAqB,EAAE,iCAAiC,CAAC,QAAQ,EAAE;IACnE,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE;IAC/B,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE;IAC9B,yFAAyF;IACzF,aAAa,EAAE,sBAAsB;IACrC,QAAQ,EAAE,aAAa;IACvB,8FAA8F;IAC9F,8FAA8F;IAC9F,mGAAmG;IACnG,MAAM,EAAE,YAAY,CAAC,QAAQ,EAAE;IAC/B,aAAa,EAAE,YAAY,CAAC,QAAQ,EAAE;IACtC,gBAAgB,EAAE,4BAA4B,CAAC,QAAQ,EAAE;IACzD,0BAA0B,EAAE,CA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IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACxB,CAAC,CAAC;AAGH,sGAAsG;AACtG,mGAAmG;AACnG,+GAA+G;AAC/G,mGAAmG;AACnG,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC;KACxC,YAAY,CAAC;IACZ,aAAa,EAAE,YAAY;IAC3B,eAAe,EAAE,YAAY;IAC7B,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5C,MAAM,EAAE,gCAAgC;IACxC,0FAA0F;IAC1F,aAAa,EAAE,sBAAsB,CAAC,QAAQ,EAAE;IAChD,SAAS,EAAE,aAAa;IACxB,QAAQ,EAAE,aAAa,CAAC,QAAQ,EAAE;IAClC,UAAU,EAAE,aAAa,CAAC,QAAQ,EAAE;CACrC,CAAC;KACD,MAAM,CACL,CAAC,QAAQ,EAAE,EAAE,CACX,QAAQ,CAAC,MAAM,KAAK,qCAAqC;IACvD,CAAC,CAAC,QAAQ,CAAC,aAAa,KAAK,SAAS,IAAI,QAAQ,CAAC,QAAQ,KAAK,SAAS;IACzE,CAAC,CAAC,QAAQ,CAAC,aAAa,KAAK,SAAS,IAAI,QAAQ,CAAC,QAAQ,KAAK,SAAS,EAC7E;IACE,OAAO,EAAE,2EAA2E;IACpF,IAAI,EAAE,CAAC,eAAe,CAAC;CACxB,CACF;KACA,MAAM,CACL,CAAC,QAAQ,EAAE,EAAE,CACX,CAAC,QAAQ,CAAC,MAAM,KAAK,sCAAsC,CAAC;IAC5D,CAAC,QAAQ,CAAC,UAAU,KAAK,SAAS,CAAC,EACrC;IACE,OAAO,EAAE,kEAAkE;IAC3E,IAAI,EAAE,CAAC,YAAY,CAAC;CACrB,CACF,CAAC","sourcesContent":["// Signed waivers and referee hardware contracts. Signatures are legal artifacts: a signed waiver\n// carries the exact wording the signer saw, as named snapshots. The templates they are signed from\n// are ./waiver-template.ts.\n\nimport { z } from 'zod';\nimport {\n epochMsSchema,\n hardwareLoanContractStatusSchema,\n leagueIdSchema,\n teamIdSchema,\n userIdSchema,\n waiverWitnessAuthoritySchema,\n} from './atoms.js';\nimport {\n PENDING_HARDWARE_LOAN_CONTRACT_STATUS,\n RETURNED_HARDWARE_LOAN_CONTRACT_STATUS,\n} from '../types/unions.js';\nimport { StorageObjectRefSchema } from './pending-media.js';\nimport { waiverTemplateIdSchema, waiverTemplateVersionNumberSchema } from './waiver-template.js';\n\n// `signedWaivers/{leagueId}_{userId}` — one signed waiver per player per league, never replaced,\n// moved, or deleted: a ghost's stays under the ghost's id after the ghost is removed or linked.\nexport const SignedWaiverSchema = z\n .object({\n leagueId: leagueIdSchema,\n userId: userIdSchema,\n waiverTemplateId: waiverTemplateIdSchema,\n // The published version of the template the signature was captured under. A record that names\n // no version has its wording snapshot as its whole record.\n waiverTemplateVersion: waiverTemplateVersionNumberSchema.optional(),\n waiverTitleSnapshot: z.string(),\n waiverTextSnapshot: z.string(),\n // The kept signature image. Read only through the signature-read callable, never by URL.\n signatureFile: StorageObjectRefSchema,\n signedAt: epochMsSchema,\n // A ghost player's waiver is signed by a witness for the ghost's team: the witness's account,\n // the authority they signed under, and the ghost's name at signing — a named snapshot, so the\n // record still says whom it was for after the ghost's public identity is gone (RULE-STD-ARCH-103).\n teamId: teamIdSchema.optional(),\n witnessUserId: userIdSchema.optional(),\n witnessAuthority: waiverWitnessAuthoritySchema.optional(),\n subjectDisplayNameSnapshot: z.string().optional(),\n // A V1 witnessed waiver recorded the witness's name as it was at signing, and never the authority\n // or the ghost's name; the copy keeps that name as a named snapshot (RULE-STD-ARCH-103) and guesses neither.\n witnessDisplayNameSnapshot: z.string().optional(),\n })\n .refine(\n (waiver) => {\n const full = [\n waiver.teamId,\n waiver.witnessUserId,\n waiver.witnessAuthority,\n waiver.subjectDisplayNameSnapshot,\n ];\n const legacy = [waiver.teamId, waiver.witnessUserId, waiver.witnessDisplayNameSnapshot];\n const present = (fields: readonly unknown[]) =>\n fields.filter((field) => field !== undefined).length;\n if (present([...full, waiver.witnessDisplayNameSnapshot]) === 0) return true;\n if (present(full) === full.length) return waiver.witnessDisplayNameSnapshot === undefined;\n return (\n present(legacy) === legacy.length &&\n waiver.witnessAuthority === undefined &&\n waiver.subjectDisplayNameSnapshot === undefined\n );\n },\n {\n message:\n \"A ghost's waiver carries its team, witness, authority, and name together; or, copied from V1, its team, witness, and the witness's recorded name; or none of them.\",\n path: ['witnessUserId'],\n },\n );\nexport type SignedWaiver = z.infer<typeof SignedWaiverSchema>;\n\n// One loaned item, as the contract was created with it: its catalog id and name. A contract keeps\n// what it loaned even if the catalog later changes.\nexport const HardwareItemSchema = z.strictObject({\n id: z.string().min(1),\n name: z.string().min(1),\n});\nexport type HardwareItem = z.infer<typeof HardwareItemSchema>;\n\n// `hardwareLoanContracts/{contractId}` — equipment loaned to a referee: who holds it, what they hold,\n// and their signature on the loan agreement, a legal artifact. Names resolve from `publicUsers` at\n// read time (RULE-STD-ARCH-103). `pending` until the referee signs; `loaned` from the signing, which keeps the\n// signature for good; `returned` once an admin records the equipment back, the signature retained.\nexport const HardwareLoanContractSchema = z\n .strictObject({\n refereeUserId: userIdSchema,\n createdByUserId: userIdSchema,\n hardware: z.array(HardwareItemSchema).min(1),\n status: hardwareLoanContractStatusSchema,\n // The kept signature image. Read only through the signature-read callables, never by URL.\n signatureFile: StorageObjectRefSchema.optional(),\n createdAt: epochMsSchema,\n loanedAt: epochMsSchema.optional(),\n returnedAt: epochMsSchema.optional(),\n })\n .refine(\n (contract) =>\n contract.status === PENDING_HARDWARE_LOAN_CONTRACT_STATUS\n ? contract.signatureFile === undefined && contract.loanedAt === undefined\n : contract.signatureFile !== undefined && contract.loanedAt !== undefined,\n {\n message: 'A contract carries its signature and loan date exactly once it is signed.',\n path: ['signatureFile'],\n },\n )\n .refine(\n (contract) =>\n (contract.status === RETURNED_HARDWARE_LOAN_CONTRACT_STATUS) ===\n (contract.returnedAt !== undefined),\n {\n message: 'A contract carries its return date exactly while it is returned.',\n path: ['returnedAt'],\n },\n );\nexport type HardwareLoanContract = z.infer<typeof HardwareLoanContractSchema>;\n"]}
@@ -1,7 +1,7 @@
1
1
  // The DomainEvent union — the vocabulary of "what happened" that both sides of the boundary share.
2
2
  //
3
3
  // A callable or trigger names what it changed with one of these; the client alone maps an event to
4
- // the query-key families it makes stale (the invalidation registry is app-local, FRONTEND-102). The two
4
+ // the query-key families it makes stale (the invalidation registry is app-local, RULE-STD-FRONTEND-102). The two
5
5
  // sides share event names, never cache keys.
6
6
  import { z } from 'zod';
7
7
  import { epochMsSchema, gameIdSchema, hardwareLoanContractIdSchema, leagueIdSchema, sportKeySchema, statsValidationReportIdSchema, teamIdSchema, userIdSchema, } from '../doc-schemas/atoms.js';
@@ -400,7 +400,7 @@ export const LandingPageUpdatedEventSchema = z
400
400
  .strict();
401
401
  // A picture joined a gallery. It carries the whole new entry, so a client holding that gallery's
402
402
  // pages patches the entry in where its position sorts, and no gallery page is ever refetched for it
403
- // (FRONTEND-103). The owner's summary changed too, and the owner's own update event says so.
403
+ // (RULE-STD-FRONTEND-103). The owner's summary changed too, and the owner's own update event says so.
404
404
  export const GalleryPictureAddedEventSchema = z
405
405
  .object({
406
406
  type: z.literal('galleryPicture.added'),
@@ -1 +1 @@
1
- {"version":3,"file":"domain-events.js","sourceRoot":"","sources":["../../src/domain-events/domain-events.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,EAAE;AACF,mGAAmG;AACnG,wGAAwG;AACxG,6CAA6C;AAE7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,aAAa,EACb,YAAY,EACZ,4BAA4B,EAC5B,cAAc,EACd,cAAc,EACd,6BAA6B,EAC7B,YAAY,EACZ,YAAY,GACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC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AC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;KACnF,MAAM,EAAE,CAAC;AAEZ,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC5D,wBAAwB;IACxB,wBAAwB;IACxB,6BAA6B;IAC7B,4BAA4B;IAC5B,4BAA4B;IAC5B,8BAA8B;IAC9B,4BAA4B;IAC5B,mCAAmC;IACnC,mCAAmC;IACnC,kCAAkC;IAClC,6BAA6B;IAC7B,kCAAkC;IAClC,iCAAiC;IACjC,kCAAkC;IAClC,iCAAiC;IACjC,6BAA6B;IAC7B,4BAA4B;IAC5B,sCAAsC;IACtC,kCAAkC;IAClC,+BAA+B;IAC/B,mCAAmC;IACnC,gCAAgC;IAChC,2BAA2B;IAC3B,2BAA2B;IAC3B,4BAA4B;IAC5B,kCAAkC;IAClC,kCAAkC;IAClC,uCAAuC;IACvC,iCAAiC;IACjC,4BAA4B;IAC5B,iCAAiC;IACjC,iCAAiC;IACjC,iCAAiC;IACjC,6BAA6B;IAC7B,gCAAgC;IAChC,sCAAsC;IACtC,2BAA2B;IAC3B,yBAAyB;IACzB,6BAA6B;IAC7B,6BAA6B;IAC7B,gCAAgC;IAChC,gCAAgC;IAChC,gCAAgC;IAChC,8BAA8B;IAC9B,8BAA8B;IAC9B,8BAA8B;IAC9B,4BAA4B;IAC5B,4BAA4B;IAC5B,qCAAqC;IACrC,4CAA4C;IAC5C,mCAAmC;IACnC,6BAA6B;IAC7B,8BAA8B;IAC9B,6BAA6B;IAC7B,kCAAkC;CACnC,CAAC,CAAC","sourcesContent":["// The DomainEvent union — the vocabulary of \"what happened\" that both sides of the boundary share.\n//\n// A callable or trigger names what it changed with one of these; the client alone maps an event to\n// the query-key families it makes stale (the invalidation registry is app-local, FRONTEND-102). The two\n// sides share event names, never cache keys.\n\nimport { z } from 'zod';\nimport {\n epochMsSchema,\n gameIdSchema,\n hardwareLoanContractIdSchema,\n leagueIdSchema,\n sportKeySchema,\n statsValidationReportIdSchema,\n teamIdSchema,\n userIdSchema,\n} from '../doc-schemas/atoms.js';\nimport { awardIdSchema } from '../doc-schemas/catalogs.js';\nimport { gameLocationIdSchema } from '../doc-schemas/game-location.js';\nimport { galleryOwnerKindSchema, pictureIdSchema } from '../doc-schemas/gallery.js';\nimport { waiverTemplateIdSchema } from '../doc-schemas/waiver-template.js';\n\nexport const LeagueCreatedEventSchema = z\n .object({\n type: z.literal('league.created'),\n ids: z.object({ leagueId: leagueIdSchema }).strict(),\n })\n .strict();\n\nexport const LeagueUpdatedEventSchema = z\n .object({\n type: z.literal('league.updated'),\n ids: z.object({ leagueId: leagueIdSchema }).strict(),\n })\n .strict();\n\n// The league changed mode, and with it the `teamType` of every one of its teams.\nexport const LeagueModeSwitchedEventSchema = z\n .object({\n type: z.literal('league.modeSwitched'),\n ids: z.object({ leagueId: leagueIdSchema }).strict(),\n })\n .strict();\n\nexport const LeagueTeamCreatedEventSchema = z\n .object({\n type: z.literal('leagueTeam.created'),\n ids: z.object({ leagueId: leagueIdSchema, teamId: teamIdSchema }).strict(),\n })\n .strict();\n\n// A member was added, removed, or changed role on a team — by any path, ghosts included.\nexport const TeamRosterChangedEventSchema = z\n .object({\n type: z.literal('teamRoster.changed'),\n ids: z\n .object({ leagueId: leagueIdSchema, teamId: teamIdSchema, userId: userIdSchema })\n .strict(),\n })\n .strict();\n\n// A waiver was signed for a person in a league — by them, or for a ghost by a witness.\nexport const SignedWaiverCreatedEventSchema = z\n .object({\n type: z.literal('signedWaiver.created'),\n ids: z.object({ leagueId: leagueIdSchema, userId: userIdSchema }).strict(),\n })\n .strict();\n\nexport const GhostPlayerLinkedEventSchema = z\n .object({\n type: z.literal('ghostPlayer.linked'),\n ids: z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n ghostUserId: userIdSchema,\n realUserId: userIdSchema,\n })\n .strict(),\n })\n .strict();\n\nexport const TeamJoinRequestSubmittedEventSchema = z\n .object({\n type: z.literal('teamJoinRequest.submitted'),\n ids: z\n .object({ leagueId: leagueIdSchema, teamId: teamIdSchema, userId: userIdSchema })\n .strict(),\n })\n .strict();\n\n// The requester withdrew their join request.\nexport const TeamJoinRequestCancelledEventSchema = z\n .object({\n type: z.literal('teamJoinRequest.cancelled'),\n ids: z\n .object({ leagueId: leagueIdSchema, teamId: teamIdSchema, userId: userIdSchema })\n .strict(),\n })\n .strict();\n\n// The team accepted or rejected a join request. An acceptance also changed the roster.\nexport const TeamJoinRequestAnsweredEventSchema = z\n .object({\n type: z.literal('teamJoinRequest.answered'),\n ids: z\n .object({ leagueId: leagueIdSchema, teamId: teamIdSchema, userId: userIdSchema })\n .strict(),\n })\n .strict();\n\n// The team invited a person. `userId` is the invitee.\nexport const TeamInvitationSentEventSchema = z\n .object({\n type: z.literal('teamInvitation.sent'),\n ids: z\n .object({ leagueId: leagueIdSchema, teamId: teamIdSchema, userId: userIdSchema })\n .strict(),\n })\n .strict();\n\n// The team withdrew an invitation. `userId` is the invitee.\nexport const TeamInvitationCancelledEventSchema = z\n .object({\n type: z.literal('teamInvitation.cancelled'),\n ids: z\n .object({ leagueId: leagueIdSchema, teamId: teamIdSchema, userId: userIdSchema })\n .strict(),\n })\n .strict();\n\n// The invitee accepted or declined an invitation. An acceptance also changed the roster.\nexport const TeamInvitationAnsweredEventSchema = z\n .object({\n type: z.literal('teamInvitation.answered'),\n ids: z\n .object({ leagueId: leagueIdSchema, teamId: teamIdSchema, userId: userIdSchema })\n .strict(),\n })\n .strict();\n\n// A player signed up as a free agent in a league.\nexport const LeagueFreeAgentSignedUpEventSchema = z\n .object({\n type: z.literal('leagueFreeAgent.signedUp'),\n ids: z.object({ leagueId: leagueIdSchema, userId: userIdSchema }).strict(),\n })\n .strict();\n\n// A player's free-agent signup ended: they withdrew it, or an admin placed them on a team.\nexport const LeagueFreeAgentRemovedEventSchema = z\n .object({\n type: z.literal('leagueFreeAgent.removed'),\n ids: z.object({ leagueId: leagueIdSchema, userId: userIdSchema }).strict(),\n })\n .strict();\n\nexport const SportGameFinalizedEventSchema = z\n .object({\n type: z.literal('sportGame.finalized'),\n ids: z.object({ leagueId: leagueIdSchema, gameId: gameIdSchema }).strict(),\n })\n .strict();\n\nexport const SportGameReopenedEventSchema = z\n .object({\n type: z.literal('sportGame.reopened'),\n ids: z.object({ leagueId: leagueIdSchema, gameId: gameIdSchema }).strict(),\n })\n .strict();\n\n// A scoring write stored stat events on a live game: its rollup and score moved.\nexport const SportGameStatEventsRecordedEventSchema = z\n .object({\n type: z.literal('sportGame.statEventsRecorded'),\n ids: z.object({ leagueId: leagueIdSchema, gameId: gameIdSchema }).strict(),\n })\n .strict();\n\n// A roster entry of a live game was marked absent or present.\nexport const SportGameAbsenceChangedEventSchema = z\n .object({\n type: z.literal('sportGame.absenceChanged'),\n ids: z.object({ leagueId: leagueIdSchema, gameId: gameIdSchema }).strict(),\n })\n .strict();\n\n// A scorer's note on one person in a live game changed.\nexport const SportGameMemoUpdatedEventSchema = z\n .object({\n type: z.literal('sportGame.memoUpdated'),\n ids: z.object({ leagueId: leagueIdSchema, gameId: gameIdSchema }).strict(),\n })\n .strict();\n\n// The jump-ball possession arrow of a live basketball game moved.\nexport const SportGameJumpBallChangedEventSchema = z\n .object({\n type: z.literal('sportGame.jumpBallChanged'),\n ids: z.object({ leagueId: leagueIdSchema, gameId: gameIdSchema }).strict(),\n })\n .strict();\n\n// A league's schedule changed as a whole: a week was created, its shared fields edited, or it was\n// deleted, or a game was added to a week. Any of the league's games may have been added, changed, or\n// removed.\nexport const LeagueScheduleChangedEventSchema = z\n .object({\n type: z.literal('leagueSchedule.changed'),\n ids: z.object({ leagueId: leagueIdSchema }).strict(),\n })\n .strict();\n\n// One game's schedule changed — its week, start time, or venue — or its teams were replaced, which\n// replaces their roster entries and stat lines too.\nexport const SportGameUpdatedEventSchema = z\n .object({\n type: z.literal('sportGame.updated'),\n ids: z.object({ leagueId: leagueIdSchema, gameId: gameIdSchema }).strict(),\n })\n .strict();\n\n// One game was deleted with its events and roster.\nexport const SportGameDeletedEventSchema = z\n .object({\n type: z.literal('sportGame.deleted'),\n ids: z.object({ leagueId: leagueIdSchema, gameId: gameIdSchema }).strict(),\n })\n .strict();\n\n// A rebuild ran. Every scope id is optional: a rebuild covers one league, every league, one user,\n// every user, or one sport's hall of fame (for one user or the whole sport).\nexport const StatsRecalculatedEventSchema = z\n .object({\n type: z.literal('stats.recalculated'),\n ids: z\n .object({\n userId: userIdSchema.optional(),\n leagueId: leagueIdSchema.optional(),\n sportKey: sportKeySchema.optional(),\n })\n .strict(),\n })\n .strict();\n\n// A game's numbers were corrected or restored from its events in Fix stats; for a completed game,\n// every destination it feeds moved with them.\nexport const SportGameStatsCorrectedEventSchema = z\n .object({\n type: z.literal('sportGame.statsCorrected'),\n ids: z.object({ leagueId: leagueIdSchema, gameId: gameIdSchema }).strict(),\n })\n .strict();\n\n// A stats check wrote or advanced its report.\nexport const StatsValidationReportedEventSchema = z\n .object({\n type: z.literal('statsValidation.reported'),\n ids: z.object({ reportId: z.string().min(1) }).strict(),\n })\n .strict();\n\n// An admin deleted a stats check's report.\nexport const StatsValidationReportDeletedEventSchema = z\n .object({\n type: z.literal('statsValidation.reportDeleted'),\n ids: z.object({ reportId: statsValidationReportIdSchema }).strict(),\n })\n .strict();\n\n// A person's pre-Q-Sports baseline was written, and their career line and hall-of-fame entry rebuilt.\nexport const HistoricalStatsUpdatedEventSchema = z\n .object({\n type: z.literal('historicalStats.updated'),\n ids: z.object({ userId: userIdSchema }).strict(),\n })\n .strict();\n\n// An admin banned an account or lifted its ban.\nexport const UserStatusChangedEventSchema = z\n .object({\n type: z.literal('user.statusChanged'),\n ids: z.object({ userId: userIdSchema }).strict(),\n })\n .strict();\n\n// An award joined the catalog — its first badge was published.\nexport const AwardDefinitionCreatedEventSchema = z\n .object({\n type: z.literal('awardDefinition.created'),\n ids: z.object({ awardId: awardIdSchema }).strict(),\n })\n .strict();\n\n// An award's document changed: its badge was replaced, or its holder count moved.\nexport const AwardDefinitionUpdatedEventSchema = z\n .object({\n type: z.literal('awardDefinition.updated'),\n ids: z.object({ awardId: awardIdSchema }).strict(),\n })\n .strict();\n\nexport const AwardDefinitionDeletedEventSchema = z\n .object({\n type: z.literal('awardDefinition.deleted'),\n ids: z.object({ awardId: awardIdSchema }).strict(),\n })\n .strict();\n\n// An award was granted to or revoked from some accounts, which may have cleared a featured badge.\n// The accounts are many, so the event names the award; a client holding any profile's awards\n// refreshes them.\nexport const AwardGrantsChangedEventSchema = z\n .object({\n type: z.literal('awardGrants.changed'),\n ids: z.object({ awardId: awardIdSchema }).strict(),\n })\n .strict();\n\n// An account chose which of its awards to feature beside its name.\nexport const FeaturedAwardsChangedEventSchema = z\n .object({\n type: z.literal('featuredAwards.changed'),\n ids: z.object({ userId: userIdSchema }).strict(),\n })\n .strict();\n\n// A hardware loan contract was created, signed, returned, or deleted.\nexport const HardwareLoanContractChangedEventSchema = z\n .object({\n type: z.literal('hardwareLoanContract.changed'),\n ids: z\n .object({ contractId: hardwareLoanContractIdSchema, refereeUserId: userIdSchema })\n .strict(),\n })\n .strict();\n\nexport const AdminListChangedEventSchema = z\n .object({\n type: z.literal('adminList.changed'),\n ids: z.object({ userId: userIdSchema }).strict(),\n })\n .strict();\n\n// A new account finished registration: its profile and public identity now exist.\nexport const UserRegisteredEventSchema = z\n .object({ type: z.literal('user.registered'), ids: z.object({ userId: userIdSchema }).strict() })\n .strict();\n\nexport const DisplayNameChangedEventSchema = z\n .object({\n type: z.literal('displayName.changed'),\n ids: z.object({ userId: userIdSchema }).strict(),\n })\n .strict();\n\n// The shared stats beacon moved: stats changed somewhere. The beacon holds only its latest change,\n// not a log of them, so the event names no scope and a watching client refreshes every\n// stats-bearing read.\nexport const StatsBeaconChangedEventSchema = z\n .object({ type: z.literal('statsBeacon.changed'), ids: z.object({}).strict() })\n .strict();\n\nexport const WaiverTemplateCreatedEventSchema = z\n .object({\n type: z.literal('waiverTemplate.created'),\n ids: z.object({ waiverTemplateId: waiverTemplateIdSchema }).strict(),\n })\n .strict();\n\n// A template's wording changed: a new version was published.\nexport const WaiverTemplateUpdatedEventSchema = z\n .object({\n type: z.literal('waiverTemplate.updated'),\n ids: z.object({ waiverTemplateId: waiverTemplateIdSchema }).strict(),\n })\n .strict();\n\n// A template left the admin's list — deleted, or retired because something still names it.\nexport const WaiverTemplateDeletedEventSchema = z\n .object({\n type: z.literal('waiverTemplate.deleted'),\n ids: z.object({ waiverTemplateId: waiverTemplateIdSchema }).strict(),\n })\n .strict();\n\nexport const GameLocationCreatedEventSchema = z\n .object({\n type: z.literal('gameLocation.created'),\n ids: z.object({ gameLocationId: gameLocationIdSchema }).strict(),\n })\n .strict();\n\n// A venue's document changed — its own fields through the location callables, or its picture\n// through the upload pipeline.\nexport const GameLocationUpdatedEventSchema = z\n .object({\n type: z.literal('gameLocation.updated'),\n ids: z.object({ gameLocationId: gameLocationIdSchema }).strict(),\n })\n .strict();\n\nexport const GameLocationDeletedEventSchema = z\n .object({\n type: z.literal('gameLocation.deleted'),\n ids: z.object({ gameLocationId: gameLocationIdSchema }).strict(),\n })\n .strict();\n\n// A team's document changed: an admin renamed it or changed its type, or the picture core changed its\n// gallery summary.\nexport const LeagueTeamUpdatedEventSchema = z\n .object({\n type: z.literal('leagueTeam.updated'),\n ids: z.object({ leagueId: leagueIdSchema, teamId: teamIdSchema }).strict(),\n })\n .strict();\n\n// An admin deleted a team that never played, with its memberships, ghosts, invitations, join\n// requests, contact phone, gallery, and unplayed games.\nexport const LeagueTeamDeletedEventSchema = z\n .object({\n type: z.literal('leagueTeam.deleted'),\n ids: z.object({ leagueId: leagueIdSchema, teamId: teamIdSchema }).strict(),\n })\n .strict();\n\n// An admin's deletion of a team stopped short: some of the team's games, ghost players, invitations,\n// join requests, or memberships are gone, and the team, with its contact phone, still stands.\nexport const LeagueTeamDeletionAdvancedEventSchema = z\n .object({\n type: z.literal('leagueTeam.deletionAdvanced'),\n ids: z.object({ leagueId: leagueIdSchema, teamId: teamIdSchema }).strict(),\n })\n .strict();\n\n// A ghost player's removal took the ghost's entries off finished games of its team — each one it sat\n// out without a stat, so no result or total changed, but the games' finalized records no longer name\n// it. The event names no game.\nexport const GhostPlayerFinishedEntriesRemovedEventSchema = z\n .object({\n type: z.literal('ghostPlayer.finishedEntriesRemoved'),\n ids: z\n .object({ leagueId: leagueIdSchema, teamId: teamIdSchema, ghostUserId: userIdSchema })\n .strict(),\n })\n .strict();\n\n// An admin set a team's contact phone, which only admins read.\nexport const LeagueTeamContactUpdatedEventSchema = z\n .object({\n type: z.literal('leagueTeamContact.updated'),\n ids: z.object({ leagueId: leagueIdSchema, teamId: teamIdSchema }).strict(),\n })\n .strict();\n\n// The landing page's document changed — its copy, or its gallery summary. There is one landing page,\n// so the event names none.\nexport const LandingPageUpdatedEventSchema = z\n .object({ type: z.literal('landingPage.updated'), ids: z.object({}).strict() })\n .strict();\n\n// A picture joined a gallery. It carries the whole new entry, so a client holding that gallery's\n// pages patches the entry in where its position sorts, and no gallery page is ever refetched for it\n// (FRONTEND-103). The owner's summary changed too, and the owner's own update event says so.\nexport const GalleryPictureAddedEventSchema = z\n .object({\n type: z.literal('galleryPicture.added'),\n ids: z\n .object({\n ownerKind: galleryOwnerKindSchema,\n ownerId: z.string().min(1),\n pictureId: pictureIdSchema,\n })\n .strict(),\n position: z.string().min(1),\n createdAt: epochMsSchema,\n })\n .strict();\n\n// A dead-lettered row was replayed back onto its pipeline's queue, so the operator's dead-letter list\n// loses it. The list spans every lane, so the event names none.\nexport const DeadLetterReplayedEventSchema = z\n .object({ type: z.literal('deadLetter.replayed'), ids: z.object({}).strict() })\n .strict();\n\n// The migration console's state moved: an action ran a page, a step was recorded, or the cutover\n// was. There is one console, so the event names none.\nexport const MigrationConsoleChangedEventSchema = z\n .object({ type: z.literal('migrationConsole.changed'), ids: z.object({}).strict() })\n .strict();\n\nexport const DomainEventSchema = z.discriminatedUnion('type', [\n LeagueCreatedEventSchema,\n LeagueUpdatedEventSchema,\n LeagueModeSwitchedEventSchema,\n LeagueTeamCreatedEventSchema,\n TeamRosterChangedEventSchema,\n SignedWaiverCreatedEventSchema,\n GhostPlayerLinkedEventSchema,\n TeamJoinRequestSubmittedEventSchema,\n TeamJoinRequestCancelledEventSchema,\n TeamJoinRequestAnsweredEventSchema,\n TeamInvitationSentEventSchema,\n TeamInvitationCancelledEventSchema,\n TeamInvitationAnsweredEventSchema,\n LeagueFreeAgentSignedUpEventSchema,\n LeagueFreeAgentRemovedEventSchema,\n SportGameFinalizedEventSchema,\n SportGameReopenedEventSchema,\n SportGameStatEventsRecordedEventSchema,\n SportGameAbsenceChangedEventSchema,\n SportGameMemoUpdatedEventSchema,\n SportGameJumpBallChangedEventSchema,\n LeagueScheduleChangedEventSchema,\n SportGameUpdatedEventSchema,\n SportGameDeletedEventSchema,\n StatsRecalculatedEventSchema,\n SportGameStatsCorrectedEventSchema,\n StatsValidationReportedEventSchema,\n StatsValidationReportDeletedEventSchema,\n HistoricalStatsUpdatedEventSchema,\n UserStatusChangedEventSchema,\n AwardDefinitionCreatedEventSchema,\n AwardDefinitionUpdatedEventSchema,\n AwardDefinitionDeletedEventSchema,\n AwardGrantsChangedEventSchema,\n FeaturedAwardsChangedEventSchema,\n HardwareLoanContractChangedEventSchema,\n AdminListChangedEventSchema,\n UserRegisteredEventSchema,\n DisplayNameChangedEventSchema,\n StatsBeaconChangedEventSchema,\n WaiverTemplateCreatedEventSchema,\n WaiverTemplateUpdatedEventSchema,\n WaiverTemplateDeletedEventSchema,\n GameLocationCreatedEventSchema,\n GameLocationUpdatedEventSchema,\n GameLocationDeletedEventSchema,\n LeagueTeamUpdatedEventSchema,\n LeagueTeamDeletedEventSchema,\n LeagueTeamDeletionAdvancedEventSchema,\n GhostPlayerFinishedEntriesRemovedEventSchema,\n LeagueTeamContactUpdatedEventSchema,\n LandingPageUpdatedEventSchema,\n GalleryPictureAddedEventSchema,\n DeadLetterReplayedEventSchema,\n MigrationConsoleChangedEventSchema,\n]);\nexport type DomainEvent = z.infer<typeof DomainEventSchema>;\nexport type DomainEventType = DomainEvent['type'];\n"]}
1
+ {"version":3,"file":"domain-events.js","sourceRoot":"","sources":["../../src/domain-events/domain-events.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,EAAE;AACF,mGAAmG;AACnG,iHAAiH;AACjH,6CAA6C;AAE7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,aAAa,EACb,YAAY,EACZ,4BAA4B,EAC5B,cAAc,EACd,cAAc,EACd,6BAA6B,EAC7B,YAAY,EACZ,YAAY,GACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACpF,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAE3E,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC;KACtC,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC;IACjC,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;CACrD,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC;KACtC,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC;IACjC,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;CACrD,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,iFAAiF;AACjF,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC;KAC3C,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,OA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B;IAC7B,6BAA6B;IAC7B,gCAAgC;IAChC,gCAAgC;IAChC,gCAAgC;IAChC,8BAA8B;IAC9B,8BAA8B;IAC9B,8BAA8B;IAC9B,4BAA4B;IAC5B,4BAA4B;IAC5B,qCAAqC;IACrC,4CAA4C;IAC5C,mCAAmC;IACnC,6BAA6B;IAC7B,8BAA8B;IAC9B,6BAA6B;IAC7B,kCAAkC;CACnC,CAAC,CAAC","sourcesContent":["// The DomainEvent union — the vocabulary of \"what happened\" that both sides of the boundary share.\n//\n// A callable or trigger names what it changed with one of these; the client alone maps an event to\n// the query-key families it makes stale (the invalidation registry is app-local, RULE-STD-FRONTEND-102). The two\n// sides share event names, never cache keys.\n\nimport { z } from 'zod';\nimport {\n epochMsSchema,\n gameIdSchema,\n hardwareLoanContractIdSchema,\n leagueIdSchema,\n sportKeySchema,\n statsValidationReportIdSchema,\n teamIdSchema,\n userIdSchema,\n} from '../doc-schemas/atoms.js';\nimport { awardIdSchema } from '../doc-schemas/catalogs.js';\nimport { gameLocationIdSchema } from '../doc-schemas/game-location.js';\nimport { galleryOwnerKindSchema, pictureIdSchema } from '../doc-schemas/gallery.js';\nimport { waiverTemplateIdSchema } from '../doc-schemas/waiver-template.js';\n\nexport const LeagueCreatedEventSchema = z\n .object({\n type: z.literal('league.created'),\n ids: z.object({ leagueId: leagueIdSchema }).strict(),\n })\n .strict();\n\nexport const LeagueUpdatedEventSchema = z\n .object({\n type: z.literal('league.updated'),\n ids: z.object({ leagueId: leagueIdSchema }).strict(),\n })\n .strict();\n\n// The league changed mode, and with it the `teamType` of every one of its teams.\nexport const LeagueModeSwitchedEventSchema = z\n .object({\n type: z.literal('league.modeSwitched'),\n ids: z.object({ leagueId: leagueIdSchema }).strict(),\n })\n .strict();\n\nexport const LeagueTeamCreatedEventSchema = z\n .object({\n type: z.literal('leagueTeam.created'),\n ids: z.object({ leagueId: leagueIdSchema, teamId: teamIdSchema }).strict(),\n })\n .strict();\n\n// A member was added, removed, or changed role on a team — by any path, ghosts included.\nexport const TeamRosterChangedEventSchema = z\n .object({\n type: z.literal('teamRoster.changed'),\n ids: z\n .object({ leagueId: leagueIdSchema, teamId: teamIdSchema, userId: userIdSchema })\n .strict(),\n })\n .strict();\n\n// A waiver was signed for a person in a league — by them, or for a ghost by a witness.\nexport const SignedWaiverCreatedEventSchema = z\n .object({\n type: z.literal('signedWaiver.created'),\n ids: z.object({ leagueId: leagueIdSchema, userId: userIdSchema }).strict(),\n })\n .strict();\n\nexport const GhostPlayerLinkedEventSchema = z\n .object({\n type: z.literal('ghostPlayer.linked'),\n ids: z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n ghostUserId: userIdSchema,\n realUserId: userIdSchema,\n })\n .strict(),\n })\n .strict();\n\nexport const TeamJoinRequestSubmittedEventSchema = z\n .object({\n type: z.literal('teamJoinRequest.submitted'),\n ids: z\n .object({ leagueId: leagueIdSchema, teamId: teamIdSchema, userId: userIdSchema })\n .strict(),\n })\n .strict();\n\n// The requester withdrew their join request.\nexport const TeamJoinRequestCancelledEventSchema = z\n .object({\n type: z.literal('teamJoinRequest.cancelled'),\n ids: z\n .object({ leagueId: leagueIdSchema, teamId: teamIdSchema, userId: userIdSchema })\n .strict(),\n })\n .strict();\n\n// The team accepted or rejected a join request. An acceptance also changed the roster.\nexport const TeamJoinRequestAnsweredEventSchema = z\n .object({\n type: z.literal('teamJoinRequest.answered'),\n ids: z\n .object({ leagueId: leagueIdSchema, teamId: teamIdSchema, userId: userIdSchema })\n .strict(),\n })\n .strict();\n\n// The team invited a person. `userId` is the invitee.\nexport const TeamInvitationSentEventSchema = z\n .object({\n type: z.literal('teamInvitation.sent'),\n ids: z\n .object({ leagueId: leagueIdSchema, teamId: teamIdSchema, userId: userIdSchema })\n .strict(),\n })\n .strict();\n\n// The team withdrew an invitation. `userId` is the invitee.\nexport const TeamInvitationCancelledEventSchema = z\n .object({\n type: z.literal('teamInvitation.cancelled'),\n ids: z\n .object({ leagueId: leagueIdSchema, teamId: teamIdSchema, userId: userIdSchema })\n .strict(),\n })\n .strict();\n\n// The invitee accepted or declined an invitation. An acceptance also changed the roster.\nexport const TeamInvitationAnsweredEventSchema = z\n .object({\n type: z.literal('teamInvitation.answered'),\n ids: z\n .object({ leagueId: leagueIdSchema, teamId: teamIdSchema, userId: userIdSchema })\n .strict(),\n })\n .strict();\n\n// A player signed up as a free agent in a league.\nexport const LeagueFreeAgentSignedUpEventSchema = z\n .object({\n type: z.literal('leagueFreeAgent.signedUp'),\n ids: z.object({ leagueId: leagueIdSchema, userId: userIdSchema }).strict(),\n })\n .strict();\n\n// A player's free-agent signup ended: they withdrew it, or an admin placed them on a team.\nexport const LeagueFreeAgentRemovedEventSchema = z\n .object({\n type: z.literal('leagueFreeAgent.removed'),\n ids: z.object({ leagueId: leagueIdSchema, userId: userIdSchema }).strict(),\n })\n .strict();\n\nexport const SportGameFinalizedEventSchema = z\n .object({\n type: z.literal('sportGame.finalized'),\n ids: z.object({ leagueId: leagueIdSchema, gameId: gameIdSchema }).strict(),\n })\n .strict();\n\nexport const SportGameReopenedEventSchema = z\n .object({\n type: z.literal('sportGame.reopened'),\n ids: z.object({ leagueId: leagueIdSchema, gameId: gameIdSchema }).strict(),\n })\n .strict();\n\n// A scoring write stored stat events on a live game: its rollup and score moved.\nexport const SportGameStatEventsRecordedEventSchema = z\n .object({\n type: z.literal('sportGame.statEventsRecorded'),\n ids: z.object({ leagueId: leagueIdSchema, gameId: gameIdSchema }).strict(),\n })\n .strict();\n\n// A roster entry of a live game was marked absent or present.\nexport const SportGameAbsenceChangedEventSchema = z\n .object({\n type: z.literal('sportGame.absenceChanged'),\n ids: z.object({ leagueId: leagueIdSchema, gameId: gameIdSchema }).strict(),\n })\n .strict();\n\n// A scorer's note on one person in a live game changed.\nexport const SportGameMemoUpdatedEventSchema = z\n .object({\n type: z.literal('sportGame.memoUpdated'),\n ids: z.object({ leagueId: leagueIdSchema, gameId: gameIdSchema }).strict(),\n })\n .strict();\n\n// The jump-ball possession arrow of a live basketball game moved.\nexport const SportGameJumpBallChangedEventSchema = z\n .object({\n type: z.literal('sportGame.jumpBallChanged'),\n ids: z.object({ leagueId: leagueIdSchema, gameId: gameIdSchema }).strict(),\n })\n .strict();\n\n// A league's schedule changed as a whole: a week was created, its shared fields edited, or it was\n// deleted, or a game was added to a week. Any of the league's games may have been added, changed, or\n// removed.\nexport const LeagueScheduleChangedEventSchema = z\n .object({\n type: z.literal('leagueSchedule.changed'),\n ids: z.object({ leagueId: leagueIdSchema }).strict(),\n })\n .strict();\n\n// One game's schedule changed — its week, start time, or venue — or its teams were replaced, which\n// replaces their roster entries and stat lines too.\nexport const SportGameUpdatedEventSchema = z\n .object({\n type: z.literal('sportGame.updated'),\n ids: z.object({ leagueId: leagueIdSchema, gameId: gameIdSchema }).strict(),\n })\n .strict();\n\n// One game was deleted with its events and roster.\nexport const SportGameDeletedEventSchema = z\n .object({\n type: z.literal('sportGame.deleted'),\n ids: z.object({ leagueId: leagueIdSchema, gameId: gameIdSchema }).strict(),\n })\n .strict();\n\n// A rebuild ran. Every scope id is optional: a rebuild covers one league, every league, one user,\n// every user, or one sport's hall of fame (for one user or the whole sport).\nexport const StatsRecalculatedEventSchema = z\n .object({\n type: z.literal('stats.recalculated'),\n ids: z\n .object({\n userId: userIdSchema.optional(),\n leagueId: leagueIdSchema.optional(),\n sportKey: sportKeySchema.optional(),\n })\n .strict(),\n })\n .strict();\n\n// A game's numbers were corrected or restored from its events in Fix stats; for a completed game,\n// every destination it feeds moved with them.\nexport const SportGameStatsCorrectedEventSchema = z\n .object({\n type: z.literal('sportGame.statsCorrected'),\n ids: z.object({ leagueId: leagueIdSchema, gameId: gameIdSchema }).strict(),\n })\n .strict();\n\n// A stats check wrote or advanced its report.\nexport const StatsValidationReportedEventSchema = z\n .object({\n type: z.literal('statsValidation.reported'),\n ids: z.object({ reportId: z.string().min(1) }).strict(),\n })\n .strict();\n\n// An admin deleted a stats check's report.\nexport const StatsValidationReportDeletedEventSchema = z\n .object({\n type: z.literal('statsValidation.reportDeleted'),\n ids: z.object({ reportId: statsValidationReportIdSchema }).strict(),\n })\n .strict();\n\n// A person's pre-Q-Sports baseline was written, and their career line and hall-of-fame entry rebuilt.\nexport const HistoricalStatsUpdatedEventSchema = z\n .object({\n type: z.literal('historicalStats.updated'),\n ids: z.object({ userId: userIdSchema }).strict(),\n })\n .strict();\n\n// An admin banned an account or lifted its ban.\nexport const UserStatusChangedEventSchema = z\n .object({\n type: z.literal('user.statusChanged'),\n ids: z.object({ userId: userIdSchema }).strict(),\n })\n .strict();\n\n// An award joined the catalog — its first badge was published.\nexport const AwardDefinitionCreatedEventSchema = z\n .object({\n type: z.literal('awardDefinition.created'),\n ids: z.object({ awardId: awardIdSchema }).strict(),\n })\n .strict();\n\n// An award's document changed: its badge was replaced, or its holder count moved.\nexport const AwardDefinitionUpdatedEventSchema = z\n .object({\n type: z.literal('awardDefinition.updated'),\n ids: z.object({ awardId: awardIdSchema }).strict(),\n })\n .strict();\n\nexport const AwardDefinitionDeletedEventSchema = z\n .object({\n type: z.literal('awardDefinition.deleted'),\n ids: z.object({ awardId: awardIdSchema }).strict(),\n })\n .strict();\n\n// An award was granted to or revoked from some accounts, which may have cleared a featured badge.\n// The accounts are many, so the event names the award; a client holding any profile's awards\n// refreshes them.\nexport const AwardGrantsChangedEventSchema = z\n .object({\n type: z.literal('awardGrants.changed'),\n ids: z.object({ awardId: awardIdSchema }).strict(),\n })\n .strict();\n\n// An account chose which of its awards to feature beside its name.\nexport const FeaturedAwardsChangedEventSchema = z\n .object({\n type: z.literal('featuredAwards.changed'),\n ids: z.object({ userId: userIdSchema }).strict(),\n })\n .strict();\n\n// A hardware loan contract was created, signed, returned, or deleted.\nexport const HardwareLoanContractChangedEventSchema = z\n .object({\n type: z.literal('hardwareLoanContract.changed'),\n ids: z\n .object({ contractId: hardwareLoanContractIdSchema, refereeUserId: userIdSchema })\n .strict(),\n })\n .strict();\n\nexport const AdminListChangedEventSchema = z\n .object({\n type: z.literal('adminList.changed'),\n ids: z.object({ userId: userIdSchema }).strict(),\n })\n .strict();\n\n// A new account finished registration: its profile and public identity now exist.\nexport const UserRegisteredEventSchema = z\n .object({ type: z.literal('user.registered'), ids: z.object({ userId: userIdSchema }).strict() })\n .strict();\n\nexport const DisplayNameChangedEventSchema = z\n .object({\n type: z.literal('displayName.changed'),\n ids: z.object({ userId: userIdSchema }).strict(),\n })\n .strict();\n\n// The shared stats beacon moved: stats changed somewhere. The beacon holds only its latest change,\n// not a log of them, so the event names no scope and a watching client refreshes every\n// stats-bearing read.\nexport const StatsBeaconChangedEventSchema = z\n .object({ type: z.literal('statsBeacon.changed'), ids: z.object({}).strict() })\n .strict();\n\nexport const WaiverTemplateCreatedEventSchema = z\n .object({\n type: z.literal('waiverTemplate.created'),\n ids: z.object({ waiverTemplateId: waiverTemplateIdSchema }).strict(),\n })\n .strict();\n\n// A template's wording changed: a new version was published.\nexport const WaiverTemplateUpdatedEventSchema = z\n .object({\n type: z.literal('waiverTemplate.updated'),\n ids: z.object({ waiverTemplateId: waiverTemplateIdSchema }).strict(),\n })\n .strict();\n\n// A template left the admin's list — deleted, or retired because something still names it.\nexport const WaiverTemplateDeletedEventSchema = z\n .object({\n type: z.literal('waiverTemplate.deleted'),\n ids: z.object({ waiverTemplateId: waiverTemplateIdSchema }).strict(),\n })\n .strict();\n\nexport const GameLocationCreatedEventSchema = z\n .object({\n type: z.literal('gameLocation.created'),\n ids: z.object({ gameLocationId: gameLocationIdSchema }).strict(),\n })\n .strict();\n\n// A venue's document changed — its own fields through the location callables, or its picture\n// through the upload pipeline.\nexport const GameLocationUpdatedEventSchema = z\n .object({\n type: z.literal('gameLocation.updated'),\n ids: z.object({ gameLocationId: gameLocationIdSchema }).strict(),\n })\n .strict();\n\nexport const GameLocationDeletedEventSchema = z\n .object({\n type: z.literal('gameLocation.deleted'),\n ids: z.object({ gameLocationId: gameLocationIdSchema }).strict(),\n })\n .strict();\n\n// A team's document changed: an admin renamed it or changed its type, or the picture core changed its\n// gallery summary.\nexport const LeagueTeamUpdatedEventSchema = z\n .object({\n type: z.literal('leagueTeam.updated'),\n ids: z.object({ leagueId: leagueIdSchema, teamId: teamIdSchema }).strict(),\n })\n .strict();\n\n// An admin deleted a team that never played, with its memberships, ghosts, invitations, join\n// requests, contact phone, gallery, and unplayed games.\nexport const LeagueTeamDeletedEventSchema = z\n .object({\n type: z.literal('leagueTeam.deleted'),\n ids: z.object({ leagueId: leagueIdSchema, teamId: teamIdSchema }).strict(),\n })\n .strict();\n\n// An admin's deletion of a team stopped short: some of the team's games, ghost players, invitations,\n// join requests, or memberships are gone, and the team, with its contact phone, still stands.\nexport const LeagueTeamDeletionAdvancedEventSchema = z\n .object({\n type: z.literal('leagueTeam.deletionAdvanced'),\n ids: z.object({ leagueId: leagueIdSchema, teamId: teamIdSchema }).strict(),\n })\n .strict();\n\n// A ghost player's removal took the ghost's entries off finished games of its team — each one it sat\n// out without a stat, so no result or total changed, but the games' finalized records no longer name\n// it. The event names no game.\nexport const GhostPlayerFinishedEntriesRemovedEventSchema = z\n .object({\n type: z.literal('ghostPlayer.finishedEntriesRemoved'),\n ids: z\n .object({ leagueId: leagueIdSchema, teamId: teamIdSchema, ghostUserId: userIdSchema })\n .strict(),\n })\n .strict();\n\n// An admin set a team's contact phone, which only admins read.\nexport const LeagueTeamContactUpdatedEventSchema = z\n .object({\n type: z.literal('leagueTeamContact.updated'),\n ids: z.object({ leagueId: leagueIdSchema, teamId: teamIdSchema }).strict(),\n })\n .strict();\n\n// The landing page's document changed — its copy, or its gallery summary. There is one landing page,\n// so the event names none.\nexport const LandingPageUpdatedEventSchema = z\n .object({ type: z.literal('landingPage.updated'), ids: z.object({}).strict() })\n .strict();\n\n// A picture joined a gallery. It carries the whole new entry, so a client holding that gallery's\n// pages patches the entry in where its position sorts, and no gallery page is ever refetched for it\n// (RULE-STD-FRONTEND-103). The owner's summary changed too, and the owner's own update event says so.\nexport const GalleryPictureAddedEventSchema = z\n .object({\n type: z.literal('galleryPicture.added'),\n ids: z\n .object({\n ownerKind: galleryOwnerKindSchema,\n ownerId: z.string().min(1),\n pictureId: pictureIdSchema,\n })\n .strict(),\n position: z.string().min(1),\n createdAt: epochMsSchema,\n })\n .strict();\n\n// A dead-lettered row was replayed back onto its pipeline's queue, so the operator's dead-letter list\n// loses it. The list spans every lane, so the event names none.\nexport const DeadLetterReplayedEventSchema = z\n .object({ type: z.literal('deadLetter.replayed'), ids: z.object({}).strict() })\n .strict();\n\n// The migration console's state moved: an action ran a page, a step was recorded, or the cutover\n// was. There is one console, so the event names none.\nexport const MigrationConsoleChangedEventSchema = z\n .object({ type: z.literal('migrationConsole.changed'), ids: z.object({}).strict() })\n .strict();\n\nexport const DomainEventSchema = z.discriminatedUnion('type', [\n LeagueCreatedEventSchema,\n LeagueUpdatedEventSchema,\n LeagueModeSwitchedEventSchema,\n LeagueTeamCreatedEventSchema,\n TeamRosterChangedEventSchema,\n SignedWaiverCreatedEventSchema,\n GhostPlayerLinkedEventSchema,\n TeamJoinRequestSubmittedEventSchema,\n TeamJoinRequestCancelledEventSchema,\n TeamJoinRequestAnsweredEventSchema,\n TeamInvitationSentEventSchema,\n TeamInvitationCancelledEventSchema,\n TeamInvitationAnsweredEventSchema,\n LeagueFreeAgentSignedUpEventSchema,\n LeagueFreeAgentRemovedEventSchema,\n SportGameFinalizedEventSchema,\n SportGameReopenedEventSchema,\n SportGameStatEventsRecordedEventSchema,\n SportGameAbsenceChangedEventSchema,\n SportGameMemoUpdatedEventSchema,\n SportGameJumpBallChangedEventSchema,\n LeagueScheduleChangedEventSchema,\n SportGameUpdatedEventSchema,\n SportGameDeletedEventSchema,\n StatsRecalculatedEventSchema,\n SportGameStatsCorrectedEventSchema,\n StatsValidationReportedEventSchema,\n StatsValidationReportDeletedEventSchema,\n HistoricalStatsUpdatedEventSchema,\n UserStatusChangedEventSchema,\n AwardDefinitionCreatedEventSchema,\n AwardDefinitionUpdatedEventSchema,\n AwardDefinitionDeletedEventSchema,\n AwardGrantsChangedEventSchema,\n FeaturedAwardsChangedEventSchema,\n HardwareLoanContractChangedEventSchema,\n AdminListChangedEventSchema,\n UserRegisteredEventSchema,\n DisplayNameChangedEventSchema,\n StatsBeaconChangedEventSchema,\n WaiverTemplateCreatedEventSchema,\n WaiverTemplateUpdatedEventSchema,\n WaiverTemplateDeletedEventSchema,\n GameLocationCreatedEventSchema,\n GameLocationUpdatedEventSchema,\n GameLocationDeletedEventSchema,\n LeagueTeamUpdatedEventSchema,\n LeagueTeamDeletedEventSchema,\n LeagueTeamDeletionAdvancedEventSchema,\n GhostPlayerFinishedEntriesRemovedEventSchema,\n LeagueTeamContactUpdatedEventSchema,\n LandingPageUpdatedEventSchema,\n GalleryPictureAddedEventSchema,\n DeadLetterReplayedEventSchema,\n MigrationConsoleChangedEventSchema,\n]);\nexport type DomainEvent = z.infer<typeof DomainEventSchema>;\nexport type DomainEventType = DomainEvent['type'];\n"]}
@@ -1,7 +1,7 @@
1
1
  // Award group grant ids. Every decision on one award for one group shares that pair's target key,
2
2
  // and each decision's record id is the key plus its decision number — deterministic, so two
3
3
  // decisions racing for the same number write the same document and conflict instead of both
4
- // committing (BACKEND-304).
4
+ // committing (RULE-STD-BACKEND-304).
5
5
  // A part prefixed by its length, so parts that contain any character still decode one way.
6
6
  const lengthPrefixed = (part) => `${part.length}:${part}`;
7
7
  const DECISION_SEPARATOR = '~';
@@ -1 +1 @@
1
- {"version":3,"file":"award-grant-ids.js","sourceRoot":"","sources":["../../src/ids/award-grant-ids.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,4FAA4F;AAC5F,4FAA4F;AAC5F,4BAA4B;AAU5B,2FAA2F;AAC3F,MAAM,cAAc,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC;AAE1E,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAE/B,4DAA4D;AAC5D,MAAM,UAAU,6BAA6B,CAAC,MAA6B;IACzE,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACzF,CAAC;AAED,gGAAgG;AAChG,qDAAqD;AACrD,MAAM,UAAU,sBAAsB,CAAC,SAAiB,EAAE,QAAgB;IACxE,OAAO,GAAG,SAAS,GAAG,kBAAkB,GAAG,QAAQ,EAAE,CAAC;AACxD,CAAC","sourcesContent":["// Award group grant ids. Every decision on one award for one group shares that pair's target key,\n// and each decision's record id is the key plus its decision number — deterministic, so two\n// decisions racing for the same number write the same document and conflict instead of both\n// committing (BACKEND-304).\n\nimport type { AwardGroupType } from '../types/unions.js';\n\nexport interface AwardGroupGrantTarget {\n readonly awardId: string;\n readonly groupType: AwardGroupType;\n readonly groupId: string;\n}\n\n// A part prefixed by its length, so parts that contain any character still decode one way.\nconst lengthPrefixed = (part: string): string => `${part.length}:${part}`;\n\nconst DECISION_SEPARATOR = '~';\n\n// The key every decision on one award for one group shares.\nexport function buildAwardGroupGrantTargetKey(target: AwardGroupGrantTarget): string {\n return [target.awardId, target.groupType, target.groupId].map(lengthPrefixed).join('');\n}\n\n// awardGroupGrants/{targetKey}~{decision}. The target key is length-prefixed throughout, so the\n// decision after the last separator decodes one way.\nexport function buildAwardGroupGrantId(targetKey: string, decision: number): string {\n return `${targetKey}${DECISION_SEPARATOR}${decision}`;\n}\n"]}
1
+ {"version":3,"file":"award-grant-ids.js","sourceRoot":"","sources":["../../src/ids/award-grant-ids.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,4FAA4F;AAC5F,4FAA4F;AAC5F,qCAAqC;AAUrC,2FAA2F;AAC3F,MAAM,cAAc,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC;AAE1E,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAE/B,4DAA4D;AAC5D,MAAM,UAAU,6BAA6B,CAAC,MAA6B;IACzE,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACzF,CAAC;AAED,gGAAgG;AAChG,qDAAqD;AACrD,MAAM,UAAU,sBAAsB,CAAC,SAAiB,EAAE,QAAgB;IACxE,OAAO,GAAG,SAAS,GAAG,kBAAkB,GAAG,QAAQ,EAAE,CAAC;AACxD,CAAC","sourcesContent":["// Award group grant ids. Every decision on one award for one group shares that pair's target key,\n// and each decision's record id is the key plus its decision number — deterministic, so two\n// decisions racing for the same number write the same document and conflict instead of both\n// committing (RULE-STD-BACKEND-304).\n\nimport type { AwardGroupType } from '../types/unions.js';\n\nexport interface AwardGroupGrantTarget {\n readonly awardId: string;\n readonly groupType: AwardGroupType;\n readonly groupId: string;\n}\n\n// A part prefixed by its length, so parts that contain any character still decode one way.\nconst lengthPrefixed = (part: string): string => `${part.length}:${part}`;\n\nconst DECISION_SEPARATOR = '~';\n\n// The key every decision on one award for one group shares.\nexport function buildAwardGroupGrantTargetKey(target: AwardGroupGrantTarget): string {\n return [target.awardId, target.groupType, target.groupId].map(lengthPrefixed).join('');\n}\n\n// awardGroupGrants/{targetKey}~{decision}. The target key is length-prefixed throughout, so the\n// decision after the last separator decodes one way.\nexport function buildAwardGroupGrantId(targetKey: string, decision: number): string {\n return `${targetKey}${DECISION_SEPARATOR}${decision}`;\n}\n"]}
@@ -1,4 +1,4 @@
1
- // Compound document IDs — one builder and one parser per relationship (ARCH-109).
1
+ // Compound document IDs — one builder and one parser per relationship (RULE-STD-ARCH-109).
2
2
  //
3
3
  // `firestore.rules` restates these formats, because a rules file cannot import them.
4
4
  //
@@ -1 +1 @@
1
- {"version":3,"file":"compound-ids.js","sourceRoot":"","sources":["../../src/ids/compound-ids.ts"],"names":[],"mappings":"AAA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AAC,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACjE,CAAC","sourcesContent":["// Compound document IDs — one builder and one parser per relationship (ARCH-109).\n//\n// `firestore.rules` restates these formats, because a rules file cannot import them.\n//\n// League and team ids are Firestore auto ids and never contain the separator. A user id can: a\n// ghost id is `ghost_<timestamp>_<suffix>`. So the user id is always the LAST part, and a parser\n// splits only on the leading separators and keeps the remainder whole.\n\nexport const COMPOUND_ID_SEPARATOR = '_';\n\nfunction splitLeading(id: string, leadingParts: number): string[] | null {\n const parts: string[] = [];\n let rest = id;\n for (let i = 0; i < leadingParts; i += 1) {\n const at = rest.indexOf(COMPOUND_ID_SEPARATOR);\n if (at <= 0) return null;\n parts.push(rest.slice(0, at));\n rest = rest.slice(at + COMPOUND_ID_SEPARATOR.length);\n }\n if (rest.length === 0) return null;\n parts.push(rest);\n return parts;\n}\n\n// teamMemberships/{leagueId}_{teamId}_{userId}\nexport interface TeamMembershipIdParts {\n leagueId: string;\n teamId: string;\n userId: string;\n}\n\nexport function buildTeamMembershipId(leagueId: string, teamId: string, userId: string): string {\n return [leagueId, teamId, userId].join(COMPOUND_ID_SEPARATOR);\n}\n\nexport function parseTeamMembershipId(id: string): TeamMembershipIdParts | null {\n const parts = splitLeading(id, 2);\n return parts ? { leagueId: parts[0], teamId: parts[1], userId: parts[2] } : null;\n}\n\n// leagueFreeAgents/{leagueId}_{userId}\nexport interface LeagueFreeAgentIdParts {\n leagueId: string;\n userId: string;\n}\n\nexport function buildLeagueFreeAgentId(leagueId: string, userId: string): string {\n return [leagueId, userId].join(COMPOUND_ID_SEPARATOR);\n}\n\nexport function parseLeagueFreeAgentId(id: string): LeagueFreeAgentIdParts | null {\n const parts = splitLeading(id, 1);\n return parts ? { leagueId: parts[0], userId: parts[1] } : null;\n}\n\n// sportGames/{gameId}/gameRosterPlayers/{teamId}_{userId} — one roster entry per team per person, so\n// a person rostered on both teams of a game holds two. The same id keys the entry's line in the\n// game's `stats.playerStats` and names it in the game's absence and participation lists.\nexport interface GameRosterPlayerIdParts {\n teamId: string;\n userId: string;\n}\n\nexport function buildGameRosterPlayerId(teamId: string, userId: string): string {\n return [teamId, userId].join(COMPOUND_ID_SEPARATOR);\n}\n\nexport function parseGameRosterPlayerId(id: string): GameRosterPlayerIdParts | null {\n const parts = splitLeading(id, 1);\n return parts ? { teamId: parts[0], userId: parts[1] } : null;\n}\n\n// signedWaivers/{leagueId}_{userId}\nexport interface SignedWaiverIdParts {\n leagueId: string;\n userId: string;\n}\n\nexport function buildSignedWaiverId(leagueId: string, userId: string): string {\n return [leagueId, userId].join(COMPOUND_ID_SEPARATOR);\n}\n\nexport function parseSignedWaiverId(id: string): SignedWaiverIdParts | null {\n const parts = splitLeading(id, 1);\n return parts ? { leagueId: parts[0], userId: parts[1] } : null;\n}\n"]}
1
+ {"version":3,"file":"compound-ids.js","sourceRoot":"","sources":["../../src/ids/compound-ids.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,EAAE;AACF,qFAAqF;AACrF,EAAE;AACF,+FAA+F;AAC/F,iGAAiG;AACjG,uEAAuE;AAEvE,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAEzC,SAAS,YAAY,CAAC,EAAU,EAAE,YAAoB;IACpD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACzC,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;QAC/C,IAAI,EAAE,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QACzB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QAC9B,IAAI,GAAG,IAAI,CAAC,KAAK,C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,CAAC,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,EAAU;IAChD,MAAM,KAAK,GAAG,YAAY,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC/D,CAAC;AAQD,MAAM,UAAU,mBAAmB,CAAC,QAAgB,EAAE,MAAc;IAClE,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,EAAU;IAC5C,MAAM,KAAK,GAAG,YAAY,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACjE,CAAC","sourcesContent":["// Compound document IDs — one builder and one parser per relationship (RULE-STD-ARCH-109).\n//\n// `firestore.rules` restates these formats, because a rules file cannot import them.\n//\n// League and team ids are Firestore auto ids and never contain the separator. A user id can: a\n// ghost id is `ghost_<timestamp>_<suffix>`. So the user id is always the LAST part, and a parser\n// splits only on the leading separators and keeps the remainder whole.\n\nexport const COMPOUND_ID_SEPARATOR = '_';\n\nfunction splitLeading(id: string, leadingParts: number): string[] | null {\n const parts: string[] = [];\n let rest = id;\n for (let i = 0; i < leadingParts; i += 1) {\n const at = rest.indexOf(COMPOUND_ID_SEPARATOR);\n if (at <= 0) return null;\n parts.push(rest.slice(0, at));\n rest = rest.slice(at + COMPOUND_ID_SEPARATOR.length);\n }\n if (rest.length === 0) return null;\n parts.push(rest);\n return parts;\n}\n\n// teamMemberships/{leagueId}_{teamId}_{userId}\nexport interface TeamMembershipIdParts {\n leagueId: string;\n teamId: string;\n userId: string;\n}\n\nexport function buildTeamMembershipId(leagueId: string, teamId: string, userId: string): string {\n return [leagueId, teamId, userId].join(COMPOUND_ID_SEPARATOR);\n}\n\nexport function parseTeamMembershipId(id: string): TeamMembershipIdParts | null {\n const parts = splitLeading(id, 2);\n return parts ? { leagueId: parts[0], teamId: parts[1], userId: parts[2] } : null;\n}\n\n// leagueFreeAgents/{leagueId}_{userId}\nexport interface LeagueFreeAgentIdParts {\n leagueId: string;\n userId: string;\n}\n\nexport function buildLeagueFreeAgentId(leagueId: string, userId: string): string {\n return [leagueId, userId].join(COMPOUND_ID_SEPARATOR);\n}\n\nexport function parseLeagueFreeAgentId(id: string): LeagueFreeAgentIdParts | null {\n const parts = splitLeading(id, 1);\n return parts ? { leagueId: parts[0], userId: parts[1] } : null;\n}\n\n// sportGames/{gameId}/gameRosterPlayers/{teamId}_{userId} — one roster entry per team per person, so\n// a person rostered on both teams of a game holds two. The same id keys the entry's line in the\n// game's `stats.playerStats` and names it in the game's absence and participation lists.\nexport interface GameRosterPlayerIdParts {\n teamId: string;\n userId: string;\n}\n\nexport function buildGameRosterPlayerId(teamId: string, userId: string): string {\n return [teamId, userId].join(COMPOUND_ID_SEPARATOR);\n}\n\nexport function parseGameRosterPlayerId(id: string): GameRosterPlayerIdParts | null {\n const parts = splitLeading(id, 1);\n return parts ? { teamId: parts[0], userId: parts[1] } : null;\n}\n\n// signedWaivers/{leagueId}_{userId}\nexport interface SignedWaiverIdParts {\n leagueId: string;\n userId: string;\n}\n\nexport function buildSignedWaiverId(leagueId: string, userId: string): string {\n return [leagueId, userId].join(COMPOUND_ID_SEPARATOR);\n}\n\nexport function parseSignedWaiverId(id: string): SignedWaiverIdParts | null {\n const parts = splitLeading(id, 1);\n return parts ? { leagueId: parts[0], userId: parts[1] } : null;\n}\n"]}