@ttt-productions/q-core 0.1.16 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants/business.d.ts.map +1 -1
- package/dist/constants/business.js +25 -5
- package/dist/constants/business.js.map +1 -1
- package/dist/constants/sports.d.ts.map +1 -1
- package/dist/constants/sports.js +2 -2
- package/dist/constants/sports.js.map +1 -1
- package/dist/doc-schemas/admin-notifications.d.ts +1 -1
- package/dist/doc-schemas/admin-notifications.d.ts.map +1 -1
- package/dist/doc-schemas/admin-notifications.js +4 -1
- package/dist/doc-schemas/admin-notifications.js.map +1 -1
- package/dist/doc-schemas/aggregate-stats.d.ts.map +1 -1
- package/dist/doc-schemas/aggregate-stats.js +4 -1
- package/dist/doc-schemas/aggregate-stats.js.map +1 -1
- package/dist/doc-schemas/atoms.d.ts.map +1 -1
- package/dist/doc-schemas/atoms.js +2 -2
- package/dist/doc-schemas/atoms.js.map +1 -1
- package/dist/doc-schemas/audit-event.d.ts.map +1 -1
- package/dist/doc-schemas/audit-event.js +8 -4
- package/dist/doc-schemas/audit-event.js.map +1 -1
- package/dist/doc-schemas/award-group-grant.d.ts.map +1 -1
- package/dist/doc-schemas/award-group-grant.js +11 -3
- package/dist/doc-schemas/award-group-grant.js.map +1 -1
- package/dist/doc-schemas/catalogs.js +1 -1
- package/dist/doc-schemas/catalogs.js.map +1 -1
- package/dist/doc-schemas/gallery.js +1 -1
- package/dist/doc-schemas/gallery.js.map +1 -1
- package/dist/doc-schemas/game-stat-history.d.ts.map +1 -1
- package/dist/doc-schemas/game-stat-history.js.map +1 -1
- package/dist/doc-schemas/game-stats.d.ts.map +1 -1
- package/dist/doc-schemas/game-stats.js +10 -2
- package/dist/doc-schemas/game-stats.js.map +1 -1
- package/dist/doc-schemas/league-team.js +1 -1
- package/dist/doc-schemas/league-team.js.map +1 -1
- package/dist/doc-schemas/membership-roster-sync.d.ts.map +1 -1
- package/dist/doc-schemas/membership-roster-sync.js +2 -1
- package/dist/doc-schemas/membership-roster-sync.js.map +1 -1
- package/dist/doc-schemas/migration-console.js +1 -1
- package/dist/doc-schemas/migration-console.js.map +1 -1
- package/dist/doc-schemas/pending-media.d.ts.map +1 -1
- package/dist/doc-schemas/pending-media.js.map +1 -1
- package/dist/doc-schemas/picture-retirement.d.ts.map +1 -1
- package/dist/doc-schemas/picture-retirement.js +5 -1
- package/dist/doc-schemas/picture-retirement.js.map +1 -1
- package/dist/doc-schemas/registry.d.ts +1 -1
- package/dist/doc-schemas/registry.d.ts.map +1 -1
- package/dist/doc-schemas/registry.js +1 -1
- package/dist/doc-schemas/registry.js.map +1 -1
- package/dist/doc-schemas/sport-game.d.ts.map +1 -1
- package/dist/doc-schemas/sport-game.js.map +1 -1
- package/dist/doc-schemas/sport-league.d.ts.map +1 -1
- package/dist/doc-schemas/sport-league.js +10 -2
- package/dist/doc-schemas/sport-league.js.map +1 -1
- package/dist/doc-schemas/status-reconcile-queue.d.ts.map +1 -1
- package/dist/doc-schemas/status-reconcile-queue.js.map +1 -1
- package/dist/doc-schemas/sweep-state.d.ts.map +1 -1
- package/dist/doc-schemas/sweep-state.js +10 -2
- package/dist/doc-schemas/sweep-state.js.map +1 -1
- package/dist/doc-schemas/system.d.ts.map +1 -1
- package/dist/doc-schemas/system.js.map +1 -1
- package/dist/doc-schemas/user-profile.d.ts.map +1 -1
- package/dist/doc-schemas/user-profile.js +1 -1
- package/dist/doc-schemas/user-profile.js.map +1 -1
- package/dist/doc-schemas/waivers-and-hardware.d.ts.map +1 -1
- package/dist/doc-schemas/waivers-and-hardware.js +15 -3
- package/dist/doc-schemas/waivers-and-hardware.js.map +1 -1
- package/dist/domain-events/domain-events.d.ts.map +1 -1
- package/dist/domain-events/domain-events.js +88 -24
- package/dist/domain-events/domain-events.js.map +1 -1
- package/dist/ids/notification-ids.d.ts.map +1 -1
- package/dist/ids/notification-ids.js.map +1 -1
- package/dist/ids/picture-ids.d.ts.map +1 -1
- package/dist/ids/picture-ids.js.map +1 -1
- package/dist/ids/stat-event-ids.d.ts.map +1 -1
- package/dist/ids/stat-event-ids.js.map +1 -1
- package/dist/ids/waiver-template-ids.d.ts.map +1 -1
- package/dist/ids/waiver-template-ids.js.map +1 -1
- package/dist/index.d.ts +4 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -9
- package/dist/index.js.map +1 -1
- package/dist/input-formats/{index.d.ts → input-formats.d.ts} +1 -1
- package/dist/input-formats/input-formats.d.ts.map +1 -0
- package/dist/input-formats/{index.js → input-formats.js} +1 -1
- package/dist/input-formats/input-formats.js.map +1 -0
- package/dist/media/file-origins.d.ts.map +1 -1
- package/dist/media/file-origins.js +30 -6
- package/dist/media/file-origins.js.map +1 -1
- package/dist/migration-console/action-ids.d.ts.map +1 -1
- package/dist/migration-console/action-ids.js.map +1 -1
- package/dist/migration-console/manifest.d.ts.map +1 -1
- package/dist/migration-console/manifest.js +42 -7
- package/dist/migration-console/manifest.js.map +1 -1
- package/dist/migration-console/run-state.d.ts.map +1 -1
- package/dist/migration-console/run-state.js.map +1 -1
- package/dist/notifications/admin-notification-config.d.ts.map +1 -1
- package/dist/notifications/admin-notification-config.js +5 -3
- package/dist/notifications/admin-notification-config.js.map +1 -1
- package/dist/notifications/occurrences.d.ts.map +1 -1
- package/dist/notifications/occurrences.js.map +1 -1
- package/dist/paths/path-builders.d.ts.map +1 -1
- package/dist/paths/path-builders.js +60 -15
- package/dist/paths/path-builders.js.map +1 -1
- package/dist/paths/picture-owner-paths.d.ts.map +1 -1
- package/dist/paths/picture-owner-paths.js.map +1 -1
- package/dist/paths/storage-paths.d.ts.map +1 -1
- package/dist/paths/storage-paths.js.map +1 -1
- package/dist/schemas/admin-notifications.d.ts.map +1 -1
- package/dist/schemas/admin-notifications.js +8 -4
- package/dist/schemas/admin-notifications.js.map +1 -1
- package/dist/schemas/app-config.js +1 -1
- package/dist/schemas/app-config.js.map +1 -1
- package/dist/schemas/atoms.d.ts +0 -1
- package/dist/schemas/atoms.d.ts.map +1 -1
- package/dist/schemas/atoms.js +3 -5
- package/dist/schemas/atoms.js.map +1 -1
- package/dist/schemas/awards.d.ts.map +1 -1
- package/dist/schemas/awards.js +13 -5
- package/dist/schemas/awards.js.map +1 -1
- package/dist/schemas/dead-letters.d.ts.map +1 -1
- package/dist/schemas/dead-letters.js +6 -3
- package/dist/schemas/dead-letters.js.map +1 -1
- package/dist/schemas/game-locations.d.ts.map +1 -1
- package/dist/schemas/game-locations.js +1 -1
- package/dist/schemas/game-locations.js.map +1 -1
- package/dist/schemas/hardware-loan-contracts.d.ts.map +1 -1
- package/dist/schemas/hardware-loan-contracts.js +11 -4
- package/dist/schemas/hardware-loan-contracts.js.map +1 -1
- package/dist/schemas/leagues.d.ts +2 -2
- package/dist/schemas/leagues.d.ts.map +1 -1
- package/dist/schemas/leagues.js +12 -3
- package/dist/schemas/leagues.js.map +1 -1
- package/dist/schemas/migration-console.d.ts.map +1 -1
- package/dist/schemas/migration-console.js +3 -6
- package/dist/schemas/migration-console.js.map +1 -1
- package/dist/schemas/pictures.d.ts.map +1 -1
- package/dist/schemas/pictures.js +6 -2
- package/dist/schemas/pictures.js.map +1 -1
- package/dist/schemas/schedules.d.ts +8 -8
- package/dist/schemas/schedules.d.ts.map +1 -1
- package/dist/schemas/schedules.js +9 -3
- package/dist/schemas/schedules.js.map +1 -1
- package/dist/schemas/scoring.d.ts +12 -12
- package/dist/schemas/scoring.d.ts.map +1 -1
- package/dist/schemas/scoring.js +11 -4
- package/dist/schemas/scoring.js.map +1 -1
- package/dist/schemas/signed-waivers.d.ts.map +1 -1
- package/dist/schemas/signed-waivers.js +5 -3
- package/dist/schemas/signed-waivers.js.map +1 -1
- package/dist/schemas/stats.d.ts.map +1 -1
- package/dist/schemas/stats.js +27 -8
- package/dist/schemas/stats.js.map +1 -1
- package/dist/schemas/team-joining.d.ts.map +1 -1
- package/dist/schemas/team-joining.js +13 -5
- package/dist/schemas/team-joining.js.map +1 -1
- package/dist/schemas/teams.d.ts.map +1 -1
- package/dist/schemas/teams.js +19 -6
- package/dist/schemas/teams.js.map +1 -1
- package/dist/schemas/uploads.d.ts.map +1 -1
- package/dist/schemas/uploads.js +12 -5
- package/dist/schemas/uploads.js.map +1 -1
- package/dist/schemas/users.d.ts.map +1 -1
- package/dist/schemas/users.js +22 -8
- package/dist/schemas/users.js.map +1 -1
- package/dist/schemas/waiver-templates.js +1 -1
- package/dist/schemas/waiver-templates.js.map +1 -1
- package/dist/sports/basketball-scoring.d.ts.map +1 -1
- package/dist/sports/basketball-scoring.js +67 -16
- package/dist/sports/basketball-scoring.js.map +1 -1
- package/dist/sports/basketball.d.ts.map +1 -1
- package/dist/sports/basketball.js +34 -7
- package/dist/sports/basketball.js.map +1 -1
- package/dist/sports/column-catalog.d.ts.map +1 -1
- package/dist/sports/column-catalog.js +4 -1
- package/dist/sports/column-catalog.js.map +1 -1
- package/dist/sports/contribution.d.ts.map +1 -1
- package/dist/sports/contribution.js +10 -3
- package/dist/sports/contribution.js.map +1 -1
- package/dist/sports/curling-scoring.d.ts.map +1 -1
- package/dist/sports/curling-scoring.js +30 -8
- package/dist/sports/curling-scoring.js.map +1 -1
- package/dist/sports/curling.d.ts.map +1 -1
- package/dist/sports/curling.js +1 -1
- package/dist/sports/curling.js.map +1 -1
- package/dist/sports/finalized-record.d.ts.map +1 -1
- package/dist/sports/finalized-record.js.map +1 -1
- package/dist/sports/football-scoring.d.ts.map +1 -1
- package/dist/sports/football-scoring.js +28 -8
- package/dist/sports/football-scoring.js.map +1 -1
- package/dist/sports/football.d.ts.map +1 -1
- package/dist/sports/football.js +1 -1
- package/dist/sports/football.js.map +1 -1
- package/dist/sports/index.d.ts +2 -2
- package/dist/sports/index.d.ts.map +1 -1
- package/dist/sports/index.js +1 -1
- package/dist/sports/index.js.map +1 -1
- package/dist/sports/ledger-continuity.d.ts.map +1 -1
- package/dist/sports/ledger-continuity.js.map +1 -1
- package/dist/sports/rankings.d.ts.map +1 -1
- package/dist/sports/rankings.js +5 -1
- package/dist/sports/rankings.js.map +1 -1
- package/dist/sports/replay.d.ts.map +1 -1
- package/dist/sports/replay.js +4 -1
- package/dist/sports/replay.js.map +1 -1
- package/dist/sports/rollup-check.d.ts.map +1 -1
- package/dist/sports/rollup-check.js +15 -3
- package/dist/sports/rollup-check.js.map +1 -1
- package/dist/sports/score-mirror.d.ts.map +1 -1
- package/dist/sports/score-mirror.js.map +1 -1
- package/dist/sports/scoring-display.d.ts.map +1 -1
- package/dist/sports/scoring-display.js.map +1 -1
- package/dist/sports/scoring.d.ts.map +1 -1
- package/dist/sports/scoring.js.map +1 -1
- package/dist/sports/sport-adapter.d.ts.map +1 -1
- package/dist/sports/sport-adapter.js.map +1 -1
- package/dist/sports/store-driver.d.ts.map +1 -1
- package/dist/sports/store-driver.js +18 -7
- package/dist/sports/store-driver.js.map +1 -1
- package/dist/types/audit.d.ts.map +1 -1
- package/dist/types/audit.js +16 -3
- package/dist/types/audit.js.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +0 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/notifications.d.ts.map +1 -1
- package/dist/types/notifications.js +9 -13
- package/dist/types/notifications.js.map +1 -1
- package/dist/types/schedules.d.ts.map +1 -1
- package/dist/types/schedules.js.map +1 -1
- package/dist/types/sports.d.ts.map +1 -1
- package/dist/types/sports.js +9 -2
- package/dist/types/sports.js.map +1 -1
- package/dist/types/stats.d.ts.map +1 -1
- package/dist/types/stats.js +45 -9
- package/dist/types/stats.js.map +1 -1
- package/dist/types/unions.d.ts.map +1 -1
- package/dist/types/unions.js +32 -6
- package/dist/types/unions.js.map +1 -1
- package/dist/upload-variables/picture-upload-variables.d.ts.map +1 -1
- package/dist/upload-variables/picture-upload-variables.js +4 -2
- package/dist/upload-variables/picture-upload-variables.js.map +1 -1
- package/dist/upload-variables/sign-hardware-contract-variables.d.ts.map +1 -1
- package/dist/upload-variables/sign-hardware-contract-variables.js +4 -2
- package/dist/upload-variables/sign-hardware-contract-variables.js.map +1 -1
- package/dist/upload-variables/sign-waiver-variables.d.ts.map +1 -1
- package/dist/upload-variables/sign-waiver-variables.js +5 -3
- package/dist/upload-variables/sign-waiver-variables.js.map +1 -1
- package/dist/utils/app-config.d.ts.map +1 -1
- package/dist/utils/app-config.js +5 -1
- package/dist/utils/app-config.js.map +1 -1
- package/dist/utils/app-routes.d.ts.map +1 -1
- package/dist/utils/app-routes.js +6 -1
- package/dist/utils/app-routes.js.map +1 -1
- package/dist/utils/league-calendar.d.ts.map +1 -1
- package/dist/utils/league-calendar.js +4 -1
- package/dist/utils/league-calendar.js.map +1 -1
- package/dist/utils/league-join-warning.d.ts.map +1 -1
- package/dist/utils/league-join-warning.js +15 -5
- package/dist/utils/league-join-warning.js.map +1 -1
- package/dist/utils/schedules.d.ts.map +1 -1
- package/dist/utils/schedules.js +6 -2
- package/dist/utils/schedules.js.map +1 -1
- package/dist/utils/team-member-actions.d.ts.map +1 -1
- package/dist/utils/team-member-actions.js.map +1 -1
- package/package.json +5 -17
- package/dist/input-formats/index.d.ts.map +0 -1
- package/dist/input-formats/index.js.map +0 -1
- package/dist/migration-console/index.d.ts +0 -4
- package/dist/migration-console/index.d.ts.map +0 -1
- package/dist/migration-console/index.js +0 -5
- package/dist/migration-console/index.js.map +0 -1
- package/dist/types/documents.d.ts +0 -24
- package/dist/types/documents.d.ts.map +0 -1
- package/dist/types/documents.js +0 -5
- package/dist/types/documents.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"teams.d.ts","sourceRoot":"","sources":["../../src/schemas/teams.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"teams.d.ts","sourceRoot":"","sources":["../../src/schemas/teams.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqCxB,eAAO,MAAM,2B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AC,CAAC;AAG5F,eAAO,MAAM,uCAAuC;;;kBAEzC,CAAC;AACZ,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CACrD,OAAO,uCAAuC,CAC/C,CAAC;AAEF,eAAO,MAAM,wCAAwC;;;;kBAAoC,CAAC;AAC1F,MAAM,MAAM,kCAAkC,GAAG,2BAA2B,CAAC;AAK7E,eAAO,MAAM,gCAAgC;;kBAA8C,CAAC;AAC5F,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAK1F,eAAO,MAAM,iCAAiC;;;;kBAMnC,CAAC;AACZ,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAC;AAM5F,eAAO,MAAM,+BAA+B,4BAA6B,CAAC;AAC1E,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,+BAA+B,CAAC,CAAC,MAAM,CAAC,CAAC;AACvF,eAAO,MAAM,oCAAoC;;;;;kBAEtC,CAAC;AACZ,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC"}
|
package/dist/schemas/teams.js
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
// (BACKEND-004); an admin entry's schema adds only what its authority needs.
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { leagueJoinWarningActedOnSchema, leagueJoinWarningFindingSchema, } from '../utils/league-join-warning.js';
|
|
6
|
-
import { documentIdSegmentSchema, membershipRosterSyncStatusSchema } from '../doc-schemas/atoms.js';
|
|
6
|
+
import { countSchema, documentIdSegmentSchema, gameIdSchema, leagueIdSchema, membershipRosterSyncStatusSchema, teamIconSchema, teamIdSchema, teamRoleSchema, teamTypeSchema, userIdSchema, } from '../doc-schemas/atoms.js';
|
|
7
7
|
import { buildGhostUserIdForRequest, isGhostUserId } from '../ids/minted-ids.js';
|
|
8
8
|
import { isDocumentIdSegment } from '../paths/utils.js';
|
|
9
9
|
import { GHOST_LINK_MEMBERSHIP_OUTCOME_KEYS, GHOST_REMOVAL_REFUSAL_KEYS } from '../types/stats.js';
|
|
10
10
|
import { MEMBER_ASSIGNABLE_TEAM_ROLES } from '../types/unions.js';
|
|
11
|
-
import { contactPhoneSchema,
|
|
11
|
+
import { contactPhoneSchema, displayNameSchema, teamNameSchema } from './atoms.js';
|
|
12
12
|
// ---------------------------------------------------------------------------------------------
|
|
13
13
|
// Team creation — `createLeagueTeam` (the creator becomes captain) and `adminCreateLeagueTeam`
|
|
14
14
|
// (an admin creates the team with a newly minted ghost captain). Both write the team's contact
|
|
@@ -39,7 +39,11 @@ export const CreateLeagueTeamResultSchema = z
|
|
|
39
39
|
// One document-id segment (ARCH-106), short enough that the ghost id derived from it is one too.
|
|
40
40
|
export const ghostCreateRequestIdSchema = documentIdSegmentSchema.refine((requestId) => isDocumentIdSegment(buildGhostUserIdForRequest(requestId)), 'Not a ghost add request id.');
|
|
41
41
|
export const CreateTeamGhostPlayerInputSchema = z
|
|
42
|
-
.object({
|
|
42
|
+
.object({
|
|
43
|
+
teamId: teamIdSchema,
|
|
44
|
+
displayName: displayNameSchema,
|
|
45
|
+
requestId: ghostCreateRequestIdSchema,
|
|
46
|
+
})
|
|
43
47
|
.strict();
|
|
44
48
|
export const CreateGameGhostPlayerInputSchema = z
|
|
45
49
|
.object({
|
|
@@ -83,7 +87,9 @@ export const GetLeagueJoinWarningResultSchema = z
|
|
|
83
87
|
// ---------------------------------------------------------------------------------------------
|
|
84
88
|
// Roster reconciliation recovery — an admin puts a team's failed roster obligations back to work.
|
|
85
89
|
// ---------------------------------------------------------------------------------------------
|
|
86
|
-
export const AdminRetryLeagueTeamRosterSyncInputSchema = z
|
|
90
|
+
export const AdminRetryLeagueTeamRosterSyncInputSchema = z
|
|
91
|
+
.object({ teamId: teamIdSchema })
|
|
92
|
+
.strict();
|
|
87
93
|
export const AdminRetryLeagueTeamRosterSyncResultSchema = z
|
|
88
94
|
.object({
|
|
89
95
|
teamId: teamIdSchema,
|
|
@@ -140,7 +146,11 @@ export const ghostUserIdSchema = userIdSchema.refine(isGhostUserId, 'Not a ghost
|
|
|
140
146
|
// `updateTeamMembershipRole` (the captain) / `adminUpdateTeamMembershipRole`: promote a player to
|
|
141
147
|
// co-captain, or demote a co-captain to player.
|
|
142
148
|
export const UpdateTeamMembershipRoleInputSchema = z
|
|
143
|
-
.object({
|
|
149
|
+
.object({
|
|
150
|
+
teamId: teamIdSchema,
|
|
151
|
+
userId: userIdSchema,
|
|
152
|
+
role: z.enum(MEMBER_ASSIGNABLE_TEAM_ROLES),
|
|
153
|
+
})
|
|
144
154
|
.strict();
|
|
145
155
|
// `changed` is false when the member already held the role: nothing was written or recorded.
|
|
146
156
|
export const UpdateTeamMembershipRoleResultSchema = z
|
|
@@ -195,7 +205,10 @@ export const DeleteTeamGhostPlayerResultSchema = z
|
|
|
195
205
|
// removal already under way — `finishedGameEntriesRemoved`, the removal's count so far, as the result
|
|
196
206
|
// counts it. Those entries stay removed.
|
|
197
207
|
export const GhostRemovalRefusalDetailsSchema = z
|
|
198
|
-
.object({
|
|
208
|
+
.object({
|
|
209
|
+
reason: z.enum(GHOST_REMOVAL_REFUSAL_KEYS),
|
|
210
|
+
finishedGameEntriesRemoved: countSchema.optional(),
|
|
211
|
+
})
|
|
199
212
|
.strict();
|
|
200
213
|
// `adminUpdateLeagueTeamCaptain`: make a member of the team its captain. Every other captain the team
|
|
201
214
|
// holds becomes a player.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"teams.js","sourceRoot":"","sources":["../../src/schemas/teams.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,kGAAkG;AAClG,6EAA6E;AAE7E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,8BAA8B,EAC9B,8BAA8B,GAC/B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAA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AG,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 (ARCH-106). The entry, never a field of the payload, decides the authority\n// (BACKEND-004); an admin entry'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 { documentIdSegmentSchema, membershipRosterSyncStatusSchema } 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 {\n contactPhoneSchema,\n countSchema,\n displayNameSchema,\n gameIdSchema,\n leagueIdSchema,\n teamIconSchema,\n teamIdSchema,\n teamNameSchema,\n teamRoleSchema,\n teamTypeSchema,\n userIdSchema,\n} 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` /\n// `adminCreateTeamGhostPlayer`) needs authority over the team; the game page door\n// (`createGameGhostPlayer` / `adminCreateGameGhostPlayer`) needs scoring authority over the game\n// 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 (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({ teamId: teamIdSchema, displayName: displayNameSchema, requestId: ghostCreateRequestIdSchema })\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.object({ teamId: teamIdSchema }).strict();\nexport type AdminRetryLeagueTeamRosterSyncInput = z.infer<typeof AdminRetryLeagueTeamRosterSyncInputSchema>;\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<typeof AdminRetryLeagueTeamRosterSyncResultSchema>;\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 (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 each have a member entry — the team's\n// captain or a co-captain, read from their membership — and an admin entry; 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 (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) / `adminUpdateTeamMembershipRole`: promote a player to\n// co-captain, or demote a co-captain to player.\nexport const UpdateTeamMembershipRoleInputSchema = z\n .object({ teamId: teamIdSchema, userId: userIdSchema, role: z.enum(MEMBER_ASSIGNABLE_TEAM_ROLES) })\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 or a co-captain) / `adminDeleteTeamMembership`: remove a real\n// player from the team. A ghost is removed through its own action, below.\nexport const DeleteTeamMembershipInputSchema = z\n .object({\n teamId: teamIdSchema,\n userId: userIdSchema.refine((userId) => !isGhostUserId(userId), 'A ghost player is removed as a ghost player.'),\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 or a co-captain) / `adminDeleteTeamGhostPlayer`: remove a ghost\n// that has never 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 (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({ reason: z.enum(GHOST_REMOVAL_REFUSAL_KEYS), finishedGameEntriesRemoved: countSchema.optional() })\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<typeof AdminUpdateLeagueTeamCaptainInputSchema>;\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<typeof AdminUpdateLeagueTeamCaptainResultSchema>;\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<typeof AdminUpdateLeagueTeamContactInputSchema>;\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 (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,mGAAmG;AACnG,kGAAkG;AAClG,6EAA6E;AAE7E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,8BAA8B,EAC9B,8BAA8B,GAC/B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,WAAW,EACX,uBAAuB,EACvB,YAAY,EACZ,cAAc,EACd,gCAAgC,EAChC,cAAc,EACd,YAAY,EACZ,cAAc,EACd,cAA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AAE;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 (ARCH-106). The entry, never a field of the payload, decides the authority\n// (BACKEND-004); an admin entry'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` /\n// `adminCreateTeamGhostPlayer`) needs authority over the team; the game page door\n// (`createGameGhostPlayer` / `adminCreateGameGhostPlayer`) needs scoring authority over the game\n// 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 (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 (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 each have a member entry — the team's\n// captain or a co-captain, read from their membership — and an admin entry; 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 (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) / `adminUpdateTeamMembershipRole`: promote a player to\n// co-captain, or demote a 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 or a co-captain) / `adminDeleteTeamMembership`: remove a real\n// player from the 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 or a co-captain) / `adminDeleteTeamGhostPlayer`: remove a ghost\n// that has never 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 (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 (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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploads.d.ts","sourceRoot":"","sources":["../../src/schemas/uploads.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
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,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AO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;kBAyBpC,CAAC;AACL,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,eAAO,MAAM,4BAA4B;;;kBAO9B,CAAC;AACZ,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAOlF,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;AAG1F,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"}
|
package/dist/schemas/uploads.js
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
// id, and every path the picture is later written to is derived on the server.
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
import { ClientMediaClaimSchema } from '@ttt-productions/media-schemas';
|
|
8
|
-
import { MAX_STAGING_UPLOAD_PATH_LENGTH, MAX_UPLOADS_MARKED_SEEN_PER_CALL } from '../constants/media.js';
|
|
9
|
-
import { countSchema, leagueIdSchema, stagingIdSchema, teamIdSchema } from '../doc-schemas/atoms.js';
|
|
8
|
+
import { MAX_STAGING_UPLOAD_PATH_LENGTH, MAX_UPLOADS_MARKED_SEEN_PER_CALL, } from '../constants/media.js';
|
|
9
|
+
import { countSchema, leagueIdSchema, stagingIdSchema, teamIdSchema, } from '../doc-schemas/atoms.js';
|
|
10
10
|
import { awardIdSchema, awardNameSchema } from '../doc-schemas/catalogs.js';
|
|
11
11
|
import { gameLocationIdSchema } from '../doc-schemas/game-location.js';
|
|
12
12
|
import { pictureOriginSchema } from '../doc-schemas/pending-media.js';
|
|
@@ -18,12 +18,17 @@ export const LeaguePictureTargetInfoSchema = z.object({ leagueId: leagueIdSchema
|
|
|
18
18
|
export const TeamPictureTargetInfoSchema = z.object({ teamId: teamIdSchema }).strict();
|
|
19
19
|
// There is one landing page, so its target names nothing.
|
|
20
20
|
export const LandingPictureTargetInfoSchema = z.object({}).strict();
|
|
21
|
-
export const LocationPictureTargetInfoSchema = z
|
|
21
|
+
export const LocationPictureTargetInfoSchema = z
|
|
22
|
+
.object({ gameLocationId: gameLocationIdSchema })
|
|
23
|
+
.strict();
|
|
22
24
|
// A badge either replaces an existing award's (`awardId`) or creates the award it is the first badge
|
|
23
25
|
// of (`newAwardName`), whose id is the upload's staging id.
|
|
24
26
|
export const ExistingAwardBadgeTargetInfoSchema = z.object({ awardId: awardIdSchema }).strict();
|
|
25
27
|
export const NewAwardBadgeTargetInfoSchema = z.object({ newAwardName: awardNameSchema }).strict();
|
|
26
|
-
export const AwardBadgeTargetInfoSchema = z.union([
|
|
28
|
+
export const AwardBadgeTargetInfoSchema = z.union([
|
|
29
|
+
ExistingAwardBadgeTargetInfoSchema,
|
|
30
|
+
NewAwardBadgeTargetInfoSchema,
|
|
31
|
+
]);
|
|
27
32
|
function pictureTarget(schema, ownerKind, ownerId) {
|
|
28
33
|
return { schema, ownerKind, ownerId };
|
|
29
34
|
}
|
|
@@ -101,6 +106,8 @@ export const AdminMarkUploadsSeenInputSchema = z
|
|
|
101
106
|
.strict();
|
|
102
107
|
export const AdminMarkUploadsSeenResultSchema = z.object({ marked: countSchema }).strict();
|
|
103
108
|
// Clears one of the caller's finished uploads from the tray.
|
|
104
|
-
export const AdminClearUploadActivityInputSchema = z
|
|
109
|
+
export const AdminClearUploadActivityInputSchema = z
|
|
110
|
+
.object({ pendingMediaId: stagingIdSchema })
|
|
111
|
+
.strict();
|
|
105
112
|
export const AdminClearUploadActivityResultSchema = z.object({ cleared: z.literal(true) }).strict();
|
|
106
113
|
//# sourceMappingURL=uploads.js.map
|
|
@@ -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,+EAA+E;AAE/E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,8BAA8B,EAAE,gCAAgC,EAAE,MAAM,uBAAuB,CAAC;AACzG,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACrG,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,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;AAE7F,uEAAuE;AACvE,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAC7F,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE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AA6D;AAC7D,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAE1G,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 { MAX_STAGING_UPLOAD_PATH_LENGTH, MAX_UPLOADS_MARKED_SEEN_PER_CALL } from '../constants/media.js';\nimport { countSchema, leagueIdSchema, stagingIdSchema, teamIdSchema } 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.object({ gameLocationId: gameLocationIdSchema }).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([ExistingAwardBadgeTargetInfoSchema, NewAwardBadgeTargetInfoSchema]);\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(LeaguePictureTargetInfoSchema, 'sportLeague', (target) => target.leagueId),\n 'team-picture': pictureTarget(TeamPictureTargetInfoSchema, 'leagueTeam', (target) => target.teamId),\n 'landing-picture': pictureTarget(LandingPictureTargetInfoSchema, 'landingPage', () => SPECIAL_DOCS.LANDING_PAGE),\n 'location-picture': pictureTarget(\n LocationPictureTargetInfoSchema,\n 'gameLocation',\n (target) => target.gameLocationId,\n ),\n 'award-badge': pictureTarget(AwardBadgeTargetInfoSchema, AWARD_DEFINITION_OWNER_KIND, (target, stagingId) => {\n if ('awardId' in target) return target.awardId;\n if (stagingId === undefined) throw new Error(\"A new award's id is its badge upload's staging id, which was not given.\");\n return stagingId;\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(fileOrigin: PictureOrigin, targetInfo: unknown, stagingId?: string): 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.object({ pendingMediaId: stagingIdSchema }).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,qDAAqD;AACrD,EAAE;AACF,sGAAsG;AACtG,oGAAoG;AACpG,+EAA+E;AAE/E,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,E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,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../src/schemas/users.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
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,CAA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
import { MAX_ADMIN_LIST_CHANGES } from '../constants/business.js';
|
|
4
|
-
import { userStatusSchema } from '../doc-schemas/atoms.js';
|
|
5
|
-
import {
|
|
4
|
+
import { countSchema, repairReasonSchema, userIdSchema, userStatusSchema, } from '../doc-schemas/atoms.js';
|
|
5
|
+
import { displayNameSchema } from './atoms.js';
|
|
6
6
|
// The signed-in caller finishes registration: profile, public identity, and the display-name
|
|
7
7
|
// reservation are created for `request.auth.uid`. Email comes from the token, never the payload.
|
|
8
8
|
export const RegisterUserInputSchema = z
|
|
@@ -14,7 +14,9 @@ export const RegisterUserInputSchema = z
|
|
|
14
14
|
.strict();
|
|
15
15
|
export const RegisterUserResultSchema = z.discriminatedUnion('status', [
|
|
16
16
|
// The account is registered (or already was — an idempotent replay).
|
|
17
|
-
z
|
|
17
|
+
z
|
|
18
|
+
.object({ status: z.literal('registered'), userId: userIdSchema, displayName: z.string() })
|
|
19
|
+
.strict(),
|
|
18
20
|
// The orphan-registration cleanup claimed this login for deletion, so the registration cannot
|
|
19
21
|
// finish on it; nothing is written and the person signs up again.
|
|
20
22
|
z.object({ status: z.literal('registrationExpired') }).strict(),
|
|
@@ -23,7 +25,9 @@ export const RegisterUserResultSchema = z.discriminatedUnion('status', [
|
|
|
23
25
|
// account exists, over the same name rule `registerUser` takes, and is a soft answer — the claim
|
|
24
26
|
// itself is `registerUser`'s transaction, which refuses `already-exists` when two registrations
|
|
25
27
|
// pass this check at once.
|
|
26
|
-
export const CheckDisplayNameAvailableInputSchema = z
|
|
28
|
+
export const CheckDisplayNameAvailableInputSchema = z
|
|
29
|
+
.object({ displayName: displayNameSchema })
|
|
30
|
+
.strict();
|
|
27
31
|
// Why a name is not available. Uniqueness is the only rule a Q-Sports name is held to beyond its
|
|
28
32
|
// input format.
|
|
29
33
|
export const DISPLAY_NAME_UNAVAILABLE_REASONS = ['taken'];
|
|
@@ -62,7 +66,9 @@ export const LookedUpUserSchema = z
|
|
|
62
66
|
})
|
|
63
67
|
.strict();
|
|
64
68
|
// The one exact match, or `null` when no account with a profile resolves.
|
|
65
|
-
export const LookupUserByEmailOrUidResultSchema = z
|
|
69
|
+
export const LookupUserByEmailOrUidResultSchema = z
|
|
70
|
+
.object({ user: LookedUpUserSchema.nullable() })
|
|
71
|
+
.strict();
|
|
66
72
|
// An admin searches accounts by the start of their name, over public display identity. Ghosts are
|
|
67
73
|
// not accounts and are left out; a banned account is found, with its status.
|
|
68
74
|
export const SearchPublicUsersInputSchema = z
|
|
@@ -71,12 +77,16 @@ export const SearchPublicUsersInputSchema = z
|
|
|
71
77
|
export const PublicUserSearchResultSchema = z
|
|
72
78
|
.object({ uid: userIdSchema, displayName: z.string(), userStatus: userStatusSchema })
|
|
73
79
|
.strict();
|
|
74
|
-
export const SearchPublicUsersResultSchema = z
|
|
80
|
+
export const SearchPublicUsersResultSchema = z
|
|
81
|
+
.object({ users: z.array(PublicUserSearchResultSchema) })
|
|
82
|
+
.strict();
|
|
75
83
|
// An admin renames a user. Self-service rename is not a Q-Sports feature.
|
|
76
84
|
export const UpdateDisplayNameInputSchema = z
|
|
77
85
|
.object({ userId: userIdSchema, newDisplayName: displayNameSchema })
|
|
78
86
|
.strict();
|
|
79
|
-
export const UpdateDisplayNameResultSchema = z
|
|
87
|
+
export const UpdateDisplayNameResultSchema = z
|
|
88
|
+
.object({ userId: userIdSchema, displayName: z.string() })
|
|
89
|
+
.strict();
|
|
80
90
|
// An admin grants or revokes the two global roles on `_systemData/adminList`. Four named lists —
|
|
81
91
|
// never a role/action discriminator (BACKEND-002).
|
|
82
92
|
const adminListChangeSchema = z.array(userIdSchema).max(MAX_ADMIN_LIST_CHANGES).optional();
|
|
@@ -121,7 +131,11 @@ export const CreateRegistrationStartInputSchema = z.object({}).strict();
|
|
|
121
131
|
// `started` wrote both records; `alreadyStarted` found the registration already started and wrote
|
|
122
132
|
// nothing — a retry, or a resume after a later step failed; `registrationExpired` found the login
|
|
123
133
|
// claimed by the orphan-registration cleanup and wrote nothing — the person signs up again.
|
|
124
|
-
export const REGISTRATION_START_OUTCOMES = [
|
|
134
|
+
export const REGISTRATION_START_OUTCOMES = [
|
|
135
|
+
'started',
|
|
136
|
+
'alreadyStarted',
|
|
137
|
+
'registrationExpired',
|
|
138
|
+
];
|
|
125
139
|
export const CreateRegistrationStartResultSchema = z
|
|
126
140
|
.object({ outcome: z.enum(REGISTRATION_START_OUTCOMES) })
|
|
127
141
|
.strict();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"users.js","sourceRoot":"","sources":["../../src/schemas/users.ts"],"names":[],"mappings":"AAAA,oEAAoE;AAEpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE9F,6FAA6F;AAC7F,iGAAiG;AACjG,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC;KACrC,MAAM,CAAC;IACN,WAAW,EAAE,iBAAiB;IAC9B,qEAAqE;IACrE,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;CAC/B,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,kBAAkB,CAAC,QAAQ,EAAE;IACrE,qEAAqE;IACrE,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACrG,8FAA8F;IAC9F,kEAAkE;IAClE,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAAC,E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O,EAAE;CACrB,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,oGAAoG;AACpG,iDAAiD;AACjD,MAAM,CAAC,MAAM,iCAAiC,GAAG,qBAAqB,CAAC;AAEvE,mGAAmG;AACnG,mGAAmG;AACnG,yFAAyF;AACzF,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAExE,kGAAkG;AAClG,kGAAkG;AAClG,4FAA4F;AAC5F,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,SAAS,EAAE,gBAAgB,EAAE,qBAAqB,CAAU,CAAC;AAEzG,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC;KACjD,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,2BAA2B,CAAC,EAAE,CAAC;KACxD,MAAM,EAAE,CAAC","sourcesContent":["// Callable contracts for user accounts and the global role rosters.\n\nimport { z } from 'zod';\nimport { MAX_ADMIN_LIST_CHANGES } from '../constants/business.js';\nimport { userStatusSchema } from '../doc-schemas/atoms.js';\nimport { countSchema, displayNameSchema, repairReasonSchema, userIdSchema } from './atoms.js';\n\n// The signed-in caller finishes registration: profile, public identity, and the display-name\n// reservation are created for `request.auth.uid`. Email comes from the token, never the payload.\nexport const RegisterUserInputSchema = z\n .object({\n displayName: displayNameSchema,\n // The terms checkbox, re-checked server-side: only `true` registers.\n acceptedTerms: z.literal(true),\n })\n .strict();\nexport type RegisterUserInput = z.infer<typeof RegisterUserInputSchema>;\nexport const RegisterUserResultSchema = z.discriminatedUnion('status', [\n // The account is registered (or already was — an idempotent replay).\n z.object({ status: z.literal('registered'), userId: userIdSchema, displayName: z.string() }).strict(),\n // The orphan-registration cleanup claimed this login for deletion, so the registration cannot\n // finish on it; nothing is written and the person signs up again.\n z.object({ status: z.literal('registrationExpired') }).strict(),\n]);\nexport type RegisterUserResult = z.infer<typeof RegisterUserResultSchema>;\n\n// The register form's check before the login is created: is the name free? It runs before any\n// account exists, over the same name rule `registerUser` takes, and is a soft answer — the claim\n// itself is `registerUser`'s transaction, which refuses `already-exists` when two registrations\n// pass this check at once.\nexport const CheckDisplayNameAvailableInputSchema = z.object({ displayName: displayNameSchema }).strict();\nexport type CheckDisplayNameAvailableInput = z.infer<typeof CheckDisplayNameAvailableInputSchema>;\n// Why a name is not available. Uniqueness is the only rule a Q-Sports name is held to beyond its\n// input format.\nexport const DISPLAY_NAME_UNAVAILABLE_REASONS = ['taken'] as const;\nexport type DisplayNameUnavailableReason = (typeof DISPLAY_NAME_UNAVAILABLE_REASONS)[number];\nexport const CheckDisplayNameAvailableResultSchema = z\n .object({ available: z.boolean(), reason: z.enum(DISPLAY_NAME_UNAVAILABLE_REASONS).optional() })\n .strict();\nexport type CheckDisplayNameAvailableResult = z.infer<typeof CheckDisplayNameAvailableResultSchema>;\n\n/** The longest text an admin's account search takes: a name, a full email address, or a uid. */\nexport const MAX_USER_SEARCH_QUERY_LENGTH = 100;\n\n// Which read an admin's account search routes to: a full email address or a 28-character Firebase\n// Auth uid is an exact lookup (`lookupUserByEmailOrUid`), anything else a name search. Declared once:\n// the search box routes by it and the lookup callable re-derives the same answer, so a mis-routed\n// request never looks an email up as a uid or the other way round.\nexport const USER_LOOKUP_EMAIL_PATTERN = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\nexport const USER_LOOKUP_UID_PATTERN = /^[A-Za-z0-9]{28}$/;\nexport type UserSearchKind = 'email' | 'uid' | 'name';\nexport function detectUserSearchKind(query: string): UserSearchKind {\n const trimmed = query.trim();\n if (USER_LOOKUP_EMAIL_PATTERN.test(trimmed)) return 'email';\n if (USER_LOOKUP_UID_PATTERN.test(trimmed)) return 'uid';\n return 'name';\n}\n\n// An admin finds one account by its exact email address or its uid. The answer carries the\n// owner-only email, so it is admin only.\nexport const LookupUserByEmailOrUidInputSchema = z\n .object({ query: z.string().trim().min(1).max(MAX_USER_SEARCH_QUERY_LENGTH) })\n .strict();\nexport type LookupUserByEmailOrUidInput = z.infer<typeof LookupUserByEmailOrUidInputSchema>;\nexport const LookedUpUserSchema = z\n .object({\n uid: userIdSchema,\n displayName: z.string(),\n email: z.string(),\n userStatus: userStatusSchema,\n // Present, and true, only for an account on the admin roster.\n isAdmin: z.literal(true).optional(),\n })\n .strict();\nexport type LookedUpUser = z.infer<typeof LookedUpUserSchema>;\n// The one exact match, or `null` when no account with a profile resolves.\nexport const LookupUserByEmailOrUidResultSchema = z.object({ user: LookedUpUserSchema.nullable() }).strict();\nexport type LookupUserByEmailOrUidResult = z.infer<typeof LookupUserByEmailOrUidResultSchema>;\n\n// An admin searches accounts by the start of their name, over public display identity. Ghosts are\n// not accounts and are left out; a banned account is found, with its status.\nexport const SearchPublicUsersInputSchema = z\n .object({ query: z.string().trim().min(1).max(MAX_USER_SEARCH_QUERY_LENGTH) })\n .strict();\nexport type SearchPublicUsersInput = z.infer<typeof SearchPublicUsersInputSchema>;\nexport const PublicUserSearchResultSchema = z\n .object({ uid: userIdSchema, displayName: z.string(), userStatus: userStatusSchema })\n .strict();\nexport type PublicUserSearchResult = z.infer<typeof PublicUserSearchResultSchema>;\nexport const SearchPublicUsersResultSchema = z.object({ users: z.array(PublicUserSearchResultSchema) }).strict();\nexport type SearchPublicUsersResult = z.infer<typeof SearchPublicUsersResultSchema>;\n\n// An admin renames a user. Self-service rename is not a Q-Sports feature.\nexport const UpdateDisplayNameInputSchema = z\n .object({ userId: userIdSchema, newDisplayName: displayNameSchema })\n .strict();\nexport type UpdateDisplayNameInput = z.infer<typeof UpdateDisplayNameInputSchema>;\nexport const UpdateDisplayNameResultSchema = z.object({ userId: userIdSchema, displayName: z.string() }).strict();\nexport type UpdateDisplayNameResult = z.infer<typeof UpdateDisplayNameResultSchema>;\n\n// An admin grants or revokes the two global roles on `_systemData/adminList`. Four named lists —\n// never a role/action discriminator (BACKEND-002).\nconst adminListChangeSchema = z.array(userIdSchema).max(MAX_ADMIN_LIST_CHANGES).optional();\nexport const UpdateAdminListInputSchema = z\n .object({\n addAdmins: adminListChangeSchema,\n removeAdmins: adminListChangeSchema,\n addReferees: adminListChangeSchema,\n removeReferees: adminListChangeSchema,\n })\n .strict();\nexport type UpdateAdminListInput = z.infer<typeof UpdateAdminListInputSchema>;\nexport const UpdateAdminListResultSchema = z\n .object({\n adminsGranted: countSchema,\n adminsRevoked: countSchema,\n refereesGranted: countSchema,\n refereesRevoked: countSchema,\n })\n .strict();\nexport type UpdateAdminListResult = z.infer<typeof UpdateAdminListResultSchema>;\n\n// An admin bans an account or lifts its ban. The reason is internal — recorded on the audit event,\n// never shown to the account (BACKEND-212). Banning or unbanning to the status the account already\n// holds changes nothing.\nexport const AdminUpdateUserStatusInputSchema = z\n .object({ userId: userIdSchema, userStatus: userStatusSchema, reason: repairReasonSchema })\n .strict();\nexport type AdminUpdateUserStatusInput = z.infer<typeof AdminUpdateUserStatusInputSchema>;\n\n// `changed` is whether the status moved.\nexport const AdminUpdateUserStatusResultSchema = z\n .object({\n userId: userIdSchema,\n userStatus: userStatusSchema,\n previousStatus: userStatusSchema,\n changed: z.boolean(),\n })\n .strict();\nexport type AdminUpdateUserStatusResult = z.infer<typeof AdminUpdateUserStatusResultSchema>;\n\n// The `details.reason` of the refusal to ban an account that holds admin standing (BACKEND-210), so\n// a client can tell it from every other refusal.\nexport const ADMIN_STANDING_BAN_REFUSAL_REASON = 'adminStandingTarget';\n\n// A signed-in login with no profile starts its registration, before `registerUser`: the record the\n// orphan-login cleanup finds it by, and the owner-only private record `registerUser` requires. The\n// caller is `request.auth.uid` and the email comes from its token, so it takes no input.\nexport const CreateRegistrationStartInputSchema = z.object({}).strict();\nexport type CreateRegistrationStartInput = z.infer<typeof CreateRegistrationStartInputSchema>;\n// `started` wrote both records; `alreadyStarted` found the registration already started and wrote\n// nothing — a retry, or a resume after a later step failed; `registrationExpired` found the login\n// claimed by the orphan-registration cleanup and wrote nothing — the person signs up again.\nexport const REGISTRATION_START_OUTCOMES = ['started', 'alreadyStarted', 'registrationExpired'] as const;\nexport type RegistrationStartOutcome = (typeof REGISTRATION_START_OUTCOMES)[number];\nexport const CreateRegistrationStartResultSchema = z\n .object({ outcome: z.enum(REGISTRATION_START_OUTCOMES) })\n .strict();\nexport type CreateRegistrationStartResult = z.infer<typeof CreateRegistrationStartResultSchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"users.js","sourceRoot":"","sources":["../../src/schemas/users.ts"],"names":[],"mappings":"AAAA,oEAAoE;AAEpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,GACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,6FAA6F;AAC7F,iGAAiG;AACjG,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC;KACrC,MAAM,CAAC;IACN,WAAW,EAAE,iBAAiB;IAC9B,qEAAqE;IACrE,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;CAC/B,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,kBAAkB,CAAC,QAAQ,EAAE;IACrE,qEAAqE;IACrE,CAAC;SACE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;SAC1F,MAAM,EAAE;IACX,8FAA8F;IAC9F,kEAAkE;IAClE,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE;CAChE,CAAC,CAAC;AAGH,8FAA8F;AAC9F,iGAAiG;A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AACjD,MAAM,CAAC,MAAM,iCAAiC,GAAG,qBAAqB,CAAC;AAEvE,mGAAmG;AACnG,mGAAmG;AACnG,yFAAyF;AACzF,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAExE,kGAAkG;AAClG,kGAAkG;AAClG,4FAA4F;AAC5F,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,SAAS;IACT,gBAAgB;IAChB,qBAAqB;CACb,CAAC;AAEX,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC;KACjD,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,2BAA2B,CAAC,EAAE,CAAC;KACxD,MAAM,EAAE,CAAC","sourcesContent":["// Callable contracts for user accounts and the global role rosters.\n\nimport { z } from 'zod';\nimport { MAX_ADMIN_LIST_CHANGES } from '../constants/business.js';\nimport {\n countSchema,\n repairReasonSchema,\n userIdSchema,\n userStatusSchema,\n} from '../doc-schemas/atoms.js';\nimport { displayNameSchema } from './atoms.js';\n\n// The signed-in caller finishes registration: profile, public identity, and the display-name\n// reservation are created for `request.auth.uid`. Email comes from the token, never the payload.\nexport const RegisterUserInputSchema = z\n .object({\n displayName: displayNameSchema,\n // The terms checkbox, re-checked server-side: only `true` registers.\n acceptedTerms: z.literal(true),\n })\n .strict();\nexport type RegisterUserInput = z.infer<typeof RegisterUserInputSchema>;\nexport const RegisterUserResultSchema = z.discriminatedUnion('status', [\n // The account is registered (or already was — an idempotent replay).\n z\n .object({ status: z.literal('registered'), userId: userIdSchema, displayName: z.string() })\n .strict(),\n // The orphan-registration cleanup claimed this login for deletion, so the registration cannot\n // finish on it; nothing is written and the person signs up again.\n z.object({ status: z.literal('registrationExpired') }).strict(),\n]);\nexport type RegisterUserResult = z.infer<typeof RegisterUserResultSchema>;\n\n// The register form's check before the login is created: is the name free? It runs before any\n// account exists, over the same name rule `registerUser` takes, and is a soft answer — the claim\n// itself is `registerUser`'s transaction, which refuses `already-exists` when two registrations\n// pass this check at once.\nexport const CheckDisplayNameAvailableInputSchema = z\n .object({ displayName: displayNameSchema })\n .strict();\nexport type CheckDisplayNameAvailableInput = z.infer<typeof CheckDisplayNameAvailableInputSchema>;\n// Why a name is not available. Uniqueness is the only rule a Q-Sports name is held to beyond its\n// input format.\nexport const DISPLAY_NAME_UNAVAILABLE_REASONS = ['taken'] as const;\nexport type DisplayNameUnavailableReason = (typeof DISPLAY_NAME_UNAVAILABLE_REASONS)[number];\nexport const CheckDisplayNameAvailableResultSchema = z\n .object({ available: z.boolean(), reason: z.enum(DISPLAY_NAME_UNAVAILABLE_REASONS).optional() })\n .strict();\nexport type CheckDisplayNameAvailableResult = z.infer<typeof CheckDisplayNameAvailableResultSchema>;\n\n/** The longest text an admin's account search takes: a name, a full email address, or a uid. */\nexport const MAX_USER_SEARCH_QUERY_LENGTH = 100;\n\n// Which read an admin's account search routes to: a full email address or a 28-character Firebase\n// Auth uid is an exact lookup (`lookupUserByEmailOrUid`), anything else a name search. Declared once:\n// the search box routes by it and the lookup callable re-derives the same answer, so a mis-routed\n// request never looks an email up as a uid or the other way round.\nexport const USER_LOOKUP_EMAIL_PATTERN = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\nexport const USER_LOOKUP_UID_PATTERN = /^[A-Za-z0-9]{28}$/;\nexport type UserSearchKind = 'email' | 'uid' | 'name';\nexport function detectUserSearchKind(query: string): UserSearchKind {\n const trimmed = query.trim();\n if (USER_LOOKUP_EMAIL_PATTERN.test(trimmed)) return 'email';\n if (USER_LOOKUP_UID_PATTERN.test(trimmed)) return 'uid';\n return 'name';\n}\n\n// An admin finds one account by its exact email address or its uid. The answer carries the\n// owner-only email, so it is admin only.\nexport const LookupUserByEmailOrUidInputSchema = z\n .object({ query: z.string().trim().min(1).max(MAX_USER_SEARCH_QUERY_LENGTH) })\n .strict();\nexport type LookupUserByEmailOrUidInput = z.infer<typeof LookupUserByEmailOrUidInputSchema>;\nexport const LookedUpUserSchema = z\n .object({\n uid: userIdSchema,\n displayName: z.string(),\n email: z.string(),\n userStatus: userStatusSchema,\n // Present, and true, only for an account on the admin roster.\n isAdmin: z.literal(true).optional(),\n })\n .strict();\nexport type LookedUpUser = z.infer<typeof LookedUpUserSchema>;\n// The one exact match, or `null` when no account with a profile resolves.\nexport const LookupUserByEmailOrUidResultSchema = z\n .object({ user: LookedUpUserSchema.nullable() })\n .strict();\nexport type LookupUserByEmailOrUidResult = z.infer<typeof LookupUserByEmailOrUidResultSchema>;\n\n// An admin searches accounts by the start of their name, over public display identity. Ghosts are\n// not accounts and are left out; a banned account is found, with its status.\nexport const SearchPublicUsersInputSchema = z\n .object({ query: z.string().trim().min(1).max(MAX_USER_SEARCH_QUERY_LENGTH) })\n .strict();\nexport type SearchPublicUsersInput = z.infer<typeof SearchPublicUsersInputSchema>;\nexport const PublicUserSearchResultSchema = z\n .object({ uid: userIdSchema, displayName: z.string(), userStatus: userStatusSchema })\n .strict();\nexport type PublicUserSearchResult = z.infer<typeof PublicUserSearchResultSchema>;\nexport const SearchPublicUsersResultSchema = z\n .object({ users: z.array(PublicUserSearchResultSchema) })\n .strict();\nexport type SearchPublicUsersResult = z.infer<typeof SearchPublicUsersResultSchema>;\n\n// An admin renames a user. Self-service rename is not a Q-Sports feature.\nexport const UpdateDisplayNameInputSchema = z\n .object({ userId: userIdSchema, newDisplayName: displayNameSchema })\n .strict();\nexport type UpdateDisplayNameInput = z.infer<typeof UpdateDisplayNameInputSchema>;\nexport const UpdateDisplayNameResultSchema = z\n .object({ userId: userIdSchema, displayName: z.string() })\n .strict();\nexport type UpdateDisplayNameResult = z.infer<typeof UpdateDisplayNameResultSchema>;\n\n// An admin grants or revokes the two global roles on `_systemData/adminList`. Four named lists —\n// never a role/action discriminator (BACKEND-002).\nconst adminListChangeSchema = z.array(userIdSchema).max(MAX_ADMIN_LIST_CHANGES).optional();\nexport const UpdateAdminListInputSchema = z\n .object({\n addAdmins: adminListChangeSchema,\n removeAdmins: adminListChangeSchema,\n addReferees: adminListChangeSchema,\n removeReferees: adminListChangeSchema,\n })\n .strict();\nexport type UpdateAdminListInput = z.infer<typeof UpdateAdminListInputSchema>;\nexport const UpdateAdminListResultSchema = z\n .object({\n adminsGranted: countSchema,\n adminsRevoked: countSchema,\n refereesGranted: countSchema,\n refereesRevoked: countSchema,\n })\n .strict();\nexport type UpdateAdminListResult = z.infer<typeof UpdateAdminListResultSchema>;\n\n// An admin bans an account or lifts its ban. The reason is internal — recorded on the audit event,\n// never shown to the account (BACKEND-212). Banning or unbanning to the status the account already\n// holds changes nothing.\nexport const AdminUpdateUserStatusInputSchema = z\n .object({ userId: userIdSchema, userStatus: userStatusSchema, reason: repairReasonSchema })\n .strict();\nexport type AdminUpdateUserStatusInput = z.infer<typeof AdminUpdateUserStatusInputSchema>;\n\n// `changed` is whether the status moved.\nexport const AdminUpdateUserStatusResultSchema = z\n .object({\n userId: userIdSchema,\n userStatus: userStatusSchema,\n previousStatus: userStatusSchema,\n changed: z.boolean(),\n })\n .strict();\nexport type AdminUpdateUserStatusResult = z.infer<typeof AdminUpdateUserStatusResultSchema>;\n\n// The `details.reason` of the refusal to ban an account that holds admin standing (BACKEND-210), so\n// a client can tell it from every other refusal.\nexport const ADMIN_STANDING_BAN_REFUSAL_REASON = 'adminStandingTarget';\n\n// A signed-in login with no profile starts its registration, before `registerUser`: the record the\n// orphan-login cleanup finds it by, and the owner-only private record `registerUser` requires. The\n// caller is `request.auth.uid` and the email comes from its token, so it takes no input.\nexport const CreateRegistrationStartInputSchema = z.object({}).strict();\nexport type CreateRegistrationStartInput = z.infer<typeof CreateRegistrationStartInputSchema>;\n// `started` wrote both records; `alreadyStarted` found the registration already started and wrote\n// nothing — a retry, or a resume after a later step failed; `registrationExpired` found the login\n// claimed by the orphan-registration cleanup and wrote nothing — the person signs up again.\nexport const REGISTRATION_START_OUTCOMES = [\n 'started',\n 'alreadyStarted',\n 'registrationExpired',\n] as const;\nexport type RegistrationStartOutcome = (typeof REGISTRATION_START_OUTCOMES)[number];\nexport const CreateRegistrationStartResultSchema = z\n .object({ outcome: z.enum(REGISTRATION_START_OUTCOMES) })\n .strict();\nexport type CreateRegistrationStartResult = z.infer<typeof CreateRegistrationStartResultSchema>;\n"]}
|
|
@@ -3,7 +3,7 @@ import { z } from 'zod';
|
|
|
3
3
|
import { textFieldSchema } from '../doc-schemas/atoms.js';
|
|
4
4
|
import { waiverTemplateIdSchema, waiverTemplateVersionNumberSchema, } from '../doc-schemas/waiver-template.js';
|
|
5
5
|
import { WAIVER_TEMPLATE_DELETE_OUTCOME_KEYS } from '../types/unions.js';
|
|
6
|
-
import { WAIVER_TEMPLATE_TEXT_INPUT_FORMAT, WAIVER_TEMPLATE_TITLE_INPUT_FORMAT, } from '../input-formats/
|
|
6
|
+
import { WAIVER_TEMPLATE_TEXT_INPUT_FORMAT, WAIVER_TEMPLATE_TITLE_INPUT_FORMAT, } from '../input-formats/input-formats.js';
|
|
7
7
|
export const waiverTemplateTitleSchema = textFieldSchema(WAIVER_TEMPLATE_TITLE_INPUT_FORMAT);
|
|
8
8
|
export const waiverTemplateTextSchema = textFieldSchema(WAIVER_TEMPLATE_TEXT_INPUT_FORMAT);
|
|
9
9
|
export const AdminCreateWaiverTemplateInputSchema = z
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"waiver-templates.js","sourceRoot":"","sources":["../../src/schemas/waiver-templates.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAE7F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EACL,sBAAsB,EACtB,iCAAiC,GAClC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,mCAAmC,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EACL,iCAAiC,EACjC,kCAAkC,GACnC,MAAM,
|
|
1
|
+
{"version":3,"file":"waiver-templates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AS,EAAE,CAAC,CAAC,OAAO,EAAE;CACvB,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC;KAClD,MAAM,CAAC,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,CAAC;KACpD,MAAM,EAAE,CAAC;AAEZ,MAAM,CAAC,MAAM,qCAAqC,GAAG,CAAC;KACnD,MAAM,CAAC;IACN,gBAAgB,EAAE,sBAAsB;IACxC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,mCAAmC,CAAC;CACrD,CAAC;KACD,MAAM,EAAE,CAAC","sourcesContent":["// Callable contracts for waiver templates: create, save new wording, and delete. Admin only.\n\nimport { z } from 'zod';\nimport { textFieldSchema } from '../doc-schemas/atoms.js';\nimport {\n waiverTemplateIdSchema,\n waiverTemplateVersionNumberSchema,\n} from '../doc-schemas/waiver-template.js';\nimport { WAIVER_TEMPLATE_DELETE_OUTCOME_KEYS } from '../types/unions.js';\nimport {\n WAIVER_TEMPLATE_TEXT_INPUT_FORMAT,\n WAIVER_TEMPLATE_TITLE_INPUT_FORMAT,\n} from '../input-formats/input-formats.js';\n\nexport const waiverTemplateTitleSchema = textFieldSchema(WAIVER_TEMPLATE_TITLE_INPUT_FORMAT);\nexport const waiverTemplateTextSchema = textFieldSchema(WAIVER_TEMPLATE_TEXT_INPUT_FORMAT);\n\nexport const AdminCreateWaiverTemplateInputSchema = z\n .object({ title: waiverTemplateTitleSchema, waiverText: waiverTemplateTextSchema })\n .strict();\nexport type AdminCreateWaiverTemplateInput = z.infer<typeof AdminCreateWaiverTemplateInputSchema>;\nexport const AdminCreateWaiverTemplateResultSchema = z\n .object({ waiverTemplateId: waiverTemplateIdSchema, version: waiverTemplateVersionNumberSchema })\n .strict();\nexport type AdminCreateWaiverTemplateResult = z.infer<typeof AdminCreateWaiverTemplateResultSchema>;\n\n// The template's whole wording as the admin wants it to read. Wording that differs from the current\n// version publishes the next version; the same wording changes nothing. `expectedVersion` is the\n// version the editor loaded: a save whose base is no longer current is refused, so a publication\n// never brings back wording another admin has since replaced.\nexport const AdminUpdateWaiverTemplateInputSchema = z\n .object({\n waiverTemplateId: waiverTemplateIdSchema,\n expectedVersion: waiverTemplateVersionNumberSchema,\n title: waiverTemplateTitleSchema,\n waiverText: waiverTemplateTextSchema,\n })\n .strict();\nexport type AdminUpdateWaiverTemplateInput = z.infer<typeof AdminUpdateWaiverTemplateInputSchema>;\nexport const AdminUpdateWaiverTemplateResultSchema = z\n .object({\n waiverTemplateId: waiverTemplateIdSchema,\n // The template's current version after the save.\n version: waiverTemplateVersionNumberSchema,\n // False when the wording matched the current version and nothing was written.\n published: z.boolean(),\n })\n .strict();\nexport type AdminUpdateWaiverTemplateResult = z.infer<typeof AdminUpdateWaiverTemplateResultSchema>;\n\nexport const AdminDeleteWaiverTemplateInputSchema = z\n .object({ waiverTemplateId: waiverTemplateIdSchema })\n .strict();\nexport type AdminDeleteWaiverTemplateInput = z.infer<typeof AdminDeleteWaiverTemplateInputSchema>;\nexport const AdminDeleteWaiverTemplateResultSchema = z\n .object({\n waiverTemplateId: waiverTemplateIdSchema,\n outcome: z.enum(WAIVER_TEMPLATE_DELETE_OUTCOME_KEYS),\n })\n .strict();\nexport type AdminDeleteWaiverTemplateResult = z.infer<typeof AdminDeleteWaiverTemplateResultSchema>;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basketball-scoring.d.ts","sourceRoot":"","sources":["../../src/sports/basketball-scoring.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"basketball-scoring.d.ts","sourceRoot":"","sources":["../../src/sports/basketball-scoring.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACV,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,EACd,MAAM,8BAA8B,CAAC;AAkBtC,OAAO,KAAK,EACV,uBAAuB,EAGxB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAIL,KAAK,oBAAoB,EAG1B,MAAM,iBAAiB,CAAC;AAMzB,OAAO,EASL,KAAK,YAAY,EAKlB,MAAM,cAAc,CAAC;AACtB,OAAO,EAGL,KAAK,wBAAwB,EAC7B,KAAK,UAAU,EAEf,KAAK,qBAAqB,EAE3B,MAAM,sBAAsB,CAAC;AAuB9B;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,IAAI,CAAC,qBAAqB,EAAE,uBAAuB,CAAC,GACzD,MAAM,CAKR;AAKD,wBAAgB,uBAAuB,IAAI,mBAAmB,CAI7D;AAuND,eAAO,MAAM,kBAAkB,EAAE,YAqBhC,CAAC;AAMF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQgC,CAAC;AAErE,eAAO,MAAM,uBAAuB;;;;;;;;;;CAGgD,CAAC;AAErF,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,qBAAqB,GAC7B,MAAM,CAiBR;AASD,eAAO,MAAM,qBAAqB,EAAE,UAwBnC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,wBAQtC,CAAC;AAMF,eAAO,MAAM,mCAAmC,yDACQ,CAAC;AAuCzD,eAAO,MAAM,qBAAqB,EAAE,oBA6CnC,CAAC"}
|