@ttt-productions/q-core 0.1.0 → 0.1.2

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 (178) hide show
  1. package/dist/constants/business.d.ts +12 -0
  2. package/dist/constants/business.d.ts.map +1 -1
  3. package/dist/constants/business.js +24 -0
  4. package/dist/constants/business.js.map +1 -1
  5. package/dist/constants/media.d.ts +1 -0
  6. package/dist/constants/media.d.ts.map +1 -1
  7. package/dist/constants/media.js +5 -0
  8. package/dist/constants/media.js.map +1 -1
  9. package/dist/constants/sports.js.map +1 -1
  10. package/dist/constants/storage-keys.js.map +1 -1
  11. package/dist/doc-schemas/admin-notifications.d.ts +1 -0
  12. package/dist/doc-schemas/admin-notifications.d.ts.map +1 -1
  13. package/dist/doc-schemas/admin-notifications.js +4 -0
  14. package/dist/doc-schemas/admin-notifications.js.map +1 -1
  15. package/dist/doc-schemas/atoms.d.ts +2 -0
  16. package/dist/doc-schemas/atoms.d.ts.map +1 -1
  17. package/dist/doc-schemas/audit-event.d.ts +2 -0
  18. package/dist/doc-schemas/audit-event.d.ts.map +1 -1
  19. package/dist/doc-schemas/catalogs.js.map +1 -1
  20. package/dist/doc-schemas/gallery.d.ts +1 -0
  21. package/dist/doc-schemas/gallery.d.ts.map +1 -1
  22. package/dist/doc-schemas/gallery.js +3 -0
  23. package/dist/doc-schemas/gallery.js.map +1 -1
  24. package/dist/doc-schemas/game-location.js.map +1 -1
  25. package/dist/doc-schemas/game-stats.js.map +1 -1
  26. package/dist/doc-schemas/league-team.js.map +1 -1
  27. package/dist/doc-schemas/migration-console.d.ts +2 -0
  28. package/dist/doc-schemas/migration-console.d.ts.map +1 -1
  29. package/dist/doc-schemas/migration-console.js +5 -0
  30. package/dist/doc-schemas/migration-console.js.map +1 -1
  31. package/dist/doc-schemas/pending-media.d.ts +1 -0
  32. package/dist/doc-schemas/pending-media.d.ts.map +1 -1
  33. package/dist/doc-schemas/pending-media.js +8 -0
  34. package/dist/doc-schemas/pending-media.js.map +1 -1
  35. package/dist/doc-schemas/registry.d.ts +12 -0
  36. package/dist/doc-schemas/registry.d.ts.map +1 -1
  37. package/dist/doc-schemas/registry.js.map +1 -1
  38. package/dist/doc-schemas/sport-game.js.map +1 -1
  39. package/dist/doc-schemas/stats-operation.d.ts.map +1 -1
  40. package/dist/doc-schemas/stats-operation.js +6 -11
  41. package/dist/doc-schemas/stats-operation.js.map +1 -1
  42. package/dist/doc-schemas/system.d.ts +7 -0
  43. package/dist/doc-schemas/system.d.ts.map +1 -1
  44. package/dist/doc-schemas/system.js +4 -1
  45. package/dist/doc-schemas/system.js.map +1 -1
  46. package/dist/doc-schemas/user-profile.d.ts +1 -0
  47. package/dist/doc-schemas/user-profile.d.ts.map +1 -1
  48. package/dist/doc-schemas/user-profile.js +5 -0
  49. package/dist/doc-schemas/user-profile.js.map +1 -1
  50. package/dist/doc-schemas/waiver-template.d.ts +1 -0
  51. package/dist/doc-schemas/waiver-template.d.ts.map +1 -1
  52. package/dist/doc-schemas/waiver-template.js +10 -1
  53. package/dist/doc-schemas/waiver-template.js.map +1 -1
  54. package/dist/doc-schemas/waivers-and-hardware.d.ts +1 -0
  55. package/dist/doc-schemas/waivers-and-hardware.d.ts.map +1 -1
  56. package/dist/doc-schemas/waivers-and-hardware.js +17 -9
  57. package/dist/doc-schemas/waivers-and-hardware.js.map +1 -1
  58. package/dist/ids/index.js.map +1 -1
  59. package/dist/ids/minted-ids.d.ts +1 -0
  60. package/dist/ids/minted-ids.d.ts.map +1 -1
  61. package/dist/ids/minted-ids.js +6 -0
  62. package/dist/ids/minted-ids.js.map +1 -1
  63. package/dist/ids/stats-operation-ids.js.map +1 -1
  64. package/dist/index.js.map +1 -1
  65. package/dist/input-formats/index.d.ts +2 -2
  66. package/dist/input-formats/index.d.ts.map +1 -1
  67. package/dist/input-formats/index.js +2 -2
  68. package/dist/input-formats/index.js.map +1 -1
  69. package/dist/media/file-origins.js.map +1 -1
  70. package/dist/notifications/archive-all.d.ts +2 -0
  71. package/dist/notifications/archive-all.d.ts.map +1 -0
  72. package/dist/notifications/archive-all.js +6 -0
  73. package/dist/notifications/archive-all.js.map +1 -0
  74. package/dist/notifications/index.d.ts +1 -0
  75. package/dist/notifications/index.d.ts.map +1 -1
  76. package/dist/notifications/index.js +1 -0
  77. package/dist/notifications/index.js.map +1 -1
  78. package/dist/paths/collection-refs.js.map +1 -1
  79. package/dist/paths/collections.js.map +1 -1
  80. package/dist/paths/path-builders.js.map +1 -1
  81. package/dist/paths/utils.js.map +1 -1
  82. package/dist/schemas/account-settings.js.map +1 -1
  83. package/dist/schemas/admin-notifications.d.ts +1 -0
  84. package/dist/schemas/admin-notifications.d.ts.map +1 -1
  85. package/dist/schemas/admin-notifications.js +4 -2
  86. package/dist/schemas/admin-notifications.js.map +1 -1
  87. package/dist/schemas/app-config.d.ts +2 -2
  88. package/dist/schemas/app-config.d.ts.map +1 -1
  89. package/dist/schemas/app-config.js +9 -5
  90. package/dist/schemas/app-config.js.map +1 -1
  91. package/dist/schemas/atoms.js.map +1 -1
  92. package/dist/schemas/awards.d.ts +16 -4
  93. package/dist/schemas/awards.d.ts.map +1 -1
  94. package/dist/schemas/awards.js +10 -6
  95. package/dist/schemas/awards.js.map +1 -1
  96. package/dist/schemas/game-locations.d.ts +4 -4
  97. package/dist/schemas/game-locations.d.ts.map +1 -1
  98. package/dist/schemas/game-locations.js +11 -3
  99. package/dist/schemas/game-locations.js.map +1 -1
  100. package/dist/schemas/hardware-loan-contracts.js.map +1 -1
  101. package/dist/schemas/migration-console.d.ts +1 -0
  102. package/dist/schemas/migration-console.d.ts.map +1 -1
  103. package/dist/schemas/pictures.d.ts +3 -0
  104. package/dist/schemas/pictures.d.ts.map +1 -1
  105. package/dist/schemas/schedules.js.map +1 -1
  106. package/dist/schemas/scoring.js.map +1 -1
  107. package/dist/schemas/stats.d.ts +2 -0
  108. package/dist/schemas/stats.d.ts.map +1 -1
  109. package/dist/schemas/stats.js.map +1 -1
  110. package/dist/schemas/team-joining.js.map +1 -1
  111. package/dist/schemas/teams.d.ts +3 -2
  112. package/dist/schemas/teams.d.ts.map +1 -1
  113. package/dist/schemas/teams.js +19 -9
  114. package/dist/schemas/teams.js.map +1 -1
  115. package/dist/schemas/uploads.js.map +1 -1
  116. package/dist/schemas/users.d.ts +7 -3
  117. package/dist/schemas/users.d.ts.map +1 -1
  118. package/dist/schemas/users.js +10 -3
  119. package/dist/schemas/users.js.map +1 -1
  120. package/dist/schemas/waiver-templates.d.ts +1 -0
  121. package/dist/schemas/waiver-templates.d.ts.map +1 -1
  122. package/dist/schemas/waiver-templates.js +4 -1
  123. package/dist/schemas/waiver-templates.js.map +1 -1
  124. package/dist/sports/basketball-scoring.js.map +1 -1
  125. package/dist/sports/basketball.js.map +1 -1
  126. package/dist/sports/bulk-entry.js.map +1 -1
  127. package/dist/sports/contribution.js.map +1 -1
  128. package/dist/sports/curling-scoring.js.map +1 -1
  129. package/dist/sports/finalized-record.js.map +1 -1
  130. package/dist/sports/football-scoring.js.map +1 -1
  131. package/dist/sports/index.d.ts +1 -0
  132. package/dist/sports/index.d.ts.map +1 -1
  133. package/dist/sports/index.js +1 -0
  134. package/dist/sports/index.js.map +1 -1
  135. package/dist/sports/ledger-continuity.d.ts +13 -0
  136. package/dist/sports/ledger-continuity.d.ts.map +1 -0
  137. package/dist/sports/ledger-continuity.js +19 -0
  138. package/dist/sports/ledger-continuity.js.map +1 -0
  139. package/dist/sports/rankings.js.map +1 -1
  140. package/dist/sports/rollup-check.js.map +1 -1
  141. package/dist/sports/scoring.js.map +1 -1
  142. package/dist/sports/store-driver.js.map +1 -1
  143. package/dist/types/audit.d.ts +1 -1
  144. package/dist/types/audit.d.ts.map +1 -1
  145. package/dist/types/audit.js +5 -2
  146. package/dist/types/audit.js.map +1 -1
  147. package/dist/types/documents.js.map +1 -1
  148. package/dist/types/notifications.js.map +1 -1
  149. package/dist/types/picture-owners.js.map +1 -1
  150. package/dist/types/sports.js.map +1 -1
  151. package/dist/types/stats.js.map +1 -1
  152. package/dist/types/unions.d.ts +4 -2
  153. package/dist/types/unions.d.ts.map +1 -1
  154. package/dist/types/unions.js +6 -0
  155. package/dist/types/unions.js.map +1 -1
  156. package/dist/upload-variables/index.d.ts +3 -0
  157. package/dist/upload-variables/index.d.ts.map +1 -0
  158. package/dist/upload-variables/index.js +3 -0
  159. package/dist/upload-variables/index.js.map +1 -0
  160. package/dist/upload-variables/on-progress.d.ts +4 -0
  161. package/dist/upload-variables/on-progress.d.ts.map +1 -0
  162. package/dist/upload-variables/on-progress.js +10 -0
  163. package/dist/upload-variables/on-progress.js.map +1 -0
  164. package/dist/upload-variables/picture-upload-variables.d.ts +32 -0
  165. package/dist/upload-variables/picture-upload-variables.d.ts.map +1 -0
  166. package/dist/upload-variables/picture-upload-variables.js +21 -0
  167. package/dist/upload-variables/picture-upload-variables.js.map +1 -0
  168. package/dist/utils/account-status.js.map +1 -1
  169. package/dist/utils/app-config.d.ts +17 -3
  170. package/dist/utils/app-config.d.ts.map +1 -1
  171. package/dist/utils/app-config.js +21 -14
  172. package/dist/utils/app-config.js.map +1 -1
  173. package/dist/utils/app-routes.js.map +1 -1
  174. package/dist/utils/index.js.map +1 -1
  175. package/dist/utils/league-calendar.js.map +1 -1
  176. package/dist/utils/league-mode.js.map +1 -1
  177. package/dist/utils/team-member-actions.js.map +1 -1
  178. package/package.json +94 -90
@@ -1 +1 @@
1
- {"version":3,"file":"league-team.js","sourceRoot":"","sources":["../../src/doc-schemas/league-team.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,wEAAwE;AAExE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EACL,WAAW,EACX,aAAa,EACb,cAAc,EACd,cAAc,EACd,cAAc,EACd,eAAe,EACf,YAAY,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,uBAAuB,EAAE,qBAAqB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AAS,EAAE,aAAa;CACzB,CAAC,CAAC","sourcesContent":["// `leagueTeams/{teamId}` — one team in one league, with its derived season rollups. Who is on the\r\n// team, and who captains it, is `teamMemberships` — never a field here.\r\n\r\nimport { z } from 'zod';\r\nimport { CONTACT_PHONE_INPUT_FORMAT } from '../input-formats/index.js';\r\nimport {\r\n countSchema,\r\n epochMsSchema,\r\n leagueIdSchema,\r\n teamIconSchema,\r\n teamTypeSchema,\r\n textFieldSchema,\r\n userIdSchema,\r\n} from './atoms.js';\r\nimport { PlayerSeasonStatsSchema, TeamSeasonStatsSchema } from './aggregate-stats.js';\r\nimport { GallerySummarySchema } from './gallery.js';\r\n\r\nexport const LeagueTeamSchema = z.object({\r\n name: z.string(),\r\n icon: teamIconSchema,\r\n leagueId: leagueIdSchema,\r\n // Present only in a Competitive/Recreational league.\r\n teamType: teamTypeSchema.optional(),\r\n // The account that created the team — the new captain, or the admin who created it for a ghost\r\n // captain. A creation record, never a membership or an authority.\r\n createdByUserId: userIdSchema,\r\n // The team's standings line, absent until its first game is finalized.\r\n seasonStats: TeamSeasonStatsSchema.optional(),\r\n // The league player stats: one row per person the team's games credited, keyed by userId (real or\r\n // ghost). The team's league, the team, and the key are the membership the row belongs to.\r\n playerSeasonStats: z.record(userIdSchema, PlayerSeasonStatsSchema).optional(),\r\n // The team's picture gallery summary — absent is an empty gallery. Only the picture core writes\r\n // it; the team callables and the copy action never do.\r\n pictures: GallerySummarySchema.optional(),\r\n // Advanced by every membership change on the team after its creation; absent until the first.\r\n // Only its changing matters: game creation and a game's team replacement read this document in the\r\n // transaction that seeds a roster from the team's memberships, so a membership change landing at\r\n // the same moment conflicts with them instead of missing the new game (BACKEND-116).\r\n membershipRevision: countSchema.optional(),\r\n // Advanced by every invitation and join request a door creates for the team; absent until the\r\n // first. Only its changing matters: a pending invitation or request between one team and one\r\n // person is unique, and a membership on the team closes both, but a transaction does not lock a\r\n // query against an insert — so each creation writes this document, which every competing\r\n // creation and every membership door also writes, and two racers conflict instead of both passing\r\n // their checks (BACKEND-116).\r\n joinRevision: countSchema.optional(),\r\n // Advanced by every game creation and every game edit that brings the team in; absent until the\r\n // first. Only its changing matters: a team's deletion re-reads the team's games in the transaction\r\n // that deletes the team document, and a query does not lock against an insert — so a game created\r\n // for the team writes this document, which the deletion also writes, and the two conflict instead of\r\n // leaving a game naming a deleted team (BACKEND-116).\r\n scheduleRevision: countSchema.optional(),\r\n createdAt: epochMsSchema,\r\n updatedAt: epochMsSchema,\r\n});\r\nexport type LeagueTeam = z.infer<typeof LeagueTeamSchema>;\r\n\r\n// `leagueTeamContacts/{teamId}` — how the league reaches the team. Admin read only: the team\r\n// document is public, so the phone lives here, never on it (BACKEND-105). `leagueId` is what lists a\r\n// league's contacts in one query. Written with the team by team creation.\r\nexport const LeagueTeamContactSchema = z.object({\r\n leagueId: leagueIdSchema,\r\n // The number as the contact callables kept it, held to the same declaration they parse with.\r\n contactPhone: textFieldSchema(CONTACT_PHONE_INPUT_FORMAT),\r\n updatedAt: epochMsSchema,\r\n});\r\nexport type LeagueTeamContact = z.infer<typeof LeagueTeamContactSchema>;\r\n"]}
1
+ {"version":3,"file":"league-team.js","sourceRoot":"","sources":["../../src/doc-schemas/league-team.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,wEAAwE;AAExE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EACL,WAAW,EACX,aAAa,EACb,cAAc,EACd,cAAc,EACd,cAAc,EACd,eAAe,EACf,YAAY,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,cAAc;IACpB,QAAQ,EAAE,cAAc;IACxB,qDAAqD;IACrD,QAAQ,EAAE,cAAc,CAAC,QAAQ,EAAE;IACnC,+FAA+F;IAC/F,kEAAkE;IAClE,eAAe,EAAE,YAAY;IAC7B,uEAAuE;IACvE,WAAW,EAAE,qBAAqB,CAAC,QAAQ,EAAE;IAC7C,kGAAkG;IAClG,0FAA0F;IAC1F,iBAAiB,EAAE,CAAC,CAAC,MAAM,CAAC,YAAY,EAAE,uBAAuB,CAAC,CAAC,QAAQ,EAAE;IAC7E,gGAAgG;IAChG,uDAAuD;IACvD,QAAQ,EAAE,oBAAoB,CAAC,QAAQ,EAAE;IACzC,8FAA8F;IAC9F,mGAAmG;IACnG,iGAAiG;IACjG,qFAAqF;IACrF,kBAAkB,EAAE,WAAW,CAAC,QAAQ,EAAE;IAC1C,8FAA8F;IAC9F,6FAA6F;IAC7F,gGAAgG;IAChG,yFAAyF;IACzF,kGAAkG;IAClG,8BAA8B;IAC9B,YAAY,EAAE,WAAW,CAAC,QAAQ,EAAE;IACpC,gGAAgG;IAChG,mGAAmG;IACnG,kGAAkG;IAClG,qGAAqG;IACrG,sDAAsD;IACtD,gBAAgB,EAAE,WAAW,CAAC,QAAQ,EAAE;IACxC,SAAS,EAAE,aAAa;IACxB,SAAS,EAAE,aAAa;CACzB,CAAC,CAAC;AAGH,6FAA6F;AAC7F,qGAAqG;AACrG,0EAA0E;AAC1E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,QAAQ,EAAE,cAAc;IACxB,6FAA6F;IAC7F,YAAY,EAAE,eAAe,CAAC,0BAA0B,CAAC;IACzD,SAAS,EAAE,aAAa;CACzB,CAAC,CAAC","sourcesContent":["// `leagueTeams/{teamId}` — one team in one league, with its derived season rollups. Who is on the\n// team, and who captains it, is `teamMemberships` — never a field here.\n\nimport { z } from 'zod';\nimport { CONTACT_PHONE_INPUT_FORMAT } from '../input-formats/index.js';\nimport {\n countSchema,\n epochMsSchema,\n leagueIdSchema,\n teamIconSchema,\n teamTypeSchema,\n textFieldSchema,\n userIdSchema,\n} from './atoms.js';\nimport { PlayerSeasonStatsSchema, TeamSeasonStatsSchema } from './aggregate-stats.js';\nimport { GallerySummarySchema } from './gallery.js';\n\nexport const LeagueTeamSchema = z.object({\n name: z.string(),\n icon: teamIconSchema,\n leagueId: leagueIdSchema,\n // Present only in a Competitive/Recreational league.\n teamType: teamTypeSchema.optional(),\n // The account that created the team — the new captain, or the admin who created it for a ghost\n // captain. A creation record, never a membership or an authority.\n createdByUserId: userIdSchema,\n // The team's standings line, absent until its first game is finalized.\n seasonStats: TeamSeasonStatsSchema.optional(),\n // The league player stats: one row per person the team's games credited, keyed by userId (real or\n // ghost). The team's league, the team, and the key are the membership the row belongs to.\n playerSeasonStats: z.record(userIdSchema, PlayerSeasonStatsSchema).optional(),\n // The team's picture gallery summary — absent is an empty gallery. Only the picture core writes\n // it; the team callables and the copy action never do.\n pictures: GallerySummarySchema.optional(),\n // Advanced by every membership change on the team after its creation; absent until the first.\n // Only its changing matters: game creation and a game's team replacement read this document in the\n // transaction that seeds a roster from the team's memberships, so a membership change landing at\n // the same moment conflicts with them instead of missing the new game (BACKEND-116).\n membershipRevision: countSchema.optional(),\n // Advanced by every invitation and join request a door creates for the team; absent until the\n // first. Only its changing matters: a pending invitation or request between one team and one\n // person is unique, and a membership on the team closes both, but a transaction does not lock a\n // query against an insert — so each creation writes this document, which every competing\n // creation and every membership door also writes, and two racers conflict instead of both passing\n // their checks (BACKEND-116).\n joinRevision: countSchema.optional(),\n // Advanced by every game creation and every game edit that brings the team in; absent until the\n // first. Only its changing matters: a team's deletion re-reads the team's games in the transaction\n // that deletes the team document, and a query does not lock against an insert — so a game created\n // for the team writes this document, which the deletion also writes, and the two conflict instead of\n // leaving a game naming a deleted team (BACKEND-116).\n scheduleRevision: countSchema.optional(),\n createdAt: epochMsSchema,\n updatedAt: epochMsSchema,\n});\nexport type LeagueTeam = z.infer<typeof LeagueTeamSchema>;\n\n// `leagueTeamContacts/{teamId}` — how the league reaches the team. Admin read only: the team\n// document is public, so the phone lives here, never on it (BACKEND-105). `leagueId` is what lists a\n// league's contacts in one query. Written with the team by team creation.\nexport const LeagueTeamContactSchema = z.object({\n leagueId: leagueIdSchema,\n // The number as the contact callables kept it, held to the same declaration they parse with.\n contactPhone: textFieldSchema(CONTACT_PHONE_INPUT_FORMAT),\n updatedAt: epochMsSchema,\n});\nexport type LeagueTeamContact = z.infer<typeof LeagueTeamContactSchema>;\n"]}
@@ -415,6 +415,7 @@ export declare const MigrationConsoleLockSchema: z.ZodObject<{
415
415
  operationId: z.ZodString;
416
416
  heldByUserId: z.ZodString;
417
417
  expiresAt: z.ZodNumber;
418
+ pageClaimedAt: z.ZodOptional<z.ZodNumber>;
418
419
  }, z.core.$strict>;
419
420
  export type MigrationConsoleLock = z.infer<typeof MigrationConsoleLockSchema>;
420
421
  export declare const MigrationConsoleSchema: z.ZodObject<{
@@ -514,6 +515,7 @@ export declare const MigrationConsoleSchema: z.ZodObject<{
514
515
  operationId: z.ZodString;
515
516
  heldByUserId: z.ZodString;
516
517
  expiresAt: z.ZodNumber;
518
+ pageClaimedAt: z.ZodOptional<z.ZodNumber>;
517
519
  }, z.core.$strict>>;
518
520
  updatedAt: z.ZodNumber;
519
521
  }, z.core.$strict>;
@@ -1 +1 @@
1
- {"version":3,"file":"migration-console.d.ts","sourceRoot":"","sources":["../../src/doc-schemas/migration-console.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmBxB,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAmC,CAAC;AACxE,eAAO,MAAM,+BAA+B;;;EAA2C,CAAC;AACxF,4FAA4F;AAC5F,eAAO,MAAM,0BAA0B,aAA0B,CAAC;A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yBAAyB,CAAC,CAAC;AAE5E,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAOnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,oEAAoE;AACpE,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAUrC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAMjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
@@ -86,6 +86,11 @@ export const MigrationConsoleLockSchema = z.strictObject({
86
86
  operationId: migrationOperationIdSchema,
87
87
  heldByUserId: userIdSchema,
88
88
  expiresAt: epochMsSchema,
89
+ // Present while one page of the run is in flight: the moment its claim was stamped, and that
90
+ // page's fencing token. Only the page holding this exact token records its result or releases the
91
+ // lock; any other page, the same run's included, is refused while it stands. A lock stored
92
+ // without one has no page in flight.
93
+ pageClaimedAt: epochMsSchema.optional(),
89
94
  });
90
95
  export const MigrationConsoleSchema = z.strictObject({
91
96
  destinationState: migrationDestinationStateSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"migration-console.js","sourceRoot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AAyB,GAAG,CAAC,CAAC,YAAY,CAAC;IACtD,UAAU,EAAE,aAAa;IACzB,gBAAgB,EAAE,YAAY;IAC9B,gEAAgE;IAChE,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC,QAAQ,EAAE;IACxD,kEAAkE;IAClE,QAAQ,EAAE,uBAAuB;CAClC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,YAAY,CAAC;IACrD,QAAQ,EAAE,uBAAuB;IACjC,kEAAkE;IAClE,GAAG,EAAE,wBAAwB,CAAC,QAAQ,EAAE;IACxC,yEAAyE;IACzE,OAAO,EAAE,wBAAwB,CAAC,QAAQ,EAAE;IAC5C,QAAQ,EAAE,yBAAyB,CAAC,QAAQ,EAAE;CAC/C,CAAC,CAAC;AAGH,oEAAoE;AACpE,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,YAAY,CAAC;IACvD,QAAQ,EAAE,uBAAuB;IACjC,WAAW,EAAE,0BAA0B;IACvC,YAAY,EAAE,YAAY;IAC1B,SAAS,EAAE,aAAa;CACzB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,YAAY,CAAC;IACnD,gBAAgB,EAAE,+BAA+B;IACjD,iBAAiB,EAAE,aAAa,CAAC,QAAQ,EAAE;IAC3C,uBAAuB,EAAE,YAAY,CAAC,QAAQ,EAAE;IAChD,IAAI,EAAE,0BAA0B,CAAC,QAAQ,EAAE;IAC3C,SAAS,EAAE,aAAa;CACzB,CAAC,CAAC","sourcesContent":["// The migration console's recorded state — admin read, written only by the console's callables.\n//\n// `_serverData/migrationConsole` holds the cutover marker and the lock: one action runs at a time, and\n// whether the destinations are still the migration's is recorded here, never taken from the\n// operator. `migrationActionRuns/{actionId}` holds each step's latest real run — the one its\n// dependents read — its latest preview, and, for a recorded step, what was recorded.\n\nimport { z } from 'zod';\nimport { MIGRATION_EVIDENCE_INPUT_FORMAT } from '../input-formats/index.js';\nimport { MIGRATION_ACTION_ID_KEYS } from '../migration-console/action-ids.js';\nimport {\n MAX_MIGRATION_FINDING_TEXT_LENGTH,\n MAX_MIGRATION_RUN_FINDINGS,\n MIGRATION_DESTINATION_STATE_KEYS,\n MIGRATION_RUN_STATUS_KEYS,\n} from '../migration-console/run-state.js';\nimport {\n countSchema,\n documentIdSegmentSchema,\n epochMsSchema,\n repairReasonSchema,\n statsOperationIdSchema,\n textFieldSchema,\n userIdSchema,\n} from './atoms.js';\n\nexport const migrationActionIdSchema = z.enum(MIGRATION_ACTION_ID_KEYS);\nexport const migrationDestinationStateSchema = z.enum(MIGRATION_DESTINATION_STATE_KEYS);\n/** One logical run of an action, minted by the admin's browser when the admin starts it. */\nexport const migrationOperationIdSchema = documentIdSegmentSchema;\n/** What the operator records as proof of a step the console cannot see done. */\nexport const migrationEvidenceSchema = textFieldSchema(MIGRATION_EVIDENCE_INPUT_FORMAT);\n\nconst findingText = z.string().max(MAX_MIGRATION_FINDING_TEXT_LENGTH);\n\n/**\n * One document an action reported: skipped by a copy, missing or mismatched in a verification, or\n * named by one of an action's own report lists (a merged pair, a created roster entry, a ghost's\n * disposition) — `category` names which.\n */\nexport const MigrationFindingSchema = z.strictObject({\n category: z.string().min(1).max(64),\n id: findingText,\n field: findingText,\n reason: findingText,\n});\nexport type MigrationFinding = z.infer<typeof MigrationFindingSchema>;\n\n/** A run's totals across its pages. A write action fills the first three, a verification the next three. */\nexport const MigrationRunCountsSchema = z.strictObject({\n read: countSchema,\n written: countSchema,\n skipped: countSchema,\n checked: countSchema,\n missing: countSchema,\n mismatched: countSchema,\n});\nexport type MigrationRunCounts = z.infer<typeof MigrationRunCountsSchema>;\n\nexport const MigrationRunRecordSchema = z.strictObject({\n operationId: migrationOperationIdSchema,\n dryRun: z.boolean(),\n reason: repairReasonSchema,\n startedByUserId: userIdSchema,\n startedAt: epochMsSchema,\n updatedAt: epochMsSchema,\n // Set with `complete`: the moment the run reached its end.\n completedAt: epochMsSchema.optional(),\n status: z.enum(MIGRATION_RUN_STATUS_KEYS),\n pages: countSchema,\n // The resume key of the next page, or null once the run reached its end.\n nextResumeAfter: z.string().min(1).nullable(),\n counts: MigrationRunCountsSchema,\n // An action's own counters beyond the shared ones — merged pairs, corrections by field, kept\n // ghosts by disposition — summed across pages.\n details: z.record(z.string().min(1), countSchema),\n findings: z.array(MigrationFindingSchema).max(MAX_MIGRATION_RUN_FINDINGS),\n // Findings met past the kept ones; each page's answer carried them in full.\n findingsNotKept: countSchema,\n // A verification run declared, at its start, that its source is empty.\n expectEmptySource: z.boolean(),\n // A `verify.v1Pictures` run acknowledged, at its start, the sources it cannot examine.\n acknowledgeUnexaminedSources: z.boolean().optional(),\n // Why a stopped run stopped: the refusal its core gave.\n stoppedReason: findingText.optional(),\n});\nexport type MigrationRunRecord = z.infer<typeof MigrationRunRecordSchema>;\n\n/** A product control's run, an operator checkpoint, or the cutover, as recorded. */\nexport const MigrationStepRecordSchema = z.strictObject({\n recordedAt: epochMsSchema,\n recordedByUserId: userIdSchema,\n // A product control's runs, whose evidence the console checked.\n operationIds: z.array(statsOperationIdSchema).optional(),\n // An operator checkpoint's evidence, or a recorded step's reason.\n evidence: migrationEvidenceSchema,\n});\nexport type MigrationStepRecord = z.infer<typeof MigrationStepRecordSchema>;\n\nexport const MigrationActionRunSchema = z.strictObject({\n actionId: migrationActionIdSchema,\n // The latest real run: what every dependent and every gate reads.\n run: MigrationRunRecordSchema.optional(),\n // The latest dry run, kept apart so a preview never stands in for a run.\n preview: MigrationRunRecordSchema.optional(),\n recorded: MigrationStepRecordSchema.optional(),\n});\nexport type MigrationActionRun = z.infer<typeof MigrationActionRunSchema>;\n\n/** The one action holding the console, until its lease runs out. */\nexport const MigrationConsoleLockSchema = z.strictObject({\n actionId: migrationActionIdSchema,\n operationId: migrationOperationIdSchema,\n heldByUserId: userIdSchema,\n expiresAt: epochMsSchema,\n});\nexport type MigrationConsoleLock = z.infer<typeof MigrationConsoleLockSchema>;\n\nexport const MigrationConsoleSchema = z.strictObject({\n destinationState: migrationDestinationStateSchema,\n cutoverRecordedAt: epochMsSchema.optional(),\n cutoverRecordedByUserId: userIdSchema.optional(),\n lock: MigrationConsoleLockSchema.nullable(),\n updatedAt: epochMsSchema,\n});\nexport type MigrationConsole = z.infer<typeof MigrationConsoleSchema>;\n"]}
1
+ {"version":3,"file":"migration-console.js","sourceRoot":"","sources":["../../src/doc-schemas/migration-console.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,EAAE;AACF,uGAAuG;AACvG,4FAA4F;AAC5F,6FAA6F;AAC7F,qFAAqF;AAErF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EACL,iCAAiC,EACjC,0BAA0B,EAC1B,gCAAgC,EAChC,yBAAyB,GAC1B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,WAAW,EACX,uBAAuB,EACvB,aAAa,EACb,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,YAAY,GACb,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;AACxE,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;AACxF,4FAA4F;AAC5F,MAAM,CAAC,MAAM,0BAA0B,GAAG,uBAAuB,CAAC;AAClE,gFAAgF;AAChF,MAAM,CAAC,MAAM,uBAAuB,GAAG,eAAe,CAAC,+BAA+B,CAAC,CAAC;AAExF,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;AAEtE;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAA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AE,YAAY,CAAC,QAAQ,EAAE;IAChD,IAAI,EAAE,0BAA0B,CAAC,QAAQ,EAAE;IAC3C,SAAS,EAAE,aAAa;CACzB,CAAC,CAAC","sourcesContent":["// The migration console's recorded state — admin read, written only by the console's callables.\n//\n// `_serverData/migrationConsole` holds the cutover marker and the lock: one action runs at a time, and\n// whether the destinations are still the migration's is recorded here, never taken from the\n// operator. `migrationActionRuns/{actionId}` holds each step's latest real run — the one its\n// dependents read — its latest preview, and, for a recorded step, what was recorded.\n\nimport { z } from 'zod';\nimport { MIGRATION_EVIDENCE_INPUT_FORMAT } from '../input-formats/index.js';\nimport { MIGRATION_ACTION_ID_KEYS } from '../migration-console/action-ids.js';\nimport {\n MAX_MIGRATION_FINDING_TEXT_LENGTH,\n MAX_MIGRATION_RUN_FINDINGS,\n MIGRATION_DESTINATION_STATE_KEYS,\n MIGRATION_RUN_STATUS_KEYS,\n} from '../migration-console/run-state.js';\nimport {\n countSchema,\n documentIdSegmentSchema,\n epochMsSchema,\n repairReasonSchema,\n statsOperationIdSchema,\n textFieldSchema,\n userIdSchema,\n} from './atoms.js';\n\nexport const migrationActionIdSchema = z.enum(MIGRATION_ACTION_ID_KEYS);\nexport const migrationDestinationStateSchema = z.enum(MIGRATION_DESTINATION_STATE_KEYS);\n/** One logical run of an action, minted by the admin's browser when the admin starts it. */\nexport const migrationOperationIdSchema = documentIdSegmentSchema;\n/** What the operator records as proof of a step the console cannot see done. */\nexport const migrationEvidenceSchema = textFieldSchema(MIGRATION_EVIDENCE_INPUT_FORMAT);\n\nconst findingText = z.string().max(MAX_MIGRATION_FINDING_TEXT_LENGTH);\n\n/**\n * One document an action reported: skipped by a copy, missing or mismatched in a verification, or\n * named by one of an action's own report lists (a merged pair, a created roster entry, a ghost's\n * disposition) — `category` names which.\n */\nexport const MigrationFindingSchema = z.strictObject({\n category: z.string().min(1).max(64),\n id: findingText,\n field: findingText,\n reason: findingText,\n});\nexport type MigrationFinding = z.infer<typeof MigrationFindingSchema>;\n\n/** A run's totals across its pages. A write action fills the first three, a verification the next three. */\nexport const MigrationRunCountsSchema = z.strictObject({\n read: countSchema,\n written: countSchema,\n skipped: countSchema,\n checked: countSchema,\n missing: countSchema,\n mismatched: countSchema,\n});\nexport type MigrationRunCounts = z.infer<typeof MigrationRunCountsSchema>;\n\nexport const MigrationRunRecordSchema = z.strictObject({\n operationId: migrationOperationIdSchema,\n dryRun: z.boolean(),\n reason: repairReasonSchema,\n startedByUserId: userIdSchema,\n startedAt: epochMsSchema,\n updatedAt: epochMsSchema,\n // Set with `complete`: the moment the run reached its end.\n completedAt: epochMsSchema.optional(),\n status: z.enum(MIGRATION_RUN_STATUS_KEYS),\n pages: countSchema,\n // The resume key of the next page, or null once the run reached its end.\n nextResumeAfter: z.string().min(1).nullable(),\n counts: MigrationRunCountsSchema,\n // An action's own counters beyond the shared ones — merged pairs, corrections by field, kept\n // ghosts by disposition — summed across pages.\n details: z.record(z.string().min(1), countSchema),\n findings: z.array(MigrationFindingSchema).max(MAX_MIGRATION_RUN_FINDINGS),\n // Findings met past the kept ones; each page's answer carried them in full.\n findingsNotKept: countSchema,\n // A verification run declared, at its start, that its source is empty.\n expectEmptySource: z.boolean(),\n // A `verify.v1Pictures` run acknowledged, at its start, the sources it cannot examine.\n acknowledgeUnexaminedSources: z.boolean().optional(),\n // Why a stopped run stopped: the refusal its core gave.\n stoppedReason: findingText.optional(),\n});\nexport type MigrationRunRecord = z.infer<typeof MigrationRunRecordSchema>;\n\n/** A product control's run, an operator checkpoint, or the cutover, as recorded. */\nexport const MigrationStepRecordSchema = z.strictObject({\n recordedAt: epochMsSchema,\n recordedByUserId: userIdSchema,\n // A product control's runs, whose evidence the console checked.\n operationIds: z.array(statsOperationIdSchema).optional(),\n // An operator checkpoint's evidence, or a recorded step's reason.\n evidence: migrationEvidenceSchema,\n});\nexport type MigrationStepRecord = z.infer<typeof MigrationStepRecordSchema>;\n\nexport const MigrationActionRunSchema = z.strictObject({\n actionId: migrationActionIdSchema,\n // The latest real run: what every dependent and every gate reads.\n run: MigrationRunRecordSchema.optional(),\n // The latest dry run, kept apart so a preview never stands in for a run.\n preview: MigrationRunRecordSchema.optional(),\n recorded: MigrationStepRecordSchema.optional(),\n});\nexport type MigrationActionRun = z.infer<typeof MigrationActionRunSchema>;\n\n/** The one action holding the console, until its lease runs out. */\nexport const MigrationConsoleLockSchema = z.strictObject({\n actionId: migrationActionIdSchema,\n operationId: migrationOperationIdSchema,\n heldByUserId: userIdSchema,\n expiresAt: epochMsSchema,\n // Present while one page of the run is in flight: the moment its claim was stamped, and that\n // page's fencing token. Only the page holding this exact token records its result or releases the\n // lock; any other page, the same run's included, is refused while it stands. A lock stored\n // without one has no page in flight.\n pageClaimedAt: epochMsSchema.optional(),\n});\nexport type MigrationConsoleLock = z.infer<typeof MigrationConsoleLockSchema>;\n\nexport const MigrationConsoleSchema = z.strictObject({\n destinationState: migrationDestinationStateSchema,\n cutoverRecordedAt: epochMsSchema.optional(),\n cutoverRecordedByUserId: userIdSchema.optional(),\n lock: MigrationConsoleLockSchema.nullable(),\n updatedAt: epochMsSchema,\n});\nexport type MigrationConsole = z.infer<typeof MigrationConsoleSchema>;\n"]}
@@ -46,6 +46,7 @@ export declare const PendingMediaTargetSchema: z.ZodObject<{
46
46
  bucket: z.ZodString;
47
47
  path: z.ZodString;
48
48
  }, z.core.$strict>>;
49
+ sourceIndex: z.ZodOptional<z.ZodNumber>;
49
50
  newAwardName: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
50
51
  }, z.core.$strict>;
51
52
  export type PendingMediaTarget = z.infer<typeof PendingMediaTargetSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"pending-media.d.ts","sourceRoot":"","sources":["../../src/doc-schemas/pending-media.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,gBAAgB;;;;;;;;EAA2B,CAAC;AACzD,eAAO,MAAM,mBAAmB;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAA6B,CAAC;AAE7D,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AACxF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC5E,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAClF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAChF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
@@ -11,6 +11,7 @@ import { createPendingMediaSchemas } from '@ttt-productions/media-schemas';
11
11
  import { DomainEventSchema } from '../domain-events/domain-events.js';
12
12
  import { FILE_ORIGIN_KEYS, PICTURE_ORIGIN_KEYS } from '../media/file-origins.js';
13
13
  import { AWARD_DEFINITION_OWNER_KIND } from '../types/picture-owners.js';
14
+ import { countSchema } from './atoms.js';
14
15
  import { awardNameSchema } from './catalogs.js';
15
16
  import { pictureOwnerKindSchema } from './gallery.js';
16
17
  export const fileOriginSchema = z.enum(FILE_ORIGIN_KEYS);
@@ -30,6 +31,9 @@ export const PendingMediaTargetSchema = z
30
31
  // The object a carried picture was read from. Written only by the migration console's picture
31
32
  // carry, never from a callable's input; a carried picture fills only an empty slot.
32
33
  carriedFrom: StorageObjectRefSchema.optional(),
34
+ // A carried picture's position in its V1 source list, so the carried gallery keeps V1's order
35
+ // and V1's first image stays the featured one. Only beside `carriedFrom`.
36
+ sourceIndex: countSchema.optional(),
33
37
  // A badge upload that creates its award: the award's name, which the publication writes with
34
38
  // the award. The owner's id is then the upload's staging id.
35
39
  newAwardName: awardNameSchema.optional(),
@@ -38,6 +42,10 @@ export const PendingMediaTargetSchema = z
38
42
  .refine((target) => target.newAwardName === undefined || target.owner.kind === AWARD_DEFINITION_OWNER_KIND, {
39
43
  message: 'Only a badge upload creates an award.',
40
44
  path: ['newAwardName'],
45
+ })
46
+ .refine((target) => target.sourceIndex === undefined || target.carriedFrom !== undefined, {
47
+ message: 'Only a carried picture has a source position.',
48
+ path: ['sourceIndex'],
41
49
  });
42
50
  const schemas = createPendingMediaSchemas({
43
51
  fileOriginSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"pending-media.js","sourceRoot":"","sources":["../../src/doc-schemas/pending-media.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,iGAAiG;AACjG,gFAAgF;AAChF,EAAE;AACF,kGAAkG;AAClG,+FAA+F;AAC/F,8FAA8F;AAC9F,wFAAwF;AAExF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,eA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OAAO,GAAG,yBAAyB,CAAC;IACxC,gBAAgB;IAChB,iBAAiB,EAAE,iBAAiB;CACrC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,+BAA+B,GAAG,OAAO,CAAC,+BAA+B,CAAC;AACvF,MAAM,CAAC,MAAM,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,CAAC;AACzE,MAAM,CAAC,MAAM,yBAAyB,GAAG,OAAO,CAAC,yBAAyB,CAAC;AAC3E,MAAM,CAAC,MAAM,4BAA4B,GAAG,OAAO,CAAC,4BAA4B,CAAC;AACjF,MAAM,CAAC,MAAM,2BAA2B,GAAG,OAAO,CAAC,2BAA2B,CAAC;AAC/E,MAAM,CAAC,MAAM,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,CAAC;AACzE,MAAM,CAAC,MAAM,0BAA0B,GAAG,OAAO,CAAC,0BAA0B,CAAC;AAC7E,MAAM,CAAC,MAAM,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC","sourcesContent":["// `pendingMedia/{pendingMediaId}` — one accepted picture upload: the durable hand-off from the\r\n// accepting callable to the processing trigger. Its id is the upload's staging id, which is also\r\n// the picture's id; rows are never deleted, so no two uploads ever share an id.\r\n//\r\n// The shape is media-schemas' generic pending-media lifecycle composed with Q-Sports' origins and\r\n// domain events. Every field is written by the server: `originalFileName` and `clientContext`,\r\n// which the generic shape requires, hold the staging id and the origin, so no client-authored\r\n// metadata reaches the row. `targetInfo` is the server-normalized `PendingMediaTarget`.\r\n\r\nimport { z } from 'zod';\r\nimport { createPendingMediaSchemas } from '@ttt-productions/media-schemas';\r\nimport { DomainEventSchema } from '../domain-events/domain-events.js';\r\nimport { FILE_ORIGIN_KEYS, PICTURE_ORIGIN_KEYS } from '../media/file-origins.js';\r\nimport { AWARD_DEFINITION_OWNER_KIND } from '../types/picture-owners.js';\r\nimport { awardNameSchema } from './catalogs.js';\r\nimport { pictureOwnerKindSchema } from './gallery.js';\r\n\r\nexport const fileOriginSchema = z.enum(FILE_ORIGIN_KEYS);\r\nexport const pictureOriginSchema = z.enum(PICTURE_ORIGIN_KEYS);\r\n\r\n// A stored object, by bucket and path — never a URL. A retained signature is recorded this way, and\r\n// so is the source a carried picture was read from.\r\nexport const StorageObjectRefSchema = z\r\n .object({ bucket: z.string().min(1), path: z.string().min(1) })\r\n .strict();\r\nexport type StorageObjectRef = z.infer<typeof StorageObjectRefSchema>;\r\n\r\n// The document a picture belongs to. A landing page picture's owner id is `SPECIAL_DOCS.LANDING_PAGE`.\r\nexport const PictureOwnerRefSchema = z\r\n .object({ kind: pictureOwnerKindSchema, id: z.string().min(1) })\r\n .strict();\r\nexport type PictureOwnerRef = z.infer<typeof PictureOwnerRefSchema>;\r\n\r\nexport const PendingMediaTargetSchema = z\r\n .object({\r\n owner: PictureOwnerRefSchema,\r\n // The object a carried picture was read from. Written only by the migration console's picture\r\n // carry, never from a callable's input; a carried picture fills only an empty slot.\r\n carriedFrom: StorageObjectRefSchema.optional(),\r\n // A badge upload that creates its award: the award's name, which the publication writes with\r\n // the award. The owner's id is then the upload's staging id.\r\n newAwardName: awardNameSchema.optional(),\r\n })\r\n .strict()\r\n .refine((target) => target.newAwardName === undefined || target.owner.kind === AWARD_DEFINITION_OWNER_KIND, {\r\n message: 'Only a badge upload creates an award.',\r\n path: ['newAwardName'],\r\n });\r\nexport type PendingMediaTarget = z.infer<typeof PendingMediaTargetSchema>;\r\n\r\nconst schemas = createPendingMediaSchemas({\r\n fileOriginSchema,\r\n domainEventSchema: DomainEventSchema,\r\n});\r\n\r\nexport const PendingMediaErrorCategorySchema = schemas.PendingMediaErrorCategorySchema;\r\nexport const PendingMediaResultSchema = schemas.PendingMediaResultSchema;\r\nexport const PendingMediaPendingSchema = schemas.PendingMediaPendingSchema;\r\nexport const PendingMediaProcessingSchema = schemas.PendingMediaProcessingSchema;\r\nexport const PendingMediaCompletedSchema = schemas.PendingMediaCompletedSchema;\r\nexport const PendingMediaFailedSchema = schemas.PendingMediaFailedSchema;\r\nexport const PendingMediaRejectedSchema = schemas.PendingMediaRejectedSchema;\r\nexport const PendingMediaSchema = schemas.PendingMediaSchema;\r\n\r\nexport type PendingMediaErrorCategory = z.infer<typeof PendingMediaErrorCategorySchema>;\r\nexport type PendingMediaResult = z.infer<typeof PendingMediaResultSchema>;\r\nexport type PendingMediaPending = z.infer<typeof PendingMediaPendingSchema>;\r\nexport type PendingMediaProcessing = z.infer<typeof PendingMediaProcessingSchema>;\r\nexport type PendingMediaCompleted = z.infer<typeof PendingMediaCompletedSchema>;\r\nexport type PendingMediaFailed = z.infer<typeof PendingMediaFailedSchema>;\r\nexport type PendingMediaRejected = z.infer<typeof PendingMediaRejectedSchema>;\r\nexport type PendingMedia = z.infer<typeof PendingMediaSchema>;\r\n"]}
1
+ {"version":3,"file":"pending-media.js","sourceRoot":"","sources":["../../src/doc-schemas/pending-media.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,iGAAiG;AACjG,gFAAgF;AAChF,EAAE;AACF,kGAAkG;AAClG,+FAA+F;AAC/F,8FAA8F;AAC9F,wFAAwF;AAExF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAEtD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;AACzD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,IAAI,CAAC,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,aAAa,CAAC;CACtB,CAAC,CAAC;AAGL,MAAM,OAAO,GAAG,yBAAyB,CAAC;IACxC,gBAAgB;IAChB,iBAAiB,EAAE,iBAAiB;CACrC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,+BAA+B,GAAG,OAAO,CAAC,+BAA+B,CAAC;AACvF,MAAM,CAAC,MAAM,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,CAAC;AACzE,MAAM,CAAC,MAAM,yBAAyB,GAAG,OAAO,CAAC,yBAAyB,CAAC;AAC3E,MAAM,CAAC,MAAM,4BAA4B,GAAG,OAAO,CAAC,4BAA4B,CAAC;AACjF,MAAM,CAAC,MAAM,2BAA2B,GAAG,OAAO,CAAC,2BAA2B,CAAC;AAC/E,MAAM,CAAC,MAAM,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,CAAC;AACzE,MAAM,CAAC,MAAM,0BAA0B,GAAG,OAAO,CAAC,0BAA0B,CAAC;AAC7E,MAAM,CAAC,MAAM,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC","sourcesContent":["// `pendingMedia/{pendingMediaId}` — one accepted picture upload: the durable hand-off from the\n// accepting callable to the processing trigger. Its id is the upload's staging id, which is also\n// the picture's id; rows are never deleted, so no two uploads ever share an id.\n//\n// The shape is media-schemas' generic pending-media lifecycle composed with Q-Sports' origins and\n// domain events. Every field is written by the server: `originalFileName` and `clientContext`,\n// which the generic shape requires, hold the staging id and the origin, so no client-authored\n// metadata reaches the row. `targetInfo` is the server-normalized `PendingMediaTarget`.\n\nimport { z } from 'zod';\nimport { createPendingMediaSchemas } from '@ttt-productions/media-schemas';\nimport { DomainEventSchema } from '../domain-events/domain-events.js';\nimport { FILE_ORIGIN_KEYS, PICTURE_ORIGIN_KEYS } from '../media/file-origins.js';\nimport { AWARD_DEFINITION_OWNER_KIND } from '../types/picture-owners.js';\nimport { countSchema } from './atoms.js';\nimport { awardNameSchema } from './catalogs.js';\nimport { pictureOwnerKindSchema } from './gallery.js';\n\nexport const fileOriginSchema = z.enum(FILE_ORIGIN_KEYS);\nexport const pictureOriginSchema = z.enum(PICTURE_ORIGIN_KEYS);\n\n// A stored object, by bucket and path — never a URL. A retained signature is recorded this way, and\n// so is the source a carried picture was read from.\nexport const StorageObjectRefSchema = z\n .object({ bucket: z.string().min(1), path: z.string().min(1) })\n .strict();\nexport type StorageObjectRef = z.infer<typeof StorageObjectRefSchema>;\n\n// The document a picture belongs to. A landing page picture's owner id is `SPECIAL_DOCS.LANDING_PAGE`.\nexport const PictureOwnerRefSchema = z\n .object({ kind: pictureOwnerKindSchema, id: z.string().min(1) })\n .strict();\nexport type PictureOwnerRef = z.infer<typeof PictureOwnerRefSchema>;\n\nexport const PendingMediaTargetSchema = z\n .object({\n owner: PictureOwnerRefSchema,\n // The object a carried picture was read from. Written only by the migration console's picture\n // carry, never from a callable's input; a carried picture fills only an empty slot.\n carriedFrom: StorageObjectRefSchema.optional(),\n // A carried picture's position in its V1 source list, so the carried gallery keeps V1's order\n // and V1's first image stays the featured one. Only beside `carriedFrom`.\n sourceIndex: countSchema.optional(),\n // A badge upload that creates its award: the award's name, which the publication writes with\n // the award. The owner's id is then the upload's staging id.\n newAwardName: awardNameSchema.optional(),\n })\n .strict()\n .refine((target) => target.newAwardName === undefined || target.owner.kind === AWARD_DEFINITION_OWNER_KIND, {\n message: 'Only a badge upload creates an award.',\n path: ['newAwardName'],\n })\n .refine((target) => target.sourceIndex === undefined || target.carriedFrom !== undefined, {\n message: 'Only a carried picture has a source position.',\n path: ['sourceIndex'],\n });\nexport type PendingMediaTarget = z.infer<typeof PendingMediaTargetSchema>;\n\nconst schemas = createPendingMediaSchemas({\n fileOriginSchema,\n domainEventSchema: DomainEventSchema,\n});\n\nexport const PendingMediaErrorCategorySchema = schemas.PendingMediaErrorCategorySchema;\nexport const PendingMediaResultSchema = schemas.PendingMediaResultSchema;\nexport const PendingMediaPendingSchema = schemas.PendingMediaPendingSchema;\nexport const PendingMediaProcessingSchema = schemas.PendingMediaProcessingSchema;\nexport const PendingMediaCompletedSchema = schemas.PendingMediaCompletedSchema;\nexport const PendingMediaFailedSchema = schemas.PendingMediaFailedSchema;\nexport const PendingMediaRejectedSchema = schemas.PendingMediaRejectedSchema;\nexport const PendingMediaSchema = schemas.PendingMediaSchema;\n\nexport type PendingMediaErrorCategory = z.infer<typeof PendingMediaErrorCategorySchema>;\nexport type PendingMediaResult = z.infer<typeof PendingMediaResultSchema>;\nexport type PendingMediaPending = z.infer<typeof PendingMediaPendingSchema>;\nexport type PendingMediaProcessing = z.infer<typeof PendingMediaProcessingSchema>;\nexport type PendingMediaCompleted = z.infer<typeof PendingMediaCompletedSchema>;\nexport type PendingMediaFailed = z.infer<typeof PendingMediaFailedSchema>;\nexport type PendingMediaRejected = z.infer<typeof PendingMediaRejectedSchema>;\nexport type PendingMedia = z.infer<typeof PendingMediaSchema>;\n"]}
@@ -34,6 +34,7 @@ export declare const COLLECTION_SCHEMAS: {
34
34
  readonly 'userProfiles/{userId}/privateData/{privateDataId}': z.ZodObject<{
35
35
  email: z.ZodString;
36
36
  registrationStartedAt: z.ZodOptional<z.ZodNumber>;
37
+ orphanDeletionClaimedAt: z.ZodOptional<z.ZodNumber>;
37
38
  defaultContactPhone: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
38
39
  theme: z.ZodOptional<z.ZodEnum<{
39
40
  light: "light";
@@ -1165,6 +1166,7 @@ export declare const COLLECTION_SCHEMAS: {
1165
1166
  version: z.ZodNumber;
1166
1167
  createdAt: z.ZodNumber;
1167
1168
  updatedAt: z.ZodNumber;
1169
+ retired: z.ZodBoolean;
1168
1170
  retiredAt: z.ZodOptional<z.ZodNumber>;
1169
1171
  lastChosenAt: z.ZodOptional<z.ZodNumber>;
1170
1172
  }, z.core.$strip>;
@@ -1196,6 +1198,7 @@ export declare const COLLECTION_SCHEMAS: {
1196
1198
  coCaptain: "coCaptain";
1197
1199
  }>>;
1198
1200
  subjectDisplayNameSnapshot: z.ZodOptional<z.ZodString>;
1201
+ witnessDisplayNameSnapshot: z.ZodOptional<z.ZodString>;
1199
1202
  }, z.core.$strip>;
1200
1203
  readonly 'hardwareLoanContracts/{contractId}': z.ZodObject<{
1201
1204
  refereeUserId: z.ZodString;
@@ -1246,8 +1249,10 @@ export declare const COLLECTION_SCHEMAS: {
1246
1249
  complete: z.ZodBoolean;
1247
1250
  discrepancies: z.ZodArray<z.ZodObject<{
1248
1251
  kind: z.ZodEnum<{
1252
+ gameUnreadable: "gameUnreadable";
1249
1253
  invalidEvent: "invalidEvent";
1250
1254
  eventSequenceMismatch: "eventSequenceMismatch";
1255
+ eventSequenceGap: "eventSequenceGap";
1251
1256
  rollupMismatch: "rollupMismatch";
1252
1257
  scoreMirrorMismatch: "scoreMirrorMismatch";
1253
1258
  unrosteredStatLine: "unrosteredStatLine";
@@ -1269,8 +1274,10 @@ export declare const COLLECTION_SCHEMAS: {
1269
1274
  actual: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodArray<z.ZodNullable<z.ZodNumber>>, z.ZodRecord<z.ZodString, z.ZodNumber>, z.ZodNull]>>;
1270
1275
  }, z.core.$strict>>;
1271
1276
  discrepancyCounts: z.ZodRecord<z.ZodEnum<{
1277
+ gameUnreadable: "gameUnreadable";
1272
1278
  invalidEvent: "invalidEvent";
1273
1279
  eventSequenceMismatch: "eventSequenceMismatch";
1280
+ eventSequenceGap: "eventSequenceGap";
1274
1281
  rollupMismatch: "rollupMismatch";
1275
1282
  scoreMirrorMismatch: "scoreMirrorMismatch";
1276
1283
  unrosteredStatLine: "unrosteredStatLine";
@@ -1526,6 +1533,7 @@ export declare const COLLECTION_SCHEMAS: {
1526
1533
  }>;
1527
1534
  ownerId: z.ZodString;
1528
1535
  position: z.ZodString;
1536
+ sourceIndex: z.ZodOptional<z.ZodNumber>;
1529
1537
  createdAt: z.ZodNumber;
1530
1538
  }, z.core.$strip>;
1531
1539
  readonly 'pendingMedia/{pendingMediaId}': z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -2574,6 +2582,7 @@ export declare const COLLECTION_SCHEMAS: {
2574
2582
  "adminNotification.archiveAllRequested": "adminNotification.archiveAllRequested";
2575
2583
  "system.manualIntervention": "system.manualIntervention";
2576
2584
  "migrationAction.pageRun": "migrationAction.pageRun";
2585
+ "migrationAction.writesCommitted": "migrationAction.writesCommitted";
2577
2586
  "migrationAction.controlRecorded": "migrationAction.controlRecorded";
2578
2587
  "migrationAction.checkpointRecorded": "migrationAction.checkpointRecorded";
2579
2588
  "migrationConsole.cutoverRecorded": "migrationConsole.cutoverRecorded";
@@ -2718,6 +2727,7 @@ export declare const COLLECTION_SCHEMAS: {
2718
2727
  }>;
2719
2728
  revision: z.ZodNumber;
2720
2729
  archived: z.ZodNumber;
2730
+ notArchived: z.ZodOptional<z.ZodNumber>;
2721
2731
  error: z.ZodNullable<z.ZodString>;
2722
2732
  attemptCount: z.ZodNumber;
2723
2733
  nextAttemptAt: z.ZodNumber;
@@ -2747,6 +2757,7 @@ export declare const COLLECTION_SCHEMAS: {
2747
2757
  }, z.core.$strip>;
2748
2758
  readonly '_appConfig/statsBeacon': z.ZodObject<{
2749
2759
  updatedAt: z.ZodNumber;
2760
+ changeId: z.ZodOptional<z.ZodString>;
2750
2761
  action: z.ZodEnum<{
2751
2762
  finalize: "finalize";
2752
2763
  reopen: "reopen";
@@ -2860,6 +2871,7 @@ export declare const COLLECTION_SCHEMAS: {
2860
2871
  operationId: z.ZodString;
2861
2872
  heldByUserId: z.ZodString;
2862
2873
  expiresAt: z.ZodNumber;
2874
+ pageClaimedAt: z.ZodOptional<z.ZodNumber>;
2863
2875
  }, z.core.$strict>>;
2864
2876
  updatedAt: z.ZodNumber;
2865
2877
  }, z.core.$strict>;
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/doc-schemas/registry.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA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sBAAsB,EAAE,KAAK;IAC7B,6BAA6B,EAAE,QAAQ;IACvC,8CAA8C,EAAE,SAAS;IACzD,mCAAmC,EAAE,UAAU;IAC/C,4BAA4B,EAAE,IAAI;IAClC,+BAA+B,EAAE,IAAI;IACrC,sCAAsC,EAAE,qBAAqB;IAC7D,qCAAqC,EAAE,YAAY;IACnD,oCAAoC,EAAE,OAAO;IAC7C,gCAAgC,EAAE,UAAU;CACwB,CAAC;AAEvE,mFAAmF;AACnF,MAAM,CAAC,MAAM,mBAAmB,GAAsB,EAAE,CAAC","sourcesContent":["// Collection → schema registry: every Firestore path template bound to the zod schema its\r\n// documents must satisfy. Every document a migration copy action writes is validated against the\r\n// schema bound here.\r\n//\r\n// A key is the literal path template — `{placeholder}` for an id, the literal segment for a fixed\r\n// document id. __tests__/doc-schemas-registry.test.ts fails when a collection constant has neither a\r\n// binding here nor an explicit PENDING_COLLECTIONS entry.\r\n\r\nimport type { z } from 'zod';\r\nimport { StatusReconcileQueueEntrySchema } from './status-reconcile-queue.js';\r\nimport {\r\n ActiveAdminNotificationSchema,\r\n AdminNotificationHistorySchema,\r\n NotificationArchiveAllJobSchema,\r\n NotificationDeliverySchema,\r\n} from './admin-notifications.js';\r\nimport { AwardDefinitionSchema } from './catalogs.js';\r\nimport { GameLocationSchema } from './game-location.js';\r\nimport { GalleryPictureSchema } from './gallery.js';\r\nimport { PendingMediaSchema } from './pending-media.js';\r\nimport { PictureRetirementSchema } from './picture-retirement.js';\r\nimport { GameRosterPlayerSchema, SportGameSchema } from './sport-game.js';\r\nimport { SportHallOfFameSchema } from './aggregate-stats.js';\r\nimport { GameStatHistoryPageSchema } from './game-stat-history.js';\r\nimport { GameStatEventSchema } from './game-stats.js';\r\nimport { StatsOperationSchema } from './stats-operation.js';\r\nimport { LeagueTeamContactSchema, LeagueTeamSchema } from './league-team.js';\r\nimport { MembershipRosterSyncSchema } from './membership-roster-sync.js';\r\nimport { MigrationActionRunSchema, MigrationConsoleSchema } from './migration-console.js';\r\nimport { AuditEventSchema } from './audit-event.js';\r\nimport { PublicUserSchema } from './publicUser.js';\r\nimport { RegistrationStartSchema } from './registration-start.js';\r\nimport { ReservedDisplayNameSchema } from './reserved-display-name.js';\r\nimport { SportLeagueSchema } from './sport-league.js';\r\nimport { SweepStateSchema } from './sweep-state.js';\r\nimport {\r\n AppConfigSchema,\r\n LandingPageConfigSchema,\r\n AdminListSchema,\r\n StatsBeaconSchema,\r\n StatsValidationReportSchema,\r\n} from './system.js';\r\nimport {\r\n LeagueFreeAgentSchema,\r\n TeamJoinRequestSchema,\r\n TeamInvitationSchema,\r\n TeamMembershipSchema,\r\n} from './team-membership.js';\r\nimport { HistoricalStatsSchema, UserPrivateDataSchema, UserProfileSchema } from './user-profile.js';\r\nimport { HardwareLoanContractSchema, SignedWaiverSchema } from './waivers-and-hardware.js';\r\nimport { WaiverTemplateSchema, WaiverTemplateVersionSchema } from './waiver-template.js';\r\n\r\nexport const COLLECTION_SCHEMAS = {\r\n 'userProfiles/{userId}': UserProfileSchema,\r\n 'userProfiles/{userId}/privateData/{privateDataId}': UserPrivateDataSchema,\r\n 'userProfiles/{userId}/historicalStats/{sportKey}': HistoricalStatsSchema,\r\n 'publicUsers/{userId}': PublicUserSchema,\r\n 'reservedDisplayNames/{reservedDisplayNameKey}': ReservedDisplayNameSchema,\r\n 'statusReconcileQueue/{userId}': StatusReconcileQueueEntrySchema,\r\n 'registrationStarts/{userId}': RegistrationStartSchema,\r\n\r\n 'sportLeagues/{leagueId}': SportLeagueSchema,\r\n 'leagueTeams/{teamId}': LeagueTeamSchema,\r\n 'leagueTeamContacts/{teamId}': LeagueTeamContactSchema,\r\n 'teamMemberships/{teamMembershipId}': TeamMembershipSchema,\r\n 'membershipRosterSyncs/{teamMembershipId}': MembershipRosterSyncSchema,\r\n 'teamInvitations/{inviteId}': TeamInvitationSchema,\r\n 'teamJoinRequests/{requestId}': TeamJoinRequestSchema,\r\n 'leagueFreeAgents/{leagueFreeAgentId}': LeagueFreeAgentSchema,\r\n\r\n 'sportGames/{gameId}': SportGameSchema,\r\n 'sportGames/{gameId}/gameRosterPlayers/{gameRosterPlayerId}': GameRosterPlayerSchema,\r\n 'sportGames/{gameId}/gameStatEvents/{eventId}': GameStatEventSchema,\r\n 'sportGames/{gameId}/gameStatHistory/{pageId}': GameStatHistoryPageSchema,\r\n 'gameLocations/{gameLocationId}': GameLocationSchema,\r\n\r\n 'waiverTemplates/{waiverTemplateId}': WaiverTemplateSchema,\r\n 'waiverTemplates/{waiverTemplateId}/waiverTemplateVersions/{versionId}': WaiverTemplateVersionSchema,\r\n 'signedWaivers/{signedWaiverId}': SignedWaiverSchema,\r\n 'hardwareLoanContracts/{contractId}': HardwareLoanContractSchema,\r\n\r\n 'awardDefinitions/{awardId}': AwardDefinitionSchema,\r\n 'sportHallOfFame/{sportKey}': SportHallOfFameSchema,\r\n 'statsValidationReports/{reportId}': StatsValidationReportSchema,\r\n 'statsOperations/{operationId}': StatsOperationSchema,\r\n\r\n 'galleryPictures/{pictureId}': GalleryPictureSchema,\r\n 'pendingMedia/{pendingMediaId}': PendingMediaSchema,\r\n 'pictureRetirements/{retirementId}': PictureRetirementSchema,\r\n\r\n 'auditEvents/{auditEventId}': AuditEventSchema,\r\n\r\n 'activeAdminNotifications/{notificationId}': ActiveAdminNotificationSchema,\r\n 'adminNotificationHistory/{historyId}': AdminNotificationHistorySchema,\r\n 'notificationDeliveries/{deliveryId}': NotificationDeliverySchema,\r\n 'notificationArchiveAllJobs/{jobId}': NotificationArchiveAllJobSchema,\r\n\r\n '_appConfig/landingPage': LandingPageConfigSchema,\r\n '_appConfig/app': AppConfigSchema,\r\n '_appConfig/statsBeacon': StatsBeaconSchema,\r\n '_systemData/adminList': AdminListSchema,\r\n '_serverData/migrationConsole': MigrationConsoleSchema,\r\n 'migrationActionRuns/{actionId}': MigrationActionRunSchema,\r\n 'sweepState/{sweepName}': SweepStateSchema,\r\n} as const satisfies Record<string, z.ZodTypeAny>;\r\n\r\nexport type RegisteredCollectionPath = keyof typeof COLLECTION_SCHEMAS;\r\n\r\n// The body field that equals the document id, where a schema declares one. A drift check injects\r\n// `doc.id` under this key before validating, so a doc-id field is never a false mismatch.\r\nexport const COLLECTION_DOC_ID_FIELDS = {\r\n 'publicUsers/{userId}': 'uid',\r\n 'registrationStarts/{userId}': 'userId',\r\n 'sportGames/{gameId}/gameStatEvents/{eventId}': 'eventId',\r\n 'statsValidationReports/{reportId}': 'reportId',\r\n 'auditEvents/{auditEventId}': 'id',\r\n 'pendingMedia/{pendingMediaId}': 'id',\r\n 'adminNotificationHistory/{historyId}': 'archiveOccurrenceId',\r\n 'notificationDeliveries/{deliveryId}': 'deliveryId',\r\n 'notificationArchiveAllJobs/{jobId}': 'jobId',\r\n 'migrationActionRuns/{actionId}': 'actionId',\r\n} as const satisfies Partial<Record<RegisteredCollectionPath, string>>;\r\n\r\n// Collections declared in ../paths with no bound schema yet, each with the reason.\r\nexport const PENDING_COLLECTIONS: readonly string[] = [];\r\n"]}
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/doc-schemas/registry.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,iGAAiG;AACjG,qBAAqB;AACrB,EAAE;AACF,kGAAkG;AAClG,qGAAqG;AACrG,0DAA0D;AAG1D,OAAO,EAAE,+BAA+B,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EACL,6BAA6B,EAC7B,8BAA8B,EAC9B,+BAA+B,EAC/B,0BAA0B,GAC3B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,sBAA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gBAAgB;CACK,CAAC;AAIlD,iGAAiG;AACjG,0FAA0F;AAC1F,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,sBAAsB,EAAE,KAAK;IAC7B,6BAA6B,EAAE,QAAQ;IACvC,8CAA8C,EAAE,SAAS;IACzD,mCAAmC,EAAE,UAAU;IAC/C,4BAA4B,EAAE,IAAI;IAClC,+BAA+B,EAAE,IAAI;IACrC,sCAAsC,EAAE,qBAAqB;IAC7D,qCAAqC,EAAE,YAAY;IACnD,oCAAoC,EAAE,OAAO;IAC7C,gCAAgC,EAAE,UAAU;CACwB,CAAC;AAEvE,mFAAmF;AACnF,MAAM,CAAC,MAAM,mBAAmB,GAAsB,EAAE,CAAC","sourcesContent":["// Collection → schema registry: every Firestore path template bound to the zod schema its\n// documents must satisfy. Every document a migration copy action writes is validated against the\n// schema bound here.\n//\n// A key is the literal path template — `{placeholder}` for an id, the literal segment for a fixed\n// document id. __tests__/doc-schemas-registry.test.ts fails when a collection constant has neither a\n// binding here nor an explicit PENDING_COLLECTIONS entry.\n\nimport type { z } from 'zod';\nimport { StatusReconcileQueueEntrySchema } from './status-reconcile-queue.js';\nimport {\n ActiveAdminNotificationSchema,\n AdminNotificationHistorySchema,\n NotificationArchiveAllJobSchema,\n NotificationDeliverySchema,\n} from './admin-notifications.js';\nimport { AwardDefinitionSchema } from './catalogs.js';\nimport { GameLocationSchema } from './game-location.js';\nimport { GalleryPictureSchema } from './gallery.js';\nimport { PendingMediaSchema } from './pending-media.js';\nimport { PictureRetirementSchema } from './picture-retirement.js';\nimport { GameRosterPlayerSchema, SportGameSchema } from './sport-game.js';\nimport { SportHallOfFameSchema } from './aggregate-stats.js';\nimport { GameStatHistoryPageSchema } from './game-stat-history.js';\nimport { GameStatEventSchema } from './game-stats.js';\nimport { StatsOperationSchema } from './stats-operation.js';\nimport { LeagueTeamContactSchema, LeagueTeamSchema } from './league-team.js';\nimport { MembershipRosterSyncSchema } from './membership-roster-sync.js';\nimport { MigrationActionRunSchema, MigrationConsoleSchema } from './migration-console.js';\nimport { AuditEventSchema } from './audit-event.js';\nimport { PublicUserSchema } from './publicUser.js';\nimport { RegistrationStartSchema } from './registration-start.js';\nimport { ReservedDisplayNameSchema } from './reserved-display-name.js';\nimport { SportLeagueSchema } from './sport-league.js';\nimport { SweepStateSchema } from './sweep-state.js';\nimport {\n AppConfigSchema,\n LandingPageConfigSchema,\n AdminListSchema,\n StatsBeaconSchema,\n StatsValidationReportSchema,\n} from './system.js';\nimport {\n LeagueFreeAgentSchema,\n TeamJoinRequestSchema,\n TeamInvitationSchema,\n TeamMembershipSchema,\n} from './team-membership.js';\nimport { HistoricalStatsSchema, UserPrivateDataSchema, UserProfileSchema } from './user-profile.js';\nimport { HardwareLoanContractSchema, SignedWaiverSchema } from './waivers-and-hardware.js';\nimport { WaiverTemplateSchema, WaiverTemplateVersionSchema } from './waiver-template.js';\n\nexport const COLLECTION_SCHEMAS = {\n 'userProfiles/{userId}': UserProfileSchema,\n 'userProfiles/{userId}/privateData/{privateDataId}': UserPrivateDataSchema,\n 'userProfiles/{userId}/historicalStats/{sportKey}': HistoricalStatsSchema,\n 'publicUsers/{userId}': PublicUserSchema,\n 'reservedDisplayNames/{reservedDisplayNameKey}': ReservedDisplayNameSchema,\n 'statusReconcileQueue/{userId}': StatusReconcileQueueEntrySchema,\n 'registrationStarts/{userId}': RegistrationStartSchema,\n\n 'sportLeagues/{leagueId}': SportLeagueSchema,\n 'leagueTeams/{teamId}': LeagueTeamSchema,\n 'leagueTeamContacts/{teamId}': LeagueTeamContactSchema,\n 'teamMemberships/{teamMembershipId}': TeamMembershipSchema,\n 'membershipRosterSyncs/{teamMembershipId}': MembershipRosterSyncSchema,\n 'teamInvitations/{inviteId}': TeamInvitationSchema,\n 'teamJoinRequests/{requestId}': TeamJoinRequestSchema,\n 'leagueFreeAgents/{leagueFreeAgentId}': LeagueFreeAgentSchema,\n\n 'sportGames/{gameId}': SportGameSchema,\n 'sportGames/{gameId}/gameRosterPlayers/{gameRosterPlayerId}': GameRosterPlayerSchema,\n 'sportGames/{gameId}/gameStatEvents/{eventId}': GameStatEventSchema,\n 'sportGames/{gameId}/gameStatHistory/{pageId}': GameStatHistoryPageSchema,\n 'gameLocations/{gameLocationId}': GameLocationSchema,\n\n 'waiverTemplates/{waiverTemplateId}': WaiverTemplateSchema,\n 'waiverTemplates/{waiverTemplateId}/waiverTemplateVersions/{versionId}': WaiverTemplateVersionSchema,\n 'signedWaivers/{signedWaiverId}': SignedWaiverSchema,\n 'hardwareLoanContracts/{contractId}': HardwareLoanContractSchema,\n\n 'awardDefinitions/{awardId}': AwardDefinitionSchema,\n 'sportHallOfFame/{sportKey}': SportHallOfFameSchema,\n 'statsValidationReports/{reportId}': StatsValidationReportSchema,\n 'statsOperations/{operationId}': StatsOperationSchema,\n\n 'galleryPictures/{pictureId}': GalleryPictureSchema,\n 'pendingMedia/{pendingMediaId}': PendingMediaSchema,\n 'pictureRetirements/{retirementId}': PictureRetirementSchema,\n\n 'auditEvents/{auditEventId}': AuditEventSchema,\n\n 'activeAdminNotifications/{notificationId}': ActiveAdminNotificationSchema,\n 'adminNotificationHistory/{historyId}': AdminNotificationHistorySchema,\n 'notificationDeliveries/{deliveryId}': NotificationDeliverySchema,\n 'notificationArchiveAllJobs/{jobId}': NotificationArchiveAllJobSchema,\n\n '_appConfig/landingPage': LandingPageConfigSchema,\n '_appConfig/app': AppConfigSchema,\n '_appConfig/statsBeacon': StatsBeaconSchema,\n '_systemData/adminList': AdminListSchema,\n '_serverData/migrationConsole': MigrationConsoleSchema,\n 'migrationActionRuns/{actionId}': MigrationActionRunSchema,\n 'sweepState/{sweepName}': SweepStateSchema,\n} as const satisfies Record<string, z.ZodTypeAny>;\n\nexport type RegisteredCollectionPath = keyof typeof COLLECTION_SCHEMAS;\n\n// The body field that equals the document id, where a schema declares one. A drift check injects\n// `doc.id` under this key before validating, so a doc-id field is never a false mismatch.\nexport const COLLECTION_DOC_ID_FIELDS = {\n 'publicUsers/{userId}': 'uid',\n 'registrationStarts/{userId}': 'userId',\n 'sportGames/{gameId}/gameStatEvents/{eventId}': 'eventId',\n 'statsValidationReports/{reportId}': 'reportId',\n 'auditEvents/{auditEventId}': 'id',\n 'pendingMedia/{pendingMediaId}': 'id',\n 'adminNotificationHistory/{historyId}': 'archiveOccurrenceId',\n 'notificationDeliveries/{deliveryId}': 'deliveryId',\n 'notificationArchiveAllJobs/{jobId}': 'jobId',\n 'migrationActionRuns/{actionId}': 'actionId',\n} as const satisfies Partial<Record<RegisteredCollectionPath, string>>;\n\n// Collections declared in ../paths with no bound schema yet, each with the reason.\nexport const PENDING_COLLECTIONS: readonly string[] = [];\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sport-game.js","sourceRoot":"","sources":["../../src/doc-schemas/sport-game.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,0FAA0F;AAE1F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,wBAAwB,EACxB,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,sBAAsB,EACtB,YAAY,EACZ,YAAY,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1D,iGAAiG;AACjG,mGAAmG;AACnG,qFAAqF;AACrF,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,UAAU,EAAE,eAAe,CAAC,kBAAkB,CAAC,UAAU,CAAC,QAAQ,EAAE,kBAAkB,CAAC,UAAU,CAAC,UAAU,CAAC;IAC7G,OAAO,EAAE,eAAe,CAAC,kBAAkB,CAAC,OAAO,CAAC,QAAQ,EAAE,kBAAkB,C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C;AAE3F,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC;KAClC,MAAM,CAAC;IACN,GAAG,aAAa;IAChB,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,YAAiC,CAAC;IACxD,KAAK,EAAE,wBAAwB,CAAC,UAAU;IAC1C,yCAAyC;IACzC,cAAc,EAAE,YAAY,CAAC,QAAQ,EAAE;CACxC,CAAC;KACD,MAAM,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC;AAG/C,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC;KAC/B,MAAM,CAAC;IACN,GAAG,aAAa;IAChB,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,SAA8B,CAAC;IACrD,KAAK,EAAE,wBAAwB,CAAC,OAAO;CACxC,CAAC;KACD,MAAM,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC;AAG/C,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC;KAChC,MAAM,CAAC;IACN,GAAG,aAAa;IAChB,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,UAA+B,CAAC;IACtD,KAAK,EAAE,wBAAwB,CAAC,QAAQ;CACzC,CAAC;KACD,MAAM,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC;AAG/C,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,kBAAkB,CAAC,YAAY,EAAE;IAChE,oBAAoB;IACpB,iBAAiB;IACjB,kBAAkB;CACnB,CAAC,CAAC;AAGH,oGAAoG;AACpG,+FAA+F;AAC/F,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,QAAQ,EAAE,aAAa;CACxB,CAAC,CAAC","sourcesContent":["// `sportGames/{gameId}` — one scheduled or played game — and its `gameRosterPlayers` subcollection.\r\n// The game is discriminated on `leagueType`, which selects its `stats` shape (SPORT-002).\r\n\r\nimport { z } from 'zod';\r\nimport { parseGameRosterPlayerId } from '../ids/compound-ids.js';\r\nimport type { LeagueType } from '../types/sports.js';\r\nimport { SPORT_LINE_SCHEMAS } from './aggregate-stats.js';\r\nimport { gameStatsSchema } from './game-stats.js';\r\nimport {\r\n calendarDateSchema,\r\n countSchema,\r\n epochMsSchema,\r\n gameRosterPlayerIdSchema,\r\n gameStatusSchema,\r\n leagueIdSchema,\r\n scheduleWeekIdSchema,\r\n statsOperationIdSchema,\r\n teamIdSchema,\r\n userIdSchema,\r\n} from './atoms.js';\r\nimport { gameLocationIdSchema } from './game-location.js';\r\n\r\n// Each sport's game `stats`: the two-key payload (SPORT-001) over that sport's game lines, taken\r\n// from `SPORT_LINE_SCHEMAS` — the one pairing of a sport with its lines. Spelled per sport so each\r\n// payload keeps its exact type; `satisfies` fails the build when a sport is missing.\r\nexport const SPORT_GAME_STATS_SCHEMAS = {\r\n Basketball: gameStatsSchema(SPORT_LINE_SCHEMAS.Basketball.gameTeam, SPORT_LINE_SCHEMAS.Basketball.gamePlayer),\r\n Curling: gameStatsSchema(SPORT_LINE_SCHEMAS.Curling.gameTeam, SPORT_LINE_SCHEMAS.Curling.gamePlayer),\r\n Football: gameStatsSchema(SPORT_LINE_SCHEMAS.Football.gameTeam, SPORT_LINE_SCHEMAS.Football.gamePlayer),\r\n} as const satisfies Record<LeagueType, z.ZodType>;\r\n\r\nexport type BasketballGameStats = z.infer<typeof SPORT_GAME_STATS_SCHEMAS.Basketball>;\r\nexport type CurlingGameStats = z.infer<typeof SPORT_GAME_STATS_SCHEMAS.Curling>;\r\nexport type FootballGameStats = z.infer<typeof SPORT_GAME_STATS_SCHEMAS.Football>;\r\n\r\n// Which sport's payload a game holds is decided by its `leagueType`, never by the payload's shape\r\n// (SPORT-002).\r\nexport type GameStats = z.infer<(typeof SPORT_GAME_STATS_SCHEMAS)[LeagueType]>;\r\n\r\n// One of a game's two team slots. `teamId` is a leagueTeams id, or BYE_TEAM_ID for a bye week.\r\nexport const GameTeamSchema = z.object({\r\n teamId: teamIdSchema,\r\n});\r\nexport type GameTeam = z.infer<typeof GameTeamSchema>;\r\n\r\nconst sportGameBase = {\r\n leagueId: leagueIdSchema,\r\n // The week this game belongs to; weekly schedules are reconstructed by grouping on `weekId`.\r\n weekId: scheduleWeekIdSchema,\r\n weekTitle: z.string(),\r\n weekLocation: z.string(),\r\n weekStartDate: epochMsSchema,\r\n startTime: epochMsSchema,\r\n // The game's local calendar date in LEAGUE_TIME_ZONE.\r\n dayKey: calendarDateSchema,\r\n // The venue as shown, e.g. \"Main Gym - Court 2\". Free text; `gameLocationId` is the reference.\r\n locationLabel: z.string(),\r\n gameLocationId: gameLocationIdSchema.optional(),\r\n subLocation: z.string().optional(),\r\n status: gameStatusSchema,\r\n // Positional: teams[0] is team one, teams[1] is team two.\r\n teams: z.tuple([GameTeamSchema, GameTeamSchema]),\r\n // The real (non-bye) team ids, for `array-contains` queries.\r\n teamIds: z.array(teamIdSchema).min(1).max(2),\r\n // Each team's score, mirrored from its `stats.teamStats` line by the same write that changes it\r\n // (SPORT-107), so a schedule or list reads a score without the stats.\r\n score: z.record(teamIdSchema, countSchema),\r\n // The number of this game's stat event documents, which is also the last `sequence` assigned.\r\n statEventSequence: countSchema,\r\n // A scorer's note per person, keyed by userId (real or ghost).\r\n memos: z.record(z.string(), z.string()).optional(),\r\n // Absence is per roster entry: a person on both teams can be absent on one side only.\r\n absentRosterPlayerIds: z.array(gameRosterPlayerIdSchema),\r\n // The roster entries finalize credited no game played — the adapter's decision, stored so every\r\n // later path reverses what was applied rather than deciding again (SPORT-204). Present only while\r\n // the game is completed.\r\n nonScoringRosterPlayerIds: z.array(gameRosterPlayerIdSchema).optional(),\r\n // Set while a multi-page stats operation holds the game; every other writer of its stats, roster,\r\n // absence, memos, teams, or existence refuses it until the operation clears it.\r\n statsOperationId: statsOperationIdSchema.optional(),\r\n finalizedAt: epochMsSchema.optional(),\r\n // When reopen last opened the finalized game again; set by reopen and never cleared. Its roster is\r\n // then the record of who played it, so a membership change no longer reaches it — only a scorer\r\n // adding a ghost to this game does.\r\n reopenedAt: epochMsSchema.optional(),\r\n createdAt: epochMsSchema,\r\n updatedAt: epochMsSchema,\r\n};\r\n\r\n// The rollup holds a line for each of the game's teams and no other, the score mirror names the same\r\n// teams, and every player line is keyed to one of them.\r\nfunction rollupMatchesTeams(game: {\r\n teamIds: string[];\r\n score: Record<string, number>;\r\n stats: { teamStats: Record<string, unknown>; playerStats: Record<string, unknown> };\r\n}): boolean {\r\n const teams = new Set(game.teamIds);\r\n const namesEveryTeam = (keys: string[]) => keys.length === teams.size && keys.every((key) => teams.has(key));\r\n return (\r\n namesEveryTeam(Object.keys(game.stats.teamStats)) &&\r\n namesEveryTeam(Object.keys(game.score)) &&\r\n Object.keys(game.stats.playerStats).every((key) => teams.has(parseGameRosterPlayerId(key)?.teamId ?? ''))\r\n );\r\n}\r\nconst ROLLUP_MISMATCH = \"The stats rollup and score mirror hold exactly the game's teams.\";\r\n\r\nexport const BasketballGameSchema = z\r\n .object({\r\n ...sportGameBase,\r\n leagueType: z.literal('Basketball' satisfies LeagueType),\r\n stats: SPORT_GAME_STATS_SCHEMAS.Basketball,\r\n // Which team holds the possession arrow.\r\n jumpBallTeamId: teamIdSchema.optional(),\r\n })\r\n .refine(rollupMatchesTeams, ROLLUP_MISMATCH);\r\nexport type BasketballGame = z.infer<typeof BasketballGameSchema>;\r\n\r\nexport const CurlingGameSchema = z\r\n .object({\r\n ...sportGameBase,\r\n leagueType: z.literal('Curling' satisfies LeagueType),\r\n stats: SPORT_GAME_STATS_SCHEMAS.Curling,\r\n })\r\n .refine(rollupMatchesTeams, ROLLUP_MISMATCH);\r\nexport type CurlingGame = z.infer<typeof CurlingGameSchema>;\r\n\r\nexport const FootballGameSchema = z\r\n .object({\r\n ...sportGameBase,\r\n leagueType: z.literal('Football' satisfies LeagueType),\r\n stats: SPORT_GAME_STATS_SCHEMAS.Football,\r\n })\r\n .refine(rollupMatchesTeams, ROLLUP_MISMATCH);\r\nexport type FootballGame = z.infer<typeof FootballGameSchema>;\r\n\r\nexport const SportGameSchema = z.discriminatedUnion('leagueType', [\r\n BasketballGameSchema,\r\n CurlingGameSchema,\r\n FootballGameSchema,\r\n]);\r\nexport type SportGame = z.infer<typeof SportGameSchema>;\r\n\r\n// `sportGames/{gameId}/gameRosterPlayers/{teamId}_{userId}` — one entry per team per person, the id\r\n// from `buildGameRosterPlayerId`. The roster is the participation authority finalize iterates.\r\nexport const GameRosterPlayerSchema = z.object({\r\n userId: userIdSchema,\r\n teamId: teamIdSchema,\r\n isGhost: z.boolean(),\r\n syncedAt: epochMsSchema,\r\n});\r\nexport type GameRosterPlayer = z.infer<typeof GameRosterPlayerSchema>;\r\n"]}
1
+ {"version":3,"file":"sport-game.js","sourceRoot":"","sources":["../../src/doc-schemas/sport-game.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,0FAA0F;AAE1F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,wBAAwB,EACxB,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,sBAAsB,EACtB,YAAY,EACZ,YAAY,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1D,iGAAiG;AACjG,mGAAmG;AACnG,qFAAqF;AACrF,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,UAAU,EAAE,eAAe,CAAC,kBAAkB,CAAC,UAAU,CAAC,QAAQ,EAAE,kBAAkB,CAAC,UAAU,CAAC,UAAU,CAAC;IAC7G,OAAO,EAAE,eAAe,CAAC,k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layers` subcollection.\n// The game is discriminated on `leagueType`, which selects its `stats` shape (SPORT-002).\n\nimport { z } from 'zod';\nimport { parseGameRosterPlayerId } from '../ids/compound-ids.js';\nimport type { LeagueType } from '../types/sports.js';\nimport { SPORT_LINE_SCHEMAS } from './aggregate-stats.js';\nimport { gameStatsSchema } from './game-stats.js';\nimport {\n calendarDateSchema,\n countSchema,\n epochMsSchema,\n gameRosterPlayerIdSchema,\n gameStatusSchema,\n leagueIdSchema,\n scheduleWeekIdSchema,\n statsOperationIdSchema,\n teamIdSchema,\n userIdSchema,\n} from './atoms.js';\nimport { gameLocationIdSchema } from './game-location.js';\n\n// Each sport's game `stats`: the two-key payload (SPORT-001) over that sport's game lines, taken\n// from `SPORT_LINE_SCHEMAS` — the one pairing of a sport with its lines. Spelled per sport so each\n// payload keeps its exact type; `satisfies` fails the build when a sport is missing.\nexport const SPORT_GAME_STATS_SCHEMAS = {\n Basketball: gameStatsSchema(SPORT_LINE_SCHEMAS.Basketball.gameTeam, SPORT_LINE_SCHEMAS.Basketball.gamePlayer),\n Curling: gameStatsSchema(SPORT_LINE_SCHEMAS.Curling.gameTeam, SPORT_LINE_SCHEMAS.Curling.gamePlayer),\n Football: gameStatsSchema(SPORT_LINE_SCHEMAS.Football.gameTeam, SPORT_LINE_SCHEMAS.Football.gamePlayer),\n} as const satisfies Record<LeagueType, z.ZodType>;\n\nexport type BasketballGameStats = z.infer<typeof SPORT_GAME_STATS_SCHEMAS.Basketball>;\nexport type CurlingGameStats = z.infer<typeof SPORT_GAME_STATS_SCHEMAS.Curling>;\nexport type FootballGameStats = z.infer<typeof SPORT_GAME_STATS_SCHEMAS.Football>;\n\n// Which sport's payload a game holds is decided by its `leagueType`, never by the payload's shape\n// (SPORT-002).\nexport type GameStats = z.infer<(typeof SPORT_GAME_STATS_SCHEMAS)[LeagueType]>;\n\n// One of a game's two team slots. `teamId` is a leagueTeams id, or BYE_TEAM_ID for a bye week.\nexport const GameTeamSchema = z.object({\n teamId: teamIdSchema,\n});\nexport type GameTeam = z.infer<typeof GameTeamSchema>;\n\nconst sportGameBase = {\n leagueId: leagueIdSchema,\n // The week this game belongs to; weekly schedules are reconstructed by grouping on `weekId`.\n weekId: scheduleWeekIdSchema,\n weekTitle: z.string(),\n weekLocation: z.string(),\n weekStartDate: epochMsSchema,\n startTime: epochMsSchema,\n // The game's local calendar date in LEAGUE_TIME_ZONE.\n dayKey: calendarDateSchema,\n // The venue as shown, e.g. \"Main Gym - Court 2\". Free text; `gameLocationId` is the reference.\n locationLabel: z.string(),\n gameLocationId: gameLocationIdSchema.optional(),\n subLocation: z.string().optional(),\n status: gameStatusSchema,\n // Positional: teams[0] is team one, teams[1] is team two.\n teams: z.tuple([GameTeamSchema, GameTeamSchema]),\n // The real (non-bye) team ids, for `array-contains` queries.\n teamIds: z.array(teamIdSchema).min(1).max(2),\n // Each team's score, mirrored from its `stats.teamStats` line by the same write that changes it\n // (SPORT-107), so a schedule or list reads a score without the stats.\n score: z.record(teamIdSchema, countSchema),\n // The number of this game's stat event documents, which is also the last `sequence` assigned.\n statEventSequence: countSchema,\n // A scorer's note per person, keyed by userId (real or ghost).\n memos: z.record(z.string(), z.string()).optional(),\n // Absence is per roster entry: a person on both teams can be absent on one side only.\n absentRosterPlayerIds: z.array(gameRosterPlayerIdSchema),\n // The roster entries finalize credited no game played — the adapter's decision, stored so every\n // later path reverses what was applied rather than deciding again (SPORT-204). Present only while\n // the game is completed.\n nonScoringRosterPlayerIds: z.array(gameRosterPlayerIdSchema).optional(),\n // Set while a multi-page stats operation holds the game; every other writer of its stats, roster,\n // absence, memos, teams, or existence refuses it until the operation clears it.\n statsOperationId: statsOperationIdSchema.optional(),\n finalizedAt: epochMsSchema.optional(),\n // When reopen last opened the finalized game again; set by reopen and never cleared. Its roster is\n // then the record of who played it, so a membership change no longer reaches it — only a scorer\n // adding a ghost to this game does.\n reopenedAt: epochMsSchema.optional(),\n createdAt: epochMsSchema,\n updatedAt: epochMsSchema,\n};\n\n// The rollup holds a line for each of the game's teams and no other, the score mirror names the same\n// teams, and every player line is keyed to one of them.\nfunction rollupMatchesTeams(game: {\n teamIds: string[];\n score: Record<string, number>;\n stats: { teamStats: Record<string, unknown>; playerStats: Record<string, unknown> };\n}): boolean {\n const teams = new Set(game.teamIds);\n const namesEveryTeam = (keys: string[]) => keys.length === teams.size && keys.every((key) => teams.has(key));\n return (\n namesEveryTeam(Object.keys(game.stats.teamStats)) &&\n namesEveryTeam(Object.keys(game.score)) &&\n Object.keys(game.stats.playerStats).every((key) => teams.has(parseGameRosterPlayerId(key)?.teamId ?? ''))\n );\n}\nconst ROLLUP_MISMATCH = \"The stats rollup and score mirror hold exactly the game's teams.\";\n\nexport const BasketballGameSchema = z\n .object({\n ...sportGameBase,\n leagueType: z.literal('Basketball' satisfies LeagueType),\n stats: SPORT_GAME_STATS_SCHEMAS.Basketball,\n // Which team holds the possession arrow.\n jumpBallTeamId: teamIdSchema.optional(),\n })\n .refine(rollupMatchesTeams, ROLLUP_MISMATCH);\nexport type BasketballGame = z.infer<typeof BasketballGameSchema>;\n\nexport const CurlingGameSchema = z\n .object({\n ...sportGameBase,\n leagueType: z.literal('Curling' satisfies LeagueType),\n stats: SPORT_GAME_STATS_SCHEMAS.Curling,\n })\n .refine(rollupMatchesTeams, ROLLUP_MISMATCH);\nexport type CurlingGame = z.infer<typeof CurlingGameSchema>;\n\nexport const FootballGameSchema = z\n .object({\n ...sportGameBase,\n leagueType: z.literal('Football' satisfies LeagueType),\n stats: SPORT_GAME_STATS_SCHEMAS.Football,\n })\n .refine(rollupMatchesTeams, ROLLUP_MISMATCH);\nexport type FootballGame = z.infer<typeof FootballGameSchema>;\n\nexport const SportGameSchema = z.discriminatedUnion('leagueType', [\n BasketballGameSchema,\n CurlingGameSchema,\n FootballGameSchema,\n]);\nexport type SportGame = z.infer<typeof SportGameSchema>;\n\n// `sportGames/{gameId}/gameRosterPlayers/{teamId}_{userId}` — one entry per team per person, the id\n// from `buildGameRosterPlayerId`. The roster is the participation authority finalize iterates.\nexport const GameRosterPlayerSchema = z.object({\n userId: userIdSchema,\n teamId: teamIdSchema,\n isGhost: z.boolean(),\n syncedAt: epochMsSchema,\n});\nexport type GameRosterPlayer = z.infer<typeof GameRosterPlayerSchema>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"stats-operation.d.ts","sourceRoot":"","sources":["../../src/doc-schemas/stats-operation.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmBxB,eAAO,MAAM,0BAA0B;;;;kBAIrC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAsB9E,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;kBAK5C,CAAC;AAEH,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;kBAK9C,CAAC;AAEH,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;kBAK3C,CAAC;AAGH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;kBAMzC,CAAC;AAEH,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;kBAK7C,CAAC;AAEH,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;kBAKhD,CAAC;AAEH,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;;kBAK/C,CAAC;AAKH,eAAO,MAAM,+BAA+B;;;;kBAI1C,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAKxF,eAAO,MAAM,qBAAqB;;;;kBAIhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAMpE,eAAO,MAAM,4BAA4B;;;;;kBAKvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GA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sDestinationChangeSchema = z.strictObject({
108
108
  after: z.record(z.string(), z.number()).nullable(),
109
109
  });
110
110
  // The ghost's one operation records the account a link chose, or the removal, so a call naming a
111
- // different account — or a removal against a link — is refused, and the same call resumes. A link
112
- // rewrites completed records, so it carries its reason; a never-played ghost's removal is not a
113
- // repair and carries none (BACKEND-212).
111
+ // different account — or a removal against a link — is refused, and the same call resumes. Neither
112
+ // takes a reason: a link is chosen and confirmed, and its audit event records who linked which ghost
113
+ // to whom and what moved (BACKEND-212).
114
114
  export const GhostPlayerStatsOperationSchema = z
115
115
  .strictObject({
116
116
  ...operationBase,
@@ -128,7 +128,9 @@ export const GhostPlayerStatsOperationSchema = z
128
128
  ghostUserId: userIdSchema,
129
129
  }),
130
130
  ]),
131
- // A link's reason; a removal carries none (one stored by an earlier removal is dropped on read).
131
+ // A reason stored by a link or a removal recorded while they still took one; no operation
132
+ // writes one now. A removal's is dropped on read; a link's is kept, so its stored operation
133
+ // still resumes.
132
134
  reason: repairReasonSchema.optional(),
133
135
  // A removal's finished-game entries, in the order it removed them; absent on a link.
134
136
  removedFinishedGameEntries: z.array(GhostRemovedFinishedEntrySchema).optional(),
@@ -139,13 +141,6 @@ export const GhostPlayerStatsOperationSchema = z
139
141
  // What a completed link did with the team's memberships, so a call after completion answers it.
140
142
  membershipOutcome: z.enum(GHOST_LINK_MEMBERSHIP_OUTCOME_KEYS).optional(),
141
143
  })
142
- .superRefine((operation, ctx) => {
143
- if (operation.scope.action === 'link' && operation.reason === undefined) {
144
- ctx.addIssue({ code: 'custom', path: ['reason'], message: 'A ghost link records its reason.' });
145
- }
146
- })
147
- // A removal recorded while removals still took a reason keeps it on disk; it is dropped on read
148
- // rather than failing the document, and no removal writes one now.
149
144
  .overwrite((operation) => {
150
145
  if (operation.scope.action !== 'removal' || operation.reason === undefined)
151
146
  return operation;
@@ -1 +1 @@
1
- {"version":3,"file":"stats-operation.js","sourceRoot":"","sources":["../../src/doc-schemas/stats-operation.ts"],"names":[],"mappings":"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'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. A link\n// rewrites completed records, so it carries its reason; a never-played ghost's removal is not a\n// repair and carries none (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 link's reason; a removal carries none (one stored by an earlier removal is dropped on read).\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 .superRefine((operation, ctx) => {\n if (operation.scope.action === 'link' && operation.reason === undefined) {\n ctx.addIssue({ code: 'custom', path: ['reason'], message: 'A ghost link records its reason.' });\n }\n })\n // A removal recorded while removals still took a reason keeps it on disk; it is dropped on read\n // rather than failing the document, and no removal writes one now.\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;AAE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AAO,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"]}
@@ -20,6 +20,7 @@ export declare const LandingPageConfigSchema: z.ZodObject<{
20
20
  export type LandingPageConfig = z.infer<typeof LandingPageConfigSchema>;
21
21
  export declare const StatsBeaconSchema: z.ZodObject<{
22
22
  updatedAt: z.ZodNumber;
23
+ changeId: z.ZodOptional<z.ZodString>;
23
24
  action: z.ZodEnum<{
24
25
  finalize: "finalize";
25
26
  reopen: "reopen";
@@ -41,8 +42,10 @@ export type AdminList = z.infer<typeof AdminListSchema>;
41
42
  export declare const STATS_DISCREPANCY_VALUE_SCHEMA: z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodArray<z.ZodNullable<z.ZodNumber>>, z.ZodRecord<z.ZodString, z.ZodNumber>, z.ZodNull]>;
42
43
  export declare const StatsDiscrepancySchema: z.ZodObject<{
43
44
  kind: z.ZodEnum<{
45
+ gameUnreadable: "gameUnreadable";
44
46
  invalidEvent: "invalidEvent";
45
47
  eventSequenceMismatch: "eventSequenceMismatch";
48
+ eventSequenceGap: "eventSequenceGap";
46
49
  rollupMismatch: "rollupMismatch";
47
50
  scoreMirrorMismatch: "scoreMirrorMismatch";
48
51
  unrosteredStatLine: "unrosteredStatLine";
@@ -89,8 +92,10 @@ export declare const StatsValidationReportSchema: z.ZodObject<{
89
92
  complete: z.ZodBoolean;
90
93
  discrepancies: z.ZodArray<z.ZodObject<{
91
94
  kind: z.ZodEnum<{
95
+ gameUnreadable: "gameUnreadable";
92
96
  invalidEvent: "invalidEvent";
93
97
  eventSequenceMismatch: "eventSequenceMismatch";
98
+ eventSequenceGap: "eventSequenceGap";
94
99
  rollupMismatch: "rollupMismatch";
95
100
  scoreMirrorMismatch: "scoreMirrorMismatch";
96
101
  unrosteredStatLine: "unrosteredStatLine";
@@ -112,8 +117,10 @@ export declare const StatsValidationReportSchema: z.ZodObject<{
112
117
  actual: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodArray<z.ZodNullable<z.ZodNumber>>, z.ZodRecord<z.ZodString, z.ZodNumber>, z.ZodNull]>>;
113
118
  }, z.core.$strict>>;
114
119
  discrepancyCounts: z.ZodRecord<z.ZodEnum<{
120
+ gameUnreadable: "gameUnreadable";
115
121
  invalidEvent: "invalidEvent";
116
122
  eventSequenceMismatch: "eventSequenceMismatch";
123
+ eventSequenceGap: "eventSequenceGap";
117
124
  rollupMismatch: "rollupMismatch";
118
125
  scoreMirrorMismatch: "scoreMirrorMismatch";
119
126
  unrosteredStatLine: "unrosteredStatLine";