@ttt-productions/q-core 0.1.28 → 0.1.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (496) hide show
  1. package/dist/constants/admin-views.d.ts.map +1 -1
  2. package/dist/constants/admin-views.js +0 -3
  3. package/dist/constants/admin-views.js.map +1 -1
  4. package/dist/constants/business.d.ts.map +1 -1
  5. package/dist/constants/business.js +0 -52
  6. package/dist/constants/business.js.map +1 -1
  7. package/dist/constants/deployment.d.ts +0 -2
  8. package/dist/constants/deployment.d.ts.map +1 -1
  9. package/dist/constants/deployment.js +0 -2
  10. package/dist/constants/deployment.js.map +1 -1
  11. package/dist/constants/media.d.ts.map +1 -1
  12. package/dist/constants/media.js +4 -30
  13. package/dist/constants/media.js.map +1 -1
  14. package/dist/constants/scheduled-jobs.d.ts +0 -25
  15. package/dist/constants/scheduled-jobs.d.ts.map +1 -1
  16. package/dist/constants/scheduled-jobs.js +0 -26
  17. package/dist/constants/scheduled-jobs.js.map +1 -1
  18. package/dist/constants/sports.d.ts +1 -0
  19. package/dist/constants/sports.d.ts.map +1 -1
  20. package/dist/constants/sports.js +4 -25
  21. package/dist/constants/sports.js.map +1 -1
  22. package/dist/constants/storage-keys.d.ts +0 -38
  23. package/dist/constants/storage-keys.d.ts.map +1 -1
  24. package/dist/constants/storage-keys.js +0 -41
  25. package/dist/constants/storage-keys.js.map +1 -1
  26. package/dist/constants/telemetry.d.ts +0 -3
  27. package/dist/constants/telemetry.d.ts.map +1 -1
  28. package/dist/constants/telemetry.js +2 -11
  29. package/dist/constants/telemetry.js.map +1 -1
  30. package/dist/doc-schemas/admin-notifications.d.ts +1 -2
  31. package/dist/doc-schemas/admin-notifications.d.ts.map +1 -1
  32. package/dist/doc-schemas/admin-notifications.js +0 -41
  33. package/dist/doc-schemas/admin-notifications.js.map +1 -1
  34. package/dist/doc-schemas/aggregate-stats.d.ts.map +1 -1
  35. package/dist/doc-schemas/aggregate-stats.js +0 -35
  36. package/dist/doc-schemas/aggregate-stats.js.map +1 -1
  37. package/dist/doc-schemas/atoms.d.ts +0 -17
  38. package/dist/doc-schemas/atoms.d.ts.map +1 -1
  39. package/dist/doc-schemas/atoms.js +0 -36
  40. package/dist/doc-schemas/atoms.js.map +1 -1
  41. package/dist/doc-schemas/audit-event.d.ts +2 -0
  42. package/dist/doc-schemas/audit-event.d.ts.map +1 -1
  43. package/dist/doc-schemas/audit-event.js +0 -8
  44. package/dist/doc-schemas/audit-event.js.map +1 -1
  45. package/dist/doc-schemas/award-group-grant.d.ts +2 -8
  46. package/dist/doc-schemas/award-group-grant.d.ts.map +1 -1
  47. package/dist/doc-schemas/award-group-grant.js +0 -25
  48. package/dist/doc-schemas/award-group-grant.js.map +1 -1
  49. package/dist/doc-schemas/catalogs.d.ts.map +1 -1
  50. package/dist/doc-schemas/catalogs.js +0 -12
  51. package/dist/doc-schemas/catalogs.js.map +1 -1
  52. package/dist/doc-schemas/firestore-primitives.d.ts.map +1 -1
  53. package/dist/doc-schemas/firestore-primitives.js +0 -5
  54. package/dist/doc-schemas/firestore-primitives.js.map +1 -1
  55. package/dist/doc-schemas/gallery.d.ts.map +1 -1
  56. package/dist/doc-schemas/gallery.js +9 -18
  57. package/dist/doc-schemas/gallery.js.map +1 -1
  58. package/dist/doc-schemas/game-location.d.ts.map +1 -1
  59. package/dist/doc-schemas/game-location.js +2 -11
  60. package/dist/doc-schemas/game-location.js.map +1 -1
  61. package/dist/doc-schemas/game-stat-history.d.ts.map +1 -1
  62. package/dist/doc-schemas/game-stat-history.js +2 -11
  63. package/dist/doc-schemas/game-stat-history.js.map +1 -1
  64. package/dist/doc-schemas/game-stats.d.ts.map +1 -1
  65. package/dist/doc-schemas/game-stats.js +0 -56
  66. package/dist/doc-schemas/game-stats.js.map +1 -1
  67. package/dist/doc-schemas/league-team.d.ts.map +1 -1
  68. package/dist/doc-schemas/league-team.js +6 -29
  69. package/dist/doc-schemas/league-team.js.map +1 -1
  70. package/dist/doc-schemas/membership-roster-sync.d.ts.map +1 -1
  71. package/dist/doc-schemas/membership-roster-sync.js +0 -17
  72. package/dist/doc-schemas/membership-roster-sync.js.map +1 -1
  73. package/dist/doc-schemas/migration-console.d.ts +21 -15
  74. package/dist/doc-schemas/migration-console.d.ts.map +1 -1
  75. package/dist/doc-schemas/migration-console.js +0 -32
  76. package/dist/doc-schemas/migration-console.js.map +1 -1
  77. package/dist/doc-schemas/pending-media.d.ts.map +1 -1
  78. package/dist/doc-schemas/pending-media.js +8 -20
  79. package/dist/doc-schemas/pending-media.js.map +1 -1
  80. package/dist/doc-schemas/picture-retirement.d.ts.map +1 -1
  81. package/dist/doc-schemas/picture-retirement.js +8 -13
  82. package/dist/doc-schemas/picture-retirement.js.map +1 -1
  83. package/dist/doc-schemas/publicUser.d.ts.map +1 -1
  84. package/dist/doc-schemas/publicUser.js +0 -5
  85. package/dist/doc-schemas/publicUser.js.map +1 -1
  86. package/dist/doc-schemas/registration-start.d.ts.map +1 -1
  87. package/dist/doc-schemas/registration-start.js +2 -5
  88. package/dist/doc-schemas/registration-start.js.map +1 -1
  89. package/dist/doc-schemas/registry.d.ts +25 -14
  90. package/dist/doc-schemas/registry.d.ts.map +1 -1
  91. package/dist/doc-schemas/registry.js +0 -10
  92. package/dist/doc-schemas/registry.js.map +1 -1
  93. package/dist/doc-schemas/reserved-display-name.d.ts.map +1 -1
  94. package/dist/doc-schemas/reserved-display-name.js +0 -5
  95. package/dist/doc-schemas/reserved-display-name.js.map +1 -1
  96. package/dist/doc-schemas/sport-game.d.ts.map +1 -1
  97. package/dist/doc-schemas/sport-game.js +1 -29
  98. package/dist/doc-schemas/sport-game.js.map +1 -1
  99. package/dist/doc-schemas/sport-league.d.ts +0 -9
  100. package/dist/doc-schemas/sport-league.d.ts.map +1 -1
  101. package/dist/doc-schemas/sport-league.js +4 -26
  102. package/dist/doc-schemas/sport-league.js.map +1 -1
  103. package/dist/doc-schemas/stats-operation.d.ts +22 -18
  104. package/dist/doc-schemas/stats-operation.d.ts.map +1 -1
  105. package/dist/doc-schemas/stats-operation.js +7 -44
  106. package/dist/doc-schemas/stats-operation.js.map +1 -1
  107. package/dist/doc-schemas/status-reconcile-queue.d.ts +0 -6
  108. package/dist/doc-schemas/status-reconcile-queue.d.ts.map +1 -1
  109. package/dist/doc-schemas/status-reconcile-queue.js +0 -13
  110. package/dist/doc-schemas/status-reconcile-queue.js.map +1 -1
  111. package/dist/doc-schemas/sweep-state.d.ts.map +1 -1
  112. package/dist/doc-schemas/sweep-state.js +4 -20
  113. package/dist/doc-schemas/sweep-state.js.map +1 -1
  114. package/dist/doc-schemas/system.d.ts.map +1 -1
  115. package/dist/doc-schemas/system.js +1 -27
  116. package/dist/doc-schemas/system.js.map +1 -1
  117. package/dist/doc-schemas/team-membership.d.ts.map +1 -1
  118. package/dist/doc-schemas/team-membership.js +0 -10
  119. package/dist/doc-schemas/team-membership.js.map +1 -1
  120. package/dist/doc-schemas/user-profile.d.ts +0 -1
  121. package/dist/doc-schemas/user-profile.d.ts.map +1 -1
  122. package/dist/doc-schemas/user-profile.js +0 -28
  123. package/dist/doc-schemas/user-profile.js.map +1 -1
  124. package/dist/doc-schemas/waiver-template.d.ts.map +1 -1
  125. package/dist/doc-schemas/waiver-template.js +4 -25
  126. package/dist/doc-schemas/waiver-template.js.map +1 -1
  127. package/dist/doc-schemas/waivers-and-hardware.d.ts.map +1 -1
  128. package/dist/doc-schemas/waivers-and-hardware.js +0 -20
  129. package/dist/doc-schemas/waivers-and-hardware.js.map +1 -1
  130. package/dist/domain-events/domain-events.d.ts.map +1 -1
  131. package/dist/domain-events/domain-events.js +0 -67
  132. package/dist/domain-events/domain-events.js.map +1 -1
  133. package/dist/ids/award-grant-ids.d.ts.map +1 -1
  134. package/dist/ids/award-grant-ids.js +0 -7
  135. package/dist/ids/award-grant-ids.js.map +1 -1
  136. package/dist/ids/compound-ids.d.ts.map +1 -1
  137. package/dist/ids/compound-ids.js +0 -7
  138. package/dist/ids/compound-ids.js.map +1 -1
  139. package/dist/ids/minted-ids.d.ts.map +1 -1
  140. package/dist/ids/minted-ids.js +4 -14
  141. package/dist/ids/minted-ids.js.map +1 -1
  142. package/dist/ids/notification-ids.d.ts.map +1 -1
  143. package/dist/ids/notification-ids.js +0 -15
  144. package/dist/ids/notification-ids.js.map +1 -1
  145. package/dist/ids/picture-ids.d.ts +0 -5
  146. package/dist/ids/picture-ids.d.ts.map +1 -1
  147. package/dist/ids/picture-ids.js +0 -11
  148. package/dist/ids/picture-ids.js.map +1 -1
  149. package/dist/ids/stat-event-ids.d.ts +0 -6
  150. package/dist/ids/stat-event-ids.d.ts.map +1 -1
  151. package/dist/ids/stat-event-ids.js +0 -15
  152. package/dist/ids/stat-event-ids.js.map +1 -1
  153. package/dist/ids/stats-operation-ids.d.ts.map +1 -1
  154. package/dist/ids/stats-operation-ids.js +0 -7
  155. package/dist/ids/stats-operation-ids.js.map +1 -1
  156. package/dist/ids/waiver-template-ids.d.ts +0 -1
  157. package/dist/ids/waiver-template-ids.d.ts.map +1 -1
  158. package/dist/ids/waiver-template-ids.js +0 -2
  159. package/dist/ids/waiver-template-ids.js.map +1 -1
  160. package/dist/index.d.ts +2 -0
  161. package/dist/index.d.ts.map +1 -1
  162. package/dist/index.js +2 -2
  163. package/dist/index.js.map +1 -1
  164. package/dist/input-formats/input-formats.d.ts +0 -80
  165. package/dist/input-formats/input-formats.d.ts.map +1 -1
  166. package/dist/input-formats/input-formats.js +0 -86
  167. package/dist/input-formats/input-formats.js.map +1 -1
  168. package/dist/media/file-origins.d.ts +0 -3
  169. package/dist/media/file-origins.d.ts.map +1 -1
  170. package/dist/media/file-origins.js +0 -26
  171. package/dist/media/file-origins.js.map +1 -1
  172. package/dist/media/picture-aspects.d.ts +0 -2
  173. package/dist/media/picture-aspects.d.ts.map +1 -1
  174. package/dist/media/picture-aspects.js +0 -5
  175. package/dist/media/picture-aspects.js.map +1 -1
  176. package/dist/media/picture-url.d.ts +0 -6
  177. package/dist/media/picture-url.d.ts.map +1 -1
  178. package/dist/media/picture-url.js +0 -9
  179. package/dist/media/picture-url.js.map +1 -1
  180. package/dist/media/upload-tray-display.d.ts +0 -3
  181. package/dist/media/upload-tray-display.d.ts.map +1 -1
  182. package/dist/media/upload-tray-display.js +0 -6
  183. package/dist/media/upload-tray-display.js.map +1 -1
  184. package/dist/migration-console/action-ids.d.ts +4 -1
  185. package/dist/migration-console/action-ids.d.ts.map +1 -1
  186. package/dist/migration-console/action-ids.js +8 -45
  187. package/dist/migration-console/action-ids.js.map +1 -1
  188. package/dist/migration-console/console-lock.d.ts +10 -0
  189. package/dist/migration-console/console-lock.d.ts.map +1 -0
  190. package/dist/migration-console/console-lock.js +14 -0
  191. package/dist/migration-console/console-lock.js.map +1 -0
  192. package/dist/migration-console/consumed-source.d.ts +4 -0
  193. package/dist/migration-console/consumed-source.d.ts.map +1 -0
  194. package/dist/migration-console/consumed-source.js +10 -0
  195. package/dist/migration-console/consumed-source.js.map +1 -0
  196. package/dist/migration-console/manifest.d.ts +2 -24
  197. package/dist/migration-console/manifest.d.ts.map +1 -1
  198. package/dist/migration-console/manifest.js +174 -61
  199. package/dist/migration-console/manifest.js.map +1 -1
  200. package/dist/migration-console/run-state.d.ts +2 -14
  201. package/dist/migration-console/run-state.d.ts.map +1 -1
  202. package/dist/migration-console/run-state.js +3 -16
  203. package/dist/migration-console/run-state.js.map +1 -1
  204. package/dist/notifications/admin-notification-config.d.ts +0 -11
  205. package/dist/notifications/admin-notification-config.d.ts.map +1 -1
  206. package/dist/notifications/admin-notification-config.js +2 -13
  207. package/dist/notifications/admin-notification-config.js.map +1 -1
  208. package/dist/notifications/archive-all.d.ts.map +1 -1
  209. package/dist/notifications/archive-all.js +0 -2
  210. package/dist/notifications/archive-all.js.map +1 -1
  211. package/dist/notifications/occurrences.d.ts +0 -3
  212. package/dist/notifications/occurrences.d.ts.map +1 -1
  213. package/dist/notifications/occurrences.js +0 -7
  214. package/dist/notifications/occurrences.js.map +1 -1
  215. package/dist/paths/app-routes.d.ts +0 -12
  216. package/dist/paths/app-routes.d.ts.map +1 -1
  217. package/dist/paths/app-routes.js +0 -18
  218. package/dist/paths/app-routes.js.map +1 -1
  219. package/dist/paths/collection-groups.d.ts.map +1 -1
  220. package/dist/paths/collection-groups.js +0 -5
  221. package/dist/paths/collection-groups.js.map +1 -1
  222. package/dist/paths/collection-refs.d.ts.map +1 -1
  223. package/dist/paths/collection-refs.js +0 -4
  224. package/dist/paths/collection-refs.js.map +1 -1
  225. package/dist/paths/collections.d.ts +0 -5
  226. package/dist/paths/collections.d.ts.map +1 -1
  227. package/dist/paths/collections.js +0 -68
  228. package/dist/paths/collections.js.map +1 -1
  229. package/dist/paths/path-builders.d.ts.map +1 -1
  230. package/dist/paths/path-builders.js +0 -16
  231. package/dist/paths/path-builders.js.map +1 -1
  232. package/dist/paths/picture-owner-paths.d.ts +0 -4
  233. package/dist/paths/picture-owner-paths.d.ts.map +1 -1
  234. package/dist/paths/picture-owner-paths.js +2 -11
  235. package/dist/paths/picture-owner-paths.js.map +1 -1
  236. package/dist/paths/storage-paths.d.ts +0 -18
  237. package/dist/paths/storage-paths.d.ts.map +1 -1
  238. package/dist/paths/storage-paths.js +0 -23
  239. package/dist/paths/storage-paths.js.map +1 -1
  240. package/dist/paths/utils.d.ts +0 -6
  241. package/dist/paths/utils.d.ts.map +1 -1
  242. package/dist/paths/utils.js +0 -9
  243. package/dist/paths/utils.js.map +1 -1
  244. package/dist/schemas/account-settings.d.ts.map +1 -1
  245. package/dist/schemas/account-settings.js +0 -7
  246. package/dist/schemas/account-settings.js.map +1 -1
  247. package/dist/schemas/admin-notifications.d.ts.map +1 -1
  248. package/dist/schemas/admin-notifications.js +0 -17
  249. package/dist/schemas/admin-notifications.js.map +1 -1
  250. package/dist/schemas/admin-stats.d.ts.map +1 -1
  251. package/dist/schemas/admin-stats.js +0 -9
  252. package/dist/schemas/admin-stats.js.map +1 -1
  253. package/dist/schemas/app-config.d.ts.map +1 -1
  254. package/dist/schemas/app-config.js +0 -10
  255. package/dist/schemas/app-config.js.map +1 -1
  256. package/dist/schemas/atoms.d.ts.map +1 -1
  257. package/dist/schemas/atoms.js +0 -10
  258. package/dist/schemas/atoms.js.map +1 -1
  259. package/dist/schemas/awards.d.ts +3 -3
  260. package/dist/schemas/awards.d.ts.map +1 -1
  261. package/dist/schemas/awards.js +0 -29
  262. package/dist/schemas/awards.js.map +1 -1
  263. package/dist/schemas/dead-letters.d.ts +0 -3
  264. package/dist/schemas/dead-letters.d.ts.map +1 -1
  265. package/dist/schemas/dead-letters.js +0 -15
  266. package/dist/schemas/dead-letters.js.map +1 -1
  267. package/dist/schemas/game-locations.d.ts.map +1 -1
  268. package/dist/schemas/game-locations.js +0 -6
  269. package/dist/schemas/game-locations.js.map +1 -1
  270. package/dist/schemas/hardware-loan-contracts.d.ts.map +1 -1
  271. package/dist/schemas/hardware-loan-contracts.js +0 -13
  272. package/dist/schemas/hardware-loan-contracts.js.map +1 -1
  273. package/dist/schemas/index.d.ts.map +1 -1
  274. package/dist/schemas/index.js +0 -2
  275. package/dist/schemas/index.js.map +1 -1
  276. package/dist/schemas/leagues.d.ts.map +1 -1
  277. package/dist/schemas/leagues.js +0 -24
  278. package/dist/schemas/leagues.js.map +1 -1
  279. package/dist/schemas/migration-console.d.ts +58 -15
  280. package/dist/schemas/migration-console.d.ts.map +1 -1
  281. package/dist/schemas/migration-console.js +4 -34
  282. package/dist/schemas/migration-console.js.map +1 -1
  283. package/dist/schemas/pictures.d.ts.map +1 -1
  284. package/dist/schemas/pictures.js +0 -10
  285. package/dist/schemas/pictures.js.map +1 -1
  286. package/dist/schemas/schedules.d.ts.map +1 -1
  287. package/dist/schemas/schedules.js +0 -26
  288. package/dist/schemas/schedules.js.map +1 -1
  289. package/dist/schemas/scoring.d.ts +20 -26
  290. package/dist/schemas/scoring.d.ts.map +1 -1
  291. package/dist/schemas/scoring.js +0 -33
  292. package/dist/schemas/scoring.js.map +1 -1
  293. package/dist/schemas/signed-waivers.d.ts.map +1 -1
  294. package/dist/schemas/signed-waivers.js +0 -22
  295. package/dist/schemas/signed-waivers.js.map +1 -1
  296. package/dist/schemas/stats.d.ts +12 -0
  297. package/dist/schemas/stats.d.ts.map +1 -1
  298. package/dist/schemas/stats.js +21 -61
  299. package/dist/schemas/stats.js.map +1 -1
  300. package/dist/schemas/team-joining.d.ts.map +1 -1
  301. package/dist/schemas/team-joining.js +0 -30
  302. package/dist/schemas/team-joining.js.map +1 -1
  303. package/dist/schemas/teams.d.ts +0 -1
  304. package/dist/schemas/teams.d.ts.map +1 -1
  305. package/dist/schemas/teams.js +0 -83
  306. package/dist/schemas/teams.js.map +1 -1
  307. package/dist/schemas/uploads.d.ts +0 -8
  308. package/dist/schemas/uploads.d.ts.map +1 -1
  309. package/dist/schemas/uploads.js +0 -29
  310. package/dist/schemas/uploads.js.map +1 -1
  311. package/dist/schemas/users.d.ts +0 -1
  312. package/dist/schemas/users.d.ts.map +1 -1
  313. package/dist/schemas/users.js +0 -41
  314. package/dist/schemas/users.js.map +1 -1
  315. package/dist/schemas/waiver-templates.d.ts.map +1 -1
  316. package/dist/schemas/waiver-templates.js +0 -7
  317. package/dist/schemas/waiver-templates.js.map +1 -1
  318. package/dist/sports/basketball-scoring.d.ts +0 -4
  319. package/dist/sports/basketball-scoring.d.ts.map +1 -1
  320. package/dist/sports/basketball-scoring.js +0 -34
  321. package/dist/sports/basketball-scoring.js.map +1 -1
  322. package/dist/sports/basketball.d.ts.map +1 -1
  323. package/dist/sports/basketball.js +0 -5
  324. package/dist/sports/basketball.js.map +1 -1
  325. package/dist/sports/bulk-entry.d.ts +0 -22
  326. package/dist/sports/bulk-entry.d.ts.map +1 -1
  327. package/dist/sports/bulk-entry.js +0 -10
  328. package/dist/sports/bulk-entry.js.map +1 -1
  329. package/dist/sports/column-catalog.d.ts +0 -17
  330. package/dist/sports/column-catalog.d.ts.map +1 -1
  331. package/dist/sports/column-catalog.js +0 -10
  332. package/dist/sports/column-catalog.js.map +1 -1
  333. package/dist/sports/contribution.d.ts +2 -59
  334. package/dist/sports/contribution.d.ts.map +1 -1
  335. package/dist/sports/contribution.js +2 -45
  336. package/dist/sports/contribution.js.map +1 -1
  337. package/dist/sports/curling-scoring.d.ts +0 -1
  338. package/dist/sports/curling-scoring.d.ts.map +1 -1
  339. package/dist/sports/curling-scoring.js +0 -27
  340. package/dist/sports/curling-scoring.js.map +1 -1
  341. package/dist/sports/curling.d.ts.map +1 -1
  342. package/dist/sports/curling.js +0 -4
  343. package/dist/sports/curling.js.map +1 -1
  344. package/dist/sports/finalized-record.d.ts +2 -19
  345. package/dist/sports/finalized-record.d.ts.map +1 -1
  346. package/dist/sports/finalized-record.js +21 -22
  347. package/dist/sports/finalized-record.js.map +1 -1
  348. package/dist/sports/football-scoring.d.ts.map +1 -1
  349. package/dist/sports/football-scoring.js +0 -21
  350. package/dist/sports/football-scoring.js.map +1 -1
  351. package/dist/sports/football.d.ts.map +1 -1
  352. package/dist/sports/football.js +0 -4
  353. package/dist/sports/football.js.map +1 -1
  354. package/dist/sports/index.d.ts.map +1 -1
  355. package/dist/sports/index.js +0 -2
  356. package/dist/sports/index.js.map +1 -1
  357. package/dist/sports/ledger-continuity.d.ts +0 -2
  358. package/dist/sports/ledger-continuity.d.ts.map +1 -1
  359. package/dist/sports/ledger-continuity.js +0 -5
  360. package/dist/sports/ledger-continuity.js.map +1 -1
  361. package/dist/sports/lifetime-summary.d.ts +0 -6
  362. package/dist/sports/lifetime-summary.d.ts.map +1 -1
  363. package/dist/sports/lifetime-summary.js +0 -7
  364. package/dist/sports/lifetime-summary.js.map +1 -1
  365. package/dist/sports/rankings.d.ts +0 -12
  366. package/dist/sports/rankings.d.ts.map +1 -1
  367. package/dist/sports/rankings.js +0 -15
  368. package/dist/sports/rankings.js.map +1 -1
  369. package/dist/sports/registry.d.ts +0 -10
  370. package/dist/sports/registry.d.ts.map +1 -1
  371. package/dist/sports/registry.js +0 -9
  372. package/dist/sports/registry.js.map +1 -1
  373. package/dist/sports/replay.d.ts +0 -11
  374. package/dist/sports/replay.d.ts.map +1 -1
  375. package/dist/sports/replay.js +0 -16
  376. package/dist/sports/replay.js.map +1 -1
  377. package/dist/sports/rollup-check.d.ts +0 -7
  378. package/dist/sports/rollup-check.d.ts.map +1 -1
  379. package/dist/sports/rollup-check.js +0 -14
  380. package/dist/sports/rollup-check.js.map +1 -1
  381. package/dist/sports/score-mirror.d.ts +0 -1
  382. package/dist/sports/score-mirror.d.ts.map +1 -1
  383. package/dist/sports/score-mirror.js +0 -4
  384. package/dist/sports/score-mirror.js.map +1 -1
  385. package/dist/sports/scoring-display.d.ts +0 -30
  386. package/dist/sports/scoring-display.d.ts.map +1 -1
  387. package/dist/sports/scoring-display.js +0 -9
  388. package/dist/sports/scoring-display.js.map +1 -1
  389. package/dist/sports/scoring.d.ts +0 -36
  390. package/dist/sports/scoring.d.ts.map +1 -1
  391. package/dist/sports/scoring.js +0 -10
  392. package/dist/sports/scoring.js.map +1 -1
  393. package/dist/sports/shared-columns.d.ts +0 -1
  394. package/dist/sports/shared-columns.d.ts.map +1 -1
  395. package/dist/sports/shared-columns.js +0 -7
  396. package/dist/sports/shared-columns.js.map +1 -1
  397. package/dist/sports/sport-adapter.d.ts +0 -32
  398. package/dist/sports/sport-adapter.d.ts.map +1 -1
  399. package/dist/sports/sport-adapter.js +0 -7
  400. package/dist/sports/sport-adapter.js.map +1 -1
  401. package/dist/sports/store-driver.d.ts +0 -28
  402. package/dist/sports/store-driver.d.ts.map +1 -1
  403. package/dist/sports/store-driver.js +0 -38
  404. package/dist/sports/store-driver.js.map +1 -1
  405. package/dist/types/audit.d.ts +1 -1
  406. package/dist/types/audit.d.ts.map +1 -1
  407. package/dist/types/audit.js +1 -67
  408. package/dist/types/audit.js.map +1 -1
  409. package/dist/types/claims.d.ts +0 -10
  410. package/dist/types/claims.d.ts.map +1 -1
  411. package/dist/types/claims.js +0 -16
  412. package/dist/types/claims.js.map +1 -1
  413. package/dist/types/notifications.d.ts.map +1 -1
  414. package/dist/types/notifications.js +7 -25
  415. package/dist/types/notifications.js.map +1 -1
  416. package/dist/types/picture-owners.d.ts +0 -1
  417. package/dist/types/picture-owners.d.ts.map +1 -1
  418. package/dist/types/picture-owners.js +0 -6
  419. package/dist/types/picture-owners.js.map +1 -1
  420. package/dist/types/schedules.d.ts.map +1 -1
  421. package/dist/types/schedules.js +0 -9
  422. package/dist/types/schedules.js.map +1 -1
  423. package/dist/types/sports.d.ts.map +1 -1
  424. package/dist/types/sports.js +0 -24
  425. package/dist/types/sports.js.map +1 -1
  426. package/dist/types/stats.d.ts.map +1 -1
  427. package/dist/types/stats.js +0 -65
  428. package/dist/types/stats.js.map +1 -1
  429. package/dist/types/unions.d.ts +0 -2
  430. package/dist/types/unions.d.ts.map +1 -1
  431. package/dist/types/unions.js +3 -91
  432. package/dist/types/unions.js.map +1 -1
  433. package/dist/types/uploads.d.ts.map +1 -1
  434. package/dist/types/uploads.js +0 -7
  435. package/dist/types/uploads.js.map +1 -1
  436. package/dist/upload-variables/on-progress.d.ts.map +1 -1
  437. package/dist/upload-variables/on-progress.js +2 -5
  438. package/dist/upload-variables/on-progress.js.map +1 -1
  439. package/dist/upload-variables/picture-upload-variables.d.ts +0 -1
  440. package/dist/upload-variables/picture-upload-variables.d.ts.map +1 -1
  441. package/dist/upload-variables/picture-upload-variables.js +0 -4
  442. package/dist/upload-variables/picture-upload-variables.js.map +1 -1
  443. package/dist/upload-variables/sign-hardware-contract-variables.d.ts.map +1 -1
  444. package/dist/upload-variables/sign-hardware-contract-variables.js +0 -2
  445. package/dist/upload-variables/sign-hardware-contract-variables.js.map +1 -1
  446. package/dist/upload-variables/sign-waiver-variables.d.ts.map +1 -1
  447. package/dist/upload-variables/sign-waiver-variables.js +0 -4
  448. package/dist/upload-variables/sign-waiver-variables.js.map +1 -1
  449. package/dist/utils/account-status.d.ts.map +1 -1
  450. package/dist/utils/account-status.js +0 -4
  451. package/dist/utils/account-status.js.map +1 -1
  452. package/dist/utils/app-config.d.ts +0 -53
  453. package/dist/utils/app-config.d.ts.map +1 -1
  454. package/dist/utils/app-config.js +0 -62
  455. package/dist/utils/app-config.js.map +1 -1
  456. package/dist/utils/display-name.d.ts +0 -7
  457. package/dist/utils/display-name.d.ts.map +1 -1
  458. package/dist/utils/display-name.js +0 -8
  459. package/dist/utils/display-name.js.map +1 -1
  460. package/dist/utils/index.d.ts +1 -0
  461. package/dist/utils/index.d.ts.map +1 -1
  462. package/dist/utils/index.js +1 -0
  463. package/dist/utils/index.js.map +1 -1
  464. package/dist/utils/league-calendar.d.ts +0 -11
  465. package/dist/utils/league-calendar.d.ts.map +1 -1
  466. package/dist/utils/league-calendar.js +7 -19
  467. package/dist/utils/league-calendar.js.map +1 -1
  468. package/dist/utils/league-join-warning.d.ts +0 -11
  469. package/dist/utils/league-join-warning.d.ts.map +1 -1
  470. package/dist/utils/league-join-warning.js +0 -28
  471. package/dist/utils/league-join-warning.js.map +1 -1
  472. package/dist/utils/league-joining.d.ts +0 -1
  473. package/dist/utils/league-joining.d.ts.map +1 -1
  474. package/dist/utils/league-joining.js +0 -7
  475. package/dist/utils/league-joining.js.map +1 -1
  476. package/dist/utils/league-mode.d.ts +0 -1
  477. package/dist/utils/league-mode.d.ts.map +1 -1
  478. package/dist/utils/league-mode.js +0 -4
  479. package/dist/utils/league-mode.js.map +1 -1
  480. package/dist/utils/schedules.d.ts +0 -15
  481. package/dist/utils/schedules.d.ts.map +1 -1
  482. package/dist/utils/schedules.js +0 -19
  483. package/dist/utils/schedules.js.map +1 -1
  484. package/dist/utils/stats-operation-request.d.ts +20 -0
  485. package/dist/utils/stats-operation-request.d.ts.map +1 -0
  486. package/dist/utils/stats-operation-request.js +10 -0
  487. package/dist/utils/stats-operation-request.js.map +1 -0
  488. package/dist/utils/team-creation.d.ts +0 -2
  489. package/dist/utils/team-creation.d.ts.map +1 -1
  490. package/dist/utils/team-creation.js +0 -6
  491. package/dist/utils/team-creation.js.map +1 -1
  492. package/dist/utils/team-member-actions.d.ts +0 -6
  493. package/dist/utils/team-member-actions.d.ts.map +1 -1
  494. package/dist/utils/team-member-actions.js +0 -12
  495. package/dist/utils/team-member-actions.js.map +1 -1
  496. package/package.json +2 -1
@@ -1,6 +1,3 @@
1
- // Callable contracts for teams and team membership. The acting user is always `request.auth.uid` —
2
- // never an input field (RULE-STD-ARCH-106). The server, never a field of the payload, decides the
3
- // authority (RULE-STD-BACKEND-004); an admin-only action's schema adds only what its authority needs.
4
1
  import { z } from 'zod';
5
2
  import { leagueJoinWarningActedOnSchema, leagueJoinWarningFindingSchema, } from '../utils/league-join-warning.js';
6
3
  import { countSchema, documentIdSegmentSchema, gameIdSchema, leagueIdSchema, membershipRosterSyncStatusSchema, teamIconSchema, teamIdSchema, teamRoleSchema, teamTypeSchema, userIdSchema, } from '../doc-schemas/atoms.js';
@@ -9,11 +6,6 @@ import { isDocumentIdSegment } from '../paths/utils.js';
9
6
  import { GHOST_LINK_MEMBERSHIP_OUTCOME_KEYS, GHOST_REMOVAL_REFUSAL_KEYS } from '../types/stats.js';
10
7
  import { MEMBER_ASSIGNABLE_TEAM_ROLES } from '../types/unions.js';
11
8
  import { contactPhoneSchema, displayNameSchema, teamNameSchema } from './atoms.js';
12
- // ---------------------------------------------------------------------------------------------
13
- // Team creation — `createLeagueTeam` (the creator becomes captain) and `adminCreateLeagueTeam`
14
- // (an admin creates the team with a newly minted ghost captain). Both write the team's contact
15
- // phone; `teamType` is read only in a Competitive/Recreational league, which requires it.
16
- // ---------------------------------------------------------------------------------------------
17
9
  const teamCreationFields = {
18
10
  leagueId: leagueIdSchema,
19
11
  name: teamNameSchema,
@@ -28,14 +20,6 @@ export const AdminCreateLeagueTeamInputSchema = z
28
20
  export const CreateLeagueTeamResultSchema = z
29
21
  .object({ leagueId: leagueIdSchema, teamId: teamIdSchema, captainUserId: userIdSchema })
30
22
  .strict();
31
- // ---------------------------------------------------------------------------------------------
32
- // Ghost add — one core behind two doors. The team page door (`createTeamGhostPlayer`) needs
33
- // authority over the team; the game page door (`createGameGhostPlayer`) needs scoring authority over
34
- // the game and adds to one of its two teams. The ghost id is derived by the server from the add's
35
- // `requestId`, which the client mints once when the add starts and re-sends on every retry, so a
36
- // retry after an unknown outcome is recognised as the same add (`buildGhostUserIdForRequest`).
37
- // ---------------------------------------------------------------------------------------------
38
- // One document-id segment (RULE-STD-ARCH-106), short enough that the ghost id derived from it is one too.
39
23
  export const ghostCreateRequestIdSchema = documentIdSegmentSchema.refine((requestId) => isDocumentIdSegment(buildGhostUserIdForRequest(requestId)), 'Not a ghost add request id.');
40
24
  export const CreateTeamGhostPlayerInputSchema = z
41
25
  .object({
@@ -52,8 +36,6 @@ export const CreateGameGhostPlayerInputSchema = z
52
36
  requestId: ghostCreateRequestIdSchema,
53
37
  })
54
38
  .strict();
55
- // `rosterSyncStatus` is where the new membership's roster work stood when the call returned: the
56
- // membership is committed either way, and `pending` finishes in the background.
57
39
  export const CreateGhostPlayerResultSchema = z
58
40
  .object({
59
41
  leagueId: leagueIdSchema,
@@ -62,12 +44,6 @@ export const CreateGhostPlayerResultSchema = z
62
44
  rosterSyncStatus: membershipRosterSyncStatusSchema,
63
45
  })
64
46
  .strict();
65
- // ---------------------------------------------------------------------------------------------
66
- // The join warning — `getLeagueJoinWarning` (the person, or a captain or co-captain of the target
67
- // team) and `adminGetLeagueJoinWarning` (an admin, about anyone).
68
- // ---------------------------------------------------------------------------------------------
69
- // `targetTeamId` is the team the door acts for; a free-agent signup and a team being created have
70
- // none. `actedOn` is the item the door answers, which the warning leaves out.
71
47
  export const GetLeagueJoinWarningInputSchema = z
72
48
  .object({
73
49
  leagueId: leagueIdSchema,
@@ -83,33 +59,17 @@ export const GetLeagueJoinWarningResultSchema = z
83
59
  findings: z.array(leagueJoinWarningFindingSchema),
84
60
  })
85
61
  .strict();
86
- // ---------------------------------------------------------------------------------------------
87
- // Roster reconciliation recovery — an admin puts a team's failed roster obligations back to work.
88
- // ---------------------------------------------------------------------------------------------
89
62
  export const AdminRetryLeagueTeamRosterSyncInputSchema = z
90
63
  .object({ teamId: teamIdSchema })
91
64
  .strict();
92
65
  export const AdminRetryLeagueTeamRosterSyncResultSchema = z
93
66
  .object({
94
67
  teamId: teamIdSchema,
95
- // Failed obligations put back to pending.
96
68
  retried: countSchema,
97
- // Of those and any already pending, how many the call itself finished.
98
69
  reconciled: countSchema,
99
- // Failed obligations left as they are because they fail their schema, by document id; a
100
- // damaged document's id is reported as stored, so it is not held to the membership id format.
101
70
  damagedTeamMembershipIds: z.array(z.string().min(1)),
102
71
  })
103
72
  .strict();
104
- // ---------------------------------------------------------------------------------------------
105
- // Linking a ghost to a real account — `linkGhostPlayerToUser` in a league that is not closed, and
106
- // `adminLinkClosedLeagueGhostPlayer` in a closed one. Both are admin-only and act on one team. A link
107
- // takes no reason: the admin chooses the account and confirms, and the link's audit event records
108
- // who linked which ghost to whom and what moved (RULE-STD-BACKEND-212). The ghost and the account are
109
- // ids the core checks itself, so a ghost id named as the account, or a real id named as the ghost,
110
- // is refused with a failure record rather than at the parse. Every name the link records is read
111
- // server-side, never sent.
112
- // ---------------------------------------------------------------------------------------------
113
73
  export const LinkGhostPlayerInputSchema = z
114
74
  .object({
115
75
  teamId: teamIdSchema,
@@ -117,9 +77,6 @@ export const LinkGhostPlayerInputSchema = z
117
77
  userId: userIdSchema,
118
78
  })
119
79
  .strict();
120
- // `complete` is false when the call ran out of time part-way: the link stays under way, and the same
121
- // call by the same account continues it. `membershipOutcome` is present once it is complete.
122
- // `publicUserDeleted` is false when something else still names the ghost.
123
80
  export const LinkGhostPlayerResultSchema = z
124
81
  .object({
125
82
  leagueId: leagueIdSchema,
@@ -134,16 +91,7 @@ export const LinkGhostPlayerResultSchema = z
134
91
  .strict();
135
92
  export const AdminLinkClosedLeagueGhostPlayerInputSchema = LinkGhostPlayerInputSchema;
136
93
  export const AdminLinkClosedLeagueGhostPlayerResultSchema = LinkGhostPlayerResultSchema;
137
- // ---------------------------------------------------------------------------------------------
138
- // Managing a team's members. A role change and a removal are each one callable for the team's
139
- // captain or a co-captain, read from their membership, and for an admin; changing the captain,
140
- // renaming the team, changing its type, setting its contact phone, and deleting it are admin-only.
141
- // Every target is named by id and read server-side; nothing here names who is acting (RULE-STD-ARCH-106).
142
- // ---------------------------------------------------------------------------------------------
143
- /** A ghost id, refused for any other id, so a removal input cannot name a real account. */
144
94
  export const ghostUserIdSchema = userIdSchema.refine(isGhostUserId, 'Not a ghost player.');
145
- // `updateTeamMembershipRole` (the captain or an admin): promote a player to co-captain, or demote a
146
- // co-captain to player.
147
95
  export const UpdateTeamMembershipRoleInputSchema = z
148
96
  .object({
149
97
  teamId: teamIdSchema,
@@ -151,7 +99,6 @@ export const UpdateTeamMembershipRoleInputSchema = z
151
99
  role: z.enum(MEMBER_ASSIGNABLE_TEAM_ROLES),
152
100
  })
153
101
  .strict();
154
- // `changed` is false when the member already held the role: nothing was written or recorded.
155
102
  export const UpdateTeamMembershipRoleResultSchema = z
156
103
  .object({
157
104
  leagueId: leagueIdSchema,
@@ -161,16 +108,12 @@ export const UpdateTeamMembershipRoleResultSchema = z
161
108
  changed: z.boolean(),
162
109
  })
163
110
  .strict();
164
- // `deleteTeamMembership` (the captain, a co-captain, or an admin): remove a real player from the
165
- // team. A ghost is removed through its own action, below.
166
111
  export const DeleteTeamMembershipInputSchema = z
167
112
  .object({
168
113
  teamId: teamIdSchema,
169
114
  userId: userIdSchema.refine((userId) => !isGhostUserId(userId), 'A ghost player is removed as a ghost player.'),
170
115
  })
171
116
  .strict();
172
- // `deleted` is false when the person held no membership on the team: nothing was written. The
173
- // membership is gone either way; `rosterSyncStatus` is where its roster work stood on return.
174
117
  export const DeleteTeamMembershipResultSchema = z
175
118
  .object({
176
119
  leagueId: leagueIdSchema,
@@ -180,16 +123,9 @@ export const DeleteTeamMembershipResultSchema = z
180
123
  rosterSyncStatus: membershipRosterSyncStatusSchema,
181
124
  })
182
125
  .strict();
183
- // `deleteTeamGhostPlayer` (the captain, a co-captain, or an admin): remove a ghost that has never
184
- // played, completely. A never-played ghost holds no stat, so its removal is not a
185
- // repair and takes no reason; its audit event still records who removed what (RULE-STD-BACKEND-212).
186
126
  export const DeleteTeamGhostPlayerInputSchema = z
187
127
  .object({ teamId: teamIdSchema, ghostUserId: ghostUserIdSchema })
188
128
  .strict();
189
- // `complete` is false when the call ran out of time part-way: the ghost's games stay held and the
190
- // same call finishes the removal. `finishedGameEntriesRemoved` is the whole removal's count so far,
191
- // never one call's share, so a later response replaces an earlier one. `publicUserDeleted` is false
192
- // when something else still names the ghost, so its name stays until that reference goes.
193
129
  export const DeleteTeamGhostPlayerResultSchema = z
194
130
  .object({
195
131
  leagueId: leagueIdSchema,
@@ -200,17 +136,12 @@ export const DeleteTeamGhostPlayerResultSchema = z
200
136
  publicUserDeleted: z.boolean(),
201
137
  })
202
138
  .strict();
203
- // The details of a ghost removal's designed refusal: its reason, and — for a refusal that stops a
204
- // removal already under way — `finishedGameEntriesRemoved`, the removal's count so far, as the result
205
- // counts it. Those entries stay removed.
206
139
  export const GhostRemovalRefusalDetailsSchema = z
207
140
  .object({
208
141
  reason: z.enum(GHOST_REMOVAL_REFUSAL_KEYS),
209
142
  finishedGameEntriesRemoved: countSchema.optional(),
210
143
  })
211
144
  .strict();
212
- // `adminUpdateLeagueTeamCaptain`: make a member of the team its captain. Every other captain the team
213
- // holds becomes a player.
214
145
  export const AdminUpdateLeagueTeamCaptainInputSchema = z
215
146
  .object({ teamId: teamIdSchema, captainUserId: userIdSchema })
216
147
  .strict();
@@ -223,30 +154,20 @@ export const AdminUpdateLeagueTeamCaptainResultSchema = z
223
154
  changed: z.boolean(),
224
155
  })
225
156
  .strict();
226
- // `adminUpdateLeagueTeamName`: rename a team. The name lives on the team alone; nothing copies it.
227
157
  export const AdminUpdateLeagueTeamNameInputSchema = z
228
158
  .object({ teamId: teamIdSchema, name: teamNameSchema })
229
159
  .strict();
230
- // `adminUpdateLeagueTeamType`: change a team's type in a league that sorts its teams by type.
231
160
  export const AdminUpdateLeagueTeamTypeInputSchema = z
232
161
  .object({ teamId: teamIdSchema, teamType: teamTypeSchema })
233
162
  .strict();
234
- // The answer to either edit: `changed` is false when the team already held the value.
235
163
  export const AdminUpdateLeagueTeamResultSchema = z
236
164
  .object({ leagueId: leagueIdSchema, teamId: teamIdSchema, changed: z.boolean() })
237
165
  .strict();
238
- // `adminUpdateLeagueTeamContact`: set the team's contact phone on its admin-only contact document.
239
166
  export const AdminUpdateLeagueTeamContactInputSchema = z
240
167
  .object({ teamId: teamIdSchema, contactPhone: contactPhoneSchema })
241
168
  .strict();
242
169
  export const AdminUpdateLeagueTeamContactResultSchema = AdminUpdateLeagueTeamResultSchema;
243
- // `adminDeleteLeagueTeam`: delete a team that has never played, with everything that is only its.
244
- // A never-played team holds no stat, so its deletion is not a repair and takes no reason; its audit
245
- // event still records who deleted what (RULE-STD-BACKEND-212).
246
170
  export const AdminDeleteLeagueTeamInputSchema = z.object({ teamId: teamIdSchema }).strict();
247
- // `complete` is false when the call ran out of time part-way: what is left stays, the team still
248
- // stands, and the same call finishes the deletion. `remainingGameCount` is the team's games still to
249
- // delete when it stopped.
250
171
  export const AdminDeleteLeagueTeamResultSchema = z
251
172
  .object({
252
173
  teamId: teamIdSchema,
@@ -254,10 +175,6 @@ export const AdminDeleteLeagueTeamResultSchema = z
254
175
  remainingGameCount: countSchema,
255
176
  })
256
177
  .strict();
257
- // Why a team's deletion was refused, in the refusal's details: the team has played — a completed
258
- // game, or a stat in one of its games — whether that is found before anything is deleted or only as a
259
- // later game is reached. `deletedGameCount` is the unplayed games this request had already deleted
260
- // when it found the play, 0 when it found it first; those games stay deleted.
261
178
  export const LEAGUE_TEAM_DELETE_REFUSAL_KEYS = ['teamHasPlayed'];
262
179
  export const LeagueTeamDeleteRefusalDetailsSchema = z
263
180
  .object({ reason: z.enum(LEAGUE_TEAM_DELETE_REFUSAL_KEYS), deletedGameCount: countSchema })
@@ -1 +1 @@
1
- {"version":3,"file":"teams.js","sourceRoot":"","sources":["../../src/schemas/teams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AAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAG5F,iGAAiG;AACjG,qGAAqG;AACrG,0BAA0B;AAC1B,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC;KAC/C,MAAM,CAAC;IACN,MAAM,EAAE,YAAY;IACpB,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;IACrB,kBAAkB,EAAE,WAAW;CAChC,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,iGAAiG;AACjG,sGAAsG;AACtG,mGAAmG;AACnG,8EAA8E;AAC9E,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,eAAe,CAAU,CAAC;AAE1E,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC;KAClD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,+BAA+B,CAAC,EAAE,gBAAgB,EAAE,WAAW,EAAE,CAAC;KAC1F,MAAM,EAAE,CAAC","sourcesContent":["// Callable contracts for teams and team membership. The acting user is always `request.auth.uid` —\n// never an input field (RULE-STD-ARCH-106). The server, never a field of the payload, decides the\n// authority (RULE-STD-BACKEND-004); an admin-only action's schema adds only what its authority needs.\n\nimport { z } from 'zod';\nimport {\n leagueJoinWarningActedOnSchema,\n leagueJoinWarningFindingSchema,\n} from '../utils/league-join-warning.js';\nimport {\n countSchema,\n documentIdSegmentSchema,\n gameIdSchema,\n leagueIdSchema,\n membershipRosterSyncStatusSchema,\n teamIconSchema,\n teamIdSchema,\n teamRoleSchema,\n teamTypeSchema,\n userIdSchema,\n} from '../doc-schemas/atoms.js';\nimport { buildGhostUserIdForRequest, isGhostUserId } from '../ids/minted-ids.js';\nimport { isDocumentIdSegment } from '../paths/utils.js';\nimport { GHOST_LINK_MEMBERSHIP_OUTCOME_KEYS, GHOST_REMOVAL_REFUSAL_KEYS } from '../types/stats.js';\nimport { MEMBER_ASSIGNABLE_TEAM_ROLES } from '../types/unions.js';\nimport { contactPhoneSchema, displayNameSchema, teamNameSchema } from './atoms.js';\n\n// ---------------------------------------------------------------------------------------------\n// Team creation — `createLeagueTeam` (the creator becomes captain) and `adminCreateLeagueTeam`\n// (an admin creates the team with a newly minted ghost captain). Both write the team's contact\n// phone; `teamType` is read only in a Competitive/Recreational league, which requires it.\n// ---------------------------------------------------------------------------------------------\n\nconst teamCreationFields = {\n leagueId: leagueIdSchema,\n name: teamNameSchema,\n icon: teamIconSchema,\n teamType: teamTypeSchema.optional(),\n contactPhone: contactPhoneSchema,\n};\n\nexport const CreateLeagueTeamInputSchema = z.object(teamCreationFields).strict();\nexport type CreateLeagueTeamInput = z.infer<typeof CreateLeagueTeamInputSchema>;\n\nexport const AdminCreateLeagueTeamInputSchema = z\n .object({ ...teamCreationFields, captainDisplayName: displayNameSchema })\n .strict();\nexport type AdminCreateLeagueTeamInput = z.infer<typeof AdminCreateLeagueTeamInputSchema>;\n\nexport const CreateLeagueTeamResultSchema = z\n .object({ leagueId: leagueIdSchema, teamId: teamIdSchema, captainUserId: userIdSchema })\n .strict();\nexport type CreateLeagueTeamResult = z.infer<typeof CreateLeagueTeamResultSchema>;\n\n// ---------------------------------------------------------------------------------------------\n// Ghost add — one core behind two doors. The team page door (`createTeamGhostPlayer`) needs\n// authority over the team; the game page door (`createGameGhostPlayer`) needs scoring authority over\n// the game and adds to one of its two teams. The ghost id is derived by the server from the add's\n// `requestId`, which the client mints once when the add starts and re-sends on every retry, so a\n// retry after an unknown outcome is recognised as the same add (`buildGhostUserIdForRequest`).\n// ---------------------------------------------------------------------------------------------\n\n// One document-id segment (RULE-STD-ARCH-106), short enough that the ghost id derived from it is one too.\nexport const ghostCreateRequestIdSchema = documentIdSegmentSchema.refine(\n (requestId) => isDocumentIdSegment(buildGhostUserIdForRequest(requestId)),\n 'Not a ghost add request id.',\n);\n\nexport const CreateTeamGhostPlayerInputSchema = z\n .object({\n teamId: teamIdSchema,\n displayName: displayNameSchema,\n requestId: ghostCreateRequestIdSchema,\n })\n .strict();\nexport type CreateTeamGhostPlayerInput = z.infer<typeof CreateTeamGhostPlayerInputSchema>;\n\nexport const CreateGameGhostPlayerInputSchema = z\n .object({\n gameId: gameIdSchema,\n teamId: teamIdSchema,\n displayName: displayNameSchema,\n requestId: ghostCreateRequestIdSchema,\n })\n .strict();\nexport type CreateGameGhostPlayerInput = z.infer<typeof CreateGameGhostPlayerInputSchema>;\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 CreateGhostPlayerResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n ghostUserId: userIdSchema,\n rosterSyncStatus: membershipRosterSyncStatusSchema,\n })\n .strict();\nexport type CreateGhostPlayerResult = z.infer<typeof CreateGhostPlayerResultSchema>;\n\n// ---------------------------------------------------------------------------------------------\n// The join warning — `getLeagueJoinWarning` (the person, or a captain or co-captain of the target\n// team) and `adminGetLeagueJoinWarning` (an admin, about anyone).\n// ---------------------------------------------------------------------------------------------\n\n// `targetTeamId` is the team the door acts for; a free-agent signup and a team being created have\n// none. `actedOn` is the item the door answers, which the warning leaves out.\nexport const GetLeagueJoinWarningInputSchema = z\n .object({\n leagueId: leagueIdSchema,\n userId: userIdSchema,\n targetTeamId: teamIdSchema.optional(),\n actedOn: leagueJoinWarningActedOnSchema.optional(),\n })\n .strict();\nexport type GetLeagueJoinWarningInput = z.infer<typeof GetLeagueJoinWarningInputSchema>;\n\nexport const GetLeagueJoinWarningResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n userId: userIdSchema,\n findings: z.array(leagueJoinWarningFindingSchema),\n })\n .strict();\nexport type GetLeagueJoinWarningResult = z.infer<typeof GetLeagueJoinWarningResultSchema>;\n\n// ---------------------------------------------------------------------------------------------\n// Roster reconciliation recovery — an admin puts a team's failed roster obligations back to work.\n// ---------------------------------------------------------------------------------------------\n\nexport const AdminRetryLeagueTeamRosterSyncInputSchema = z\n .object({ teamId: teamIdSchema })\n .strict();\nexport type AdminRetryLeagueTeamRosterSyncInput = z.infer<\n typeof AdminRetryLeagueTeamRosterSyncInputSchema\n>;\n\nexport const AdminRetryLeagueTeamRosterSyncResultSchema = z\n .object({\n teamId: teamIdSchema,\n // Failed obligations put back to pending.\n retried: countSchema,\n // Of those and any already pending, how many the call itself finished.\n reconciled: countSchema,\n // Failed obligations left as they are because they fail their schema, by document id; a\n // damaged document's id is reported as stored, so it is not held to the membership id format.\n damagedTeamMembershipIds: z.array(z.string().min(1)),\n })\n .strict();\nexport type AdminRetryLeagueTeamRosterSyncResult = z.infer<\n typeof AdminRetryLeagueTeamRosterSyncResultSchema\n>;\n\n// ---------------------------------------------------------------------------------------------\n// Linking a ghost to a real account — `linkGhostPlayerToUser` in a league that is not closed, and\n// `adminLinkClosedLeagueGhostPlayer` in a closed one. Both are admin-only and act on one team. A link\n// takes no reason: the admin chooses the account and confirms, and the link's audit event records\n// who linked which ghost to whom and what moved (RULE-STD-BACKEND-212). The ghost and the account are\n// ids the core checks itself, so a ghost id named as the account, or a real id named as the ghost,\n// is refused with a failure record rather than at the parse. Every name the link records is read\n// server-side, never sent.\n// ---------------------------------------------------------------------------------------------\n\nexport const LinkGhostPlayerInputSchema = z\n .object({\n teamId: teamIdSchema,\n ghostUserId: userIdSchema,\n userId: userIdSchema,\n })\n .strict();\nexport type LinkGhostPlayerInput = z.infer<typeof LinkGhostPlayerInputSchema>;\n\n// `complete` is false when the call ran out of time part-way: the link stays under way, and the same\n// call by the same account continues it. `membershipOutcome` is present once it is complete.\n// `publicUserDeleted` is false when something else still names the ghost.\nexport const LinkGhostPlayerResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n ghostUserId: userIdSchema,\n userId: userIdSchema,\n complete: z.boolean(),\n gamesMoved: countSchema,\n membershipOutcome: z.enum(GHOST_LINK_MEMBERSHIP_OUTCOME_KEYS).optional(),\n publicUserDeleted: z.boolean(),\n })\n .strict();\nexport type LinkGhostPlayerResult = z.infer<typeof LinkGhostPlayerResultSchema>;\n\nexport const AdminLinkClosedLeagueGhostPlayerInputSchema = LinkGhostPlayerInputSchema;\nexport type AdminLinkClosedLeagueGhostPlayerInput = LinkGhostPlayerInput;\nexport const AdminLinkClosedLeagueGhostPlayerResultSchema = LinkGhostPlayerResultSchema;\nexport type AdminLinkClosedLeagueGhostPlayerResult = LinkGhostPlayerResult;\n\n// ---------------------------------------------------------------------------------------------\n// Managing a team's members. A role change and a removal are each one callable for the team's\n// captain or a co-captain, read from their membership, and for an admin; changing the captain,\n// renaming the team, changing its type, setting its contact phone, and deleting it are admin-only.\n// Every target is named by id and read server-side; nothing here names who is acting (RULE-STD-ARCH-106).\n// ---------------------------------------------------------------------------------------------\n\n/** A ghost id, refused for any other id, so a removal input cannot name a real account. */\nexport const ghostUserIdSchema = userIdSchema.refine(isGhostUserId, 'Not a ghost player.');\n\n// `updateTeamMembershipRole` (the captain or an admin): promote a player to co-captain, or demote a\n// co-captain to player.\nexport const UpdateTeamMembershipRoleInputSchema = z\n .object({\n teamId: teamIdSchema,\n userId: userIdSchema,\n role: z.enum(MEMBER_ASSIGNABLE_TEAM_ROLES),\n })\n .strict();\nexport type UpdateTeamMembershipRoleInput = z.infer<typeof UpdateTeamMembershipRoleInputSchema>;\n\n// `changed` is false when the member already held the role: nothing was written or recorded.\nexport const UpdateTeamMembershipRoleResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n userId: userIdSchema,\n role: teamRoleSchema,\n changed: z.boolean(),\n })\n .strict();\nexport type UpdateTeamMembershipRoleResult = z.infer<typeof UpdateTeamMembershipRoleResultSchema>;\n\n// `deleteTeamMembership` (the captain, a co-captain, or an admin): remove a real player from the\n// team. A ghost is removed through its own action, below.\nexport const DeleteTeamMembershipInputSchema = z\n .object({\n teamId: teamIdSchema,\n userId: userIdSchema.refine(\n (userId) => !isGhostUserId(userId),\n 'A ghost player is removed as a ghost player.',\n ),\n })\n .strict();\nexport type DeleteTeamMembershipInput = z.infer<typeof DeleteTeamMembershipInputSchema>;\n\n// `deleted` is false when the person held no membership on the team: nothing was written. The\n// membership is gone either way; `rosterSyncStatus` is where its roster work stood on return.\nexport const DeleteTeamMembershipResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n userId: userIdSchema,\n deleted: z.boolean(),\n rosterSyncStatus: membershipRosterSyncStatusSchema,\n })\n .strict();\nexport type DeleteTeamMembershipResult = z.infer<typeof DeleteTeamMembershipResultSchema>;\n\n// `deleteTeamGhostPlayer` (the captain, a co-captain, or an admin): remove a ghost that has never\n// played, completely. A never-played ghost holds no stat, so its removal is not a\n// repair and takes no reason; its audit event still records who removed what (RULE-STD-BACKEND-212).\nexport const DeleteTeamGhostPlayerInputSchema = z\n .object({ teamId: teamIdSchema, ghostUserId: ghostUserIdSchema })\n .strict();\nexport type DeleteTeamGhostPlayerInput = z.infer<typeof DeleteTeamGhostPlayerInputSchema>;\n\n// `complete` is false when the call ran out of time part-way: the ghost's games stay held and the\n// same call finishes the removal. `finishedGameEntriesRemoved` is the whole removal's count so far,\n// never one call's share, so a later response replaces an earlier one. `publicUserDeleted` is false\n// when something else still names the ghost, so its name stays until that reference goes.\nexport const DeleteTeamGhostPlayerResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n ghostUserId: userIdSchema,\n complete: z.boolean(),\n finishedGameEntriesRemoved: countSchema,\n publicUserDeleted: z.boolean(),\n })\n .strict();\nexport type DeleteTeamGhostPlayerResult = z.infer<typeof DeleteTeamGhostPlayerResultSchema>;\n\n// The details of a ghost removal's designed refusal: its reason, and — for a refusal that stops a\n// removal already under way — `finishedGameEntriesRemoved`, the removal's count so far, as the result\n// counts it. Those entries stay removed.\nexport const GhostRemovalRefusalDetailsSchema = z\n .object({\n reason: z.enum(GHOST_REMOVAL_REFUSAL_KEYS),\n finishedGameEntriesRemoved: countSchema.optional(),\n })\n .strict();\nexport type GhostRemovalRefusalDetails = z.infer<typeof GhostRemovalRefusalDetailsSchema>;\n\n// `adminUpdateLeagueTeamCaptain`: make a member of the team its captain. Every other captain the team\n// holds becomes a player.\nexport const AdminUpdateLeagueTeamCaptainInputSchema = z\n .object({ teamId: teamIdSchema, captainUserId: userIdSchema })\n .strict();\nexport type AdminUpdateLeagueTeamCaptainInput = z.infer<\n typeof AdminUpdateLeagueTeamCaptainInputSchema\n>;\n\nexport const AdminUpdateLeagueTeamCaptainResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n captainUserId: userIdSchema,\n demotedUserIds: z.array(userIdSchema),\n changed: z.boolean(),\n })\n .strict();\nexport type AdminUpdateLeagueTeamCaptainResult = z.infer<\n typeof AdminUpdateLeagueTeamCaptainResultSchema\n>;\n\n// `adminUpdateLeagueTeamName`: rename a team. The name lives on the team alone; nothing copies it.\nexport const AdminUpdateLeagueTeamNameInputSchema = z\n .object({ teamId: teamIdSchema, name: teamNameSchema })\n .strict();\nexport type AdminUpdateLeagueTeamNameInput = z.infer<typeof AdminUpdateLeagueTeamNameInputSchema>;\n\n// `adminUpdateLeagueTeamType`: change a team's type in a league that sorts its teams by type.\nexport const AdminUpdateLeagueTeamTypeInputSchema = z\n .object({ teamId: teamIdSchema, teamType: teamTypeSchema })\n .strict();\nexport type AdminUpdateLeagueTeamTypeInput = z.infer<typeof AdminUpdateLeagueTeamTypeInputSchema>;\n\n// The answer to either edit: `changed` is false when the team already held the value.\nexport const AdminUpdateLeagueTeamResultSchema = z\n .object({ leagueId: leagueIdSchema, teamId: teamIdSchema, changed: z.boolean() })\n .strict();\nexport type AdminUpdateLeagueTeamResult = z.infer<typeof AdminUpdateLeagueTeamResultSchema>;\n\n// `adminUpdateLeagueTeamContact`: set the team's contact phone on its admin-only contact document.\nexport const AdminUpdateLeagueTeamContactInputSchema = z\n .object({ teamId: teamIdSchema, contactPhone: contactPhoneSchema })\n .strict();\nexport type AdminUpdateLeagueTeamContactInput = z.infer<\n typeof AdminUpdateLeagueTeamContactInputSchema\n>;\n\nexport const AdminUpdateLeagueTeamContactResultSchema = AdminUpdateLeagueTeamResultSchema;\nexport type AdminUpdateLeagueTeamContactResult = AdminUpdateLeagueTeamResult;\n\n// `adminDeleteLeagueTeam`: delete a team that has never played, with everything that is only its.\n// A never-played team holds no stat, so its deletion is not a repair and takes no reason; its audit\n// event still records who deleted what (RULE-STD-BACKEND-212).\nexport const AdminDeleteLeagueTeamInputSchema = z.object({ teamId: teamIdSchema }).strict();\nexport type AdminDeleteLeagueTeamInput = z.infer<typeof AdminDeleteLeagueTeamInputSchema>;\n\n// `complete` is false when the call ran out of time part-way: what is left stays, the team still\n// stands, and the same call finishes the deletion. `remainingGameCount` is the team's games still to\n// delete when it stopped.\nexport const AdminDeleteLeagueTeamResultSchema = z\n .object({\n teamId: teamIdSchema,\n complete: z.boolean(),\n remainingGameCount: countSchema,\n })\n .strict();\nexport type AdminDeleteLeagueTeamResult = z.infer<typeof AdminDeleteLeagueTeamResultSchema>;\n\n// Why a team's deletion was refused, in the refusal's details: the team has played — a completed\n// game, or a stat in one of its games — whether that is found before anything is deleted or only as a\n// later game is reached. `deletedGameCount` is the unplayed games this request had already deleted\n// when it found the play, 0 when it found it first; those games stay deleted.\nexport const LEAGUE_TEAM_DELETE_REFUSAL_KEYS = ['teamHasPlayed'] as const;\nexport type LeagueTeamDeleteRefusal = (typeof LEAGUE_TEAM_DELETE_REFUSAL_KEYS)[number];\nexport const LeagueTeamDeleteRefusalDetailsSchema = z\n .object({ reason: z.enum(LEAGUE_TEAM_DELETE_REFUSAL_KEYS), deletedGameCount: countSchema })\n .strict();\nexport type LeagueTeamDeleteRefusalDetails = z.infer<typeof LeagueTeamDeleteRefusalDetailsSchema>;\n"]}
1
+ {"version":3,"file":"teams.js","sourceRoot":"","sources":["../../src/schemas/teams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,8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AC;AAG1F,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAG5F,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC;KAC/C,MAAM,CAAC;IACN,MAAM,EAAE,YAAY;IACpB,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;IACrB,kBAAkB,EAAE,WAAW;CAChC,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,eAAe,CAAU,CAAC;AAE1E,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC;KAClD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,+BAA+B,CAAC,EAAE,gBAAgB,EAAE,WAAW,EAAE,CAAC;KAC1F,MAAM,EAAE,CAAC","sourcesContent":["import { z } from 'zod';\nimport {\n leagueJoinWarningActedOnSchema,\n leagueJoinWarningFindingSchema,\n} from '../utils/league-join-warning.js';\nimport {\n countSchema,\n documentIdSegmentSchema,\n gameIdSchema,\n leagueIdSchema,\n membershipRosterSyncStatusSchema,\n teamIconSchema,\n teamIdSchema,\n teamRoleSchema,\n teamTypeSchema,\n userIdSchema,\n} from '../doc-schemas/atoms.js';\nimport { buildGhostUserIdForRequest, isGhostUserId } from '../ids/minted-ids.js';\nimport { isDocumentIdSegment } from '../paths/utils.js';\nimport { GHOST_LINK_MEMBERSHIP_OUTCOME_KEYS, GHOST_REMOVAL_REFUSAL_KEYS } from '../types/stats.js';\nimport { MEMBER_ASSIGNABLE_TEAM_ROLES } from '../types/unions.js';\nimport { contactPhoneSchema, displayNameSchema, teamNameSchema } from './atoms.js';\n\nconst teamCreationFields = {\n leagueId: leagueIdSchema,\n name: teamNameSchema,\n icon: teamIconSchema,\n teamType: teamTypeSchema.optional(),\n contactPhone: contactPhoneSchema,\n};\n\nexport const CreateLeagueTeamInputSchema = z.object(teamCreationFields).strict();\nexport type CreateLeagueTeamInput = z.infer<typeof CreateLeagueTeamInputSchema>;\n\nexport const AdminCreateLeagueTeamInputSchema = z\n .object({ ...teamCreationFields, captainDisplayName: displayNameSchema })\n .strict();\nexport type AdminCreateLeagueTeamInput = z.infer<typeof AdminCreateLeagueTeamInputSchema>;\n\nexport const CreateLeagueTeamResultSchema = z\n .object({ leagueId: leagueIdSchema, teamId: teamIdSchema, captainUserId: userIdSchema })\n .strict();\nexport type CreateLeagueTeamResult = z.infer<typeof CreateLeagueTeamResultSchema>;\n\nexport const ghostCreateRequestIdSchema = documentIdSegmentSchema.refine(\n (requestId) => isDocumentIdSegment(buildGhostUserIdForRequest(requestId)),\n 'Not a ghost add request id.',\n);\n\nexport const CreateTeamGhostPlayerInputSchema = z\n .object({\n teamId: teamIdSchema,\n displayName: displayNameSchema,\n requestId: ghostCreateRequestIdSchema,\n })\n .strict();\nexport type CreateTeamGhostPlayerInput = z.infer<typeof CreateTeamGhostPlayerInputSchema>;\n\nexport const CreateGameGhostPlayerInputSchema = z\n .object({\n gameId: gameIdSchema,\n teamId: teamIdSchema,\n displayName: displayNameSchema,\n requestId: ghostCreateRequestIdSchema,\n })\n .strict();\nexport type CreateGameGhostPlayerInput = z.infer<typeof CreateGameGhostPlayerInputSchema>;\n\nexport const CreateGhostPlayerResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n ghostUserId: userIdSchema,\n rosterSyncStatus: membershipRosterSyncStatusSchema,\n })\n .strict();\nexport type CreateGhostPlayerResult = z.infer<typeof CreateGhostPlayerResultSchema>;\n\nexport const GetLeagueJoinWarningInputSchema = z\n .object({\n leagueId: leagueIdSchema,\n userId: userIdSchema,\n targetTeamId: teamIdSchema.optional(),\n actedOn: leagueJoinWarningActedOnSchema.optional(),\n })\n .strict();\nexport type GetLeagueJoinWarningInput = z.infer<typeof GetLeagueJoinWarningInputSchema>;\n\nexport const GetLeagueJoinWarningResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n userId: userIdSchema,\n findings: z.array(leagueJoinWarningFindingSchema),\n })\n .strict();\nexport type GetLeagueJoinWarningResult = z.infer<typeof GetLeagueJoinWarningResultSchema>;\n\nexport const AdminRetryLeagueTeamRosterSyncInputSchema = z\n .object({ teamId: teamIdSchema })\n .strict();\nexport type AdminRetryLeagueTeamRosterSyncInput = z.infer<\n typeof AdminRetryLeagueTeamRosterSyncInputSchema\n>;\n\nexport const AdminRetryLeagueTeamRosterSyncResultSchema = z\n .object({\n teamId: teamIdSchema,\n retried: countSchema,\n reconciled: countSchema,\n damagedTeamMembershipIds: z.array(z.string().min(1)),\n })\n .strict();\nexport type AdminRetryLeagueTeamRosterSyncResult = z.infer<\n typeof AdminRetryLeagueTeamRosterSyncResultSchema\n>;\n\nexport const LinkGhostPlayerInputSchema = z\n .object({\n teamId: teamIdSchema,\n ghostUserId: userIdSchema,\n userId: userIdSchema,\n })\n .strict();\nexport type LinkGhostPlayerInput = z.infer<typeof LinkGhostPlayerInputSchema>;\n\nexport const LinkGhostPlayerResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n ghostUserId: userIdSchema,\n userId: userIdSchema,\n complete: z.boolean(),\n gamesMoved: countSchema,\n membershipOutcome: z.enum(GHOST_LINK_MEMBERSHIP_OUTCOME_KEYS).optional(),\n publicUserDeleted: z.boolean(),\n })\n .strict();\nexport type LinkGhostPlayerResult = z.infer<typeof LinkGhostPlayerResultSchema>;\n\nexport const AdminLinkClosedLeagueGhostPlayerInputSchema = LinkGhostPlayerInputSchema;\nexport type AdminLinkClosedLeagueGhostPlayerInput = LinkGhostPlayerInput;\nexport const AdminLinkClosedLeagueGhostPlayerResultSchema = LinkGhostPlayerResultSchema;\nexport type AdminLinkClosedLeagueGhostPlayerResult = LinkGhostPlayerResult;\n\nexport const ghostUserIdSchema = userIdSchema.refine(isGhostUserId, 'Not a ghost player.');\n\nexport const UpdateTeamMembershipRoleInputSchema = z\n .object({\n teamId: teamIdSchema,\n userId: userIdSchema,\n role: z.enum(MEMBER_ASSIGNABLE_TEAM_ROLES),\n })\n .strict();\nexport type UpdateTeamMembershipRoleInput = z.infer<typeof UpdateTeamMembershipRoleInputSchema>;\n\nexport const UpdateTeamMembershipRoleResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n userId: userIdSchema,\n role: teamRoleSchema,\n changed: z.boolean(),\n })\n .strict();\nexport type UpdateTeamMembershipRoleResult = z.infer<typeof UpdateTeamMembershipRoleResultSchema>;\n\nexport const DeleteTeamMembershipInputSchema = z\n .object({\n teamId: teamIdSchema,\n userId: userIdSchema.refine(\n (userId) => !isGhostUserId(userId),\n 'A ghost player is removed as a ghost player.',\n ),\n })\n .strict();\nexport type DeleteTeamMembershipInput = z.infer<typeof DeleteTeamMembershipInputSchema>;\n\nexport const DeleteTeamMembershipResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n userId: userIdSchema,\n deleted: z.boolean(),\n rosterSyncStatus: membershipRosterSyncStatusSchema,\n })\n .strict();\nexport type DeleteTeamMembershipResult = z.infer<typeof DeleteTeamMembershipResultSchema>;\n\nexport const DeleteTeamGhostPlayerInputSchema = z\n .object({ teamId: teamIdSchema, ghostUserId: ghostUserIdSchema })\n .strict();\nexport type DeleteTeamGhostPlayerInput = z.infer<typeof DeleteTeamGhostPlayerInputSchema>;\n\nexport const DeleteTeamGhostPlayerResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n ghostUserId: userIdSchema,\n complete: z.boolean(),\n finishedGameEntriesRemoved: countSchema,\n publicUserDeleted: z.boolean(),\n })\n .strict();\nexport type DeleteTeamGhostPlayerResult = z.infer<typeof DeleteTeamGhostPlayerResultSchema>;\n\nexport const GhostRemovalRefusalDetailsSchema = z\n .object({\n reason: z.enum(GHOST_REMOVAL_REFUSAL_KEYS),\n finishedGameEntriesRemoved: countSchema.optional(),\n })\n .strict();\nexport type GhostRemovalRefusalDetails = z.infer<typeof GhostRemovalRefusalDetailsSchema>;\n\nexport const AdminUpdateLeagueTeamCaptainInputSchema = z\n .object({ teamId: teamIdSchema, captainUserId: userIdSchema })\n .strict();\nexport type AdminUpdateLeagueTeamCaptainInput = z.infer<\n typeof AdminUpdateLeagueTeamCaptainInputSchema\n>;\n\nexport const AdminUpdateLeagueTeamCaptainResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n captainUserId: userIdSchema,\n demotedUserIds: z.array(userIdSchema),\n changed: z.boolean(),\n })\n .strict();\nexport type AdminUpdateLeagueTeamCaptainResult = z.infer<\n typeof AdminUpdateLeagueTeamCaptainResultSchema\n>;\n\nexport const AdminUpdateLeagueTeamNameInputSchema = z\n .object({ teamId: teamIdSchema, name: teamNameSchema })\n .strict();\nexport type AdminUpdateLeagueTeamNameInput = z.infer<typeof AdminUpdateLeagueTeamNameInputSchema>;\n\nexport const AdminUpdateLeagueTeamTypeInputSchema = z\n .object({ teamId: teamIdSchema, teamType: teamTypeSchema })\n .strict();\nexport type AdminUpdateLeagueTeamTypeInput = z.infer<typeof AdminUpdateLeagueTeamTypeInputSchema>;\n\nexport const AdminUpdateLeagueTeamResultSchema = z\n .object({ leagueId: leagueIdSchema, teamId: teamIdSchema, changed: z.boolean() })\n .strict();\nexport type AdminUpdateLeagueTeamResult = z.infer<typeof AdminUpdateLeagueTeamResultSchema>;\n\nexport const AdminUpdateLeagueTeamContactInputSchema = z\n .object({ teamId: teamIdSchema, contactPhone: contactPhoneSchema })\n .strict();\nexport type AdminUpdateLeagueTeamContactInput = z.infer<\n typeof AdminUpdateLeagueTeamContactInputSchema\n>;\n\nexport const AdminUpdateLeagueTeamContactResultSchema = AdminUpdateLeagueTeamResultSchema;\nexport type AdminUpdateLeagueTeamContactResult = AdminUpdateLeagueTeamResult;\n\nexport const AdminDeleteLeagueTeamInputSchema = z.object({ teamId: teamIdSchema }).strict();\nexport type AdminDeleteLeagueTeamInput = z.infer<typeof AdminDeleteLeagueTeamInputSchema>;\n\nexport const AdminDeleteLeagueTeamResultSchema = z\n .object({\n teamId: teamIdSchema,\n complete: z.boolean(),\n remainingGameCount: countSchema,\n })\n .strict();\nexport type AdminDeleteLeagueTeamResult = z.infer<typeof AdminDeleteLeagueTeamResultSchema>;\n\nexport const LEAGUE_TEAM_DELETE_REFUSAL_KEYS = ['teamHasPlayed'] as const;\nexport type LeagueTeamDeleteRefusal = (typeof LEAGUE_TEAM_DELETE_REFUSAL_KEYS)[number];\nexport const LeagueTeamDeleteRefusalDetailsSchema = z\n .object({ reason: z.enum(LEAGUE_TEAM_DELETE_REFUSAL_KEYS), deletedGameCount: countSchema })\n .strict();\nexport type LeagueTeamDeleteRefusalDetails = z.infer<typeof LeagueTeamDeleteRefusalDetailsSchema>;\n"]}
@@ -26,9 +26,7 @@ export declare const AwardBadgeTargetInfoSchema: z.ZodUnion<readonly [z.ZodObjec
26
26
  }, z.core.$strict>]>;
27
27
  interface PictureTarget<TSchema extends z.ZodTypeAny> {
28
28
  readonly schema: TSchema;
29
- /** The kind of document a picture of this origin belongs to. */
30
29
  readonly ownerKind: PictureOwnerKind;
31
- /** The owner's id. A target naming an owner that does not exist yet takes the upload's staging id. */
32
30
  readonly ownerId: (target: z.infer<TSchema>, stagingId: string | undefined) => string;
33
31
  }
34
32
  export declare const PICTURE_TARGETS: {
@@ -51,13 +49,7 @@ export declare const PICTURE_TARGETS: {
51
49
  export type PictureTargetInfo = {
52
50
  [O in PictureOrigin]: z.infer<(typeof PICTURE_TARGETS)[O]['schema']>;
53
51
  }[PictureOrigin];
54
- /**
55
- * Parse a picture upload's target with its origin's schema and normalize it to the owner the
56
- * picture belongs to — the form an upload row stores. A badge creating its award names the award by
57
- * the upload's `stagingId`. Throws the schema's error on a target that does not fit the origin.
58
- */
59
52
  export declare function parseTargetInfo(fileOrigin: PictureOrigin, targetInfo: unknown, stagingId?: string): PictureOwnerRef;
60
- /** The name of the award a badge upload creates, or `undefined` for every other upload. */
61
53
  export declare function newAwardNameOf(fileOrigin: PictureOrigin, targetInfo: unknown): string | undefined;
62
54
  export declare const AdminStartUploadInputSchema: z.ZodObject<{
63
55
  fileOrigin: z.ZodEnum<{
@@ -1 +1 @@
1
- {"version":3,"file":"uploads.d.ts","sourceRoot":"","sources":["../../src/schemas/uploads.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAexB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAG9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,eAAO,MAAM,uBAAuB,aAAwD,CAAC;AAG7F,eAAO,MAAM,6BAA6B;;kBAAkD,CAAC;AAC7F,eAAO,MAAM,2BAA2B;;kBAA8C,CAAC;AAEvF,eAAO,MAAM,8BAA8B,iCAAwB,CAAC;AACpE,eAAO,MAAM,+BAA+B;;kBAEjC,CAAC;AAGZ,eAAO,MAAM,kCAAkC;;kBAAgD,CAAC;AAChG,eAAO,MAAM,6BAA6B;;kBAAuD,CAAC;AAClG,eAAO,MAAM,0BAA0B;;;;oBAGrC,CAAC;AAEH,UAAU,aAAa,CAAC,OAAO,SAAS,CAAC,CAAC,UAAU;IAClD,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,gEAAgE;IAChE,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC;IACrC,sGAAsG;IACtG,QAAQ,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,KAAK,MAAM,CAAC;CACvF;AAUD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;CA+B2C,CAAC;AAExE,MAAM,MAAM,iBAAiB,GAAG;KAC7B,CAAC,IAAI,aAAa,GAAG,CAAC,CAAC,KAAK,CA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AAE,UAAU,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAIjG;AAED,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;kBAkBpC,CAAC;AACL,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,eAAO,MAAM,4BAA4B;;;kBAK9B,CAAC;AACZ,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF,eAAO,MAAM,+BAA+B;;kBAIjC,CAAC;AACZ,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AACxF,eAAO,MAAM,gCAAgC;;kBAA6C,CAAC;AAC3F,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAE1F,eAAO,MAAM,mCAAmC;;kBAErC,CAAC;AACZ,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mCAAmC,CAAC,CAAC;AAChG,eAAO,MAAM,oCAAoC;;kBAAkD,CAAC;AACpG,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC"}
@@ -1,8 +1,3 @@
1
- // Callable contracts for accepting a picture upload.
2
- //
3
- // A client stages its bytes at its own staging path and hands that path, the origin, and the origin's
4
- // target to `adminStartUpload`. Nothing about any path is negotiable: the target names the owner by
5
- // id, and every path the picture is later written to is derived on the server.
6
1
  import { z } from 'zod';
7
2
  import { ClientMediaClaimSchema } from '@ttt-productions/media-schemas';
8
3
  import { MAX_STAGING_UPLOAD_PATH_LENGTH, MAX_UPLOADS_MARKED_SEEN_PER_CALL, } from '../constants/media.js';
@@ -13,16 +8,12 @@ import { pictureOriginSchema } from '../doc-schemas/pending-media.js';
13
8
  import { SPECIAL_DOCS } from '../paths/collections.js';
14
9
  import { AWARD_DEFINITION_OWNER_KIND } from '../types/picture-owners.js';
15
10
  export const stagingUploadPathSchema = z.string().min(1).max(MAX_STAGING_UPLOAD_PATH_LENGTH);
16
- // Each picture origin's target: which owner the picture is for, by id.
17
11
  export const LeaguePictureTargetInfoSchema = z.object({ leagueId: leagueIdSchema }).strict();
18
12
  export const TeamPictureTargetInfoSchema = z.object({ teamId: teamIdSchema }).strict();
19
- // There is one landing page, so its target names nothing.
20
13
  export const LandingPictureTargetInfoSchema = z.object({}).strict();
21
14
  export const LocationPictureTargetInfoSchema = z
22
15
  .object({ gameLocationId: gameLocationIdSchema })
23
16
  .strict();
24
- // A badge either replaces an existing award's (`awardId`) or creates the award it is the first badge
25
- // of (`newAwardName`), whose id is the upload's staging id.
26
17
  export const ExistingAwardBadgeTargetInfoSchema = z.object({ awardId: awardIdSchema }).strict();
27
18
  export const NewAwardBadgeTargetInfoSchema = z.object({ newAwardName: awardNameSchema }).strict();
28
19
  export const AwardBadgeTargetInfoSchema = z.union([
@@ -45,16 +36,10 @@ export const PICTURE_TARGETS = {
45
36
  return stagingId;
46
37
  }),
47
38
  };
48
- /**
49
- * Parse a picture upload's target with its origin's schema and normalize it to the owner the
50
- * picture belongs to — the form an upload row stores. A badge creating its award names the award by
51
- * the upload's `stagingId`. Throws the schema's error on a target that does not fit the origin.
52
- */
53
39
  export function parseTargetInfo(fileOrigin, targetInfo, stagingId) {
54
40
  const target = PICTURE_TARGETS[fileOrigin];
55
41
  return { kind: target.ownerKind, id: target.ownerId(target.schema.parse(targetInfo), stagingId) };
56
42
  }
57
- /** The name of the award a badge upload creates, or `undefined` for every other upload. */
58
43
  export function newAwardNameOf(fileOrigin, targetInfo) {
59
44
  if (PICTURE_TARGETS[fileOrigin].ownerKind !== AWARD_DEFINITION_OWNER_KIND)
60
45
  return undefined;
@@ -64,15 +49,8 @@ export function newAwardNameOf(fileOrigin, targetInfo) {
64
49
  export const AdminStartUploadInputSchema = z
65
50
  .object({
66
51
  fileOrigin: pictureOriginSchema,
67
- // The full staging path the client uploaded to. Only its last segment, the staging id, is
68
- // taken from it; the server rebuilds the rest and refuses anything not exactly equal.
69
52
  storagePath: stagingUploadPathSchema,
70
- // Checked against the origin's own target schema below, so a target that does not fit its
71
- // origin is refused with the rest of a malformed payload.
72
53
  targetInfo: z.unknown(),
73
- // What the admin actually did — chose a file in the picker, an advisory claim. Untrusted
74
- // context kept on the row for the processing pipeline; the byte inspection alone decides what
75
- // the file is, and a request without it is inspected all the same.
76
54
  clientMediaClaim: ClientMediaClaimSchema.optional(),
77
55
  })
78
56
  .strict()
@@ -89,23 +67,16 @@ export const AdminStartUploadInputSchema = z
89
67
  });
90
68
  export const AdminStartUploadResultSchema = z
91
69
  .object({
92
- // The upload's row, which the uploading control follows to its end. It is also the picture's id.
93
70
  pendingMediaId: stagingIdSchema,
94
- // A badge's award: the existing one it replaces, or the one its publication will create.
95
71
  awardId: awardIdSchema.optional(),
96
72
  })
97
73
  .strict();
98
- // The admin's upload tray. Each call names only which uploads; the callable decides from the stored
99
- // rows that each is the caller's own and finished. Tray state, never a sensitive action.
100
- // Marks the caller's finished uploads seen when the tray's Uploads view opens. An id that is not the
101
- // caller's, not finished, already seen, or gone is skipped, so one stale id never fails the batch.
102
74
  export const AdminMarkUploadsSeenInputSchema = z
103
75
  .object({
104
76
  pendingMediaIds: z.array(stagingIdSchema).min(1).max(MAX_UPLOADS_MARKED_SEEN_PER_CALL),
105
77
  })
106
78
  .strict();
107
79
  export const AdminMarkUploadsSeenResultSchema = z.object({ marked: countSchema }).strict();
108
- // Clears one of the caller's finished uploads from the tray.
109
80
  export const AdminClearUploadActivityInputSchema = z
110
81
  .object({ pendingMediaId: stagingIdSchema })
111
82
  .strict();
@@ -1 +1 @@
1
- {"version":3,"file":"uploads.js","sourceRoot":"","sources":["../../src/schemas/uploads.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,EAAE;AACF,sGAAsG;AACtG,oGAAoG;AACpG,+EA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AO,EAAE,CAAC;QACpB,OAAO,CAAC,QAAQ,CAAC;YACf,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,YAAY,CAAC;YACpB,OAAO,EAAE,6BAA6B,KAAK,CAAC,UAAU,YAAY,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,IAAI,SAAS,EAAE;SACjH,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC,CAAC;AAGL,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC;KAC1C,MAAM,CAAC;IACN,iGAAiG;IACjG,cAAc,EAAE,eAAe;IAC/B,yFAAyF;IACzF,OAAO,EAAE,aAAa,CAAC,QAAQ,EAAE;CAClC,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,oGAAoG;AACpG,yFAAyF;AAEzF,qGAAqG;AACrG,mGAAmG;AACnG,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC;KAC7C,MAAM,CAAC;IACN,eAAe,EAAE,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,gCAAgC,CAAC;CACvF,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAG3F,6DAA6D;AAC7D,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC;KACjD,MAAM,CAAC,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC;KAC3C,MAAM,EAAE,CAAC;AAEZ,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC","sourcesContent":["// Callable contracts for accepting a picture upload.\n//\n// A client stages its bytes at its own staging path and hands that path, the origin, and the origin's\n// target to `adminStartUpload`. Nothing about any path is negotiable: the target names the owner by\n// id, and every path the picture is later written to is derived on the server.\n\nimport { z } from 'zod';\nimport { ClientMediaClaimSchema } from '@ttt-productions/media-schemas';\nimport {\n MAX_STAGING_UPLOAD_PATH_LENGTH,\n MAX_UPLOADS_MARKED_SEEN_PER_CALL,\n} from '../constants/media.js';\nimport {\n countSchema,\n leagueIdSchema,\n stagingIdSchema,\n teamIdSchema,\n} from '../doc-schemas/atoms.js';\nimport { awardIdSchema, awardNameSchema } from '../doc-schemas/catalogs.js';\nimport { gameLocationIdSchema } from '../doc-schemas/game-location.js';\nimport { pictureOriginSchema } from '../doc-schemas/pending-media.js';\nimport type { PictureOwnerRef } from '../doc-schemas/pending-media.js';\nimport type { PictureOrigin } from '../media/file-origins.js';\nimport { SPECIAL_DOCS } from '../paths/collections.js';\nimport { AWARD_DEFINITION_OWNER_KIND } from '../types/picture-owners.js';\nimport type { PictureOwnerKind } from '../types/picture-owners.js';\n\nexport const stagingUploadPathSchema = z.string().min(1).max(MAX_STAGING_UPLOAD_PATH_LENGTH);\n\n// Each picture origin's target: which owner the picture is for, by id.\nexport const LeaguePictureTargetInfoSchema = z.object({ leagueId: leagueIdSchema }).strict();\nexport const TeamPictureTargetInfoSchema = z.object({ teamId: teamIdSchema }).strict();\n// There is one landing page, so its target names nothing.\nexport const LandingPictureTargetInfoSchema = z.object({}).strict();\nexport const LocationPictureTargetInfoSchema = z\n .object({ gameLocationId: gameLocationIdSchema })\n .strict();\n// A badge either replaces an existing award's (`awardId`) or creates the award it is the first badge\n// of (`newAwardName`), whose id is the upload's staging id.\nexport const ExistingAwardBadgeTargetInfoSchema = z.object({ awardId: awardIdSchema }).strict();\nexport const NewAwardBadgeTargetInfoSchema = z.object({ newAwardName: awardNameSchema }).strict();\nexport const AwardBadgeTargetInfoSchema = z.union([\n ExistingAwardBadgeTargetInfoSchema,\n NewAwardBadgeTargetInfoSchema,\n]);\n\ninterface PictureTarget<TSchema extends z.ZodTypeAny> {\n readonly schema: TSchema;\n /** The kind of document a picture of this origin belongs to. */\n readonly ownerKind: PictureOwnerKind;\n /** The owner's id. A target naming an owner that does not exist yet takes the upload's staging id. */\n readonly ownerId: (target: z.infer<TSchema>, stagingId: string | undefined) => string;\n}\n\nfunction pictureTarget<TSchema extends z.ZodTypeAny>(\n schema: TSchema,\n ownerKind: PictureOwnerKind,\n ownerId: (target: z.infer<TSchema>, stagingId: string | undefined) => string,\n): PictureTarget<TSchema> {\n return { schema, ownerKind, ownerId };\n}\n\nexport const PICTURE_TARGETS = {\n 'league-picture': pictureTarget(\n LeaguePictureTargetInfoSchema,\n 'sportLeague',\n (target) => target.leagueId,\n ),\n 'team-picture': pictureTarget(\n TeamPictureTargetInfoSchema,\n 'leagueTeam',\n (target) => target.teamId,\n ),\n 'landing-picture': pictureTarget(\n LandingPictureTargetInfoSchema,\n 'landingPage',\n () => SPECIAL_DOCS.LANDING_PAGE,\n ),\n 'location-picture': pictureTarget(\n LocationPictureTargetInfoSchema,\n 'gameLocation',\n (target) => target.gameLocationId,\n ),\n 'award-badge': pictureTarget(\n AwardBadgeTargetInfoSchema,\n AWARD_DEFINITION_OWNER_KIND,\n (target, stagingId) => {\n if ('awardId' in target) return target.awardId;\n if (stagingId === undefined)\n throw new Error(\"A new award's id is its badge upload's staging id, which was not given.\");\n return stagingId;\n },\n ),\n} as const satisfies Record<PictureOrigin, PictureTarget<z.ZodTypeAny>>;\n\nexport type PictureTargetInfo = {\n [O in PictureOrigin]: z.infer<(typeof PICTURE_TARGETS)[O]['schema']>;\n}[PictureOrigin];\n\n/**\n * Parse a picture upload's target with its origin's schema and normalize it to the owner the\n * picture belongs to — the form an upload row stores. A badge creating its award names the award by\n * the upload's `stagingId`. Throws the schema's error on a target that does not fit the origin.\n */\nexport function parseTargetInfo(\n fileOrigin: PictureOrigin,\n targetInfo: unknown,\n stagingId?: string,\n): PictureOwnerRef {\n const target = PICTURE_TARGETS[fileOrigin] as PictureTarget<z.ZodTypeAny>;\n return { kind: target.ownerKind, id: target.ownerId(target.schema.parse(targetInfo), stagingId) };\n}\n\n/** The name of the award a badge upload creates, or `undefined` for every other upload. */\nexport function newAwardNameOf(fileOrigin: PictureOrigin, targetInfo: unknown): string | undefined {\n if (PICTURE_TARGETS[fileOrigin].ownerKind !== AWARD_DEFINITION_OWNER_KIND) return undefined;\n const target = AwardBadgeTargetInfoSchema.parse(targetInfo);\n return 'newAwardName' in target ? target.newAwardName : undefined;\n}\n\nexport const AdminStartUploadInputSchema = z\n .object({\n fileOrigin: pictureOriginSchema,\n // The full staging path the client uploaded to. Only its last segment, the staging id, is\n // taken from it; the server rebuilds the rest and refuses anything not exactly equal.\n storagePath: stagingUploadPathSchema,\n // Checked against the origin's own target schema below, so a target that does not fit its\n // origin is refused with the rest of a malformed payload.\n targetInfo: z.unknown(),\n // What the admin actually did — chose a file in the picker, an advisory claim. Untrusted\n // context kept on the row for the processing pipeline; the byte inspection alone decides what\n // the file is, and a request without it is inspected all the same.\n clientMediaClaim: ClientMediaClaimSchema.optional(),\n })\n .strict()\n .superRefine((input, context) => {\n const target = PICTURE_TARGETS[input.fileOrigin] as PictureTarget<z.ZodTypeAny>;\n const parsed = target.schema.safeParse(input.targetInfo);\n if (!parsed.success) {\n context.addIssue({\n code: 'custom',\n path: ['targetInfo'],\n message: `The target does not fit a ${input.fileOrigin} upload: ${parsed.error.issues[0]?.message ?? 'invalid'}`,\n });\n }\n });\nexport type AdminStartUploadInput = z.infer<typeof AdminStartUploadInputSchema>;\n\nexport const AdminStartUploadResultSchema = z\n .object({\n // The upload's row, which the uploading control follows to its end. It is also the picture's id.\n pendingMediaId: stagingIdSchema,\n // A badge's award: the existing one it replaces, or the one its publication will create.\n awardId: awardIdSchema.optional(),\n })\n .strict();\nexport type AdminStartUploadResult = z.infer<typeof AdminStartUploadResultSchema>;\n\n// The admin's upload tray. Each call names only which uploads; the callable decides from the stored\n// rows that each is the caller's own and finished. Tray state, never a sensitive action.\n\n// Marks the caller's finished uploads seen when the tray's Uploads view opens. An id that is not the\n// caller's, not finished, already seen, or gone is skipped, so one stale id never fails the batch.\nexport const AdminMarkUploadsSeenInputSchema = z\n .object({\n pendingMediaIds: z.array(stagingIdSchema).min(1).max(MAX_UPLOADS_MARKED_SEEN_PER_CALL),\n })\n .strict();\nexport type AdminMarkUploadsSeenInput = z.infer<typeof AdminMarkUploadsSeenInputSchema>;\nexport const AdminMarkUploadsSeenResultSchema = z.object({ marked: countSchema }).strict();\nexport type AdminMarkUploadsSeenResult = z.infer<typeof AdminMarkUploadsSeenResultSchema>;\n\n// Clears one of the caller's finished uploads from the tray.\nexport const AdminClearUploadActivityInputSchema = z\n .object({ pendingMediaId: stagingIdSchema })\n .strict();\nexport type AdminClearUploadActivityInput = z.infer<typeof AdminClearUploadActivityInputSchema>;\nexport const AdminClearUploadActivityResultSchema = z.object({ cleared: z.literal(true) }).strict();\nexport type AdminClearUploadActivityResult = z.infer<typeof AdminClearUploadActivityResultSchema>;\n"]}
1
+ {"version":3,"file":"uploads.js","sourceRoot":"","sources":["../../src/schemas/uploads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EACL,8BAA8B,EAC9B,gCAAgC,GACjC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,WAAW,EACX,cAAc,EACd,eAAe,EACf,YAAY,GACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAGtE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAGzE,MA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,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAG3F,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC;KACjD,MAAM,CAAC,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC;KAC3C,MAAM,EAAE,CAAC;AAEZ,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC","sourcesContent":["import { z } from 'zod';\nimport { ClientMediaClaimSchema } from '@ttt-productions/media-schemas';\nimport {\n MAX_STAGING_UPLOAD_PATH_LENGTH,\n MAX_UPLOADS_MARKED_SEEN_PER_CALL,\n} from '../constants/media.js';\nimport {\n countSchema,\n leagueIdSchema,\n stagingIdSchema,\n teamIdSchema,\n} from '../doc-schemas/atoms.js';\nimport { awardIdSchema, awardNameSchema } from '../doc-schemas/catalogs.js';\nimport { gameLocationIdSchema } from '../doc-schemas/game-location.js';\nimport { pictureOriginSchema } from '../doc-schemas/pending-media.js';\nimport type { PictureOwnerRef } from '../doc-schemas/pending-media.js';\nimport type { PictureOrigin } from '../media/file-origins.js';\nimport { SPECIAL_DOCS } from '../paths/collections.js';\nimport { AWARD_DEFINITION_OWNER_KIND } from '../types/picture-owners.js';\nimport type { PictureOwnerKind } from '../types/picture-owners.js';\n\nexport const stagingUploadPathSchema = z.string().min(1).max(MAX_STAGING_UPLOAD_PATH_LENGTH);\n\nexport const LeaguePictureTargetInfoSchema = z.object({ leagueId: leagueIdSchema }).strict();\nexport const TeamPictureTargetInfoSchema = z.object({ teamId: teamIdSchema }).strict();\nexport const LandingPictureTargetInfoSchema = z.object({}).strict();\nexport const LocationPictureTargetInfoSchema = z\n .object({ gameLocationId: gameLocationIdSchema })\n .strict();\nexport const ExistingAwardBadgeTargetInfoSchema = z.object({ awardId: awardIdSchema }).strict();\nexport const NewAwardBadgeTargetInfoSchema = z.object({ newAwardName: awardNameSchema }).strict();\nexport const AwardBadgeTargetInfoSchema = z.union([\n ExistingAwardBadgeTargetInfoSchema,\n NewAwardBadgeTargetInfoSchema,\n]);\n\ninterface PictureTarget<TSchema extends z.ZodTypeAny> {\n readonly schema: TSchema;\n readonly ownerKind: PictureOwnerKind;\n readonly ownerId: (target: z.infer<TSchema>, stagingId: string | undefined) => string;\n}\n\nfunction pictureTarget<TSchema extends z.ZodTypeAny>(\n schema: TSchema,\n ownerKind: PictureOwnerKind,\n ownerId: (target: z.infer<TSchema>, stagingId: string | undefined) => string,\n): PictureTarget<TSchema> {\n return { schema, ownerKind, ownerId };\n}\n\nexport const PICTURE_TARGETS = {\n 'league-picture': pictureTarget(\n LeaguePictureTargetInfoSchema,\n 'sportLeague',\n (target) => target.leagueId,\n ),\n 'team-picture': pictureTarget(\n TeamPictureTargetInfoSchema,\n 'leagueTeam',\n (target) => target.teamId,\n ),\n 'landing-picture': pictureTarget(\n LandingPictureTargetInfoSchema,\n 'landingPage',\n () => SPECIAL_DOCS.LANDING_PAGE,\n ),\n 'location-picture': pictureTarget(\n LocationPictureTargetInfoSchema,\n 'gameLocation',\n (target) => target.gameLocationId,\n ),\n 'award-badge': pictureTarget(\n AwardBadgeTargetInfoSchema,\n AWARD_DEFINITION_OWNER_KIND,\n (target, stagingId) => {\n if ('awardId' in target) return target.awardId;\n if (stagingId === undefined)\n throw new Error(\"A new award's id is its badge upload's staging id, which was not given.\");\n return stagingId;\n },\n ),\n} as const satisfies Record<PictureOrigin, PictureTarget<z.ZodTypeAny>>;\n\nexport type PictureTargetInfo = {\n [O in PictureOrigin]: z.infer<(typeof PICTURE_TARGETS)[O]['schema']>;\n}[PictureOrigin];\n\nexport function parseTargetInfo(\n fileOrigin: PictureOrigin,\n targetInfo: unknown,\n stagingId?: string,\n): PictureOwnerRef {\n const target = PICTURE_TARGETS[fileOrigin] as PictureTarget<z.ZodTypeAny>;\n return { kind: target.ownerKind, id: target.ownerId(target.schema.parse(targetInfo), stagingId) };\n}\n\nexport function newAwardNameOf(fileOrigin: PictureOrigin, targetInfo: unknown): string | undefined {\n if (PICTURE_TARGETS[fileOrigin].ownerKind !== AWARD_DEFINITION_OWNER_KIND) return undefined;\n const target = AwardBadgeTargetInfoSchema.parse(targetInfo);\n return 'newAwardName' in target ? target.newAwardName : undefined;\n}\n\nexport const AdminStartUploadInputSchema = z\n .object({\n fileOrigin: pictureOriginSchema,\n storagePath: stagingUploadPathSchema,\n targetInfo: z.unknown(),\n clientMediaClaim: ClientMediaClaimSchema.optional(),\n })\n .strict()\n .superRefine((input, context) => {\n const target = PICTURE_TARGETS[input.fileOrigin] as PictureTarget<z.ZodTypeAny>;\n const parsed = target.schema.safeParse(input.targetInfo);\n if (!parsed.success) {\n context.addIssue({\n code: 'custom',\n path: ['targetInfo'],\n message: `The target does not fit a ${input.fileOrigin} upload: ${parsed.error.issues[0]?.message ?? 'invalid'}`,\n });\n }\n });\nexport type AdminStartUploadInput = z.infer<typeof AdminStartUploadInputSchema>;\n\nexport const AdminStartUploadResultSchema = z\n .object({\n pendingMediaId: stagingIdSchema,\n awardId: awardIdSchema.optional(),\n })\n .strict();\nexport type AdminStartUploadResult = z.infer<typeof AdminStartUploadResultSchema>;\n\nexport const AdminMarkUploadsSeenInputSchema = z\n .object({\n pendingMediaIds: z.array(stagingIdSchema).min(1).max(MAX_UPLOADS_MARKED_SEEN_PER_CALL),\n })\n .strict();\nexport type AdminMarkUploadsSeenInput = z.infer<typeof AdminMarkUploadsSeenInputSchema>;\nexport const AdminMarkUploadsSeenResultSchema = z.object({ marked: countSchema }).strict();\nexport type AdminMarkUploadsSeenResult = z.infer<typeof AdminMarkUploadsSeenResultSchema>;\n\nexport const AdminClearUploadActivityInputSchema = z\n .object({ pendingMediaId: stagingIdSchema })\n .strict();\nexport type AdminClearUploadActivityInput = z.infer<typeof AdminClearUploadActivityInputSchema>;\nexport const AdminClearUploadActivityResultSchema = z.object({ cleared: z.literal(true) }).strict();\nexport type AdminClearUploadActivityResult = z.infer<typeof AdminClearUploadActivityResultSchema>;\n"]}
@@ -25,7 +25,6 @@ export declare const CheckDisplayNameAvailableResultSchema: z.ZodObject<{
25
25
  }>>;
26
26
  }, z.core.$strict>;
27
27
  export type CheckDisplayNameAvailableResult = z.infer<typeof CheckDisplayNameAvailableResultSchema>;
28
- /** The longest text an admin's account search takes: a name, a full email address, or a uid. */
29
28
  export declare const MAX_USER_SEARCH_QUERY_LENGTH = 100;
30
29
  export declare const USER_LOOKUP_EMAIL_PATTERN: RegExp;
31
30
  export declare const USER_LOOKUP_UID_PATTERN: RegExp;
@@ -1 +1 @@
1
- {"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../src/schemas/users.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAYxB,eAAO,MAAM,uBAAuB;;;kBAMzB,CAAC;AACZ,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,eAAO,MAAM,wBAAwB;;;;;;8BAQnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAM1E,eAAO,MAAM,oCAAoC;;kBAEtC,CAAC;AACZ,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC;AAGlG,eAAO,MAAM,gCAAgC,oBAAqB,CAAC;AACnE,MAAM,MAAM,4BAA4B,GAAG,CAAC,OAAO,gCAAgC,CAAC,CAAC,MAAM,CAAC,CAAC;AAC7F,eAAO,MAAM,qCAAqC;;;;;kBAEvC,CAAC;AACZ,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qCAAqC,CAAC,CAAC;AAEpG,gGAAgG;AAChG,eAAO,MAAM,4BAA4B,MAAM,CAAC;AAMhD,eAAO,MAAM,yBAAyB,QAA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