@ttt-productions/q-core 0.1.16 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/dist/constants/business.d.ts.map +1 -1
  2. package/dist/constants/business.js +25 -5
  3. package/dist/constants/business.js.map +1 -1
  4. package/dist/constants/sports.d.ts.map +1 -1
  5. package/dist/constants/sports.js +2 -2
  6. package/dist/constants/sports.js.map +1 -1
  7. package/dist/doc-schemas/admin-notifications.d.ts +1 -1
  8. package/dist/doc-schemas/admin-notifications.d.ts.map +1 -1
  9. package/dist/doc-schemas/admin-notifications.js +4 -1
  10. package/dist/doc-schemas/admin-notifications.js.map +1 -1
  11. package/dist/doc-schemas/aggregate-stats.d.ts.map +1 -1
  12. package/dist/doc-schemas/aggregate-stats.js +4 -1
  13. package/dist/doc-schemas/aggregate-stats.js.map +1 -1
  14. package/dist/doc-schemas/atoms.d.ts.map +1 -1
  15. package/dist/doc-schemas/atoms.js +2 -2
  16. package/dist/doc-schemas/atoms.js.map +1 -1
  17. package/dist/doc-schemas/audit-event.d.ts.map +1 -1
  18. package/dist/doc-schemas/audit-event.js +8 -4
  19. package/dist/doc-schemas/audit-event.js.map +1 -1
  20. package/dist/doc-schemas/award-group-grant.d.ts.map +1 -1
  21. package/dist/doc-schemas/award-group-grant.js +11 -3
  22. package/dist/doc-schemas/award-group-grant.js.map +1 -1
  23. package/dist/doc-schemas/catalogs.js +1 -1
  24. package/dist/doc-schemas/catalogs.js.map +1 -1
  25. package/dist/doc-schemas/gallery.js +1 -1
  26. package/dist/doc-schemas/gallery.js.map +1 -1
  27. package/dist/doc-schemas/game-stat-history.d.ts.map +1 -1
  28. package/dist/doc-schemas/game-stat-history.js.map +1 -1
  29. package/dist/doc-schemas/game-stats.d.ts.map +1 -1
  30. package/dist/doc-schemas/game-stats.js +10 -2
  31. package/dist/doc-schemas/game-stats.js.map +1 -1
  32. package/dist/doc-schemas/league-team.js +1 -1
  33. package/dist/doc-schemas/league-team.js.map +1 -1
  34. package/dist/doc-schemas/membership-roster-sync.d.ts.map +1 -1
  35. package/dist/doc-schemas/membership-roster-sync.js +2 -1
  36. package/dist/doc-schemas/membership-roster-sync.js.map +1 -1
  37. package/dist/doc-schemas/migration-console.js +1 -1
  38. package/dist/doc-schemas/migration-console.js.map +1 -1
  39. package/dist/doc-schemas/pending-media.d.ts.map +1 -1
  40. package/dist/doc-schemas/pending-media.js.map +1 -1
  41. package/dist/doc-schemas/picture-retirement.d.ts.map +1 -1
  42. package/dist/doc-schemas/picture-retirement.js +5 -1
  43. package/dist/doc-schemas/picture-retirement.js.map +1 -1
  44. package/dist/doc-schemas/registry.d.ts +1 -1
  45. package/dist/doc-schemas/registry.d.ts.map +1 -1
  46. package/dist/doc-schemas/registry.js +1 -1
  47. package/dist/doc-schemas/registry.js.map +1 -1
  48. package/dist/doc-schemas/sport-game.d.ts.map +1 -1
  49. package/dist/doc-schemas/sport-game.js.map +1 -1
  50. package/dist/doc-schemas/sport-league.d.ts.map +1 -1
  51. package/dist/doc-schemas/sport-league.js +10 -2
  52. package/dist/doc-schemas/sport-league.js.map +1 -1
  53. package/dist/doc-schemas/status-reconcile-queue.d.ts.map +1 -1
  54. package/dist/doc-schemas/status-reconcile-queue.js.map +1 -1
  55. package/dist/doc-schemas/sweep-state.d.ts.map +1 -1
  56. package/dist/doc-schemas/sweep-state.js +10 -2
  57. package/dist/doc-schemas/sweep-state.js.map +1 -1
  58. package/dist/doc-schemas/system.d.ts.map +1 -1
  59. package/dist/doc-schemas/system.js.map +1 -1
  60. package/dist/doc-schemas/user-profile.d.ts.map +1 -1
  61. package/dist/doc-schemas/user-profile.js +1 -1
  62. package/dist/doc-schemas/user-profile.js.map +1 -1
  63. package/dist/doc-schemas/waivers-and-hardware.d.ts.map +1 -1
  64. package/dist/doc-schemas/waivers-and-hardware.js +15 -3
  65. package/dist/doc-schemas/waivers-and-hardware.js.map +1 -1
  66. package/dist/domain-events/domain-events.d.ts.map +1 -1
  67. package/dist/domain-events/domain-events.js +88 -24
  68. package/dist/domain-events/domain-events.js.map +1 -1
  69. package/dist/ids/notification-ids.d.ts.map +1 -1
  70. package/dist/ids/notification-ids.js.map +1 -1
  71. package/dist/ids/picture-ids.d.ts.map +1 -1
  72. package/dist/ids/picture-ids.js.map +1 -1
  73. package/dist/ids/stat-event-ids.d.ts.map +1 -1
  74. package/dist/ids/stat-event-ids.js.map +1 -1
  75. package/dist/ids/waiver-template-ids.d.ts.map +1 -1
  76. package/dist/ids/waiver-template-ids.js.map +1 -1
  77. package/dist/index.d.ts +4 -9
  78. package/dist/index.d.ts.map +1 -1
  79. package/dist/index.js +6 -9
  80. package/dist/index.js.map +1 -1
  81. package/dist/input-formats/{index.d.ts → input-formats.d.ts} +1 -1
  82. package/dist/input-formats/input-formats.d.ts.map +1 -0
  83. package/dist/input-formats/{index.js → input-formats.js} +1 -1
  84. package/dist/input-formats/input-formats.js.map +1 -0
  85. package/dist/media/file-origins.d.ts.map +1 -1
  86. package/dist/media/file-origins.js +30 -6
  87. package/dist/media/file-origins.js.map +1 -1
  88. package/dist/migration-console/action-ids.d.ts.map +1 -1
  89. package/dist/migration-console/action-ids.js.map +1 -1
  90. package/dist/migration-console/manifest.d.ts.map +1 -1
  91. package/dist/migration-console/manifest.js +42 -7
  92. package/dist/migration-console/manifest.js.map +1 -1
  93. package/dist/migration-console/run-state.d.ts.map +1 -1
  94. package/dist/migration-console/run-state.js.map +1 -1
  95. package/dist/notifications/admin-notification-config.d.ts.map +1 -1
  96. package/dist/notifications/admin-notification-config.js +5 -3
  97. package/dist/notifications/admin-notification-config.js.map +1 -1
  98. package/dist/notifications/occurrences.d.ts.map +1 -1
  99. package/dist/notifications/occurrences.js.map +1 -1
  100. package/dist/paths/path-builders.d.ts.map +1 -1
  101. package/dist/paths/path-builders.js +60 -15
  102. package/dist/paths/path-builders.js.map +1 -1
  103. package/dist/paths/picture-owner-paths.d.ts.map +1 -1
  104. package/dist/paths/picture-owner-paths.js.map +1 -1
  105. package/dist/paths/storage-paths.d.ts.map +1 -1
  106. package/dist/paths/storage-paths.js.map +1 -1
  107. package/dist/schemas/admin-notifications.d.ts.map +1 -1
  108. package/dist/schemas/admin-notifications.js +8 -4
  109. package/dist/schemas/admin-notifications.js.map +1 -1
  110. package/dist/schemas/app-config.js +1 -1
  111. package/dist/schemas/app-config.js.map +1 -1
  112. package/dist/schemas/atoms.d.ts +0 -1
  113. package/dist/schemas/atoms.d.ts.map +1 -1
  114. package/dist/schemas/atoms.js +3 -5
  115. package/dist/schemas/atoms.js.map +1 -1
  116. package/dist/schemas/awards.d.ts.map +1 -1
  117. package/dist/schemas/awards.js +13 -5
  118. package/dist/schemas/awards.js.map +1 -1
  119. package/dist/schemas/dead-letters.d.ts.map +1 -1
  120. package/dist/schemas/dead-letters.js +6 -3
  121. package/dist/schemas/dead-letters.js.map +1 -1
  122. package/dist/schemas/game-locations.d.ts.map +1 -1
  123. package/dist/schemas/game-locations.js +1 -1
  124. package/dist/schemas/game-locations.js.map +1 -1
  125. package/dist/schemas/hardware-loan-contracts.d.ts.map +1 -1
  126. package/dist/schemas/hardware-loan-contracts.js +11 -4
  127. package/dist/schemas/hardware-loan-contracts.js.map +1 -1
  128. package/dist/schemas/leagues.d.ts +2 -2
  129. package/dist/schemas/leagues.d.ts.map +1 -1
  130. package/dist/schemas/leagues.js +12 -3
  131. package/dist/schemas/leagues.js.map +1 -1
  132. package/dist/schemas/migration-console.d.ts.map +1 -1
  133. package/dist/schemas/migration-console.js +3 -6
  134. package/dist/schemas/migration-console.js.map +1 -1
  135. package/dist/schemas/pictures.d.ts.map +1 -1
  136. package/dist/schemas/pictures.js +6 -2
  137. package/dist/schemas/pictures.js.map +1 -1
  138. package/dist/schemas/schedules.d.ts +8 -8
  139. package/dist/schemas/schedules.d.ts.map +1 -1
  140. package/dist/schemas/schedules.js +9 -3
  141. package/dist/schemas/schedules.js.map +1 -1
  142. package/dist/schemas/scoring.d.ts +12 -12
  143. package/dist/schemas/scoring.d.ts.map +1 -1
  144. package/dist/schemas/scoring.js +11 -4
  145. package/dist/schemas/scoring.js.map +1 -1
  146. package/dist/schemas/signed-waivers.d.ts.map +1 -1
  147. package/dist/schemas/signed-waivers.js +5 -3
  148. package/dist/schemas/signed-waivers.js.map +1 -1
  149. package/dist/schemas/stats.d.ts.map +1 -1
  150. package/dist/schemas/stats.js +27 -8
  151. package/dist/schemas/stats.js.map +1 -1
  152. package/dist/schemas/team-joining.d.ts.map +1 -1
  153. package/dist/schemas/team-joining.js +13 -5
  154. package/dist/schemas/team-joining.js.map +1 -1
  155. package/dist/schemas/teams.d.ts.map +1 -1
  156. package/dist/schemas/teams.js +19 -6
  157. package/dist/schemas/teams.js.map +1 -1
  158. package/dist/schemas/uploads.d.ts.map +1 -1
  159. package/dist/schemas/uploads.js +12 -5
  160. package/dist/schemas/uploads.js.map +1 -1
  161. package/dist/schemas/users.d.ts.map +1 -1
  162. package/dist/schemas/users.js +22 -8
  163. package/dist/schemas/users.js.map +1 -1
  164. package/dist/schemas/waiver-templates.js +1 -1
  165. package/dist/schemas/waiver-templates.js.map +1 -1
  166. package/dist/sports/basketball-scoring.d.ts.map +1 -1
  167. package/dist/sports/basketball-scoring.js +67 -16
  168. package/dist/sports/basketball-scoring.js.map +1 -1
  169. package/dist/sports/basketball.d.ts.map +1 -1
  170. package/dist/sports/basketball.js +34 -7
  171. package/dist/sports/basketball.js.map +1 -1
  172. package/dist/sports/column-catalog.d.ts.map +1 -1
  173. package/dist/sports/column-catalog.js +4 -1
  174. package/dist/sports/column-catalog.js.map +1 -1
  175. package/dist/sports/contribution.d.ts.map +1 -1
  176. package/dist/sports/contribution.js +10 -3
  177. package/dist/sports/contribution.js.map +1 -1
  178. package/dist/sports/curling-scoring.d.ts.map +1 -1
  179. package/dist/sports/curling-scoring.js +30 -8
  180. package/dist/sports/curling-scoring.js.map +1 -1
  181. package/dist/sports/curling.d.ts.map +1 -1
  182. package/dist/sports/curling.js +1 -1
  183. package/dist/sports/curling.js.map +1 -1
  184. package/dist/sports/finalized-record.d.ts.map +1 -1
  185. package/dist/sports/finalized-record.js.map +1 -1
  186. package/dist/sports/football-scoring.d.ts.map +1 -1
  187. package/dist/sports/football-scoring.js +28 -8
  188. package/dist/sports/football-scoring.js.map +1 -1
  189. package/dist/sports/football.d.ts.map +1 -1
  190. package/dist/sports/football.js +1 -1
  191. package/dist/sports/football.js.map +1 -1
  192. package/dist/sports/index.d.ts +2 -2
  193. package/dist/sports/index.d.ts.map +1 -1
  194. package/dist/sports/index.js +1 -1
  195. package/dist/sports/index.js.map +1 -1
  196. package/dist/sports/ledger-continuity.d.ts.map +1 -1
  197. package/dist/sports/ledger-continuity.js.map +1 -1
  198. package/dist/sports/rankings.d.ts.map +1 -1
  199. package/dist/sports/rankings.js +5 -1
  200. package/dist/sports/rankings.js.map +1 -1
  201. package/dist/sports/replay.d.ts.map +1 -1
  202. package/dist/sports/replay.js +4 -1
  203. package/dist/sports/replay.js.map +1 -1
  204. package/dist/sports/rollup-check.d.ts.map +1 -1
  205. package/dist/sports/rollup-check.js +15 -3
  206. package/dist/sports/rollup-check.js.map +1 -1
  207. package/dist/sports/score-mirror.d.ts.map +1 -1
  208. package/dist/sports/score-mirror.js.map +1 -1
  209. package/dist/sports/scoring-display.d.ts.map +1 -1
  210. package/dist/sports/scoring-display.js.map +1 -1
  211. package/dist/sports/scoring.d.ts.map +1 -1
  212. package/dist/sports/scoring.js.map +1 -1
  213. package/dist/sports/sport-adapter.d.ts.map +1 -1
  214. package/dist/sports/sport-adapter.js.map +1 -1
  215. package/dist/sports/store-driver.d.ts.map +1 -1
  216. package/dist/sports/store-driver.js +18 -7
  217. package/dist/sports/store-driver.js.map +1 -1
  218. package/dist/types/audit.d.ts.map +1 -1
  219. package/dist/types/audit.js +16 -3
  220. package/dist/types/audit.js.map +1 -1
  221. package/dist/types/index.d.ts +0 -1
  222. package/dist/types/index.d.ts.map +1 -1
  223. package/dist/types/index.js +0 -1
  224. package/dist/types/index.js.map +1 -1
  225. package/dist/types/notifications.d.ts.map +1 -1
  226. package/dist/types/notifications.js +9 -13
  227. package/dist/types/notifications.js.map +1 -1
  228. package/dist/types/schedules.d.ts.map +1 -1
  229. package/dist/types/schedules.js.map +1 -1
  230. package/dist/types/sports.d.ts.map +1 -1
  231. package/dist/types/sports.js +9 -2
  232. package/dist/types/sports.js.map +1 -1
  233. package/dist/types/stats.d.ts.map +1 -1
  234. package/dist/types/stats.js +45 -9
  235. package/dist/types/stats.js.map +1 -1
  236. package/dist/types/unions.d.ts.map +1 -1
  237. package/dist/types/unions.js +32 -6
  238. package/dist/types/unions.js.map +1 -1
  239. package/dist/upload-variables/picture-upload-variables.d.ts.map +1 -1
  240. package/dist/upload-variables/picture-upload-variables.js +4 -2
  241. package/dist/upload-variables/picture-upload-variables.js.map +1 -1
  242. package/dist/upload-variables/sign-hardware-contract-variables.d.ts.map +1 -1
  243. package/dist/upload-variables/sign-hardware-contract-variables.js +4 -2
  244. package/dist/upload-variables/sign-hardware-contract-variables.js.map +1 -1
  245. package/dist/upload-variables/sign-waiver-variables.d.ts.map +1 -1
  246. package/dist/upload-variables/sign-waiver-variables.js +5 -3
  247. package/dist/upload-variables/sign-waiver-variables.js.map +1 -1
  248. package/dist/utils/app-config.d.ts.map +1 -1
  249. package/dist/utils/app-config.js +5 -1
  250. package/dist/utils/app-config.js.map +1 -1
  251. package/dist/utils/app-routes.d.ts.map +1 -1
  252. package/dist/utils/app-routes.js +6 -1
  253. package/dist/utils/app-routes.js.map +1 -1
  254. package/dist/utils/league-calendar.d.ts.map +1 -1
  255. package/dist/utils/league-calendar.js +4 -1
  256. package/dist/utils/league-calendar.js.map +1 -1
  257. package/dist/utils/league-join-warning.d.ts.map +1 -1
  258. package/dist/utils/league-join-warning.js +15 -5
  259. package/dist/utils/league-join-warning.js.map +1 -1
  260. package/dist/utils/schedules.d.ts.map +1 -1
  261. package/dist/utils/schedules.js +6 -2
  262. package/dist/utils/schedules.js.map +1 -1
  263. package/dist/utils/team-member-actions.d.ts.map +1 -1
  264. package/dist/utils/team-member-actions.js.map +1 -1
  265. package/package.json +5 -17
  266. package/dist/input-formats/index.d.ts.map +0 -1
  267. package/dist/input-formats/index.js.map +0 -1
  268. package/dist/migration-console/index.d.ts +0 -4
  269. package/dist/migration-console/index.d.ts.map +0 -1
  270. package/dist/migration-console/index.js +0 -5
  271. package/dist/migration-console/index.js.map +0 -1
  272. package/dist/types/documents.d.ts +0 -24
  273. package/dist/types/documents.d.ts.map +0 -1
  274. package/dist/types/documents.js +0 -5
  275. package/dist/types/documents.js.map +0 -1
@@ -10,18 +10,18 @@ export declare const StatEventSubmissionSchema: z.ZodDiscriminatedUnion<[z.ZodOb
10
10
  eventId: z.ZodString;
11
11
  type: z.ZodLiteral<"1PT">;
12
12
  teamId: z.ZodString;
13
- playerUserId: z.ZodString;
14
13
  recordedAt: z.ZodNumber;
14
+ playerUserId: z.ZodString;
15
15
  }, z.core.$strict>, z.ZodObject<{
16
16
  eventId: z.ZodString;
17
17
  type: z.ZodEnum<{
18
18
  "2PT": "2PT";
19
19
  "3PT": "3PT";
20
20
  }>;
21
- assistedByUserId: z.ZodOptional<z.ZodString>;
22
21
  teamId: z.ZodString;
23
- playerUserId: z.ZodString;
24
22
  recordedAt: z.ZodNumber;
23
+ assistedByUserId: z.ZodOptional<z.ZodString>;
24
+ playerUserId: z.ZodString;
25
25
  }, z.core.$strict>, z.ZodObject<{
26
26
  eventId: z.ZodString;
27
27
  type: z.ZodEnum<{
@@ -29,8 +29,8 @@ export declare const StatEventSubmissionSchema: z.ZodDiscriminatedUnion<[z.ZodOb
29
29
  ASSIST: "ASSIST";
30
30
  }>;
31
31
  teamId: z.ZodString;
32
- playerUserId: z.ZodString;
33
32
  recordedAt: z.ZodNumber;
33
+ playerUserId: z.ZodString;
34
34
  }, z.core.$strict>, z.ZodObject<{
35
35
  eventId: z.ZodString;
36
36
  type: z.ZodLiteral<"TIMEOUT">;
@@ -42,8 +42,8 @@ export declare const StatEventSubmissionSchema: z.ZodDiscriminatedUnion<[z.ZodOb
42
42
  type: z.ZodLiteral<"BULK_EDIT">;
43
43
  value: z.ZodNumber;
44
44
  teamId: z.ZodString;
45
- playerUserId: z.ZodString;
46
45
  recordedAt: z.ZodNumber;
46
+ playerUserId: z.ZodString;
47
47
  stat: z.ZodEnum<{
48
48
  points: "points";
49
49
  rebounds: "rebounds";
@@ -86,9 +86,9 @@ export declare const StatEventSubmissionSchema: z.ZodDiscriminatedUnion<[z.ZodOb
86
86
  value: z.ZodNumber;
87
87
  reason: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
88
88
  teamId: z.ZodString;
89
- playerUserId: z.ZodOptional<z.ZodString>;
90
89
  eventId: z.ZodString;
91
90
  recordedAt: z.ZodNumber;
91
+ playerUserId: z.ZodOptional<z.ZodString>;
92
92
  stat: z.ZodEnum<{
93
93
  score: "score";
94
94
  timeouts: "timeouts";
@@ -110,18 +110,18 @@ export declare const RecordGameStatEventsInputSchema: z.ZodObject<{
110
110
  eventId: z.ZodString;
111
111
  type: z.ZodLiteral<"1PT">;
112
112
  teamId: z.ZodString;
113
- playerUserId: z.ZodString;
114
113
  recordedAt: z.ZodNumber;
114
+ playerUserId: z.ZodString;
115
115
  }, z.core.$strict>, z.ZodObject<{
116
116
  eventId: z.ZodString;
117
117
  type: z.ZodEnum<{
118
118
  "2PT": "2PT";
119
119
  "3PT": "3PT";
120
120
  }>;
121
- assistedByUserId: z.ZodOptional<z.ZodString>;
122
121
  teamId: z.ZodString;
123
- playerUserId: z.ZodString;
124
122
  recordedAt: z.ZodNumber;
123
+ assistedByUserId: z.ZodOptional<z.ZodString>;
124
+ playerUserId: z.ZodString;
125
125
  }, z.core.$strict>, z.ZodObject<{
126
126
  eventId: z.ZodString;
127
127
  type: z.ZodEnum<{
@@ -129,8 +129,8 @@ export declare const RecordGameStatEventsInputSchema: z.ZodObject<{
129
129
  ASSIST: "ASSIST";
130
130
  }>;
131
131
  teamId: z.ZodString;
132
- playerUserId: z.ZodString;
133
132
  recordedAt: z.ZodNumber;
133
+ playerUserId: z.ZodString;
134
134
  }, z.core.$strict>, z.ZodObject<{
135
135
  eventId: z.ZodString;
136
136
  type: z.ZodLiteral<"TIMEOUT">;
@@ -142,8 +142,8 @@ export declare const RecordGameStatEventsInputSchema: z.ZodObject<{
142
142
  type: z.ZodLiteral<"BULK_EDIT">;
143
143
  value: z.ZodNumber;
144
144
  teamId: z.ZodString;
145
- playerUserId: z.ZodString;
146
145
  recordedAt: z.ZodNumber;
146
+ playerUserId: z.ZodString;
147
147
  stat: z.ZodEnum<{
148
148
  points: "points";
149
149
  rebounds: "rebounds";
@@ -186,9 +186,9 @@ export declare const RecordGameStatEventsInputSchema: z.ZodObject<{
186
186
  value: z.ZodNumber;
187
187
  reason: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
188
188
  teamId: z.ZodString;
189
- playerUserId: z.ZodOptional<z.ZodString>;
190
189
  eventId: z.ZodString;
191
190
  recordedAt: z.ZodNumber;
191
+ playerUserId: z.ZodOptional<z.ZodString>;
192
192
  stat: z.ZodEnum<{
193
193
  score: "score";
194
194
  timeouts: "timeouts";
@@ -1 +1 @@
1
- {"version":3,"file":"scoring.d.ts","sourceRoot":"","sources":["../../src/schemas/scoring.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA8DxB,eAAO,MAAM,sBAAsB,aAAuE,CAAC;AAI3G;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAYpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAG5E,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,CAAC;AAMpF,eAAO,MAAM,kCAAkC;;;;kBAMpC,CAAC;AACZ,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC;AAG9F,eAAO,MAAM,mCAAmC;;;;;kBAOrC,CAAC;AACZ,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mCAAmC,CAAC,CAAC;AAQhG,eAAO,MAAM,cAAc,wDAA0C,CAAC;AAEtE,eAAO,MAAM,yBAAyB;;;;kBAM3B,CAAC;AACZ,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,eAAO,MAAM,0BAA0B;;;;;kBAO5B,CAAC;AACZ,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAM9E,eAAO,MAAM,6BAA6B;;;kBAK/B,CAAC;AACZ,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEpF,eAAO,MAAM,8BAA8B;;;;kBAMhC,CAAC;AACZ,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC"}
@@ -5,10 +5,10 @@
5
5
  import { z } from 'zod';
6
6
  import { MAX_STAT_EVENTS_PER_WRITE } from '../constants/sports.js';
7
7
  import { isSportStatEventId } from '../ids/stat-event-ids.js';
8
- import { GAME_MEMO_INPUT_FORMAT } from '../input-formats/index.js';
8
+ import { GAME_MEMO_INPUT_FORMAT } from '../input-formats/input-formats.js';
9
9
  import { BasketballAssistableShotEventSchema, BasketballBulkEditEventSchema, BasketballOnePointEventSchema, BasketballPlayerTallyEventSchema, BasketballTimeoutEventSchema, CurlingBlankEndEventSchema, CurlingRoundScoreEventSchema, FootballBulkEditEventSchema, FootballScoreEventSchema, StatCorrectionEventSchema, StatVoidEventSchema, } from '../doc-schemas/game-stats.js';
10
10
  import { RECORDED_STAT_EVENT_OUTCOME_KEYS, STAT_EVENT_RECORDER_FIELD_KEYS, STAT_EVENT_REFUSAL_KEYS, STAT_EVENT_SNAPSHOT_FIELD_KEYS, } from '../types/stats.js';
11
- import { countSchema, gameIdSchema, gameRosterPlayerIdSchema, statEventIdSchema, teamIdSchema, textFieldSchema, userIdSchema, } from './atoms.js';
11
+ import { countSchema, gameIdSchema, gameRosterPlayerIdSchema, statEventIdSchema, teamIdSchema, textFieldSchema, userIdSchema, } from '../doc-schemas/atoms.js';
12
12
  const SERVER_DERIVED_FIELDS = new Set([
13
13
  ...STAT_EVENT_RECORDER_FIELD_KEYS,
14
14
  ...STAT_EVENT_SNAPSHOT_FIELD_KEYS,
@@ -37,12 +37,19 @@ export const StatEventSubmissionSchema = z.discriminatedUnion('type', [
37
37
  z.strictObject({ ...callerShape(BasketballAssistableShotEventSchema.shape), ...sportEventId }),
38
38
  z.strictObject({ ...callerShape(BasketballPlayerTallyEventSchema.shape), ...sportEventId }),
39
39
  z.strictObject({ ...callerShape(BasketballTimeoutEventSchema.shape), ...sportEventId }),
40
- z.strictObject({ ...callerShape(BasketballBulkEditEventSchema.shape), ...sportEventId, previousValue: countSchema }),
40
+ z.strictObject({
41
+ ...callerShape(BasketballBulkEditEventSchema.shape),
42
+ ...sportEventId,
43
+ previousValue: countSchema,
44
+ }),
41
45
  z.strictObject({ ...callerShape(CurlingRoundScoreEventSchema.shape), ...sportEventId }),
42
46
  z.strictObject({ ...callerShape(CurlingBlankEndEventSchema.shape), ...sportEventId }),
43
47
  z.strictObject({ ...callerShape(FootballScoreEventSchema.shape), ...sportEventId }),
44
48
  z.strictObject({ ...callerShape(FootballBulkEditEventSchema.shape), ...sportEventId }),
45
- z.strictObject({ ...callerShape(StatVoidEventSchema.shape, ['eventId']), targetEventId: sportStatEventIdSchema }),
49
+ z.strictObject({
50
+ ...callerShape(StatVoidEventSchema.shape, ['eventId']),
51
+ targetEventId: sportStatEventIdSchema,
52
+ }),
46
53
  z.strictObject(callerShape(StatCorrectionEventSchema.shape)),
47
54
  ]);
48
55
  // A queue drain, a bulk-entry submission, or an undo: one ordered batch, applied whole or not at all.
@@ -1 +1 @@
1
- {"version":3,"file":"scoring.js","sourceRoot":"","sources":["../../src/schemas/scoring.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,oGAAoG;AACpG,mGAAmG;AACnG,8DAA8D;AAE9D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EACL,mCAAmC,EACnC,6BAA6B,EAC7B,6BAA6B,EAC7B,gCAAgC,EAChC,4BAA4B,EAC5B,0BAA0B,EAC1B,4BAA4B,EAC5B,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,gCAAgC,EAChC,8BAA8B,EAC9B,uBAAuB,EACvB,8BAA8B,GAC/B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,WAAW,EACX,YAAY,EACZ,wBAAwB,EACxB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,YAAY,GACb,MAAM,YAAY,CAAC;AAOpB,MAAM,qBAAqB,GAAwB,IAAI,GAAG,CAAC;IACzD,GAAG,8BAA8B;IACjC,GAAG,8BAA8B;CAClC,CAAC,CAAC;AAEH;;;;GAIG;AACH,SAAS,WAAW,CAClB,KAAY,EACZ,UAA8B,EAAE;IAEhC,MAAM,OAAO,GAAG,IAAI,GAAG,CAAc,CAAC,GAAG,qBAAqB,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC;IAC7E,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,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8FAA8F;AAC9F,gGAAgG;AAEhG,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC;KAC3C,MAAM,CAAC;IACN,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;CACrB,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC;KAC5C,MAAM,CAAC;IACN,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACrB,CAAC;KACD,MAAM,EAAE,CAAC","sourcesContent":["// Callable contracts for live scoring: recording stat events, marking a roster entry absent, a\n// scorer's memo, and the jump-ball possession arrow. Each action is two entries over one core — the\n// member entry for a captain or co-captain of one of the game's two teams, and the admin entry for\n// an admin or referee — which share one input and one result.\n\nimport { z } from 'zod';\nimport { MAX_STAT_EVENTS_PER_WRITE } from '../constants/sports.js';\nimport { isSportStatEventId } from '../ids/stat-event-ids.js';\nimport { GAME_MEMO_INPUT_FORMAT } from '../input-formats/index.js';\nimport {\n BasketballAssistableShotEventSchema,\n BasketballBulkEditEventSchema,\n BasketballOnePointEventSchema,\n BasketballPlayerTallyEventSchema,\n BasketballTimeoutEventSchema,\n CurlingBlankEndEventSchema,\n CurlingRoundScoreEventSchema,\n FootballBulkEditEventSchema,\n FootballScoreEventSchema,\n StatCorrectionEventSchema,\n StatVoidEventSchema,\n} from '../doc-schemas/game-stats.js';\nimport {\n RECORDED_STAT_EVENT_OUTCOME_KEYS,\n STAT_EVENT_RECORDER_FIELD_KEYS,\n STAT_EVENT_REFUSAL_KEYS,\n STAT_EVENT_SNAPSHOT_FIELD_KEYS,\n} from '../types/stats.js';\nimport type { StatEventRecorderField, StatEventSnapshotField } from '../types/stats.js';\nimport {\n countSchema,\n gameIdSchema,\n gameRosterPlayerIdSchema,\n statEventIdSchema,\n teamIdSchema,\n textFieldSchema,\n userIdSchema,\n} from './atoms.js';\n\n// ---------------------------------------------------------------------------------------------\n// Recording stat events\n// ---------------------------------------------------------------------------------------------\n\ntype ServerDerivedField = StatEventRecorderField | StatEventSnapshotField;\nconst SERVER_DERIVED_FIELDS: ReadonlySet<string> = new Set([\n ...STAT_EVENT_RECORDER_FIELD_KEYS,\n ...STAT_EVENT_SNAPSHOT_FIELD_KEYS,\n]);\n\n/**\n * A stored event's fields as its caller sends them: without the sequence and recorder facts the\n * writing core derives (ARCH-106), and without a name snapshot, which only a copied event carries.\n * Built from the stored event's own declaration, so the wire and the document cannot drift.\n */\nfunction callerShape<Shape extends z.ZodRawShape, Omitted extends keyof Shape = never>(\n shape: Shape,\n omitted: readonly Omitted[] = [],\n): Omit<Shape, ServerDerivedField | Omitted> {\n const dropped = new Set<PropertyKey>([...SERVER_DERIVED_FIELDS, ...omitted]);\n return Object.fromEntries(Object.entries(shape).filter(([field]) => !dropped.has(field))) as Omit<\n Shape,\n ServerDerivedField | Omitted\n >;\n}\n\n// A sport event's id as its caller sends it — the id minted at the tap, or, as a void's target, one a\n// copied event kept. It becomes a document path, so it is held to the shape a sport event id has.\nexport const sportStatEventIdSchema = statEventIdSchema.refine(isSportStatEventId, 'Not a stat event id.');\n\nconst sportEventId = { eventId: sportStatEventIdSchema };\n\n/**\n * One event of a scoring write, as the tap minted it: a sport event with its id and `recordedAt`, or\n * a void naming its target, whose own id the core derives. A bulk edit carries `previousValue`, the\n * value the form showed, so a stale form is refused. A correction parses so the core can answer it\n * with its refusal: only the game-reconcile core appends one.\n */\nexport const StatEventSubmissionSchema = z.discriminatedUnion('type', [\n z.strictObject({ ...callerShape(BasketballOnePointEventSchema.shape), ...sportEventId }),\n z.strictObject({ ...callerShape(BasketballAssistableShotEventSchema.shape), ...sportEventId }),\n z.strictObject({ ...callerShape(BasketballPlayerTallyEventSchema.shape), ...sportEventId }),\n z.strictObject({ ...callerShape(BasketballTimeoutEventSchema.shape), ...sportEventId }),\n z.strictObject({ ...callerShape(BasketballBulkEditEventSchema.shape), ...sportEventId, previousValue: countSchema }),\n z.strictObject({ ...callerShape(CurlingRoundScoreEventSchema.shape), ...sportEventId }),\n z.strictObject({ ...callerShape(CurlingBlankEndEventSchema.shape), ...sportEventId }),\n z.strictObject({ ...callerShape(FootballScoreEventSchema.shape), ...sportEventId }),\n z.strictObject({ ...callerShape(FootballBulkEditEventSchema.shape), ...sportEventId }),\n z.strictObject({ ...callerShape(StatVoidEventSchema.shape, ['eventId']), targetEventId: sportStatEventIdSchema }),\n z.strictObject(callerShape(StatCorrectionEventSchema.shape)),\n]);\nexport type StatEventSubmission = z.infer<typeof StatEventSubmissionSchema>;\n\n// A queue drain, a bulk-entry submission, or an undo: one ordered batch, applied whole or not at all.\nexport const RecordGameStatEventsInputSchema = z\n .object({\n gameId: gameIdSchema,\n events: z.array(StatEventSubmissionSchema).min(1).max(MAX_STAT_EVENTS_PER_WRITE),\n })\n .strict();\nexport type RecordGameStatEventsInput = z.infer<typeof RecordGameStatEventsInputSchema>;\n\n// Each event sent, in order: stored now, or found already stored by an earlier send.\nexport const RecordedStatEventSchema = z\n .object({\n eventId: statEventIdSchema,\n outcome: z.enum(RECORDED_STAT_EVENT_OUTCOME_KEYS),\n sequence: z.number().int().positive(),\n })\n .strict();\nexport type RecordedStatEvent = z.infer<typeof RecordedStatEventSchema>;\n\nexport const RecordGameStatEventsResultSchema = z\n .object({\n gameId: gameIdSchema,\n events: z.array(RecordedStatEventSchema),\n })\n .strict();\nexport type RecordGameStatEventsResult = z.infer<typeof RecordGameStatEventsResultSchema>;\n\n// What a refused scoring write names in its error details: why, and the first event it refused. No\n// event of the batch was stored, and the scorekeeper's failed list shows the refusal's copy beside\n// that event.\nexport const StatEventRefusalDetailsSchema = z\n .object({\n refusal: z.enum(STAT_EVENT_REFUSAL_KEYS),\n eventId: statEventIdSchema,\n })\n .strict();\nexport type StatEventRefusalDetails = z.infer<typeof StatEventRefusalDetailsSchema>;\n\n// ---------------------------------------------------------------------------------------------\n// Absence — per roster entry, so a person on both teams can be absent on one side only\n// ---------------------------------------------------------------------------------------------\n\nexport const UpdateGameAbsentPlayersInputSchema = z\n .object({\n gameId: gameIdSchema,\n gameRosterPlayerId: gameRosterPlayerIdSchema,\n absent: z.boolean(),\n })\n .strict();\nexport type UpdateGameAbsentPlayersInput = z.infer<typeof UpdateGameAbsentPlayersInputSchema>;\n\n// `changed` is false when the entry was already marked that way; nothing was written.\nexport const UpdateGameAbsentPlayersResultSchema = z\n .object({\n gameId: gameIdSchema,\n gameRosterPlayerId: gameRosterPlayerIdSchema,\n absent: z.boolean(),\n changed: z.boolean(),\n })\n .strict();\nexport type UpdateGameAbsentPlayersResult = z.infer<typeof UpdateGameAbsentPlayersResultSchema>;\n\n// ---------------------------------------------------------------------------------------------\n// The memo — a scorer's note on one person in a live game (\"red shirt\", \"#9\")\n// ---------------------------------------------------------------------------------------------\n\n// Built from the memo's one declaration, so the memo form and the callable accept exactly the same\n// text: trimmed, one line, empty allowed — an empty memo clears the person's note.\nexport const gameMemoSchema = textFieldSchema(GAME_MEMO_INPUT_FORMAT);\n\nexport const UpdateGameMemoInputSchema = z\n .object({\n gameId: gameIdSchema,\n userId: userIdSchema,\n memo: gameMemoSchema,\n })\n .strict();\nexport type UpdateGameMemoInput = z.infer<typeof UpdateGameMemoInputSchema>;\n\nexport const UpdateGameMemoResultSchema = z\n .object({\n gameId: gameIdSchema,\n userId: userIdSchema,\n memo: z.string(),\n changed: z.boolean(),\n })\n .strict();\nexport type UpdateGameMemoResult = z.infer<typeof UpdateGameMemoResultSchema>;\n\n// ---------------------------------------------------------------------------------------------\n// The jump-ball possession arrow — set to a team, so a retried call lands where the first did\n// ---------------------------------------------------------------------------------------------\n\nexport const UpdateGameJumpBallInputSchema = z\n .object({\n gameId: gameIdSchema,\n teamId: teamIdSchema,\n })\n .strict();\nexport type UpdateGameJumpBallInput = z.infer<typeof UpdateGameJumpBallInputSchema>;\n\nexport const UpdateGameJumpBallResultSchema = z\n .object({\n gameId: gameIdSchema,\n teamId: teamIdSchema,\n changed: z.boolean(),\n })\n .strict();\nexport type UpdateGameJumpBallResult = z.infer<typeof UpdateGameJumpBallResultSchema>;\n"]}
1
+ {"version":3,"file":"scoring.js","sourceRoot":"","sources":["../../src/schemas/scoring.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,oGAAoG;AACpG,mGAAmG;AACnG,8DAA8D;AAE9D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EACL,mCAAmC,EACnC,6BAA6B,EAC7B,6BAA6B,EAC7B,gCAAgC,EAChC,4BAA4B,EAC5B,0BAA0B,EAC1B,4BAA4B,EAC5B,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,gCAAgC,EAChC,8BAA8B,EAC9B,uBAAuB,EACvB,8BAA8B,GAC/B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,WAAW,EACX,YAAY,EACZ,wBAAwB,EACxB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,YAAY,GACb,MAAM,yBAAyB,CAAC;AAOjC,MAAM,qBAAqB,GAAwB,IAAI,GAAG,CAAC;IACzD,GAAG,8BAA8B;IACjC,GAAG,8BAA8B;CAClC,CAAC,CAAC;AAEH;;;;GAIG;AACH,SAAS,WAAW,CAClB,KAAY,EACZ,UAA8B,EAAE;IAEhC,MAAM,OAAO,GAAG,IAAI,GAAG,CAAc,CAAC,GAAG,qBAAqB,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC;IAC7E,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,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IACN,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;CACrB,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC;KAC5C,MAAM,CAAC;IACN,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACrB,CAAC;KACD,MAAM,EAAE,CAAC","sourcesContent":["// Callable contracts for live scoring: recording stat events, marking a roster entry absent, a\n// scorer's memo, and the jump-ball possession arrow. Each action is two entries over one core — the\n// member entry for a captain or co-captain of one of the game's two teams, and the admin entry for\n// an admin or referee — which share one input and one result.\n\nimport { z } from 'zod';\nimport { MAX_STAT_EVENTS_PER_WRITE } from '../constants/sports.js';\nimport { isSportStatEventId } from '../ids/stat-event-ids.js';\nimport { GAME_MEMO_INPUT_FORMAT } from '../input-formats/input-formats.js';\nimport {\n BasketballAssistableShotEventSchema,\n BasketballBulkEditEventSchema,\n BasketballOnePointEventSchema,\n BasketballPlayerTallyEventSchema,\n BasketballTimeoutEventSchema,\n CurlingBlankEndEventSchema,\n CurlingRoundScoreEventSchema,\n FootballBulkEditEventSchema,\n FootballScoreEventSchema,\n StatCorrectionEventSchema,\n StatVoidEventSchema,\n} from '../doc-schemas/game-stats.js';\nimport {\n RECORDED_STAT_EVENT_OUTCOME_KEYS,\n STAT_EVENT_RECORDER_FIELD_KEYS,\n STAT_EVENT_REFUSAL_KEYS,\n STAT_EVENT_SNAPSHOT_FIELD_KEYS,\n} from '../types/stats.js';\nimport type { StatEventRecorderField, StatEventSnapshotField } from '../types/stats.js';\nimport {\n countSchema,\n gameIdSchema,\n gameRosterPlayerIdSchema,\n statEventIdSchema,\n teamIdSchema,\n textFieldSchema,\n userIdSchema,\n} from '../doc-schemas/atoms.js';\n\n// ---------------------------------------------------------------------------------------------\n// Recording stat events\n// ---------------------------------------------------------------------------------------------\n\ntype ServerDerivedField = StatEventRecorderField | StatEventSnapshotField;\nconst SERVER_DERIVED_FIELDS: ReadonlySet<string> = new Set([\n ...STAT_EVENT_RECORDER_FIELD_KEYS,\n ...STAT_EVENT_SNAPSHOT_FIELD_KEYS,\n]);\n\n/**\n * A stored event's fields as its caller sends them: without the sequence and recorder facts the\n * writing core derives (ARCH-106), and without a name snapshot, which only a copied event carries.\n * Built from the stored event's own declaration, so the wire and the document cannot drift.\n */\nfunction callerShape<Shape extends z.ZodRawShape, Omitted extends keyof Shape = never>(\n shape: Shape,\n omitted: readonly Omitted[] = [],\n): Omit<Shape, ServerDerivedField | Omitted> {\n const dropped = new Set<PropertyKey>([...SERVER_DERIVED_FIELDS, ...omitted]);\n return Object.fromEntries(Object.entries(shape).filter(([field]) => !dropped.has(field))) as Omit<\n Shape,\n ServerDerivedField | Omitted\n >;\n}\n\n// A sport event's id as its caller sends it — the id minted at the tap, or, as a void's target, one a\n// copied event kept. It becomes a document path, so it is held to the shape a sport event id has.\nexport const sportStatEventIdSchema = statEventIdSchema.refine(\n isSportStatEventId,\n 'Not a stat event id.',\n);\n\nconst sportEventId = { eventId: sportStatEventIdSchema };\n\n/**\n * One event of a scoring write, as the tap minted it: a sport event with its id and `recordedAt`, or\n * a void naming its target, whose own id the core derives. A bulk edit carries `previousValue`, the\n * value the form showed, so a stale form is refused. A correction parses so the core can answer it\n * with its refusal: only the game-reconcile core appends one.\n */\nexport const StatEventSubmissionSchema = z.discriminatedUnion('type', [\n z.strictObject({ ...callerShape(BasketballOnePointEventSchema.shape), ...sportEventId }),\n z.strictObject({ ...callerShape(BasketballAssistableShotEventSchema.shape), ...sportEventId }),\n z.strictObject({ ...callerShape(BasketballPlayerTallyEventSchema.shape), ...sportEventId }),\n z.strictObject({ ...callerShape(BasketballTimeoutEventSchema.shape), ...sportEventId }),\n z.strictObject({\n ...callerShape(BasketballBulkEditEventSchema.shape),\n ...sportEventId,\n previousValue: countSchema,\n }),\n z.strictObject({ ...callerShape(CurlingRoundScoreEventSchema.shape), ...sportEventId }),\n z.strictObject({ ...callerShape(CurlingBlankEndEventSchema.shape), ...sportEventId }),\n z.strictObject({ ...callerShape(FootballScoreEventSchema.shape), ...sportEventId }),\n z.strictObject({ ...callerShape(FootballBulkEditEventSchema.shape), ...sportEventId }),\n z.strictObject({\n ...callerShape(StatVoidEventSchema.shape, ['eventId']),\n targetEventId: sportStatEventIdSchema,\n }),\n z.strictObject(callerShape(StatCorrectionEventSchema.shape)),\n]);\nexport type StatEventSubmission = z.infer<typeof StatEventSubmissionSchema>;\n\n// A queue drain, a bulk-entry submission, or an undo: one ordered batch, applied whole or not at all.\nexport const RecordGameStatEventsInputSchema = z\n .object({\n gameId: gameIdSchema,\n events: z.array(StatEventSubmissionSchema).min(1).max(MAX_STAT_EVENTS_PER_WRITE),\n })\n .strict();\nexport type RecordGameStatEventsInput = z.infer<typeof RecordGameStatEventsInputSchema>;\n\n// Each event sent, in order: stored now, or found already stored by an earlier send.\nexport const RecordedStatEventSchema = z\n .object({\n eventId: statEventIdSchema,\n outcome: z.enum(RECORDED_STAT_EVENT_OUTCOME_KEYS),\n sequence: z.number().int().positive(),\n })\n .strict();\nexport type RecordedStatEvent = z.infer<typeof RecordedStatEventSchema>;\n\nexport const RecordGameStatEventsResultSchema = z\n .object({\n gameId: gameIdSchema,\n events: z.array(RecordedStatEventSchema),\n })\n .strict();\nexport type RecordGameStatEventsResult = z.infer<typeof RecordGameStatEventsResultSchema>;\n\n// What a refused scoring write names in its error details: why, and the first event it refused. No\n// event of the batch was stored, and the scorekeeper's failed list shows the refusal's copy beside\n// that event.\nexport const StatEventRefusalDetailsSchema = z\n .object({\n refusal: z.enum(STAT_EVENT_REFUSAL_KEYS),\n eventId: statEventIdSchema,\n })\n .strict();\nexport type StatEventRefusalDetails = z.infer<typeof StatEventRefusalDetailsSchema>;\n\n// ---------------------------------------------------------------------------------------------\n// Absence — per roster entry, so a person on both teams can be absent on one side only\n// ---------------------------------------------------------------------------------------------\n\nexport const UpdateGameAbsentPlayersInputSchema = z\n .object({\n gameId: gameIdSchema,\n gameRosterPlayerId: gameRosterPlayerIdSchema,\n absent: z.boolean(),\n })\n .strict();\nexport type UpdateGameAbsentPlayersInput = z.infer<typeof UpdateGameAbsentPlayersInputSchema>;\n\n// `changed` is false when the entry was already marked that way; nothing was written.\nexport const UpdateGameAbsentPlayersResultSchema = z\n .object({\n gameId: gameIdSchema,\n gameRosterPlayerId: gameRosterPlayerIdSchema,\n absent: z.boolean(),\n changed: z.boolean(),\n })\n .strict();\nexport type UpdateGameAbsentPlayersResult = z.infer<typeof UpdateGameAbsentPlayersResultSchema>;\n\n// ---------------------------------------------------------------------------------------------\n// The memo — a scorer's note on one person in a live game (\"red shirt\", \"#9\")\n// ---------------------------------------------------------------------------------------------\n\n// Built from the memo's one declaration, so the memo form and the callable accept exactly the same\n// text: trimmed, one line, empty allowed — an empty memo clears the person's note.\nexport const gameMemoSchema = textFieldSchema(GAME_MEMO_INPUT_FORMAT);\n\nexport const UpdateGameMemoInputSchema = z\n .object({\n gameId: gameIdSchema,\n userId: userIdSchema,\n memo: gameMemoSchema,\n })\n .strict();\nexport type UpdateGameMemoInput = z.infer<typeof UpdateGameMemoInputSchema>;\n\nexport const UpdateGameMemoResultSchema = z\n .object({\n gameId: gameIdSchema,\n userId: userIdSchema,\n memo: z.string(),\n changed: z.boolean(),\n })\n .strict();\nexport type UpdateGameMemoResult = z.infer<typeof UpdateGameMemoResultSchema>;\n\n// ---------------------------------------------------------------------------------------------\n// The jump-ball possession arrow — set to a team, so a retried call lands where the first did\n// ---------------------------------------------------------------------------------------------\n\nexport const UpdateGameJumpBallInputSchema = z\n .object({\n gameId: gameIdSchema,\n teamId: teamIdSchema,\n })\n .strict();\nexport type UpdateGameJumpBallInput = z.infer<typeof UpdateGameJumpBallInputSchema>;\n\nexport const UpdateGameJumpBallResultSchema = z\n .object({\n gameId: gameIdSchema,\n teamId: teamIdSchema,\n changed: z.boolean(),\n })\n .strict();\nexport type UpdateGameJumpBallResult = z.infer<typeof UpdateGameJump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K,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
@@ -3,11 +3,13 @@
3
3
  // the server rebuilds that path from the signer's own uid and derives where the image is kept from
4
4
  // the records, never from the payload (MEDIA-002).
5
5
  import { z } from 'zod';
6
- import { epochMsSchema, leagueIdSchema, teamIdSchema, userIdSchema, waiverWitnessAuthoritySchema } from '../doc-schemas/atoms.js';
7
- import { waiverTemplateIdSchema, waiverTemplateVersionNumberSchema } from '../doc-schemas/waiver-template.js';
6
+ import { epochMsSchema, leagueIdSchema, teamIdSchema, userIdSchema, waiverWitnessAuthoritySchema, } from '../doc-schemas/atoms.js';
7
+ import { waiverTemplateIdSchema, waiverTemplateVersionNumberSchema, } from '../doc-schemas/waiver-template.js';
8
8
  import { stagingUploadPathSchema } from './uploads.js';
9
9
  // Signing for a ghost: the ghost, and the team whose membership makes the signer its witness.
10
- export const ghostWaiverSubjectSchema = z.object({ ghostUserId: userIdSchema, teamId: teamIdSchema }).strict();
10
+ export const ghostWaiverSubjectSchema = z
11
+ .object({ ghostUserId: userIdSchema, teamId: teamIdSchema })
12
+ .strict();
11
13
  // The wording the signer saw: the template id and version the signing dialog displayed. A signature
12
14
  // records exactly that wording, so the core refuses one whose id or version is no longer the league's
13
15
  // (`waiverChanged`), and the dialog loads the current wording to read again.
@@ -1 +1 @@
1
- {"version":3,"file":"signed-waivers.js","sourceRoot":"","sources":["../../src/schemas/signed-waivers.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,oGAAoG;AACpG,mGAAmG;AACnG,mDAAmD;AAEnD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AAClI,OAAO,EAAE,sBAAsB,EAAE,iCAAiC,EAAE,MAAM,mCAAmC,CAAC;AAC9G,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEvD,8FAA8F;A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M,CAAC;IACN,MAAM,EAAE,YAAY;IACpB,wCAAwC;IACxC,QAAQ,EAAE,aAAa,CAAC,QAAQ,EAAE;IAClC,uFAAuF;IACvF,aAAa,EAAE,YAAY,CAAC,QAAQ,EAAE;IACtC,gBAAgB,EAAE,4BAA4B,CAAC,QAAQ,EAAE;CAC1D,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,MAAM,CAAC,MAAM,uCAAuC,GAAG,CAAC;KACrD,MAAM,CAAC;IACN,QAAQ,EAAE,cAAc;IACxB,MAAM,EAAE,YAAY;IACpB,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE;IAC3B,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,4BAA4B,CAAC;CAChD,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,mGAAmG;AACnG,gGAAgG;AAChG,8CAA8C;AAC9C,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC;KAC5C,MAAM,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,CAAC,QAAQ,EAAE,EAAE,CAAC;KAC3F,MAAM,EAAE,CAAC;AAGZ,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC;KACvC,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;KAClE,MAAM,EAAE,CAAC","sourcesContent":["// Callable contracts for signing a league's waiver and reading the result. The signer is always\n// `request.auth.uid`. A signature image arrives only as the staging path the signer uploaded it to;\n// the server rebuilds that path from the signer's own uid and derives where the image is kept from\n// the records, never from the payload (MEDIA-002).\n\nimport { z } from 'zod';\nimport { epochMsSchema, leagueIdSchema, teamIdSchema, userIdSchema, waiverWitnessAuthoritySchema } from '../doc-schemas/atoms.js';\nimport { waiverTemplateIdSchema, waiverTemplateVersionNumberSchema } from '../doc-schemas/waiver-template.js';\nimport { stagingUploadPathSchema } from './uploads.js';\n\n// Signing for a ghost: the ghost, and the team whose membership makes the signer its witness.\nexport const ghostWaiverSubjectSchema = z.object({ ghostUserId: userIdSchema, teamId: teamIdSchema }).strict();\n\n// The wording the signer saw: the template id and version the signing dialog displayed. A signature\n// records exactly that wording, so the core refuses one whose id or version is no longer the league's\n// (`waiverChanged`), and the dialog loads the current wording to read again.\nconst displayedWaiverFields = {\n waiverTemplateId: waiverTemplateIdSchema,\n waiverTemplateVersion: waiverTemplateVersionNumberSchema,\n};\n\n// `createSignedWaiver` — the member entry: a player signs their own waiver, or the ghost's team's\n// captain or co-captain signs a ghost's. `storagePath` is the full staging path the signer uploaded\n// to, under the one name every accepting callable takes it by; only its last segment, the staging\n// id, is taken from it.\nexport const CreateSignedWaiverInputSchema = z\n .object({\n leagueId: leagueIdSchema,\n ...displayedWaiverFields,\n storagePath: stagingUploadPathSchema,\n ghost: ghostWaiverSubjectSchema.optional(),\n })\n .strict();\nexport type CreateSignedWaiverInput = z.infer<typeof CreateSignedWaiverInputSchema>;\n\n// `adminCreateSignedWaiver` — the admin entry: an admin or a referee signs a ghost's waiver.\nexport const AdminCreateSignedWaiverInputSchema = z\n .object({\n leagueId: leagueIdSchema,\n ...displayedWaiverFields,\n storagePath: stagingUploadPathSchema,\n ghost: ghostWaiverSubjectSchema,\n })\n .strict();\nexport type AdminCreateSignedWaiverInput = z.infer<typeof AdminCreateSignedWaiverInputSchema>;\n\n// `alreadySigned` is true when the call found the waiver already recorded with this very signature —\n// a retry of a signing that committed — and wrote nothing.\nexport const CreateSignedWaiverResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n userId: userIdSchema,\n signedAt: epochMsSchema,\n alreadySigned: z.boolean(),\n })\n .strict();\nexport type CreateSignedWaiverResult = z.infer<typeof CreateSignedWaiverResultSchema>;\n\n// `getLeagueTeamWaiverStatuses` — a team's captain or co-captain reads whether each member of the\n// team has signed the league's waiver. Admins and referees read the records directly.\nexport const GetLeagueTeamWaiverStatusesInputSchema = z.object({ teamId: teamIdSchema }).strict();\nexport type GetLeagueTeamWaiverStatusesInput = z.infer<typeof GetLeagueTeamWaiverStatusesInputSchema>;\n\nexport const leagueTeamWaiverStatusSchema = z\n .object({\n userId: userIdSchema,\n // Null while the member has not signed.\n signedAt: epochMsSchema.nullable(),\n // Present on a ghost's waiver: who signed it for the ghost, and under which authority.\n witnessUserId: userIdSchema.nullable(),\n witnessAuthority: waiverWitnessAuthoritySchema.nullable(),\n })\n .strict();\nexport type LeagueTeamWaiverStatus = z.infer<typeof leagueTeamWaiverStatusSchema>;\n\nexport const GetLeagueTeamWaiverStatusesResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n requiresWaiver: z.boolean(),\n statuses: z.array(leagueTeamWaiverStatusSchema),\n })\n .strict();\nexport type GetLeagueTeamWaiverStatusesResult = z.infer<typeof GetLeagueTeamWaiverStatusesResultSchema>;\n\n// `getSignedWaiverFile` — the kept signature image, for its audience only. A captain or co-captain\n// names `teamId`, the team they manage, because a player may be on two teams in one league; the\n// subject, an admin, and a referee need none.\nexport const GetSignedWaiverFileInputSchema = z\n .object({ leagueId: leagueIdSchema, userId: userIdSchema, teamId: teamIdSchema.optional() })\n .strict();\nexport type GetSignedWaiverFileInput = z.infer<typeof GetSignedWaiverFileInputSchema>;\n\nexport const SignatureFileResultSchema = z\n .object({ contentType: z.string().min(1), dataBase64: z.string() })\n .strict();\nexport type SignatureFileResult = z.infer<typeof SignatureFileResultSchema>;\n"]}
1
+ {"version":3,"file":"signed-waivers.js","sourceRoot":"","sources":["../../src/schemas/signed-waivers.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,oGAAoG;AACpG,mGAAmG;AACnG,mDAAmD;AAEnD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,aAAa,EACb,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,4BAA4B,GAC7B,MAAM,yBAAyB,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,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAKlG,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC;KAC1C,MAAM,CAAC;IACN,MAAM,EAAE,YAAY;IACpB,wCAAwC;IACxC,QAAQ,EAAE,aAAa,CAAC,QAAQ,EAAE;IAClC,uFAAuF;IACvF,aAAa,EAAE,YAAY,CAAC,QAAQ,EAAE;IACtC,gBAAgB,EAAE,4BAA4B,CAAC,QAAQ,EAAE;CAC1D,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,MAAM,CAAC,MAAM,uCAAuC,GAAG,CAAC;KACrD,MAAM,CAAC;IACN,QAAQ,EAAE,cAAc;IACxB,MAAM,EAAE,YAAY;IACpB,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE;IAC3B,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,4BAA4B,CAAC;CAChD,CAAC;KACD,MAAM,EAAE,CAAC;AAKZ,mGAAmG;AACnG,gGAAgG;AAChG,8CAA8C;AAC9C,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC;KAC5C,MAAM,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,CAAC,QAAQ,EAAE,EAAE,CAAC;KAC3F,MAAM,EAAE,CAAC;AAGZ,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC;KACvC,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;KAClE,MAAM,EAAE,CAAC","sourcesContent":["// Callable contracts for signing a league's waiver and reading the result. The signer is always\n// `request.auth.uid`. A signature image arrives only as the staging path the signer uploaded it to;\n// the server rebuilds that path from the signer's own uid and derives where the image is kept from\n// the records, never from the payload (MEDIA-002).\n\nimport { z } from 'zod';\nimport {\n epochMsSchema,\n leagueIdSchema,\n teamIdSchema,\n userIdSchema,\n waiverWitnessAuthoritySchema,\n} from '../doc-schemas/atoms.js';\nimport {\n waiverTemplateIdSchema,\n waiverTemplateVersionNumberSchema,\n} from '../doc-schemas/waiver-template.js';\nimport { stagingUploadPathSchema } from './uploads.js';\n\n// Signing for a ghost: the ghost, and the team whose membership makes the signer its witness.\nexport const ghostWaiverSubjectSchema = z\n .object({ ghostUserId: userIdSchema, teamId: teamIdSchema })\n .strict();\n\n// The wording the signer saw: the template id and version the signing dialog displayed. A signature\n// records exactly that wording, so the core refuses one whose id or version is no longer the league's\n// (`waiverChanged`), and the dialog loads the current wording to read again.\nconst displayedWaiverFields = {\n waiverTemplateId: waiverTemplateIdSchema,\n waiverTemplateVersion: waiverTemplateVersionNumberSchema,\n};\n\n// `createSignedWaiver` — the member entry: a player signs their own waiver, or the ghost's team's\n// captain or co-captain signs a ghost's. `storagePath` is the full staging path the signer uploaded\n// to, under the one name every accepting callable takes it by; only its last segment, the staging\n// id, is taken from it.\nexport const CreateSignedWaiverInputSchema = z\n .object({\n leagueId: leagueIdSchema,\n ...displayedWaiverFields,\n storagePath: stagingUploadPathSchema,\n ghost: ghostWaiverSubjectSchema.optional(),\n })\n .strict();\nexport type CreateSignedWaiverInput = z.infer<typeof CreateSignedWaiverInputSchema>;\n\n// `adminCreateSignedWaiver` — the admin entry: an admin or a referee signs a ghost's waiver.\nexport const AdminCreateSignedWaiverInputSchema = z\n .object({\n leagueId: leagueIdSchema,\n ...displayedWaiverFields,\n storagePath: stagingUploadPathSchema,\n ghost: ghostWaiverSubjectSchema,\n })\n .strict();\nexport type AdminCreateSignedWaiverInput = z.infer<typeof AdminCreateSignedWaiverInputSchema>;\n\n// `alreadySigned` is true when the call found the waiver already recorded with this very signature —\n// a retry of a signing that committed — and wrote nothing.\nexport const CreateSignedWaiverResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n userId: userIdSchema,\n signedAt: epochMsSchema,\n alreadySigned: z.boolean(),\n })\n .strict();\nexport type CreateSignedWaiverResult = z.infer<typeof CreateSignedWaiverResultSchema>;\n\n// `getLeagueTeamWaiverStatuses` — a team's captain or co-captain reads whether each member of the\n// team has signed the league's waiver. Admins and referees read the records directly.\nexport const GetLeagueTeamWaiverStatusesInputSchema = z.object({ teamId: teamIdSchema }).strict();\nexport type GetLeagueTeamWaiverStatusesInput = z.infer<\n typeof GetLeagueTeamWaiverStatusesInputSchema\n>;\n\nexport const leagueTeamWaiverStatusSchema = z\n .object({\n userId: userIdSchema,\n // Null while the member has not signed.\n signedAt: epochMsSchema.nullable(),\n // Present on a ghost's waiver: who signed it for the ghost, and under which authority.\n witnessUserId: userIdSchema.nullable(),\n witnessAuthority: waiverWitnessAuthoritySchema.nullable(),\n })\n .strict();\nexport type LeagueTeamWaiverStatus = z.infer<typeof leagueTeamWaiverStatusSchema>;\n\nexport const GetLeagueTeamWaiverStatusesResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n requiresWaiver: z.boolean(),\n statuses: z.array(leagueTeamWaiverStatusSchema),\n })\n .strict();\nexport type GetLeagueTeamWaiverStatusesResult = z.infer<\n typeof GetLeagueTeamWaiverStatusesResultSchema\n>;\n\n// `getSignedWaiverFile` — the kept signature image, for its audience only. A captain or co-captain\n// names `teamId`, the team they manage, because a player may be on two teams in one league; the\n// subject, an admin, and a referee need none.\nexport const GetSignedWaiverFileInputSchema = z\n .object({ leagueId: leagueIdSchema, userId: userIdSchema, teamId: teamIdSchema.optional() })\n .strict();\nexport type GetSignedWaiverFileInput = z.infer<typeof GetSignedWaiverFileInputSchema>;\n\nexport const SignatureFileResultSchema = z\n .object({ contentType: z.string().min(1), dataBase64: z.string() })\n .strict();\nexport type SignatureFileResult = z.infer<typeof SignatureFileResultSchema>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/schemas/stats.ts"],"names":[],"mappings":"AAKA,OAAO,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;;;;;;;;;;kBAWxC,CAAC;AACZ,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CACpD,OAAO,sCAAsC,CAC9C,CAAC;AAKF,eAAO,MAAM,6BAA6B;;;;;;kBAE/B,CAAC;AACZ,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEpF,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAOhC,CAAC;AACZ,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAItF,eAAO,MAAM,2CAA2C;;kBAE7C,CAAC;AACZ,MAAM,MAAM,qCAAqC,GAAG,CAAC,CAAC,KAAK,CACzD,OAAO,2CAA2C,CACnD,CAAC;AAEF,eAAO,MAAM,4CAA4C;;kBAE9C,CAAC;AACZ,MAAM,MAAM,sCAAsC,GAAG,CAAC,CAAC,KAAK,CAC1D,OAAO,4CAA4C,CACpD,CAAC"}
@@ -4,12 +4,11 @@
4
4
  // an unplaceable stat line.
5
5
  import { z } from 'zod';
6
6
  import { MAX_GAME_STATS_CORRECTION_TARGETS } from '../constants/sports.js';
7
- import { statCounterKeySchema, statsOperationIdSchema, statsValidationReportIdSchema } from '../doc-schemas/atoms.js';
8
- import { StatsDestinationChangeSchema, StatsOperationCountsSchema } from '../doc-schemas/stats-operation.js';
7
+ import { countSchema, gameIdSchema, gameRosterPlayerIdSchema, leagueIdSchema, repairReasonSchema, sportKeySchema, statCounterKeySchema, statsOperationIdSchema, statsValidationReportIdSchema, teamIdSchema, userIdSchema, } from '../doc-schemas/atoms.js';
8
+ import { StatsDestinationChangeSchema, StatsOperationCountsSchema, } from '../doc-schemas/stats-operation.js';
9
9
  import { StatsValidationReportSchema, StatsValidationScopeSchema, StatsValidationSummarySchema, } from '../doc-schemas/system.js';
10
10
  import { HistoricalStatsSchema } from '../doc-schemas/user-profile.js';
11
11
  import { GAME_FINALIZE_OUTCOME_KEYS, GAME_REOPEN_OUTCOME_KEYS, GAME_STATS_REPAIR_OUTCOME_KEYS, UNROSTERED_STAT_LINE_RESOLUTION_OUTCOME_KEYS, } from '../types/stats.js';
12
- import { countSchema, gameIdSchema, gameRosterPlayerIdSchema, leagueIdSchema, repairReasonSchema, sportKeySchema, teamIdSchema, userIdSchema, } from './atoms.js';
13
12
  // `finalizeGame` (a captain or co-captain of either team) / `adminFinalizeGame` (an admin or a
14
13
  // referee): make a game's numbers permanent. Everything it writes is derived server-side from the
15
14
  // game's events; nothing in the input is a number (SPORT-202).
@@ -25,10 +24,16 @@ export const FinalizeGameResultSchema = z
25
24
  .strict();
26
25
  // `reopenGame` (an admin): take a finalized game's numbers back out so it can be scored again. It
27
26
  // changes a completed record, so the admin says why (SPORT-206, BACKEND-212).
28
- export const ReopenGameInputSchema = z.object({ gameId: gameIdSchema, reason: repairReasonSchema }).strict();
27
+ export const ReopenGameInputSchema = z
28
+ .object({ gameId: gameIdSchema, reason: repairReasonSchema })
29
+ .strict();
29
30
  // `alreadyOpen` when the game was not completed: nothing was written.
30
31
  export const ReopenGameResultSchema = z
31
- .object({ gameId: gameIdSchema, leagueId: leagueIdSchema, outcome: z.enum(GAME_REOPEN_OUTCOME_KEYS) })
32
+ .object({
33
+ gameId: gameIdSchema,
34
+ leagueId: leagueIdSchema,
35
+ outcome: z.enum(GAME_REOPEN_OUTCOME_KEYS),
36
+ })
32
37
  .strict();
33
38
  // `resolve.unrosteredStatLine` (an admin, at the cutover console, before the cutover): a recorded V1
34
39
  // stat line that no roster entry and no play of the game can place is placed on the team the admin
@@ -132,7 +137,11 @@ export const GameStatsCorrectionTargetSchema = z
132
137
  export const AdminCorrectGameStatsInputSchema = z
133
138
  .object({
134
139
  gameId: gameIdSchema,
135
- targets: z.array(GameStatsCorrectionTargetSchema).min(1).max(MAX_GAME_STATS_CORRECTION_TARGETS).optional(),
140
+ targets: z
141
+ .array(GameStatsCorrectionTargetSchema)
142
+ .min(1)
143
+ .max(MAX_GAME_STATS_CORRECTION_TARGETS)
144
+ .optional(),
136
145
  keepStored: z.literal(true).optional(),
137
146
  reason: repairReasonSchema,
138
147
  operationId: statsOperationIdSchema,
@@ -168,12 +177,22 @@ const replacedEntryListSchema = z
168
177
  // without copying the record.
169
178
  export const GameRepairChangesSchema = z
170
179
  .object({
171
- lines: z.array(z.object({ lineKey: z.string().min(1), field: z.string().min(1), stored: z.number(), rebuilt: z.number() }).strict()),
180
+ lines: z.array(z
181
+ .object({
182
+ lineKey: z.string().min(1),
183
+ field: z.string().min(1),
184
+ stored: z.number(),
185
+ rebuilt: z.number(),
186
+ })
187
+ .strict()),
172
188
  scores: z.array(z.object({ teamId: teamIdSchema, stored: z.number(), rebuilt: z.number() }).strict()),
173
189
  absentRosterPlayerIds: replacedEntryListSchema.optional(),
174
190
  nonScoringRosterPlayerIds: replacedEntryListSchema.optional(),
175
191
  statEventSequence: z.object({ stored: countSchema, rebuilt: countSchema }).strict().optional(),
176
- recordRewritten: z.object({ pagesBefore: countSchema, pagesAfter: countSchema }).strict().optional(),
192
+ recordRewritten: z
193
+ .object({ pagesBefore: countSchema, pagesAfter: countSchema })
194
+ .strict()
195
+ .optional(),
177
196
  })
178
197
  .strict();
179
198
  // What a game repair did: `reconciled` it changed the game; `unchanged` there was nothing to change;
@@ -1 +1 @@
1
- {"version":3,"file":"stats.js","sourceRoot":"","sources":["../../src/schemas/stats.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,sGAAsG;AACtG,2BAA2B;AAC3B,4BAA4B;AAE5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AACtH,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAC7G,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MAAM,CAAC,EAAE,QAAQ,EAAE,6BAA6B,EAAE,CAAC;KACnD,MAAM,EAAE,CAAC;AAGZ,MAAM,CAAC,MAAM,4CAA4C,GAAG,CAAC;KAC1D,MAAM,CAAC,EAAE,QAAQ,EAAE,6BAA6B,EAAE,CAAC;KACnD,MAAM,EAAE,CAAC","sourcesContent":["// Callable contracts for the stats pipeline: finalize, reopen, the Fix stats actions — the rebuilds,\n// the game repairs, the historical baseline, the stats check, and deleting a check's report — and the\n// migration's placement of\n// an unplaceable stat line.\n\nimport { z } from 'zod';\nimport { MAX_GAME_STATS_CORRECTION_TARGETS } from '../constants/sports.js';\nimport { statCounterKeySchema, statsOperationIdSchema, statsValidationReportIdSchema } from '../doc-schemas/atoms.js';\nimport { StatsDestinationChangeSchema, StatsOperationCountsSchema } from '../doc-schemas/stats-operation.js';\nimport {\n StatsValidationReportSchema,\n StatsValidationScopeSchema,\n StatsValidationSummarySchema,\n} from '../doc-schemas/system.js';\nimport { HistoricalStatsSchema } from '../doc-schemas/user-profile.js';\nimport {\n GAME_FINALIZE_OUTCOME_KEYS,\n GAME_REOPEN_OUTCOME_KEYS,\n GAME_STATS_REPAIR_OUTCOME_KEYS,\n UNROSTERED_STAT_LINE_RESOLUTION_OUTCOME_KEYS,\n} from '../types/stats.js';\nimport {\n countSchema,\n gameIdSchema,\n gameRosterPlayerIdSchema,\n leagueIdSchema,\n repairReasonSchema,\n sportKeySchema,\n teamIdSchema,\n userIdSchema,\n} from './atoms.js';\n\n// `finalizeGame` (a captain or co-captain of either team) / `adminFinalizeGame` (an admin or a\n// referee): make a game's numbers permanent. Everything it writes is derived server-side from the\n// game's events; nothing in the input is a number (SPORT-202).\nexport const FinalizeGameInputSchema = z.object({ gameId: gameIdSchema }).strict();\nexport type FinalizeGameInput = z.infer<typeof FinalizeGameInputSchema>;\n\n// `alreadyFinalized` when the game was completed before the call: nothing was written (SPORT-203).\nexport const FinalizeGameResultSchema = z\n .object({\n gameId: gameIdSchema,\n leagueId: leagueIdSchema,\n outcome: z.enum(GAME_FINALIZE_OUTCOME_KEYS),\n nonScoringRosterPlayerIds: z.array(gameRosterPlayerIdSchema),\n })\n .strict();\nexport type FinalizeGameResult = z.infer<typeof FinalizeGameResultSchema>;\n\n// `reopenGame` (an admin): take a finalized game's numbers back out so it can be scored again. It\n// changes a completed record, so the admin says why (SPORT-206, BACKEND-212).\nexport const ReopenGameInputSchema = z.object({ gameId: gameIdSchema, reason: repairReasonSchema }).strict();\nexport type ReopenGameInput = z.infer<typeof ReopenGameInputSchema>;\n\n// `alreadyOpen` when the game was not completed: nothing was written.\nexport const ReopenGameResultSchema = z\n .object({ gameId: gameIdSchema, leagueId: leagueIdSchema, outcome: z.enum(GAME_REOPEN_OUTCOME_KEYS) })\n .strict();\nexport type ReopenGameResult = z.infer<typeof ReopenGameResultSchema>;\n\n// `resolve.unrosteredStatLine` (an admin, at the cutover console, before the cutover): a recorded V1\n// stat line that no roster entry and no play of the game can place is placed on the team the admin\n// names, as the game's missing roster entry; the game's copy is then run again. The admin says why.\n// `dryRun` previews the placement — whether the game would then convert — and writes nothing.\nexport const AdminResolveUnrosteredStatLineInputSchema = z\n .object({\n gameId: gameIdSchema,\n userId: userIdSchema,\n teamId: teamIdSchema,\n reason: repairReasonSchema,\n dryRun: z.boolean().optional(),\n })\n .strict();\nexport type AdminResolveUnrosteredStatLineInput = z.infer<typeof AdminResolveUnrosteredStatLineInputSchema>;\n\n// `gameConverts` says whether the game's stats now convert, so the operator knows the copy can run.\nexport const AdminResolveUnrosteredStatLineResultSchema = z\n .object({\n gameId: gameIdSchema,\n userId: userIdSchema,\n teamId: teamIdSchema,\n outcome: z.enum(UNROSTERED_STAT_LINE_RESOLUTION_OUTCOME_KEYS),\n gameConverts: z.boolean(),\n })\n .strict();\nexport type AdminResolveUnrosteredStatLineResult = z.infer<typeof AdminResolveUnrosteredStatLineResultSchema>;\n\n// Every rebuild and every game repair is a repair of a completed record: it takes a reason, runs\n// under an operation id the admin's browser mints when the admin starts it, and offers a dry run that\n// lists each document it would change, with before and after, and writes nothing (BACKEND-212,\n// SPORT-206). A real run resumes from its operation document, so a cursor is taken from the client\n// only to page a dry run, which keeps no operation.\nconst statsRepairFields = {\n reason: repairReasonSchema,\n operationId: statsOperationIdSchema,\n dryRun: z.boolean(),\n resumeAfter: z.string().min(1).optional(),\n};\n\nconst cursorOnlyOnDryRun = (input: { dryRun: boolean; resumeAfter?: string }): boolean =>\n input.dryRun || input.resumeAfter === undefined;\nconst CURSOR_ONLY_ON_DRY_RUN = {\n message: 'A real run resumes from its operation; only a dry run takes a cursor.',\n path: ['resumeAfter'],\n};\n\n// `recalculateLeagueStats`: every team of one league — its standings line and its per-membership rows.\nexport const RecalculateLeagueStatsInputSchema = z\n .object({ leagueId: leagueIdSchema, ...statsRepairFields })\n .strict()\n .refine(cursorOnlyOnDryRun, CURSOR_ONLY_ON_DRY_RUN);\nexport type RecalculateLeagueStatsInput = z.infer<typeof RecalculateLeagueStatsInputSchema>;\n\n// `recalculateAllLeagueStats`: every league, closed ones included, a page of leagues per call.\nexport const RecalculateAllLeagueStatsInputSchema = z\n .object({ ...statsRepairFields })\n .strict()\n .refine(cursorOnlyOnDryRun, CURSOR_ONLY_ON_DRY_RUN);\nexport type RecalculateAllLeagueStatsInput = z.infer<typeof RecalculateAllLeagueStatsInputSchema>;\n\n// `recalculateUserStats`: one person's career line in every sport.\nexport const RecalculateUserStatsInputSchema = z\n .object({ userId: userIdSchema, ...statsRepairFields })\n .strict()\n .refine(cursorOnlyOnDryRun, CURSOR_ONLY_ON_DRY_RUN);\nexport type RecalculateUserStatsInput = z.infer<typeof RecalculateUserStatsInputSchema>;\n\n// `recalculateAllUserStats`: every profile's career lines, a page of profiles per call.\nexport const RecalculateAllUserStatsInputSchema = z\n .object({ ...statsRepairFields })\n .strict()\n .refine(cursorOnlyOnDryRun, CURSOR_ONLY_ON_DRY_RUN);\nexport type RecalculateAllUserStatsInput = z.infer<typeof RecalculateAllUserStatsInputSchema>;\n\n// `recalculateHallOfFame`: one sport's hall of fame — one person's entry, or the whole sport a page\n// of profiles per call. Refused for a sport that keeps none.\nexport const RecalculateHallOfFameInputSchema = z\n .object({ sportKey: sportKeySchema, userId: userIdSchema.optional(), ...statsRepairFields })\n .strict()\n .refine(cursorOnlyOnDryRun, CURSOR_ONLY_ON_DRY_RUN);\nexport type RecalculateHallOfFameInput = z.infer<typeof RecalculateHallOfFameInputSchema>;\n\n// What one call of a rebuild did. `complete` is false while a paged rebuild has pages left: the\n// admin calls again with the same operation id — or, for a dry run, with `resumeAfter` set to\n// `nextResumeAfter`. `changes` is every document this call changed or, on a dry run, would change,\n// up to MAX_STATS_REPAIR_LISTED_CHANGES (`changesTruncated` says more were left out). A game whose\n// stored numbers disagree with its record is named in `stoppedOnGameIds`, and what it feeds is left\n// untouched. `scopeChanged` says a game was finalized or reopened in the scope while it ran, so the\n// admin runs it again.\nexport const StatsRebuildResultSchema = z\n .object({\n operationId: statsOperationIdSchema,\n dryRun: z.boolean(),\n complete: z.boolean(),\n nextResumeAfter: z.string().min(1).nullable(),\n counts: StatsOperationCountsSchema,\n stoppedOnGameIds: z.array(gameIdSchema),\n changes: z.array(StatsDestinationChangeSchema),\n changesTruncated: z.boolean(),\n scopeChanged: z.boolean(),\n })\n .strict();\nexport type StatsRebuildResult = z.infer<typeof StatsRebuildResultSchema>;\n\n// A line a correction sets, by its absolute value: the team line of `teamId`, or the player line\n// `{teamId}_{playerUserId}` when a player is named. Only a field the sport's adapter lists in\n// `correctableFields` may be set.\nexport const GameStatsCorrectionTargetSchema = z\n .object({\n teamId: teamIdSchema,\n playerUserId: userIdSchema.optional(),\n stat: statCounterKeySchema,\n value: countSchema,\n })\n .strict();\nexport type GameStatsCorrectionTarget = z.infer<typeof GameStatsCorrectionTargetSchema>;\n\n// `adminCorrectGameStats`: set named fields of a game's lines to the values given, or keep the\n// numbers the game stores now — a hand edit made outside the app — as corrections. Exactly one of the\n// two.\nexport const AdminCorrectGameStatsInputSchema = z\n .object({\n gameId: gameIdSchema,\n targets: z.array(GameStatsCorrectionTargetSchema).min(1).max(MAX_GAME_STATS_CORRECTION_TARGETS).optional(),\n keepStored: z.literal(true).optional(),\n reason: repairReasonSchema,\n operationId: statsOperationIdSchema,\n dryRun: z.boolean(),\n })\n .strict()\n .refine((input) => (input.targets === undefined) !== (input.keepStored === undefined), {\n message: 'Give the values to set, or keep the stored numbers — one of the two.',\n path: ['targets'],\n });\nexport type AdminCorrectGameStatsInput = z.infer<typeof AdminCorrectGameStatsInputSchema>;\n\n// `recalculateGameStats`: restore a game's numbers from its events, discarding a hand edit.\nexport const RecalculateGameStatsInputSchema = z\n .object({\n gameId: gameIdSchema,\n reason: repairReasonSchema,\n operationId: statsOperationIdSchema,\n dryRun: z.boolean(),\n })\n .strict();\nexport type RecalculateGameStatsInput = z.infer<typeof RecalculateGameStatsInputSchema>;\n\n// One correction a repair appended, or on a dry run would append.\nexport const GameStatsCorrectionSchema = z\n .object({ lineKey: z.string().min(1), field: statCounterKeySchema, value: z.number().int() })\n .strict();\nexport type GameStatsCorrection = z.infer<typeof GameStatsCorrectionSchema>;\n\n// A list of roster entries a repair replaced, as the game stored it and as the repair rebuilds it.\nconst replacedEntryListSchema = z\n .object({ stored: z.array(gameRosterPlayerIdSchema), rebuilt: z.array(gameRosterPlayerIdSchema) })\n .strict();\n\n// Every value of the game document a repair changed, each with the value the game stored and the\n// value the repair writes — never the whole document (BACKEND-212). `lines` holds each changed field\n// of a team or player line (`lineKey` the team id or the roster entry id), `scores` each team whose\n// score mirror changed, and the lists, the event counter and `recordRewritten` appear only when the\n// repair changes them; `recordRewritten` names the finalized record's page counts before and after,\n// without copying the record.\nexport const GameRepairChangesSchema = z\n .object({\n lines: z.array(\n z.object({ lineKey: z.string().min(1), field: z.string().min(1), stored: z.number(), rebuilt: z.number() }).strict(),\n ),\n scores: z.array(z.object({ teamId: teamIdSchema, stored: z.number(), rebuilt: z.number() }).strict()),\n absentRosterPlayerIds: replacedEntryListSchema.optional(),\n nonScoringRosterPlayerIds: replacedEntryListSchema.optional(),\n statEventSequence: z.object({ stored: countSchema, rebuilt: countSchema }).strict().optional(),\n recordRewritten: z.object({ pagesBefore: countSchema, pagesAfter: countSchema }).strict().optional(),\n })\n .strict();\nexport type GameRepairChanges = z.infer<typeof GameRepairChangesSchema>;\n\n// What a game repair did: `reconciled` it changed the game; `unchanged` there was nothing to change;\n// `alreadyApplied` the operation had already committed and this call is its acknowledged retry.\n// `gameChanges` is what it changed on the game document, or on a dry run would change; empty lists\n// for any other outcome.\nexport const GameStatsRepairResultSchema = z\n .object({\n gameId: gameIdSchema,\n leagueId: leagueIdSchema,\n operationId: statsOperationIdSchema,\n dryRun: z.boolean(),\n outcome: z.enum(GAME_STATS_REPAIR_OUTCOME_KEYS),\n corrections: z.array(GameStatsCorrectionSchema),\n gameChanged: z.boolean(),\n gameChanges: GameRepairChangesSchema,\n destinationChanges: z.array(StatsDestinationChangeSchema),\n })\n .strict();\nexport type GameStatsRepairResult = z.infer<typeof GameStatsRepairResultSchema>;\n\n// `adminUpdateHistoricalStats`: a person's pre-Q-Sports career totals for a sport that takes them,\n// written whole, and their career line and hall-of-fame entry rebuilt with them.\nexport const AdminUpdateHistoricalStatsInputSchema = z\n .object({\n userId: userIdSchema,\n sportKey: sportKeySchema,\n stats: HistoricalStatsSchema,\n reason: repairReasonSchema,\n operationId: statsOperationIdSchema,\n dryRun: z.boolean(),\n })\n .strict();\nexport type AdminUpdateHistoricalStatsInput = z.infer<typeof AdminUpdateHistoricalStatsInputSchema>;\n\nexport const AdminUpdateHistoricalStatsResultSchema = z\n .object({\n userId: userIdSchema,\n sportKey: sportKeySchema,\n operationId: statsOperationIdSchema,\n dryRun: z.boolean(),\n outcome: z.enum(GAME_STATS_REPAIR_OUTCOME_KEYS),\n baselineBefore: HistoricalStatsSchema.nullable(),\n stoppedOnGameIds: z.array(gameIdSchema),\n changes: z.array(StatsDestinationChangeSchema),\n })\n .strict();\nexport type AdminUpdateHistoricalStatsResult = z.infer<typeof AdminUpdateHistoricalStatsResultSchema>;\n\n// `runStatsValidation`: check one game, one league, or — with neither — everything. A check that\n// reaches its time budget saves its place on its operation and answers `complete: false`; calling\n// again with the same operation id resumes it. It writes no stat, so it takes no reason.\nexport const RunStatsValidationInputSchema = z\n .object({ operationId: statsOperationIdSchema, scope: StatsValidationScopeSchema })\n .strict();\nexport type RunStatsValidationInput = z.infer<typeof RunStatsValidationInputSchema>;\n\nexport const RunStatsValidationResultSchema = z\n .object({\n reportId: z.string().min(1),\n complete: z.boolean(),\n summary: StatsValidationSummarySchema,\n discrepancyCounts: StatsValidationReportSchema.shape.discrepancyCounts,\n })\n .strict();\nexport type RunStatsValidationResult = z.infer<typeof RunStatsValidationResultSchema>;\n\n// `adminDeleteStatsValidationReport`: delete one stats check's report. It writes no stat, so it takes\n// no reason; a report that is not there is refused as not found.\nexport const AdminDeleteStatsValidationReportInputSchema = z\n .object({ reportId: statsValidationReportIdSchema })\n .strict();\nexport type AdminDeleteStatsValidationReportInput = z.infer<typeof AdminDeleteStatsValidationReportInputSchema>;\n\nexport const AdminDeleteStatsValidationReportResultSchema = z\n .object({ reportId: statsValidationReportIdSchema })\n .strict();\nexport type AdminDeleteStatsValidationReportResult = z.infer<typeof AdminDeleteStatsValidationReportResultSchema>;\n"]}
1
+ {"version":3,"file":"stats.js","sourceRoot":"","sources":["../../src/schemas/stats.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,sGAAsG;AACtG,2BAA2B;AAC3B,4BAA4B;AAE5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EACL,WAAW,EACX,YAAY,EACZ,wBAAwB,EACxB,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,sBAAsB,EACtB,6BAA6B,EAC7B,YAAY,EACZ,YAAY,GACb,MAAM,yBAAyB,CAAC;AACjC,OAAO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Z,MAAM,CAAC,MAAM,4CAA4C,GAAG,CAAC;KAC1D,MAAM,CAAC,EAAE,QAAQ,EAAE,6BAA6B,EAAE,CAAC;KACnD,MAAM,EAAE,CAAC","sourcesContent":["// Callable contracts for the stats pipeline: finalize, reopen, the Fix stats actions — the rebuilds,\n// the game repairs, the historical baseline, the stats check, and deleting a check's report — and the\n// migration's placement of\n// an unplaceable stat line.\n\nimport { z } from 'zod';\nimport { MAX_GAME_STATS_CORRECTION_TARGETS } from '../constants/sports.js';\nimport {\n countSchema,\n gameIdSchema,\n gameRosterPlayerIdSchema,\n leagueIdSchema,\n repairReasonSchema,\n sportKeySchema,\n statCounterKeySchema,\n statsOperationIdSchema,\n statsValidationReportIdSchema,\n teamIdSchema,\n userIdSchema,\n} from '../doc-schemas/atoms.js';\nimport {\n StatsDestinationChangeSchema,\n StatsOperationCountsSchema,\n} from '../doc-schemas/stats-operation.js';\nimport {\n StatsValidationReportSchema,\n StatsValidationScopeSchema,\n StatsValidationSummarySchema,\n} from '../doc-schemas/system.js';\nimport { HistoricalStatsSchema } from '../doc-schemas/user-profile.js';\nimport {\n GAME_FINALIZE_OUTCOME_KEYS,\n GAME_REOPEN_OUTCOME_KEYS,\n GAME_STATS_REPAIR_OUTCOME_KEYS,\n UNROSTERED_STAT_LINE_RESOLUTION_OUTCOME_KEYS,\n} from '../types/stats.js';\n\n// `finalizeGame` (a captain or co-captain of either team) / `adminFinalizeGame` (an admin or a\n// referee): make a game's numbers permanent. Everything it writes is derived server-side from the\n// game's events; nothing in the input is a number (SPORT-202).\nexport const FinalizeGameInputSchema = z.object({ gameId: gameIdSchema }).strict();\nexport type FinalizeGameInput = z.infer<typeof FinalizeGameInputSchema>;\n\n// `alreadyFinalized` when the game was completed before the call: nothing was written (SPORT-203).\nexport const FinalizeGameResultSchema = z\n .object({\n gameId: gameIdSchema,\n leagueId: leagueIdSchema,\n outcome: z.enum(GAME_FINALIZE_OUTCOME_KEYS),\n nonScoringRosterPlayerIds: z.array(gameRosterPlayerIdSchema),\n })\n .strict();\nexport type FinalizeGameResult = z.infer<typeof FinalizeGameResultSchema>;\n\n// `reopenGame` (an admin): take a finalized game's numbers back out so it can be scored again. It\n// changes a completed record, so the admin says why (SPORT-206, BACKEND-212).\nexport const ReopenGameInputSchema = z\n .object({ gameId: gameIdSchema, reason: repairReasonSchema })\n .strict();\nexport type ReopenGameInput = z.infer<typeof ReopenGameInputSchema>;\n\n// `alreadyOpen` when the game was not completed: nothing was written.\nexport const ReopenGameResultSchema = z\n .object({\n gameId: gameIdSchema,\n leagueId: leagueIdSchema,\n outcome: z.enum(GAME_REOPEN_OUTCOME_KEYS),\n })\n .strict();\nexport type ReopenGameResult = z.infer<typeof ReopenGameResultSchema>;\n\n// `resolve.unrosteredStatLine` (an admin, at the cutover console, before the cutover): a recorded V1\n// stat line that no roster entry and no play of the game can place is placed on the team the admin\n// names, as the game's missing roster entry; the game's copy is then run again. The admin says why.\n// `dryRun` previews the placement — whether the game would then convert — and writes nothing.\nexport const AdminResolveUnrosteredStatLineInputSchema = z\n .object({\n gameId: gameIdSchema,\n userId: userIdSchema,\n teamId: teamIdSchema,\n reason: repairReasonSchema,\n dryRun: z.boolean().optional(),\n })\n .strict();\nexport type AdminResolveUnrosteredStatLineInput = z.infer<\n typeof AdminResolveUnrosteredStatLineInputSchema\n>;\n\n// `gameConverts` says whether the game's stats now convert, so the operator knows the copy can run.\nexport const AdminResolveUnrosteredStatLineResultSchema = z\n .object({\n gameId: gameIdSchema,\n userId: userIdSchema,\n teamId: teamIdSchema,\n outcome: z.enum(UNROSTERED_STAT_LINE_RESOLUTION_OUTCOME_KEYS),\n gameConverts: z.boolean(),\n })\n .strict();\nexport type AdminResolveUnrosteredStatLineResult = z.infer<\n typeof AdminResolveUnrosteredStatLineResultSchema\n>;\n\n// Every rebuild and every game repair is a repair of a completed record: it takes a reason, runs\n// under an operation id the admin's browser mints when the admin starts it, and offers a dry run that\n// lists each document it would change, with before and after, and writes nothing (BACKEND-212,\n// SPORT-206). A real run resumes from its operation document, so a cursor is taken from the client\n// only to page a dry run, which keeps no operation.\nconst statsRepairFields = {\n reason: repairReasonSchema,\n operationId: statsOperationIdSchema,\n dryRun: z.boolean(),\n resumeAfter: z.string().min(1).optional(),\n};\n\nconst cursorOnlyOnDryRun = (input: { dryRun: boolean; resumeAfter?: string }): boolean =>\n input.dryRun || input.resumeAfter === undefined;\nconst CURSOR_ONLY_ON_DRY_RUN = {\n message: 'A real run resumes from its operation; only a dry run takes a cursor.',\n path: ['resumeAfter'],\n};\n\n// `recalculateLeagueStats`: every team of one league — its standings line and its per-membership rows.\nexport const RecalculateLeagueStatsInputSchema = z\n .object({ leagueId: leagueIdSchema, ...statsRepairFields })\n .strict()\n .refine(cursorOnlyOnDryRun, CURSOR_ONLY_ON_DRY_RUN);\nexport type RecalculateLeagueStatsInput = z.infer<typeof RecalculateLeagueStatsInputSchema>;\n\n// `recalculateAllLeagueStats`: every league, closed ones included, a page of leagues per call.\nexport const RecalculateAllLeagueStatsInputSchema = z\n .object({ ...statsRepairFields })\n .strict()\n .refine(cursorOnlyOnDryRun, CURSOR_ONLY_ON_DRY_RUN);\nexport type RecalculateAllLeagueStatsInput = z.infer<typeof RecalculateAllLeagueStatsInputSchema>;\n\n// `recalculateUserStats`: one person's career line in every sport.\nexport const RecalculateUserStatsInputSchema = z\n .object({ userId: userIdSchema, ...statsRepairFields })\n .strict()\n .refine(cursorOnlyOnDryRun, CURSOR_ONLY_ON_DRY_RUN);\nexport type RecalculateUserStatsInput = z.infer<typeof RecalculateUserStatsInputSchema>;\n\n// `recalculateAllUserStats`: every profile's career lines, a page of profiles per call.\nexport const RecalculateAllUserStatsInputSchema = z\n .object({ ...statsRepairFields })\n .strict()\n .refine(cursorOnlyOnDryRun, CURSOR_ONLY_ON_DRY_RUN);\nexport type RecalculateAllUserStatsInput = z.infer<typeof RecalculateAllUserStatsInputSchema>;\n\n// `recalculateHallOfFame`: one sport's hall of fame — one person's entry, or the whole sport a page\n// of profiles per call. Refused for a sport that keeps none.\nexport const RecalculateHallOfFameInputSchema = z\n .object({ sportKey: sportKeySchema, userId: userIdSchema.optional(), ...statsRepairFields })\n .strict()\n .refine(cursorOnlyOnDryRun, CURSOR_ONLY_ON_DRY_RUN);\nexport type RecalculateHallOfFameInput = z.infer<typeof RecalculateHallOfFameInputSchema>;\n\n// What one call of a rebuild did. `complete` is false while a paged rebuild has pages left: the\n// admin calls again with the same operation id — or, for a dry run, with `resumeAfter` set to\n// `nextResumeAfter`. `changes` is every document this call changed or, on a dry run, would change,\n// up to MAX_STATS_REPAIR_LISTED_CHANGES (`changesTruncated` says more were left out). A game whose\n// stored numbers disagree with its record is named in `stoppedOnGameIds`, and what it feeds is left\n// untouched. `scopeChanged` says a game was finalized or reopened in the scope while it ran, so the\n// admin runs it again.\nexport const StatsRebuildResultSchema = z\n .object({\n operationId: statsOperationIdSchema,\n dryRun: z.boolean(),\n complete: z.boolean(),\n nextResumeAfter: z.string().min(1).nullable(),\n counts: StatsOperationCountsSchema,\n stoppedOnGameIds: z.array(gameIdSchema),\n changes: z.array(StatsDestinationChangeSchema),\n changesTruncated: z.boolean(),\n scopeChanged: z.boolean(),\n })\n .strict();\nexport type StatsRebuildResult = z.infer<typeof StatsRebuildResultSchema>;\n\n// A line a correction sets, by its absolute value: the team line of `teamId`, or the player line\n// `{teamId}_{playerUserId}` when a player is named. Only a field the sport's adapter lists in\n// `correctableFields` may be set.\nexport const GameStatsCorrectionTargetSchema = z\n .object({\n teamId: teamIdSchema,\n playerUserId: userIdSchema.optional(),\n stat: statCounterKeySchema,\n value: countSchema,\n })\n .strict();\nexport type GameStatsCorrectionTarget = z.infer<typeof GameStatsCorrectionTargetSchema>;\n\n// `adminCorrectGameStats`: set named fields of a game's lines to the values given, or keep the\n// numbers the game stores now — a hand edit made outside the app — as corrections. Exactly one of the\n// two.\nexport const AdminCorrectGameStatsInputSchema = z\n .object({\n gameId: gameIdSchema,\n targets: z\n .array(GameStatsCorrectionTargetSchema)\n .min(1)\n .max(MAX_GAME_STATS_CORRECTION_TARGETS)\n .optional(),\n keepStored: z.literal(true).optional(),\n reason: repairReasonSchema,\n operationId: statsOperationIdSchema,\n dryRun: z.boolean(),\n })\n .strict()\n .refine((input) => (input.targets === undefined) !== (input.keepStored === undefined), {\n message: 'Give the values to set, or keep the stored numbers — one of the two.',\n path: ['targets'],\n });\nexport type AdminCorrectGameStatsInput = z.infer<typeof AdminCorrectGameStatsInputSchema>;\n\n// `recalculateGameStats`: restore a game's numbers from its events, discarding a hand edit.\nexport const RecalculateGameStatsInputSchema = z\n .object({\n gameId: gameIdSchema,\n reason: repairReasonSchema,\n operationId: statsOperationIdSchema,\n dryRun: z.boolean(),\n })\n .strict();\nexport type RecalculateGameStatsInput = z.infer<typeof RecalculateGameStatsInputSchema>;\n\n// One correction a repair appended, or on a dry run would append.\nexport const GameStatsCorrectionSchema = z\n .object({ lineKey: z.string().min(1), field: statCounterKeySchema, value: z.number().int() })\n .strict();\nexport type GameStatsCorrection = z.infer<typeof GameStatsCorrectionSchema>;\n\n// A list of roster entries a repair replaced, as the game stored it and as the repair rebuilds it.\nconst replacedEntryListSchema = z\n .object({ stored: z.array(gameRosterPlayerIdSchema), rebuilt: z.array(gameRosterPlayerIdSchema) })\n .strict();\n\n// Every value of the game document a repair changed, each with the value the game stored and the\n// value the repair writes — never the whole document (BACKEND-212). `lines` holds each changed field\n// of a team or player line (`lineKey` the team id or the roster entry id), `scores` each team whose\n// score mirror changed, and the lists, the event counter and `recordRewritten` appear only when the\n// repair changes them; `recordRewritten` names the finalized record's page counts before and after,\n// without copying the record.\nexport const GameRepairChangesSchema = z\n .object({\n lines: z.array(\n z\n .object({\n lineKey: z.string().min(1),\n field: z.string().min(1),\n stored: z.number(),\n rebuilt: z.number(),\n })\n .strict(),\n ),\n scores: z.array(\n z.object({ teamId: teamIdSchema, stored: z.number(), rebuilt: z.number() }).strict(),\n ),\n absentRosterPlayerIds: replacedEntryListSchema.optional(),\n nonScoringRosterPlayerIds: replacedEntryListSchema.optional(),\n statEventSequence: z.object({ stored: countSchema, rebuilt: countSchema }).strict().optional(),\n recordRewritten: z\n .object({ pagesBefore: countSchema, pagesAfter: countSchema })\n .strict()\n .optional(),\n })\n .strict();\nexport type GameRepairChanges = z.infer<typeof GameRepairChangesSchema>;\n\n// What a game repair did: `reconciled` it changed the game; `unchanged` there was nothing to change;\n// `alreadyApplied` the operation had already committed and this call is its acknowledged retry.\n// `gameChanges` is what it changed on the game document, or on a dry run would change; empty lists\n// for any other outcome.\nexport const GameStatsRepairResultSchema = z\n .object({\n gameId: gameIdSchema,\n leagueId: leagueIdSchema,\n operationId: statsOperationIdSchema,\n dryRun: z.boolean(),\n outcome: z.enum(GAME_STATS_REPAIR_OUTCOME_KEYS),\n corrections: z.array(GameStatsCorrectionSchema),\n gameChanged: z.boolean(),\n gameChanges: GameRepairChangesSchema,\n destinationChanges: z.array(StatsDestinationChangeSchema),\n })\n .strict();\nexport type GameStatsRepairResult = z.infer<typeof GameStatsRepairResultSchema>;\n\n// `adminUpdateHistoricalStats`: a person's pre-Q-Sports career totals for a sport that takes them,\n// written whole, and their career line and hall-of-fame entry rebuilt with them.\nexport const AdminUpdateHistoricalStatsInputSchema = z\n .object({\n userId: userIdSchema,\n sportKey: sportKeySchema,\n stats: HistoricalStatsSchema,\n reason: repairReasonSchema,\n operationId: statsOperationIdSchema,\n dryRun: z.boolean(),\n })\n .strict();\nexport type AdminUpdateHistoricalStatsInput = z.infer<typeof AdminUpdateHistoricalStatsInputSchema>;\n\nexport const AdminUpdateHistoricalStatsResultSchema = z\n .object({\n userId: userIdSchema,\n sportKey: sportKeySchema,\n operationId: statsOperationIdSchema,\n dryRun: z.boolean(),\n outcome: z.enum(GAME_STATS_REPAIR_OUTCOME_KEYS),\n baselineBefore: HistoricalStatsSchema.nullable(),\n stoppedOnGameIds: z.array(gameIdSchema),\n changes: z.array(StatsDestinationChangeSchema),\n })\n .strict();\nexport type AdminUpdateHistoricalStatsResult = z.infer<\n typeof AdminUpdateHistoricalStatsResultSchema\n>;\n\n// `runStatsValidation`: check one game, one league, or — with neither — everything. A check that\n// reaches its time budget saves its place on its operation and answers `complete: false`; calling\n// again with the same operation id resumes it. It writes no stat, so it takes no reason.\nexport const RunStatsValidationInputSchema = z\n .object({ operationId: statsOperationIdSchema, scope: StatsValidationScopeSchema })\n .strict();\nexport type RunStatsValidationInput = z.infer<typeof RunStatsValidationInputSchema>;\n\nexport const RunStatsValidationResultSchema = z\n .object({\n reportId: z.string().min(1),\n complete: z.boolean(),\n summary: StatsValidationSummarySchema,\n discrepancyCounts: StatsValidationReportSchema.shape.discrepancyCounts,\n })\n .strict();\nexport type RunStatsValidationResult = z.infer<typeof RunStatsValidationResultSchema>;\n\n// `adminDeleteStatsValidationReport`: delete one stats check's report. It writes no stat, so it takes\n// no reason; a report that is not there is refused as not found.\nexport const AdminDeleteStatsValidationReportInputSchema = z\n .object({ reportId: statsValidationReportIdSchema })\n .strict();\nexport type AdminDeleteStatsValidationReportInput = z.infer<\n typeof AdminDeleteStatsValidationReportInputSchema\n>;\n\nexport const AdminDeleteStatsValidationReportResultSchema = z\n .object({ reportId: statsValidationReportIdSchema })\n .strict();\nexport type AdminDeleteStatsValidationReportResult = z.infer<\n typeof AdminDeleteStatsValidationReportResultSchema\n>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"team-joining.d.ts","sourceRoot":"","sources":["../../src/schemas/team-joining.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmBxB,eAAO,MAAM,+BAA+B;;;;kBAEjC,CAAC;AACZ,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAGxF,eAAO,MAAM,+BAA+B;;kBAAkE,CAAC;AAC/G,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAIxF,eAAO,MAAM,0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AAiC;;;;;;;;;;kBAEnC,CAAC;AACZ,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAC;AAS5F,eAAO,MAAM,0BAA0B;;kBAAkD,CAAC;AAC1F,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAG9E,eAAO,MAAM,iCAAiC;;;;kBAEnC,CAAC;AACZ,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAC;AAG5F,eAAO,MAAM,iCAAiC;;;;kBAEnC,CAAC;AACZ,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAC;AAE5F,eAAO,MAAM,qCAAqC;;;;kBAEvC,CAAC;AACZ,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qCAAqC,CAAC,CAAC;AAEpG,eAAO,MAAM,sCAAsC;;;;;;;;;kBAOxC,CAAC;AACZ,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CACpD,OAAO,sCAAsC,CAC9C,CAAC"}
@@ -5,18 +5,24 @@
5
5
  // authority (BACKEND-004): each action is its own callable, never a choice made by a payload field
6
6
  // (BACKEND-305).
7
7
  import { z } from 'zod';
8
- import { membershipRosterSyncStatusSchema } from '../doc-schemas/atoms.js';
9
- import { epochMsSchema, leagueIdSchema, teamIdSchema, teamInvitationIdSchema, teamInvitationMessageSchema, teamJoinRequestIdSchema, teamJoinRequestMessageSchema, userIdSchema, } from './atoms.js';
8
+ import { epochMsSchema, leagueIdSchema, membershipRosterSyncStatusSchema, teamIdSchema, userIdSchema, } from '../doc-schemas/atoms.js';
9
+ import { teamInvitationIdSchema, teamInvitationMessageSchema, teamJoinRequestIdSchema, teamJoinRequestMessageSchema, } from './atoms.js';
10
10
  // ---------------------------------------------------------------------------------------------
11
11
  // Invitations — sent and withdrawn by the team's captain or a co-captain (`createTeamInvitation`,
12
12
  // `cancelTeamInvitation`) or by an admin (`adminCreateTeamInvitation`, `adminCancelTeamInvitation`);
13
13
  // accepted or declined by the invitee alone (`acceptTeamInvitation`, `rejectTeamInvitation`).
14
14
  // ---------------------------------------------------------------------------------------------
15
15
  export const CreateTeamInvitationInputSchema = z
16
- .object({ teamId: teamIdSchema, invitedUserId: userIdSchema, message: teamInvitationMessageSchema })
16
+ .object({
17
+ teamId: teamIdSchema,
18
+ invitedUserId: userIdSchema,
19
+ message: teamInvitationMessageSchema,
20
+ })
17
21
  .strict();
18
22
  // Names the invitation a cancel, an acceptance, or a decline acts on.
19
- export const TeamInvitationTargetInputSchema = z.object({ teamInvitationId: teamInvitationIdSchema }).strict();
23
+ export const TeamInvitationTargetInputSchema = z
24
+ .object({ teamInvitationId: teamInvitationIdSchema })
25
+ .strict();
20
26
  // What sending, cancelling, and declining answer with: the invitation and the ids a client names in
21
27
  // its domain event.
22
28
  export const TeamInvitationResultSchema = z
@@ -42,7 +48,9 @@ export const CreateTeamJoinRequestInputSchema = z
42
48
  .object({ teamId: teamIdSchema, message: teamJoinRequestMessageSchema })
43
49
  .strict();
44
50
  // Names the join request a cancel, an acceptance, or a rejection acts on.
45
- export const TeamJoinRequestTargetInputSchema = z.object({ teamJoinRequestId: teamJoinRequestIdSchema }).strict();
51
+ export const TeamJoinRequestTargetInputSchema = z
52
+ .object({ teamJoinRequestId: teamJoinRequestIdSchema })
53
+ .strict();
46
54
  export const TeamJoinRequestResultSchema = z
47
55
  .object({
48
56
  leagueId: leagueIdSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"team-joining.js","sourceRoot":"","sources":["../../src/schemas/team-joining.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,gGAAgG;AAChG,iGAAiG;AACjG,6FAA6F;AAC7F,mGAAmG;AACnG,iBAAiB;AAEjB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC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AAM,EAAE,CAAC;AAGZ,MAAM,CAAC,MAAM,sCAAsC,GAAG,CAAC;KACpD,MAAM,CAAC;IACN,QAAQ,EAAE,cAAc;IACxB,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,gBAAgB,EAAE,gCAAgC;CACnD,CAAC;KACD,MAAM,EAAE,CAAC","sourcesContent":["// Callable contracts for the ways onto a team: an invitation the team sends, a join request the\n// player sends, and a free-agent signup an admin answers by placing the player. Every door that\n// makes a membership ends in the membership core. The acting user is always `request.auth.uid` —\n// never an input field (ARCH-106) — and the entry, never a field of the payload, decides the\n// authority (BACKEND-004): each action is its own callable, never a choice made by a payload field\n// (BACKEND-305).\n\nimport { z } from 'zod';\nimport { membershipRosterSyncStatusSchema } from '../doc-schemas/atoms.js';\nimport {\n epochMsSchema,\n leagueIdSchema,\n teamIdSchema,\n teamInvitationIdSchema,\n teamInvitationMessageSchema,\n teamJoinRequestIdSchema,\n teamJoinRequestMessageSchema,\n userIdSchema,\n} from './atoms.js';\n\n// ---------------------------------------------------------------------------------------------\n// Invitations — sent and withdrawn by the team's captain or a co-captain (`createTeamInvitation`,\n// `cancelTeamInvitation`) or by an admin (`adminCreateTeamInvitation`, `adminCancelTeamInvitation`);\n// accepted or declined by the invitee alone (`acceptTeamInvitation`, `rejectTeamInvitation`).\n// ---------------------------------------------------------------------------------------------\n\nexport const CreateTeamInvitationInputSchema = z\n .object({ teamId: teamIdSchema, invitedUserId: userIdSchema, message: teamInvitationMessageSchema })\n .strict();\nexport type CreateTeamInvitationInput = z.infer<typeof CreateTeamInvitationInputSchema>;\n\n// Names the invitation a cancel, an acceptance, or a decline acts on.\nexport const TeamInvitationTargetInputSchema = z.object({ teamInvitationId: teamInvitationIdSchema }).strict();\nexport type TeamInvitationTargetInput = z.infer<typeof TeamInvitationTargetInputSchema>;\n\n// What sending, cancelling, and declining answer with: the invitation and the ids a client names in\n// its domain event.\nexport const TeamInvitationResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n teamInvitationId: teamInvitationIdSchema,\n invitedUserId: userIdSchema,\n })\n .strict();\nexport type TeamInvitationResult = z.infer<typeof TeamInvitationResultSchema>;\n\n// `rosterSyncStatus` is where the new membership's roster work stood when the call returned: the\n// membership is committed either way, and `pending` finishes in the background.\nexport const AcceptTeamInvitationResultSchema = TeamInvitationResultSchema.extend({\n rosterSyncStatus: membershipRosterSyncStatusSchema,\n}).strict();\nexport type AcceptTeamInvitationResult = z.infer<typeof AcceptTeamInvitationResultSchema>;\n\n// ---------------------------------------------------------------------------------------------\n// Join requests — sent and withdrawn by the player (`createTeamJoinRequest`,\n// `cancelTeamJoinRequest`); accepted or rejected by the team's captain or a co-captain\n// (`acceptTeamJoinRequest`, `rejectTeamJoinRequest`) or by an admin (`adminAcceptTeamJoinRequest`,\n// `adminRejectTeamJoinRequest`).\n// ---------------------------------------------------------------------------------------------\n\nexport const CreateTeamJoinRequestInputSchema = z\n .object({ teamId: teamIdSchema, message: teamJoinRequestMessageSchema })\n .strict();\nexport type CreateTeamJoinRequestInput = z.infer<typeof CreateTeamJoinRequestInputSchema>;\n\n// Names the join request a cancel, an acceptance, or a rejection acts on.\nexport const TeamJoinRequestTargetInputSchema = z.object({ teamJoinRequestId: teamJoinRequestIdSchema }).strict();\nexport type TeamJoinRequestTargetInput = z.infer<typeof TeamJoinRequestTargetInputSchema>;\n\nexport const TeamJoinRequestResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n teamJoinRequestId: teamJoinRequestIdSchema,\n userId: userIdSchema,\n })\n .strict();\nexport type TeamJoinRequestResult = z.infer<typeof TeamJoinRequestResultSchema>;\n\nexport const AcceptTeamJoinRequestResultSchema = TeamJoinRequestResultSchema.extend({\n rosterSyncStatus: membershipRosterSyncStatusSchema,\n}).strict();\nexport type AcceptTeamJoinRequestResult = z.infer<typeof AcceptTeamJoinRequestResultSchema>;\n\n// ---------------------------------------------------------------------------------------------\n// Free agents — a player signs up in a league (`createLeagueFreeAgent`) or withdraws\n// (`deleteLeagueFreeAgent`); an admin places a signed-up player on a team\n// (`adminAssignLeagueFreeAgent`).\n// ---------------------------------------------------------------------------------------------\n\n// The league a player signs up in, or withdraws from. The player is the caller.\nexport const LeagueFreeAgentInputSchema = z.object({ leagueId: leagueIdSchema }).strict();\nexport type LeagueFreeAgentInput = z.infer<typeof LeagueFreeAgentInputSchema>;\n\n// `createdAt` is the signup's own moment: a repeated signup answers the one already on record.\nexport const CreateLeagueFreeAgentResultSchema = z\n .object({ leagueId: leagueIdSchema, userId: userIdSchema, createdAt: epochMsSchema })\n .strict();\nexport type CreateLeagueFreeAgentResult = z.infer<typeof CreateLeagueFreeAgentResultSchema>;\n\n// `deleted` is false when no signup was on record — a repeated withdrawal changes nothing.\nexport const DeleteLeagueFreeAgentResultSchema = z\n .object({ leagueId: leagueIdSchema, userId: userIdSchema, deleted: z.boolean() })\n .strict();\nexport type DeleteLeagueFreeAgentResult = z.infer<typeof DeleteLeagueFreeAgentResultSchema>;\n\nexport const AdminAssignLeagueFreeAgentInputSchema = z\n .object({ leagueId: leagueIdSchema, userId: userIdSchema, teamId: teamIdSchema })\n .strict();\nexport type AdminAssignLeagueFreeAgentInput = z.infer<typeof AdminAssignLeagueFreeAgentInputSchema>;\n\nexport const AdminAssignLeagueFreeAgentResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n userId: userIdSchema,\n rosterSyncStatus: membershipRosterSyncStatusSchema,\n })\n .strict();\nexport type AdminAssignLeagueFreeAgentResult = z.infer<typeof AdminAssignLeagueFreeAgentResultSchema>;\n"]}
1
+ {"version":3,"file":"team-joining.js","sourceRoot":"","sources":["../../src/schemas/team-joining.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,gGAAgG;AAChG,iGAAiG;AACjG,6FAA6F;AAC7F,mGAAmG;AACnG,iBAAiB;AAEjB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL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AGZ,MAAM,CAAC,MAAM,sCAAsC,GAAG,CAAC;KACpD,MAAM,CAAC;IACN,QAAQ,EAAE,cAAc;IACxB,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,gBAAgB,EAAE,gCAAgC;CACnD,CAAC;KACD,MAAM,EAAE,CAAC","sourcesContent":["// Callable contracts for the ways onto a team: an invitation the team sends, a join request the\n// player sends, and a free-agent signup an admin answers by placing the player. Every door that\n// makes a membership ends in the membership core. The acting user is always `request.auth.uid` —\n// never an input field (ARCH-106) — and the entry, never a field of the payload, decides the\n// authority (BACKEND-004): each action is its own callable, never a choice made by a payload field\n// (BACKEND-305).\n\nimport { z } from 'zod';\nimport {\n epochMsSchema,\n leagueIdSchema,\n membershipRosterSyncStatusSchema,\n teamIdSchema,\n userIdSchema,\n} from '../doc-schemas/atoms.js';\nimport {\n teamInvitationIdSchema,\n teamInvitationMessageSchema,\n teamJoinRequestIdSchema,\n teamJoinRequestMessageSchema,\n} from './atoms.js';\n\n// ---------------------------------------------------------------------------------------------\n// Invitations — sent and withdrawn by the team's captain or a co-captain (`createTeamInvitation`,\n// `cancelTeamInvitation`) or by an admin (`adminCreateTeamInvitation`, `adminCancelTeamInvitation`);\n// accepted or declined by the invitee alone (`acceptTeamInvitation`, `rejectTeamInvitation`).\n// ---------------------------------------------------------------------------------------------\n\nexport const CreateTeamInvitationInputSchema = z\n .object({\n teamId: teamIdSchema,\n invitedUserId: userIdSchema,\n message: teamInvitationMessageSchema,\n })\n .strict();\nexport type CreateTeamInvitationInput = z.infer<typeof CreateTeamInvitationInputSchema>;\n\n// Names the invitation a cancel, an acceptance, or a decline acts on.\nexport const TeamInvitationTargetInputSchema = z\n .object({ teamInvitationId: teamInvitationIdSchema })\n .strict();\nexport type TeamInvitationTargetInput = z.infer<typeof TeamInvitationTargetInputSchema>;\n\n// What sending, cancelling, and declining answer with: the invitation and the ids a client names in\n// its domain event.\nexport const TeamInvitationResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n teamInvitationId: teamInvitationIdSchema,\n invitedUserId: userIdSchema,\n })\n .strict();\nexport type TeamInvitationResult = z.infer<typeof TeamInvitationResultSchema>;\n\n// `rosterSyncStatus` is where the new membership's roster work stood when the call returned: the\n// membership is committed either way, and `pending` finishes in the background.\nexport const AcceptTeamInvitationResultSchema = TeamInvitationResultSchema.extend({\n rosterSyncStatus: membershipRosterSyncStatusSchema,\n}).strict();\nexport type AcceptTeamInvitationResult = z.infer<typeof AcceptTeamInvitationResultSchema>;\n\n// ---------------------------------------------------------------------------------------------\n// Join requests — sent and withdrawn by the player (`createTeamJoinRequest`,\n// `cancelTeamJoinRequest`); accepted or rejected by the team's captain or a co-captain\n// (`acceptTeamJoinRequest`, `rejectTeamJoinRequest`) or by an admin (`adminAcceptTeamJoinRequest`,\n// `adminRejectTeamJoinRequest`).\n// ---------------------------------------------------------------------------------------------\n\nexport const CreateTeamJoinRequestInputSchema = z\n .object({ teamId: teamIdSchema, message: teamJoinRequestMessageSchema })\n .strict();\nexport type CreateTeamJoinRequestInput = z.infer<typeof CreateTeamJoinRequestInputSchema>;\n\n// Names the join request a cancel, an acceptance, or a rejection acts on.\nexport const TeamJoinRequestTargetInputSchema = z\n .object({ teamJoinRequestId: teamJoinRequestIdSchema })\n .strict();\nexport type TeamJoinRequestTargetInput = z.infer<typeof TeamJoinRequestTargetInputSchema>;\n\nexport const TeamJoinRequestResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n teamJoinRequestId: teamJoinRequestIdSchema,\n userId: userIdSchema,\n })\n .strict();\nexport type TeamJoinRequestResult = z.infer<typeof TeamJoinRequestResultSchema>;\n\nexport const AcceptTeamJoinRequestResultSchema = TeamJoinRequestResultSchema.extend({\n rosterSyncStatus: membershipRosterSyncStatusSchema,\n}).strict();\nexport type AcceptTeamJoinRequestResult = z.infer<typeof AcceptTeamJoinRequestResultSchema>;\n\n// ---------------------------------------------------------------------------------------------\n// Free agents — a player signs up in a league (`createLeagueFreeAgent`) or withdraws\n// (`deleteLeagueFreeAgent`); an admin places a signed-up player on a team\n// (`adminAssignLeagueFreeAgent`).\n// ---------------------------------------------------------------------------------------------\n\n// The league a player signs up in, or withdraws from. The player is the caller.\nexport const LeagueFreeAgentInputSchema = z.object({ leagueId: leagueIdSchema }).strict();\nexport type LeagueFreeAgentInput = z.infer<typeof LeagueFreeAgentInputSchema>;\n\n// `createdAt` is the signup's own moment: a repeated signup answers the one already on record.\nexport const CreateLeagueFreeAgentResultSchema = z\n .object({ leagueId: leagueIdSchema, userId: userIdSchema, createdAt: epochMsSchema })\n .strict();\nexport type CreateLeagueFreeAgentResult = z.infer<typeof CreateLeagueFreeAgentResultSchema>;\n\n// `deleted` is false when no signup was on record — a repeated withdrawal changes nothing.\nexport const DeleteLeagueFreeAgentResultSchema = z\n .object({ leagueId: leagueIdSchema, userId: userIdSchema, deleted: z.boolean() })\n .strict();\nexport type DeleteLeagueFreeAgentResult = z.infer<typeof DeleteLeagueFreeAgentResultSchema>;\n\nexport const AdminAssignLeagueFreeAgentInputSchema = z\n .object({ leagueId: leagueIdSchema, userId: userIdSchema, teamId: teamIdSchema })\n .strict();\nexport type AdminAssignLeagueFreeAgentInput = z.infer<typeof AdminAssignLeagueFreeAgentInputSchema>;\n\nexport const AdminAssignLeagueFreeAgentResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n userId: userIdSchema,\n rosterSyncStatus: membershipRosterSyncStatusSchema,\n })\n .strict();\nexport type AdminAssignLeagueFreeAgentResult = z.infer<\n typeof AdminAssignLeagueFreeAgentResultSchema\n>;\n"]}