@ttt-productions/q-core 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants/business.d.ts +12 -0
- package/dist/constants/business.d.ts.map +1 -1
- package/dist/constants/business.js +24 -0
- package/dist/constants/business.js.map +1 -1
- package/dist/constants/media.d.ts +1 -0
- package/dist/constants/media.d.ts.map +1 -1
- package/dist/constants/media.js +5 -0
- package/dist/constants/media.js.map +1 -1
- package/dist/doc-schemas/admin-notifications.d.ts +1 -0
- package/dist/doc-schemas/admin-notifications.d.ts.map +1 -1
- package/dist/doc-schemas/admin-notifications.js +4 -0
- package/dist/doc-schemas/admin-notifications.js.map +1 -1
- package/dist/doc-schemas/atoms.d.ts +2 -0
- package/dist/doc-schemas/atoms.d.ts.map +1 -1
- package/dist/doc-schemas/audit-event.d.ts +2 -0
- package/dist/doc-schemas/audit-event.d.ts.map +1 -1
- package/dist/doc-schemas/gallery.d.ts +1 -0
- package/dist/doc-schemas/gallery.d.ts.map +1 -1
- package/dist/doc-schemas/gallery.js +3 -0
- package/dist/doc-schemas/gallery.js.map +1 -1
- package/dist/doc-schemas/migration-console.d.ts +2 -0
- package/dist/doc-schemas/migration-console.d.ts.map +1 -1
- package/dist/doc-schemas/migration-console.js +5 -0
- package/dist/doc-schemas/migration-console.js.map +1 -1
- package/dist/doc-schemas/pending-media.d.ts +1 -0
- package/dist/doc-schemas/pending-media.d.ts.map +1 -1
- package/dist/doc-schemas/pending-media.js +8 -0
- package/dist/doc-schemas/pending-media.js.map +1 -1
- package/dist/doc-schemas/registry.d.ts +12 -0
- package/dist/doc-schemas/registry.d.ts.map +1 -1
- package/dist/doc-schemas/stats-operation.d.ts.map +1 -1
- package/dist/doc-schemas/stats-operation.js +6 -11
- package/dist/doc-schemas/stats-operation.js.map +1 -1
- package/dist/doc-schemas/system.d.ts +7 -0
- package/dist/doc-schemas/system.d.ts.map +1 -1
- package/dist/doc-schemas/system.js +4 -1
- package/dist/doc-schemas/system.js.map +1 -1
- package/dist/doc-schemas/user-profile.d.ts +1 -0
- package/dist/doc-schemas/user-profile.d.ts.map +1 -1
- package/dist/doc-schemas/user-profile.js +5 -0
- package/dist/doc-schemas/user-profile.js.map +1 -1
- package/dist/doc-schemas/waiver-template.d.ts +1 -0
- package/dist/doc-schemas/waiver-template.d.ts.map +1 -1
- package/dist/doc-schemas/waiver-template.js +10 -1
- package/dist/doc-schemas/waiver-template.js.map +1 -1
- package/dist/doc-schemas/waivers-and-hardware.d.ts +1 -0
- package/dist/doc-schemas/waivers-and-hardware.d.ts.map +1 -1
- package/dist/doc-schemas/waivers-and-hardware.js +17 -9
- package/dist/doc-schemas/waivers-and-hardware.js.map +1 -1
- package/dist/ids/minted-ids.d.ts +1 -0
- package/dist/ids/minted-ids.d.ts.map +1 -1
- package/dist/ids/minted-ids.js +6 -0
- package/dist/ids/minted-ids.js.map +1 -1
- package/dist/input-formats/index.d.ts +2 -2
- package/dist/input-formats/index.d.ts.map +1 -1
- package/dist/input-formats/index.js +2 -2
- package/dist/input-formats/index.js.map +1 -1
- package/dist/notifications/archive-all.d.ts +2 -0
- package/dist/notifications/archive-all.d.ts.map +1 -0
- package/dist/notifications/archive-all.js +6 -0
- package/dist/notifications/archive-all.js.map +1 -0
- package/dist/notifications/index.d.ts +1 -0
- package/dist/notifications/index.d.ts.map +1 -1
- package/dist/notifications/index.js +1 -0
- package/dist/notifications/index.js.map +1 -1
- package/dist/schemas/admin-notifications.d.ts +1 -0
- package/dist/schemas/admin-notifications.d.ts.map +1 -1
- package/dist/schemas/admin-notifications.js +4 -2
- package/dist/schemas/admin-notifications.js.map +1 -1
- package/dist/schemas/app-config.d.ts +2 -2
- package/dist/schemas/app-config.d.ts.map +1 -1
- package/dist/schemas/app-config.js +9 -5
- package/dist/schemas/app-config.js.map +1 -1
- package/dist/schemas/awards.d.ts +16 -4
- package/dist/schemas/awards.d.ts.map +1 -1
- package/dist/schemas/awards.js +10 -6
- package/dist/schemas/awards.js.map +1 -1
- package/dist/schemas/game-locations.d.ts +4 -4
- package/dist/schemas/game-locations.d.ts.map +1 -1
- package/dist/schemas/game-locations.js +11 -3
- package/dist/schemas/game-locations.js.map +1 -1
- package/dist/schemas/migration-console.d.ts +1 -0
- package/dist/schemas/migration-console.d.ts.map +1 -1
- package/dist/schemas/pictures.d.ts +3 -0
- package/dist/schemas/pictures.d.ts.map +1 -1
- package/dist/schemas/stats.d.ts +2 -0
- package/dist/schemas/stats.d.ts.map +1 -1
- package/dist/schemas/teams.d.ts +3 -2
- package/dist/schemas/teams.d.ts.map +1 -1
- package/dist/schemas/teams.js +19 -9
- package/dist/schemas/teams.js.map +1 -1
- package/dist/schemas/users.d.ts +7 -3
- package/dist/schemas/users.d.ts.map +1 -1
- package/dist/schemas/users.js +10 -3
- package/dist/schemas/users.js.map +1 -1
- package/dist/schemas/waiver-templates.d.ts +1 -0
- package/dist/schemas/waiver-templates.d.ts.map +1 -1
- package/dist/schemas/waiver-templates.js +4 -1
- package/dist/schemas/waiver-templates.js.map +1 -1
- package/dist/sports/index.d.ts +1 -0
- package/dist/sports/index.d.ts.map +1 -1
- package/dist/sports/index.js +1 -0
- package/dist/sports/index.js.map +1 -1
- package/dist/sports/ledger-continuity.d.ts +13 -0
- package/dist/sports/ledger-continuity.d.ts.map +1 -0
- package/dist/sports/ledger-continuity.js +19 -0
- package/dist/sports/ledger-continuity.js.map +1 -0
- package/dist/types/audit.d.ts +1 -1
- package/dist/types/audit.d.ts.map +1 -1
- package/dist/types/audit.js +5 -2
- package/dist/types/audit.js.map +1 -1
- package/dist/types/unions.d.ts +4 -2
- package/dist/types/unions.d.ts.map +1 -1
- package/dist/types/unions.js +6 -0
- package/dist/types/unions.js.map +1 -1
- package/dist/upload-variables/index.d.ts +3 -0
- package/dist/upload-variables/index.d.ts.map +1 -0
- package/dist/upload-variables/index.js +3 -0
- package/dist/upload-variables/index.js.map +1 -0
- package/dist/upload-variables/on-progress.d.ts +4 -0
- package/dist/upload-variables/on-progress.d.ts.map +1 -0
- package/dist/upload-variables/on-progress.js +10 -0
- package/dist/upload-variables/on-progress.js.map +1 -0
- package/dist/upload-variables/picture-upload-variables.d.ts +32 -0
- package/dist/upload-variables/picture-upload-variables.d.ts.map +1 -0
- package/dist/upload-variables/picture-upload-variables.js +21 -0
- package/dist/upload-variables/picture-upload-variables.js.map +1 -0
- package/dist/utils/app-config.d.ts +17 -3
- package/dist/utils/app-config.d.ts.map +1 -1
- package/dist/utils/app-config.js +21 -14
- package/dist/utils/app-config.js.map +1 -1
- package/package.json +6 -2
package/dist/types/audit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../../src/types/audit.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,0EAA0E;AAC1E,EAAE;AACF,4FAA4F;AAC5F,iBAAiB;AAKjB,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,WAAW;IACX,wBAAwB;IACxB,yBAAyB;IACzB,6FAA6F;IAC7F,mCAAmC;IACnC,gEAAgE;IAChE,oBAAoB;IACpB,sBAAsB;IACtB,oFAAoF;IACpF,yBAAyB;IACzB,yBAAyB;IACzB,6BAA6B;IAC7B,4FAA4F;IAC5F,mBAAmB;IACnB,qBAAqB;IACrB,kEAAkE;IAClE,gBAAgB;IAChB,gBAAgB;IAChB,sBAAsB;IACtB,qBAAqB;IACrB,0EAA0E;IAC1E,wBAAwB;IACxB,iCAAiC;IACjC,wBAAwB;IACxB,wBAAwB;IACxB,iBAAiB;IACjB,sBAAsB;IACtB,sBAAsB;IACtB,sBAAsB;IACtB,gGAAgG;IAChG,sFAAsF;IACtF,eAAe;IACf,kBAAkB;IAClB,eAAe;IACf,yBAAyB;IACzB,iBAAiB;IACjB,4FAA4F;IAC5F,oFAAoF;IACpF,eAAe;IACf,qBAAqB;IACrB,eAAe;IACf,eAAe;IACf,eAAe;IACf,mGAAmG;IACnG,gCAAgC;IAChC,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B,iCAAiC;IACjC,oCAAoC;IACpC,kCAAkC;CAC1B,CAAC;AAGX,mGAAmG;AACnG,8DAA8D;AAC9D,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC9C,oBAAoB;IACpB,gCAAgC;CACY,CAAC;AAG/C,qGAAqG;AACrG,qGAAqG;AACrG,mDAAmD;AACnD,+DAA+D;AAC/D,6FAA6F;AAC7F,sFAAsF;AACtF,4FAA4F;AAC5F,0DAA0D;AAC1D,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,QAAQ,CAAU,CAAC;AAGhH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,aAAa,EAAE,eAAe,CAA8C,CAAC;AAGzH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,QAAQ,CAA8C,CAAC;AAG9H,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,SAAS,EAAE,cAAc,EAAE,WAAW,CAAU,CAAC;AAoB1F,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,SAAS,EAAE,SAAS,CAAU,CAAC","sourcesContent":["// The audit vocabulary: the closed event-type union (BACKEND-202) and how an actor was acting\n// (BACKEND-205). The document schema is in ../doc-schemas/audit-event.ts.\n//\n// The union is closed: a new sensitive action adds its event types here, in the same change\n// (BACKEND-202).\n\nimport type { SystemRole } from './unions.js';\nimport { CAPTAIN_TEAM_ROLES } from './unions.js';\n\nexport const AUDIT_EVENT_TYPE_KEYS = [\n // Accounts\n 'user.accountRegistered',\n 'user.displayNameChanged',\n // The scheduled sweep deleted a sign-in account that never finished registering (no profile)\n 'user.abandonedRegistrationDeleted',\n // Account status — an admin banned an account or lifted its ban\n 'user.accountBanned',\n 'user.accountUnbanned',\n // Global roles — the policy decision (callable) and the claim propagation (trigger)\n 'admin.systemRoleGranted',\n 'admin.systemRoleRevoked',\n 'admin.systemRoleClaimSynced',\n // App configuration — the operational levers on `_appConfig/app`, and the landing page copy\n 'appConfig.updated',\n 'landingPage.updated',\n // Leagues — created, settings edited, status moved, mode switched\n 'league.created',\n 'league.updated',\n 'league.statusChanged',\n 'league.modeSwitched',\n // Waiver templates — created, a new wording published, retired or deleted\n 'waiverTemplate.created',\n 'waiverTemplate.versionPublished',\n 'waiverTemplate.retired',\n 'waiverTemplate.deleted',\n // Game locations\n 'gameLocation.created',\n 'gameLocation.updated',\n 'gameLocation.deleted',\n // Pictures — published to a gallery or a slot by the picture processor (attributed to the admin\n // who uploaded it), and ordered, featured, and removed by the admin picture callables\n 'picture.added',\n 'picture.replaced',\n 'picture.moved',\n 'picture.featuredChanged',\n 'picture.removed',\n // Awards — an award created by its first badge's publication, its badge replaced, the award\n // deleted once nobody holds it, and an award granted to or revoked from one account\n 'award.created',\n 'award.badgeReplaced',\n 'award.deleted',\n 'award.granted',\n 'award.revoked',\n // Hardware contracts — a loan created for a referee, signed by them, its equipment returned, and a\n // contract never signed deleted\n 'hardwareLoanContract.created',\n 'hardwareLoanContract.signed',\n 'hardwareLoanContract.returned',\n 'hardwareLoanContract.deleted',\n // Teams — created with its captain, a ghost player added, a team's failed roster work retried\n 'leagueTeam.created',\n 'ghostPlayer.created',\n 'teamRoster.syncRetried',\n // Team management — a member promoted to co-captain or demoted to player, the captain changed by\n // an admin, the team's name or type edited by an admin, and its contact phone set by an admin\n 'teamMembership.roleChanged',\n 'leagueTeam.captainChanged',\n 'leagueTeam.updated',\n 'leagueTeamContact.updated',\n // Exits — a membership removed, a never-played ghost removed, a ghost linked by either link, and a\n // never-played team deleted; each targets what it deleted, which the migration's live\n // verifications read as proof the product removed it\n 'teamMembership.removed',\n 'ghostPlayer.removed',\n 'ghostPlayer.linked',\n 'ghostPlayer.closedLeagueLinked',\n 'leagueTeam.deleted',\n // A ghost's removal stopped part-way because the ghost came to have played: the games it held are\n // released, and the finished-game entries it had already taken off are named\n 'ghostPlayer.removalStopped',\n // Joining a team — an invitation sent, withdrawn, accepted, or declined; a join request sent,\n // withdrawn, accepted, or rejected; a free-agent signup made, withdrawn, or answered by an admin\n // placing the player on a team\n 'teamInvitation.created',\n 'teamInvitation.cancelled',\n 'teamInvitation.accepted',\n 'teamInvitation.rejected',\n 'teamJoinRequest.created',\n 'teamJoinRequest.cancelled',\n 'teamJoinRequest.accepted',\n 'teamJoinRequest.rejected',\n 'leagueFreeAgent.created',\n 'leagueFreeAgent.deleted',\n 'leagueFreeAgent.assigned',\n // Signed waivers — a legal record, signed by its subject or witnessed for a ghost\n 'signedWaiver.created',\n // Schedules — a week created with its games or its shared fields edited; one game added, edited\n // (moved, rescheduled, or its teams replaced), or deleted with its events and roster\n 'scheduleWeek.created',\n 'scheduleWeek.updated',\n 'sportGame.created',\n 'sportGame.updated',\n 'sportGame.deleted',\n // Live scoring — a scoring write refused its caller's authority (a click writes no success event:\n // the stat event document is its own record), a roster entry marked absent or present, a\n // scorer's note on one person changed, and the jump-ball possession arrow moved\n 'sportGame.statEventsRejected',\n 'sportGame.absenceChanged',\n 'sportGame.memoUpdated',\n 'sportGame.jumpBallChanged',\n // Finalizing — a game finalized, its numbers made permanent in every derived destination, and an\n // admin's reopening of a finalized game, which takes them back out\n 'sportGame.finalized',\n 'sportGame.reopened',\n // Fix stats — a game's numbers corrected (targets, or the stored numbers kept) or restored from\n // its events; a derived aggregate rebuilt; and a person's pre-Q-Sports baseline written\n 'sportGame.statsCorrected',\n 'sportGame.statsRecalculated',\n 'stats.aggregateRecalculated',\n 'stats.historicalStatsUpdated',\n // A stats check ran to its end: its scope, its summary, and its counts by kind.\n 'stats.validationRun',\n // An admin deleted a stats check's report: its id, scope, summary, and counts by kind.\n 'stats.validationReportDeleted',\n // The migration's placement of a recorded stat line no roster entry or play could place: the\n // admin names the team, and the game's copy places the line there\n 'stats.unrosteredStatLineResolved',\n // Admin notifications — a shared card archived, which takes it off every admin's list; and an\n // admin's archive-all decision, recorded once when the job is written, with the request's origin\n 'adminNotification.archived',\n 'adminNotification.archiveAllRequested',\n // An operator's manual intervention in a durable pipeline — a dead-lettered row put back to work,\n // or a refused attempt at one — with the reason the operator gave\n 'system.manualIntervention',\n // The migration console — one page of a cutover action run, with what it read, wrote, and found;\n // a product control's run recorded once its evidence checked; an operator checkpoint recorded with\n // its evidence; and the cutover, after which the product owns every destination\n 'migrationAction.pageRun',\n 'migrationAction.controlRecorded',\n 'migrationAction.checkpointRecorded',\n 'migrationConsole.cutoverRecorded',\n] as const;\nexport type AuditEventType = (typeof AUDIT_EVENT_TYPE_KEYS)[number];\n\n// The two ways a ghost is linked to an account — the normal link and the closed-league link — each\n// committing its own event over the one artifact-moving core.\nexport const GHOST_LINK_AUDIT_EVENT_TYPE_KEYS = [\n 'ghostPlayer.linked',\n 'ghostPlayer.closedLeagueLinked',\n] as const satisfies readonly AuditEventType[];\nexport type GhostLinkAuditEventType = (typeof GHOST_LINK_AUDIT_EVENT_TYPE_KEYS)[number];\n\n// How the actor was acting for the write — never merely which authorities they happen to hold. It is\n// orthogonal to the event type: one event type is produced under several modes, and the mode is what\n// tells an ordinary action from an admin override.\n// user a signed-in account acting on its own behalf\n// teamManager a captain or co-captain acting through their team's membership permissions\n// adminReview an admin or referee doing admin work that no team permission covers\n// adminOverride an admin or referee superseding the team permission a normal entry checks\n// system backend automation with no human caller\nexport const AUDIT_ACTOR_MODE_KEYS = ['user', 'teamManager', 'adminReview', 'adminOverride', 'system'] as const;\nexport type AuditActorMode = (typeof AUDIT_ACTOR_MODE_KEYS)[number];\n\nexport const AUDIT_ADMIN_ACTOR_MODE_KEYS = ['adminReview', 'adminOverride'] as const satisfies readonly AuditActorMode[];\nexport type AuditAdminActorMode = (typeof AUDIT_ADMIN_ACTOR_MODE_KEYS)[number];\n\nexport const AUDIT_NON_ADMIN_ACTOR_MODE_KEYS = ['user', 'teamManager', 'system'] as const satisfies readonly AuditActorMode[];\nexport type AuditNonAdminActorMode = (typeof AUDIT_NON_ADMIN_ACTOR_MODE_KEYS)[number];\n\nexport const AUDIT_SYSTEM_REASON_KEYS = ['trigger', 'scheduledJob', 'migration'] as const;\nexport type AuditSystemReason = (typeof AUDIT_SYSTEM_REASON_KEYS)[number];\n\nexport type CaptainTeamRole = (typeof CAPTAIN_TEAM_ROLES)[number];\n\n// `isAdmin` is metadata only: it records that the caller's token carried a global-role claim (admin\n// or referee) when they acted, and grants nothing. `systemRole` is required on the admin modes and\n// forbidden on the others, so an admin action is never recorded without the authority it used and a\n// non-admin action never carries one.\nexport type AuditActor =\n | { uid: string | null; isAdmin: boolean; actorMode: AuditNonAdminActorMode; systemRole?: never }\n | { uid: string | null; isAdmin: boolean; actorMode: AuditAdminActorMode; systemRole: SystemRole };\n\nexport interface AuditTarget {\n // The user the action was performed on, when there is one.\n uid: string | null;\n // The slash path of the document the action changed, when there is one.\n ref: string | null;\n}\n\nexport const AUDIT_RESULT_KEYS = ['success', 'failure'] as const;\nexport type AuditResult = (typeof AUDIT_RESULT_KEYS)[number];\n"]}
|
|
1
|
+
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../../src/types/audit.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,0EAA0E;AAC1E,EAAE;AACF,4FAA4F;AAC5F,iBAAiB;AAKjB,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,WAAW;IACX,wBAAwB;IACxB,yBAAyB;IACzB,6FAA6F;IAC7F,mCAAmC;IACnC,gEAAgE;IAChE,oBAAoB;IACpB,sBAAsB;IACtB,oFAAoF;IACpF,yBAAyB;IACzB,yBAAyB;IACzB,6BAA6B;IAC7B,4FAA4F;IAC5F,mBAAmB;IACnB,qBAAqB;IACrB,kEAAkE;IAClE,gBAAgB;IAChB,gBAAgB;IAChB,sBAAsB;IACtB,qBAAqB;IACrB,0EAA0E;IAC1E,wBAAwB;IACxB,iCAAiC;IACjC,wBAAwB;IACxB,wBAAwB;IACxB,iBAAiB;IACjB,sBAAsB;IACtB,sBAAsB;IACtB,sBAAsB;IACtB,gGAAgG;IAChG,sFAAsF;IACt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kE;IAClE,kCAAkC;IAClC,8FAA8F;IAC9F,iGAAiG;IACjG,4BAA4B;IAC5B,uCAAuC;IACvC,kGAAkG;IAClG,kEAAkE;IAClE,2BAA2B;IAC3B,iGAAiG;IACjG,gGAAgG;IAChG,6FAA6F;IAC7F,6FAA6F;IAC7F,4EAA4E;IAC5E,yBAAyB;IACzB,iCAAiC;IACjC,iCAAiC;IACjC,oCAAoC;IACpC,kCAAkC;CAC1B,CAAC;AAGX,mGAAmG;AACnG,8DAA8D;AAC9D,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC9C,oBAAoB;IACpB,gCAAgC;CACY,CAAC;AAG/C,qGAAqG;AACrG,qGAAqG;AACrG,mDAAmD;AACnD,+DAA+D;AAC/D,6FAA6F;AAC7F,sFAAsF;AACtF,4FAA4F;AAC5F,0DAA0D;AAC1D,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,QAAQ,CAAU,CAAC;AAGhH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,aAAa,EAAE,eAAe,CAA8C,CAAC;AAGzH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,QAAQ,CAA8C,CAAC;AAG9H,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,SAAS,EAAE,cAAc,EAAE,WAAW,CAAU,CAAC;AAoB1F,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,SAAS,EAAE,SAAS,CAAU,CAAC","sourcesContent":["// The audit vocabulary: the closed event-type union (BACKEND-202) and how an actor was acting\n// (BACKEND-205). The document schema is in ../doc-schemas/audit-event.ts.\n//\n// The union is closed: a new sensitive action adds its event types here, in the same change\n// (BACKEND-202).\n\nimport type { SystemRole } from './unions.js';\nimport { CAPTAIN_TEAM_ROLES } from './unions.js';\n\nexport const AUDIT_EVENT_TYPE_KEYS = [\n // Accounts\n 'user.accountRegistered',\n 'user.displayNameChanged',\n // The scheduled sweep deleted a sign-in account that never finished registering (no profile)\n 'user.abandonedRegistrationDeleted',\n // Account status — an admin banned an account or lifted its ban\n 'user.accountBanned',\n 'user.accountUnbanned',\n // Global roles — the policy decision (callable) and the claim propagation (trigger)\n 'admin.systemRoleGranted',\n 'admin.systemRoleRevoked',\n 'admin.systemRoleClaimSynced',\n // App configuration — the operational levers on `_appConfig/app`, and the landing page copy\n 'appConfig.updated',\n 'landingPage.updated',\n // Leagues — created, settings edited, status moved, mode switched\n 'league.created',\n 'league.updated',\n 'league.statusChanged',\n 'league.modeSwitched',\n // Waiver templates — created, a new wording published, retired or deleted\n 'waiverTemplate.created',\n 'waiverTemplate.versionPublished',\n 'waiverTemplate.retired',\n 'waiverTemplate.deleted',\n // Game locations\n 'gameLocation.created',\n 'gameLocation.updated',\n 'gameLocation.deleted',\n // Pictures — published to a gallery or a slot by the picture processor (attributed to the admin\n // who uploaded it), and ordered, featured, and removed by the admin picture callables\n 'picture.added',\n 'picture.replaced',\n 'picture.moved',\n 'picture.featuredChanged',\n 'picture.removed',\n // Awards — an award created by its first badge's publication, its badge replaced, the award\n // deleted once nobody holds it, and an award granted to or revoked from one account\n 'award.created',\n 'award.badgeReplaced',\n 'award.deleted',\n 'award.granted',\n 'award.revoked',\n // Hardware contracts — a loan created for a referee, signed by them, its equipment returned, and a\n // contract never signed deleted\n 'hardwareLoanContract.created',\n 'hardwareLoanContract.signed',\n 'hardwareLoanContract.returned',\n 'hardwareLoanContract.deleted',\n // Teams — created with its captain, a ghost player added, a team's failed roster work retried\n 'leagueTeam.created',\n 'ghostPlayer.created',\n 'teamRoster.syncRetried',\n // Team management — a member promoted to co-captain or demoted to player, the captain changed by\n // an admin, the team's name or type edited by an admin, and its contact phone set by an admin\n 'teamMembership.roleChanged',\n 'leagueTeam.captainChanged',\n 'leagueTeam.updated',\n 'leagueTeamContact.updated',\n // Exits — a membership removed, a never-played ghost removed, a ghost linked by either link, and a\n // never-played team deleted; each targets what it deleted, which the migration's live\n // verifications read as proof the product removed it\n 'teamMembership.removed',\n 'ghostPlayer.removed',\n 'ghostPlayer.linked',\n 'ghostPlayer.closedLeagueLinked',\n 'leagueTeam.deleted',\n // A ghost's removal stopped part-way because the ghost came to have played: the games it held are\n // released, and the finished-game entries it had already taken off are named\n 'ghostPlayer.removalStopped',\n // Joining a team — an invitation sent, withdrawn, accepted, or declined; a join request sent,\n // withdrawn, accepted, or rejected; a free-agent signup made, withdrawn, or answered by an admin\n // placing the player on a team\n 'teamInvitation.created',\n 'teamInvitation.cancelled',\n 'teamInvitation.accepted',\n 'teamInvitation.rejected',\n 'teamJoinRequest.created',\n 'teamJoinRequest.cancelled',\n 'teamJoinRequest.accepted',\n 'teamJoinRequest.rejected',\n 'leagueFreeAgent.created',\n 'leagueFreeAgent.deleted',\n 'leagueFreeAgent.assigned',\n // Signed waivers — a legal record, signed by its subject or witnessed for a ghost\n 'signedWaiver.created',\n // Schedules — a week created with its games or its shared fields edited; one game added, edited\n // (moved, rescheduled, or its teams replaced), or deleted with its events and roster\n 'scheduleWeek.created',\n 'scheduleWeek.updated',\n 'sportGame.created',\n 'sportGame.updated',\n 'sportGame.deleted',\n // Live scoring — a scoring write refused its caller's authority (a click writes no success event:\n // the stat event document is its own record), a roster entry marked absent or present, a\n // scorer's note on one person changed, and the jump-ball possession arrow moved\n 'sportGame.statEventsRejected',\n 'sportGame.absenceChanged',\n 'sportGame.memoUpdated',\n 'sportGame.jumpBallChanged',\n // Finalizing — a game finalized, its numbers made permanent in every derived destination, and an\n // admin's reopening of a finalized game, which takes them back out\n 'sportGame.finalized',\n 'sportGame.reopened',\n // Fix stats — a game's numbers corrected (targets, or the stored numbers kept) or restored from\n // its events; a derived aggregate rebuilt; and a person's pre-Q-Sports baseline written\n 'sportGame.statsCorrected',\n 'sportGame.statsRecalculated',\n 'stats.aggregateRecalculated',\n 'stats.historicalStatsUpdated',\n // A stats check ran to its end: its scope, its summary, and its counts by kind.\n 'stats.validationRun',\n // An admin deleted a stats check's report: its id, scope, summary, and counts by kind.\n 'stats.validationReportDeleted',\n // The migration's placement of a recorded stat line no roster entry or play could place: the\n // admin names the team, and the game's copy places the line there\n 'stats.unrosteredStatLineResolved',\n // Admin notifications — a shared card archived, which takes it off every admin's list; and an\n // admin's archive-all decision, recorded once when the job is written, with the request's origin\n 'adminNotification.archived',\n 'adminNotification.archiveAllRequested',\n // An operator's manual intervention in a durable pipeline — a dead-lettered row put back to work,\n // or a refused attempt at one — with the reason the operator gave\n 'system.manualIntervention',\n // The migration console — one page of a cutover action run, with what it read, wrote, and found;\n // the documents an action core wrote and removed, committed in the same batch or transaction as\n // those writes (its action id, operation id, and document ids only — BACKEND-203); a product\n // control's run recorded once its evidence checked; an operator checkpoint recorded with its\n // evidence; and the cutover, after which the product owns every destination\n 'migrationAction.pageRun',\n 'migrationAction.writesCommitted',\n 'migrationAction.controlRecorded',\n 'migrationAction.checkpointRecorded',\n 'migrationConsole.cutoverRecorded',\n] as const;\nexport type AuditEventType = (typeof AUDIT_EVENT_TYPE_KEYS)[number];\n\n// The two ways a ghost is linked to an account — the normal link and the closed-league link — each\n// committing its own event over the one artifact-moving core.\nexport const GHOST_LINK_AUDIT_EVENT_TYPE_KEYS = [\n 'ghostPlayer.linked',\n 'ghostPlayer.closedLeagueLinked',\n] as const satisfies readonly AuditEventType[];\nexport type GhostLinkAuditEventType = (typeof GHOST_LINK_AUDIT_EVENT_TYPE_KEYS)[number];\n\n// How the actor was acting for the write — never merely which authorities they happen to hold. It is\n// orthogonal to the event type: one event type is produced under several modes, and the mode is what\n// tells an ordinary action from an admin override.\n// user a signed-in account acting on its own behalf\n// teamManager a captain or co-captain acting through their team's membership permissions\n// adminReview an admin or referee doing admin work that no team permission covers\n// adminOverride an admin or referee superseding the team permission a normal entry checks\n// system backend automation with no human caller\nexport const AUDIT_ACTOR_MODE_KEYS = ['user', 'teamManager', 'adminReview', 'adminOverride', 'system'] as const;\nexport type AuditActorMode = (typeof AUDIT_ACTOR_MODE_KEYS)[number];\n\nexport const AUDIT_ADMIN_ACTOR_MODE_KEYS = ['adminReview', 'adminOverride'] as const satisfies readonly AuditActorMode[];\nexport type AuditAdminActorMode = (typeof AUDIT_ADMIN_ACTOR_MODE_KEYS)[number];\n\nexport const AUDIT_NON_ADMIN_ACTOR_MODE_KEYS = ['user', 'teamManager', 'system'] as const satisfies readonly AuditActorMode[];\nexport type AuditNonAdminActorMode = (typeof AUDIT_NON_ADMIN_ACTOR_MODE_KEYS)[number];\n\nexport const AUDIT_SYSTEM_REASON_KEYS = ['trigger', 'scheduledJob', 'migration'] as const;\nexport type AuditSystemReason = (typeof AUDIT_SYSTEM_REASON_KEYS)[number];\n\nexport type CaptainTeamRole = (typeof CAPTAIN_TEAM_ROLES)[number];\n\n// `isAdmin` is metadata only: it records that the caller's token carried a global-role claim (admin\n// or referee) when they acted, and grants nothing. `systemRole` is required on the admin modes and\n// forbidden on the others, so an admin action is never recorded without the authority it used and a\n// non-admin action never carries one.\nexport type AuditActor =\n | { uid: string | null; isAdmin: boolean; actorMode: AuditNonAdminActorMode; systemRole?: never }\n | { uid: string | null; isAdmin: boolean; actorMode: AuditAdminActorMode; systemRole: SystemRole };\n\nexport interface AuditTarget {\n // The user the action was performed on, when there is one.\n uid: string | null;\n // The slash path of the document the action changed, when there is one.\n ref: string | null;\n}\n\nexport const AUDIT_RESULT_KEYS = ['success', 'failure'] as const;\nexport type AuditResult = (typeof AUDIT_RESULT_KEYS)[number];\n"]}
|
package/dist/types/unions.d.ts
CHANGED
|
@@ -60,6 +60,8 @@ export declare const HARDWARE_LOAN_CONTRACT_STATUS_KEYS: readonly ["pending", "l
|
|
|
60
60
|
export type HardwareLoanContractStatus = (typeof HARDWARE_LOAN_CONTRACT_STATUS_KEYS)[number];
|
|
61
61
|
export declare const AWARD_GRANT_SKIP_REASON_KEYS: readonly ["noProfile", "ghost"];
|
|
62
62
|
export type AwardGrantSkipReason = (typeof AWARD_GRANT_SKIP_REASON_KEYS)[number];
|
|
63
|
+
export declare const FEATURED_AWARD_SLOT_KEYS: readonly ["primary", "secondary"];
|
|
64
|
+
export type FeaturedAwardSlot = (typeof FEATURED_AWARD_SLOT_KEYS)[number];
|
|
63
65
|
export declare const PENDING_HARDWARE_LOAN_CONTRACT_STATUS: "pending";
|
|
64
66
|
export declare const LOANED_HARDWARE_LOAN_CONTRACT_STATUS: "loaned";
|
|
65
67
|
export declare const RETURNED_HARDWARE_LOAN_CONTRACT_STATUS: "returned";
|
|
@@ -85,8 +87,8 @@ export declare const TEAM_ICON_KEYS: readonly ["Shield", "Swords", "Skull", "Gho
|
|
|
85
87
|
export type TeamIcon = (typeof TEAM_ICON_KEYS)[number];
|
|
86
88
|
export declare const PICTURE_VARIANT_KEYS: readonly ["sm", "md", "lg"];
|
|
87
89
|
export type PictureVariantKey = (typeof PICTURE_VARIANT_KEYS)[number];
|
|
88
|
-
export declare const GAME_TIER_DISCREPANCY_KIND_KEYS: readonly ["invalidEvent", "eventSequenceMismatch", "rollupMismatch", "scoreMirrorMismatch", "unrosteredStatLine", "fantasyPointsStale", "finalRecordMissing", "finalRecordMismatch", "participationSnapshotMismatch", "gameHeld"];
|
|
90
|
+
export declare const GAME_TIER_DISCREPANCY_KIND_KEYS: readonly ["gameUnreadable", "invalidEvent", "eventSequenceMismatch", "eventSequenceGap", "rollupMismatch", "scoreMirrorMismatch", "unrosteredStatLine", "fantasyPointsStale", "finalRecordMissing", "finalRecordMismatch", "participationSnapshotMismatch", "gameHeld"];
|
|
89
91
|
export declare const AGGREGATE_TIER_DISCREPANCY_KIND_KEYS: readonly ["aggregateMismatch", "aggregateEntryStale", "aggregateEntryMissing", "hallOfFameLifetimeMismatch"];
|
|
90
|
-
export declare const STATS_DISCREPANCY_KIND_KEYS: readonly ["invalidEvent", "eventSequenceMismatch", "rollupMismatch", "scoreMirrorMismatch", "unrosteredStatLine", "fantasyPointsStale", "finalRecordMissing", "finalRecordMismatch", "participationSnapshotMismatch", "gameHeld", "aggregateMismatch", "aggregateEntryStale", "aggregateEntryMissing", "hallOfFameLifetimeMismatch"];
|
|
92
|
+
export declare const STATS_DISCREPANCY_KIND_KEYS: readonly ["gameUnreadable", "invalidEvent", "eventSequenceMismatch", "eventSequenceGap", "rollupMismatch", "scoreMirrorMismatch", "unrosteredStatLine", "fantasyPointsStale", "finalRecordMissing", "finalRecordMismatch", "participationSnapshotMismatch", "gameHeld", "aggregateMismatch", "aggregateEntryStale", "aggregateEntryMissing", "hallOfFameLifetimeMismatch"];
|
|
91
93
|
export type StatsDiscrepancyKind = (typeof STATS_DISCREPANCY_KIND_KEYS)[number];
|
|
92
94
|
//# sourceMappingURL=unions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unions.d.ts","sourceRoot":"","sources":["../../src/types/unions.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB,+BAAgC,CAAC;AAC9D,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAG3D,eAAO,MAAM,gBAAgB,+BAAgC,CAAC;AAC9D,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAC3D,+CAA+C;AAC/C,eAAO,MAAM,kBAAkB,WAAgC,CAAC;AAChE,qFAAqF;AACrF,eAAO,MAAM,kBAAkB,WAAgC,CAAC;AAMhE,eAAO,MAAM,mCAAmC,0CAA2C,CAAC;AAC5F,MAAM,MAAM,8BAA8B,GAAG,CAAC,OAAO,mCAAmC,CAAC,CAAC,MAAM,CAAC,CAAC;AAClG,eAAO,MAAM,0BAA0B,iBAAoE,CAAC;AAC5G,eAAO,MAAM,kBAAkB,cAAiE,CAAC;AAEjG,eAAO,MAAM,cAAc,6CAA8C,CAAC;AAC1E,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAIvD,eAAO,MAAM,kBAAkB,mCAAkE,CA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8B,CAAC;AAChE,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAItE,eAAO,MAAM,+BAA+B,yQAelC,CAAC;AACX,eAAO,MAAM,oCAAoC,8GAKvC,CAAC;AACX,eAAO,MAAM,2BAA2B,4WAG9B,CAAC;AACX,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,2BAA2B,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
package/dist/types/unions.js
CHANGED
|
@@ -110,6 +110,8 @@ export const HARDWARE_LOAN_CONTRACT_STATUS_KEYS = ['pending', 'loaned', 'returne
|
|
|
110
110
|
// Why an award grant passed over an account its teams or leagues named: it has no profile, or it is
|
|
111
111
|
// a ghost, which holds no account.
|
|
112
112
|
export const AWARD_GRANT_SKIP_REASON_KEYS = ['noProfile', 'ghost'];
|
|
113
|
+
// The two badges an account shows beside its name.
|
|
114
|
+
export const FEATURED_AWARD_SLOT_KEYS = ['primary', 'secondary'];
|
|
113
115
|
export const PENDING_HARDWARE_LOAN_CONTRACT_STATUS = 'pending';
|
|
114
116
|
export const LOANED_HARDWARE_LOAN_CONTRACT_STATUS = 'loaned';
|
|
115
117
|
export const RETURNED_HARDWARE_LOAN_CONTRACT_STATUS = 'returned';
|
|
@@ -273,8 +275,12 @@ export const PICTURE_VARIANT_KEYS = ['sm', 'md', 'lg'];
|
|
|
273
275
|
// What a stats check found, game tier first — a game's own numbers are the cause of the aggregate
|
|
274
276
|
// findings, so Fix stats repairs games before it rebuilds what they feed.
|
|
275
277
|
export const GAME_TIER_DISCREPANCY_KIND_KEYS = [
|
|
278
|
+
// A game whose document the check could not read: nothing else about it could be checked.
|
|
279
|
+
'gameUnreadable',
|
|
276
280
|
'invalidEvent',
|
|
277
281
|
'eventSequenceMismatch',
|
|
282
|
+
// A game whose events do not hold exactly the sequences 1..n: a gap or a duplicate.
|
|
283
|
+
'eventSequenceGap',
|
|
278
284
|
'rollupMismatch',
|
|
279
285
|
'scoreMirrorMismatch',
|
|
280
286
|
'unrosteredStatLine',
|
package/dist/types/unions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unions.js","sourceRoot":"","sources":["../../src/types/unions.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,gGAAgG;AAChG,UAAU;AAEV,kGAAkG;AAClG,qEAAqE;AACrE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,SAAS,CAAU,CAAC;AAG9D,kGAAkG;AAClG,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAU,CAAC;AAE9D,+CAA+C;AAC/C,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAA6B,CAAC;AAChE,qFAAqF;AACrF,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAA6B,CAAC;AAEhE,sFAAsF;AACtF,mGAAmG;AACnG,qGAAqG;AACrG,eAAe;AACf,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC,eAAe,EAAE,YAAY,CAAU,CAAC;AAE5F,MAAM,CAAC,MAAM,0BAA0B,GAAG,eAAiE,CAAC;AAC5G,MAAM,CAAC,MAAM,kBAAkB,GAAG,YAA8D,CAAC;AAEjG,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,QAAQ,CAAU,CAAC;AAG1E,qGAAqG;AACrG,oBAAoB;AACpB,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,SAAS,EAAE,WAAW,CAAwC,CAAC;AAElG,+FAA+F;AAC/F,2CAA2C;AAC3C,MAAM,CAAC,MAAM,iBAAiB,GAAG,SAAqC,CAAC;AAEvE,0FAA0F;AAC1F,oCAAoC;AACpC,MAAM,CAAC,MAAM,oBAAoB,GAAG,WAAuC,CAAC;AAC5E,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAoC,CAAC;AAErE,kGAAkG;AAClG,gGAAgG;AAChG,sCAAsC;AAC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AG;IACzC,GAAG,+BAA+B;IAClC,GAAG,oCAAoC;CAC/B,CAAC","sourcesContent":["// Canonical unions (ARCH-102): an `as const` key array with the type derived from it. Zod enums,\n// type positions, query filters, and option lists all derive from these arrays — never a quoted\n// member.\n\n// The two global roles. Each is a roster on `_systemData/adminList` and a boolean custom claim of\n// the same name; the roster is the authority, the claim a fast hint.\nexport const SYSTEM_ROLE_KEYS = ['admin', 'referee'] as const;\nexport type SystemRole = (typeof SYSTEM_ROLE_KEYS)[number];\n\n// Account status on the private profile. Only an exact `active` passes the server auth assertion.\nexport const USER_STATUS_KEYS = ['active', 'banned'] as const;\nexport type UserStatus = (typeof USER_STATUS_KEYS)[number];\n/** The one status that lets an account act. */\nexport const ACTIVE_USER_STATUS = 'active' satisfies UserStatus;\n/** The status an admin's ban sets: the account keeps its data and cannot sign in. */\nexport const BANNED_USER_STATUS = 'banned' satisfies UserStatus;\n\n// Which post-commit Auth effect queued an account on `statusReconcileQueue/{userId}`:\n// `accountStatus` — a status change's disabled flag, status claim, and token revocation, queued in\n// the status transaction itself; `roleClaims` — the `admin` / `referee` claims after a failed roster\n// claim write.\nexport const STATUS_RECONCILE_QUEUE_AUTH_EFFECTS = ['accountStatus', 'roleClaims'] as const;\nexport type StatusReconcileQueueAuthEffect = (typeof STATUS_RECONCILE_QUEUE_AUTH_EFFECTS)[number];\nexport const ACCOUNT_STATUS_AUTH_EFFECT = 'accountStatus' as const satisfies StatusReconcileQueueAuthEffect;\nexport const ROLE_CLAIMS_EFFECT = 'roleClaims' as const satisfies StatusReconcileQueueAuthEffect;\n\nexport const TEAM_ROLE_KEYS = ['captain', 'coCaptain', 'player'] as const;\nexport type TeamRole = (typeof TEAM_ROLE_KEYS)[number];\n\n// The roles that carry captain authority. `firestore.rules` restates this list, because a rules file\n// cannot import it.\nexport const CAPTAIN_TEAM_ROLES = ['captain', 'coCaptain'] as const satisfies readonly TeamRole[];\n\n// The one role a team holds at most one of: team creation, the admin captain change, and ghost\n// linking write it, and nothing else does.\nexport const TEAM_CAPTAIN_ROLE = 'captain' as const satisfies TeamRole;\n\n// The two roles below the captain. A co-captain holds every captain power except managing\n// co-captains; a player holds none.\nexport const TEAM_CO_CAPTAIN_ROLE = 'coCaptain' as const satisfies TeamRole;\nexport const TEAM_PLAYER_ROLE = 'player' as const satisfies TeamRole;\n\n// The roles a member's role change moves a membership between — promoting a player to co-captain,\n// or demoting a co-captain to player. The captain's role moves only through the admin's captain\n// change, so it is never one of them.\nexport const MEMBER_ASSIGNABLE_TEAM_ROLES = [TEAM_CO_CAPTAIN_ROLE, TEAM_PLAYER_ROLE] as const satisfies readonly TeamRole[];\nexport type MemberAssignableTeamRole = (typeof MEMBER_ASSIGNABLE_TEAM_ROLES)[number];\n\n// A ghost link that merges a ghost's membership into the account's keeps one membership with the\n// higher of the two roles: `TEAM_ROLE_KEYS` runs from the highest role down.\nexport function higherTeamRole(left: TeamRole, right: TeamRole): TeamRole {\n return TEAM_ROLE_KEYS.indexOf(left) <= TEAM_ROLE_KEYS.indexOf(right) ? left : right;\n}\n\nexport const TEAM_MEMBERSHIP_STATUS_KEYS = ['active'] as const;\nexport type TeamMembershipStatus = (typeof TEAM_MEMBERSHIP_STATUS_KEYS)[number];\n\n// The status a membership grants authority in. Every membership-based check reads it with the role\n// (BACKEND-006), so a status added later grants nothing until a check names it.\nexport const ACTIVE_TEAM_MEMBERSHIP_STATUS = 'active' as const satisfies TeamMembershipStatus;\n\n// How a membership came to exist; absent on a membership whose provenance was never recorded.\nexport const TEAM_JOIN_METHOD_KEYS = [\n 'teamCreation',\n 'invite',\n 'joinRequest',\n 'freeAgent',\n 'ghostAdd',\n] as const;\nexport type TeamJoinMethod = (typeof TEAM_JOIN_METHOD_KEYS)[number];\n\nexport const LEAGUE_STATUS_KEYS = ['pending', 'upcoming', 'active', 'closed'] as const;\nexport type LeagueStatus = (typeof LEAGUE_STATUS_KEYS)[number];\n\n// Every league is created unpublished; the admin moves it forward from here.\nexport const LEAGUE_STATUS_ON_CREATE = 'pending' as const satisfies LeagueStatus;\n\n// A finished season. Its settings stay editable; its status and mode never change again.\nexport const CLOSED_LEAGUE_STATUS = 'closed' as const satisfies LeagueStatus;\n\n// The two published statuses before a league closes: its teams are forming, then it is in play.\nexport const UPCOMING_LEAGUE_STATUS = 'upcoming' as const satisfies LeagueStatus;\nexport const ACTIVE_LEAGUE_STATUS = 'active' as const satisfies LeagueStatus;\n\n// The statuses a league may move to from each status. Movement is forward only, and `closed` is\n// final; the status callable refuses any other move.\nexport const LEAGUE_STATUS_TRANSITIONS: Readonly<Record<LeagueStatus, readonly LeagueStatus[]>> = {\n pending: ['upcoming', 'closed'],\n upcoming: ['active', 'closed'],\n active: ['closed'],\n closed: [],\n};\n\n// Every status but closed: a league still being set up, published, or played. Whatever such a\n// league is configured with — its waiver template among them — is still in use.\nexport const OPEN_LEAGUE_STATUS_KEYS: readonly Exclude<LeagueStatus, typeof CLOSED_LEAGUE_STATUS>[] =\n LEAGUE_STATUS_KEYS.filter(\n (status): status is Exclude<LeagueStatus, typeof CLOSED_LEAGUE_STATUS> => status !== CLOSED_LEAGUE_STATUS,\n );\n\n// A league players are part of now or next: published and not yet closed. The admin dashboard's\n// active free-agent count covers only these leagues.\nexport const CURRENT_LEAGUE_STATUS_KEYS = [\n UPCOMING_LEAGUE_STATUS,\n ACTIVE_LEAGUE_STATUS,\n] as const satisfies readonly LeagueStatus[];\n\nexport const LEAGUE_MODE_KEYS = ['Regular', 'Competitive/Recreational'] as const;\nexport type LeagueMode = (typeof LEAGUE_MODE_KEYS)[number];\n\n// Present only on teams in a Competitive/Recreational league. In any other mode a team has no type:\n// the field is absent, never null.\nexport const TEAM_TYPE_KEYS = ['Competitive', 'Recreational'] as const;\nexport type TeamType = (typeof TEAM_TYPE_KEYS)[number];\n\n// The one mode whose teams each carry a `teamType`.\nexport const TEAM_TYPED_LEAGUE_MODE = 'Competitive/Recreational' as const satisfies LeagueMode;\n\n// The type every team takes when its league switches into `TEAM_TYPED_LEAGUE_MODE`.\nexport const TEAM_TYPE_ON_MODE_SWITCH = 'Recreational' as const satisfies TeamType;\n\nexport const GAME_STATUS_KEYS = ['scheduled', 'inprogress', 'completed'] as const;\nexport type GameStatus = (typeof GAME_STATUS_KEYS)[number];\n\n// The one status a finished game holds: it was played, and its stats count. Every reader asking\n// whether a game was played compares against this rather than naming a status of its own.\nexport const COMPLETED_GAME_STATUS = 'completed' as const satisfies GameStatus;\n\n// The status a newly scheduled game is created in.\nexport const GAME_STATUS_ON_CREATE = 'scheduled' as const satisfies GameStatus;\n\n// The status reopen returns a finalized game to: open for scoring again, its record of who played\n// kept.\nexport const GAME_STATUS_ON_REOPEN = 'inprogress' as const satisfies GameStatus;\n\n// An invitation is pending until the invitee accepts (`approved`) or declines (`rejected`) it, or the\n// team withdraws it (`cancelled`). A membership on its team made any other way closes it `approved`.\nexport const TEAM_INVITATION_STATUS_KEYS = ['pending', 'approved', 'rejected', 'cancelled'] as const;\nexport type TeamInvitationStatus = (typeof TEAM_INVITATION_STATUS_KEYS)[number];\n\nexport const PENDING_TEAM_INVITATION_STATUS = 'pending' as const satisfies TeamInvitationStatus;\nexport const APPROVED_TEAM_INVITATION_STATUS = 'approved' as const satisfies TeamInvitationStatus;\nexport const REJECTED_TEAM_INVITATION_STATUS = 'rejected' as const satisfies TeamInvitationStatus;\nexport const CANCELLED_TEAM_INVITATION_STATUS = 'cancelled' as const satisfies TeamInvitationStatus;\n\n// A join request is pending until the team's leaders accept (`approved`) or reject (`rejected`) it,\n// or the requester withdraws it (`cancelled`). A membership on its team made any other way closes it\n// `approved`.\nexport const TEAM_JOIN_REQUEST_STATUS_KEYS = ['pending', 'approved', 'rejected', 'cancelled'] as const;\nexport type TeamJoinRequestStatus = (typeof TEAM_JOIN_REQUEST_STATUS_KEYS)[number];\n\nexport const PENDING_TEAM_JOIN_REQUEST_STATUS = 'pending' as const satisfies TeamJoinRequestStatus;\nexport const APPROVED_TEAM_JOIN_REQUEST_STATUS = 'approved' as const satisfies TeamJoinRequestStatus;\nexport const REJECTED_TEAM_JOIN_REQUEST_STATUS = 'rejected' as const satisfies TeamJoinRequestStatus;\nexport const CANCELLED_TEAM_JOIN_REQUEST_STATUS = 'cancelled' as const satisfies TeamJoinRequestStatus;\n\nexport const HARDWARE_LOAN_CONTRACT_STATUS_KEYS = ['pending', 'loaned', 'returned'] as const;\nexport type HardwareLoanContractStatus = (typeof HARDWARE_LOAN_CONTRACT_STATUS_KEYS)[number];\n// Why an award grant passed over an account its teams or leagues named: it has no profile, or it is\n// a ghost, which holds no account.\nexport const AWARD_GRANT_SKIP_REASON_KEYS = ['noProfile', 'ghost'] as const;\nexport type AwardGrantSkipReason = (typeof AWARD_GRANT_SKIP_REASON_KEYS)[number];\n\nexport const PENDING_HARDWARE_LOAN_CONTRACT_STATUS = 'pending' as const satisfies HardwareLoanContractStatus;\nexport const LOANED_HARDWARE_LOAN_CONTRACT_STATUS = 'loaned' as const satisfies HardwareLoanContractStatus;\nexport const RETURNED_HARDWARE_LOAN_CONTRACT_STATUS = 'returned' as const satisfies HardwareLoanContractStatus;\n\n// What deleting a waiver template did. A template nothing names is deleted with its versions; one a\n// signature or a closed league still names is retired — kept for them, offered to no new league.\nexport const WAIVER_TEMPLATE_DELETE_OUTCOME_KEYS = ['deleted', 'retired'] as const;\nexport type WaiverTemplateDeleteOutcome = (typeof WAIVER_TEMPLATE_DELETE_OUTCOME_KEYS)[number];\n\n// What last changed the stats, as announced on the stats beacon; `link` is a ghost link moving a\n// game's lines onto an account.\nexport const STATS_BEACON_ACTION_KEYS = ['finalize', 'reopen', 'recalculate', 'correct', 'historical-update', 'link'] as const;\nexport type StatsBeaconAction = (typeof STATS_BEACON_ACTION_KEYS)[number];\n\n// The actions that describe one game, so a beacon announcing one names the game, its league, and its\n// teams; every other action names no game, and a game id left beside it would point at a stale one.\nexport const GAME_SCOPED_STATS_BEACON_ACTION_KEYS = ['finalize', 'reopen'] as const satisfies readonly StatsBeaconAction[];\nexport type GameScopedStatsBeaconAction = (typeof GAME_SCOPED_STATS_BEACON_ACTION_KEYS)[number];\n\n// The statuses a game's roster still follows its teams' memberships in: listed explicitly, so a\n// status added later is closed until it is named here, never open by default.\nexport const OPEN_GAME_STATUS_KEYS = ['scheduled', 'inprogress'] as const satisfies readonly GameStatus[];\nexport type OpenGameStatus = (typeof OPEN_GAME_STATUS_KEYS)[number];\n\n// Whether a game is still open — not yet finalized — so a scorer may still change it. Both app roots\n// ask this one predicate.\nexport function isOpenGameStatus(status: GameStatus): status is OpenGameStatus {\n return (OPEN_GAME_STATUS_KEYS as readonly GameStatus[]).includes(status);\n}\n\n// Where one membership's roster obligation stands. `pending` waits for the reconciliation worker;\n// `failed` has spent its retries and waits for an admin's retry; `reconciled` owes nothing.\nexport const MEMBERSHIP_ROSTER_SYNC_STATUS_KEYS = ['pending', 'reconciled', 'failed'] as const;\nexport type MembershipRosterSyncStatus = (typeof MEMBERSHIP_ROSTER_SYNC_STATUS_KEYS)[number];\nexport const PENDING_ROSTER_SYNC_STATUS = 'pending' as const satisfies MembershipRosterSyncStatus;\nexport const RECONCILED_ROSTER_SYNC_STATUS = 'reconciled' as const satisfies MembershipRosterSyncStatus;\nexport const FAILED_ROSTER_SYNC_STATUS = 'failed' as const satisfies MembershipRosterSyncStatus;\n\n// The authority a ghost's waiver was signed under: the witness's captaincy on the ghost's team, or\n// the global role the admin entry confirmed.\nexport const WAIVER_WITNESS_AUTHORITY_KEYS = ['captain', 'coCaptain', 'admin', 'referee'] as const;\nexport type WaiverWitnessAuthority = (typeof WAIVER_WITNESS_AUTHORITY_KEYS)[number];\n\n// Why a signing was refused, named in its details so the signing dialog answers it: `waiverChanged`\n// when the wording the signer saw — the template id and version the dialog sent — is no longer the\n// league's, so the dialog loads the current wording to read again.\nexport const WAIVER_SIGNING_REFUSAL_KEYS = ['waiverChanged'] as const;\nexport type WaiverSigningRefusal = (typeof WAIVER_SIGNING_REFUSAL_KEYS)[number];\n\n// The icon a team picks at creation; the persisted value is the icon component's name.\nexport const TEAM_ICON_KEYS = [\n 'Shield',\n 'Swords',\n 'Skull',\n 'Ghost',\n 'Cat',\n 'Dog',\n 'Bird',\n 'Fish',\n 'Rabbit',\n 'Snail',\n 'Turtle',\n 'Cherry',\n 'Apple',\n 'Grape',\n 'Rocket',\n 'Plane',\n 'Ship',\n 'Train',\n 'Car',\n 'Bike',\n 'Bolt',\n 'Star',\n 'Sun',\n 'Moon',\n 'Cloud',\n 'Crown',\n 'Diamond',\n 'Gem',\n 'Anchor',\n // Appended — the set only grows, and no stored key is ever renamed or removed. Seasonal and events.\n 'TreePine',\n 'Trees',\n 'TreeDeciduous',\n 'TreePalm',\n 'Snowflake',\n 'MountainSnow',\n 'Gift',\n 'PartyPopper',\n 'CandyCane',\n 'Candy',\n 'Lollipop',\n 'Cake',\n 'Egg',\n 'Clover',\n 'Heart',\n 'Flower',\n 'Flower2',\n 'Rose',\n 'Leaf',\n 'Sprout',\n 'Wheat',\n 'Sunrise',\n 'Rainbow',\n 'Bell',\n // Awards and sport.\n 'Trophy',\n 'Medal',\n 'Award',\n 'Ribbon',\n 'Flag',\n 'Target',\n 'Crosshair',\n 'Goal',\n 'Dumbbell',\n 'Footprints',\n // Power and the elements.\n 'Zap',\n 'Flame',\n 'FlameKindling',\n 'Bomb',\n 'Atom',\n 'Orbit',\n 'Sparkles',\n 'WandSparkles',\n 'Mountain',\n 'Tornado',\n 'Wind',\n 'Droplet',\n 'CloudLightning',\n 'MoonStar',\n // Arms and strongholds.\n 'Sword',\n 'Axe',\n 'Hammer',\n 'Pickaxe',\n 'ShieldHalf',\n 'Castle',\n // Animals.\n 'Squirrel',\n 'Rat',\n 'Panda',\n 'Shrimp',\n 'Worm',\n 'Bug',\n 'Shell',\n 'PawPrint',\n 'Feather',\n 'Bone',\n 'Origami',\n // Food.\n 'Citrus',\n 'Banana',\n 'Carrot',\n 'Pizza',\n 'Cookie',\n 'Donut',\n 'Coffee',\n // Games and music.\n 'Dices',\n 'Puzzle',\n 'Gamepad2',\n 'Spade',\n 'Club',\n 'Music',\n 'Guitar',\n 'Hexagon',\n 'Triangle',\n // Travel.\n 'Sailboat',\n 'Tractor',\n 'Truck',\n] as const;\nexport type TeamIcon = (typeof TEAM_ICON_KEYS)[number];\n\n// A picture's processed sizes, smallest first: every picture kind declares all three, and a display\n// asks for the smallest one that covers its slot.\nexport const PICTURE_VARIANT_KEYS = ['sm', 'md', 'lg'] as const;\nexport type PictureVariantKey = (typeof PICTURE_VARIANT_KEYS)[number];\n\n// What a stats check found, game tier first — a game's own numbers are the cause of the aggregate\n// findings, so Fix stats repairs games before it rebuilds what they feed.\nexport const GAME_TIER_DISCREPANCY_KIND_KEYS = [\n 'invalidEvent',\n 'eventSequenceMismatch',\n 'rollupMismatch',\n 'scoreMirrorMismatch',\n 'unrosteredStatLine',\n 'fantasyPointsStale',\n 'finalRecordMissing',\n 'finalRecordMismatch',\n 'participationSnapshotMismatch',\n 'gameHeld',\n] as const;\nexport const AGGREGATE_TIER_DISCREPANCY_KIND_KEYS = [\n 'aggregateMismatch',\n 'aggregateEntryStale',\n 'aggregateEntryMissing',\n 'hallOfFameLifetimeMismatch',\n] as const;\nexport const STATS_DISCREPANCY_KIND_KEYS = [\n ...GAME_TIER_DISCREPANCY_KIND_KEYS,\n ...AGGREGATE_TIER_DISCREPANCY_KIND_KEYS,\n] as const;\nexport type StatsDiscrepancyKind = (typeof STATS_DISCREPANCY_KIND_KEYS)[number];\n"]}
|
|
1
|
+
{"version":3,"file":"unions.js","sourceRoot":"","sources":["../../src/types/unions.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,gGAAgG;AAChG,UAAU;AAEV,kGAAkG;AAClG,qEAAqE;AACrE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,SAAS,CAAU,CAAC;AAG9D,kGAAkG;AAClG,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAU,CAAC;AAE9D,+CAA+C;AAC/C,MAAM,C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AY;IACZ,QAAQ;IACR,WAAW;IACX,UAAU;IACV,KAAK;IACL,OAAO;IACP,QAAQ;IACR,MAAM;IACN,KAAK;IACL,OAAO;IACP,UAAU;IACV,SAAS;IACT,MAAM;IACN,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,mBAAmB;IACnB,OAAO;IACP,QAAQ;IACR,UAAU;IACV,OAAO;IACP,MAAM;IACN,OAAO;IACP,QAAQ;IACR,SAAS;IACT,UAAU;IACV,UAAU;IACV,UAAU;IACV,SAAS;IACT,OAAO;CACC,CAAC;AAGX,oGAAoG;AACpG,kDAAkD;AAClD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAU,CAAC;AAGhE,kGAAkG;AAClG,0EAA0E;AAC1E,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC7C,0FAA0F;IAC1F,gBAAgB;IAChB,cAAc;IACd,uBAAuB;IACvB,oFAAoF;IACpF,kBAAkB;IAClB,gBAAgB;IAChB,qBAAqB;IACrB,oBAAoB;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,qBAAqB;IACrB,+BAA+B;IAC/B,UAAU;CACF,CAAC;AACX,MAAM,CAAC,MAAM,oCAAoC,GAAG;IAClD,mBAAmB;IACnB,qBAAqB;IACrB,uBAAuB;IACvB,4BAA4B;CACpB,CAAC;AACX,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,GAAG,+BAA+B;IAClC,GAAG,oCAAoC;CAC/B,CAAC","sourcesContent":["// Canonical unions (ARCH-102): an `as const` key array with the type derived from it. Zod enums,\n// type positions, query filters, and option lists all derive from these arrays — never a quoted\n// member.\n\n// The two global roles. Each is a roster on `_systemData/adminList` and a boolean custom claim of\n// the same name; the roster is the authority, the claim a fast hint.\nexport const SYSTEM_ROLE_KEYS = ['admin', 'referee'] as const;\nexport type SystemRole = (typeof SYSTEM_ROLE_KEYS)[number];\n\n// Account status on the private profile. Only an exact `active` passes the server auth assertion.\nexport const USER_STATUS_KEYS = ['active', 'banned'] as const;\nexport type UserStatus = (typeof USER_STATUS_KEYS)[number];\n/** The one status that lets an account act. */\nexport const ACTIVE_USER_STATUS = 'active' satisfies UserStatus;\n/** The status an admin's ban sets: the account keeps its data and cannot sign in. */\nexport const BANNED_USER_STATUS = 'banned' satisfies UserStatus;\n\n// Which post-commit Auth effect queued an account on `statusReconcileQueue/{userId}`:\n// `accountStatus` — a status change's disabled flag, status claim, and token revocation, queued in\n// the status transaction itself; `roleClaims` — the `admin` / `referee` claims after a failed roster\n// claim write.\nexport const STATUS_RECONCILE_QUEUE_AUTH_EFFECTS = ['accountStatus', 'roleClaims'] as const;\nexport type StatusReconcileQueueAuthEffect = (typeof STATUS_RECONCILE_QUEUE_AUTH_EFFECTS)[number];\nexport const ACCOUNT_STATUS_AUTH_EFFECT = 'accountStatus' as const satisfies StatusReconcileQueueAuthEffect;\nexport const ROLE_CLAIMS_EFFECT = 'roleClaims' as const satisfies StatusReconcileQueueAuthEffect;\n\nexport const TEAM_ROLE_KEYS = ['captain', 'coCaptain', 'player'] as const;\nexport type TeamRole = (typeof TEAM_ROLE_KEYS)[number];\n\n// The roles that carry captain authority. `firestore.rules` restates this list, because a rules file\n// cannot import it.\nexport const CAPTAIN_TEAM_ROLES = ['captain', 'coCaptain'] as const satisfies readonly TeamRole[];\n\n// The one role a team holds at most one of: team creation, the admin captain change, and ghost\n// linking write it, and nothing else does.\nexport const TEAM_CAPTAIN_ROLE = 'captain' as const satisfies TeamRole;\n\n// The two roles below the captain. A co-captain holds every captain power except managing\n// co-captains; a player holds none.\nexport const TEAM_CO_CAPTAIN_ROLE = 'coCaptain' as const satisfies TeamRole;\nexport const TEAM_PLAYER_ROLE = 'player' as const satisfies TeamRole;\n\n// The roles a member's role change moves a membership between — promoting a player to co-captain,\n// or demoting a co-captain to player. The captain's role moves only through the admin's captain\n// change, so it is never one of them.\nexport const MEMBER_ASSIGNABLE_TEAM_ROLES = [TEAM_CO_CAPTAIN_ROLE, TEAM_PLAYER_ROLE] as const satisfies readonly TeamRole[];\nexport type MemberAssignableTeamRole = (typeof MEMBER_ASSIGNABLE_TEAM_ROLES)[number];\n\n// A ghost link that merges a ghost's membership into the account's keeps one membership with the\n// higher of the two roles: `TEAM_ROLE_KEYS` runs from the highest role down.\nexport function higherTeamRole(left: TeamRole, right: TeamRole): TeamRole {\n return TEAM_ROLE_KEYS.indexOf(left) <= TEAM_ROLE_KEYS.indexOf(right) ? left : right;\n}\n\nexport const TEAM_MEMBERSHIP_STATUS_KEYS = ['active'] as const;\nexport type TeamMembershipStatus = (typeof TEAM_MEMBERSHIP_STATUS_KEYS)[number];\n\n// The status a membership grants authority in. Every membership-based check reads it with the role\n// (BACKEND-006), so a status added later grants nothing until a check names it.\nexport const ACTIVE_TEAM_MEMBERSHIP_STATUS = 'active' as const satisfies TeamMembershipStatus;\n\n// How a membership came to exist; absent on a membership whose provenance was never recorded.\nexport const TEAM_JOIN_METHOD_KEYS = [\n 'teamCreation',\n 'invite',\n 'joinRequest',\n 'freeAgent',\n 'ghostAdd',\n] as const;\nexport type TeamJoinMethod = (typeof TEAM_JOIN_METHOD_KEYS)[number];\n\nexport const LEAGUE_STATUS_KEYS = ['pending', 'upcoming', 'active', 'closed'] as const;\nexport type LeagueStatus = (typeof LEAGUE_STATUS_KEYS)[number];\n\n// Every league is created unpublished; the admin moves it forward from here.\nexport const LEAGUE_STATUS_ON_CREATE = 'pending' as const satisfies LeagueStatus;\n\n// A finished season. Its settings stay editable; its status and mode never change again.\nexport const CLOSED_LEAGUE_STATUS = 'closed' as const satisfies LeagueStatus;\n\n// The two published statuses before a league closes: its teams are forming, then it is in play.\nexport const UPCOMING_LEAGUE_STATUS = 'upcoming' as const satisfies LeagueStatus;\nexport const ACTIVE_LEAGUE_STATUS = 'active' as const satisfies LeagueStatus;\n\n// The statuses a league may move to from each status. Movement is forward only, and `closed` is\n// final; the status callable refuses any other move.\nexport const LEAGUE_STATUS_TRANSITIONS: Readonly<Record<LeagueStatus, readonly LeagueStatus[]>> = {\n pending: ['upcoming', 'closed'],\n upcoming: ['active', 'closed'],\n active: ['closed'],\n closed: [],\n};\n\n// Every status but closed: a league still being set up, published, or played. Whatever such a\n// league is configured with — its waiver template among them — is still in use.\nexport const OPEN_LEAGUE_STATUS_KEYS: readonly Exclude<LeagueStatus, typeof CLOSED_LEAGUE_STATUS>[] =\n LEAGUE_STATUS_KEYS.filter(\n (status): status is Exclude<LeagueStatus, typeof CLOSED_LEAGUE_STATUS> => status !== CLOSED_LEAGUE_STATUS,\n );\n\n// A league players are part of now or next: published and not yet closed. The admin dashboard's\n// active free-agent count covers only these leagues.\nexport const CURRENT_LEAGUE_STATUS_KEYS = [\n UPCOMING_LEAGUE_STATUS,\n ACTIVE_LEAGUE_STATUS,\n] as const satisfies readonly LeagueStatus[];\n\nexport const LEAGUE_MODE_KEYS = ['Regular', 'Competitive/Recreational'] as const;\nexport type LeagueMode = (typeof LEAGUE_MODE_KEYS)[number];\n\n// Present only on teams in a Competitive/Recreational league. In any other mode a team has no type:\n// the field is absent, never null.\nexport const TEAM_TYPE_KEYS = ['Competitive', 'Recreational'] as const;\nexport type TeamType = (typeof TEAM_TYPE_KEYS)[number];\n\n// The one mode whose teams each carry a `teamType`.\nexport const TEAM_TYPED_LEAGUE_MODE = 'Competitive/Recreational' as const satisfies LeagueMode;\n\n// The type every team takes when its league switches into `TEAM_TYPED_LEAGUE_MODE`.\nexport const TEAM_TYPE_ON_MODE_SWITCH = 'Recreational' as const satisfies TeamType;\n\nexport const GAME_STATUS_KEYS = ['scheduled', 'inprogress', 'completed'] as const;\nexport type GameStatus = (typeof GAME_STATUS_KEYS)[number];\n\n// The one status a finished game holds: it was played, and its stats count. Every reader asking\n// whether a game was played compares against this rather than naming a status of its own.\nexport const COMPLETED_GAME_STATUS = 'completed' as const satisfies GameStatus;\n\n// The status a newly scheduled game is created in.\nexport const GAME_STATUS_ON_CREATE = 'scheduled' as const satisfies GameStatus;\n\n// The status reopen returns a finalized game to: open for scoring again, its record of who played\n// kept.\nexport const GAME_STATUS_ON_REOPEN = 'inprogress' as const satisfies GameStatus;\n\n// An invitation is pending until the invitee accepts (`approved`) or declines (`rejected`) it, or the\n// team withdraws it (`cancelled`). A membership on its team made any other way closes it `approved`.\nexport const TEAM_INVITATION_STATUS_KEYS = ['pending', 'approved', 'rejected', 'cancelled'] as const;\nexport type TeamInvitationStatus = (typeof TEAM_INVITATION_STATUS_KEYS)[number];\n\nexport const PENDING_TEAM_INVITATION_STATUS = 'pending' as const satisfies TeamInvitationStatus;\nexport const APPROVED_TEAM_INVITATION_STATUS = 'approved' as const satisfies TeamInvitationStatus;\nexport const REJECTED_TEAM_INVITATION_STATUS = 'rejected' as const satisfies TeamInvitationStatus;\nexport const CANCELLED_TEAM_INVITATION_STATUS = 'cancelled' as const satisfies TeamInvitationStatus;\n\n// A join request is pending until the team's leaders accept (`approved`) or reject (`rejected`) it,\n// or the requester withdraws it (`cancelled`). A membership on its team made any other way closes it\n// `approved`.\nexport const TEAM_JOIN_REQUEST_STATUS_KEYS = ['pending', 'approved', 'rejected', 'cancelled'] as const;\nexport type TeamJoinRequestStatus = (typeof TEAM_JOIN_REQUEST_STATUS_KEYS)[number];\n\nexport const PENDING_TEAM_JOIN_REQUEST_STATUS = 'pending' as const satisfies TeamJoinRequestStatus;\nexport const APPROVED_TEAM_JOIN_REQUEST_STATUS = 'approved' as const satisfies TeamJoinRequestStatus;\nexport const REJECTED_TEAM_JOIN_REQUEST_STATUS = 'rejected' as const satisfies TeamJoinRequestStatus;\nexport const CANCELLED_TEAM_JOIN_REQUEST_STATUS = 'cancelled' as const satisfies TeamJoinRequestStatus;\n\nexport const HARDWARE_LOAN_CONTRACT_STATUS_KEYS = ['pending', 'loaned', 'returned'] as const;\nexport type HardwareLoanContractStatus = (typeof HARDWARE_LOAN_CONTRACT_STATUS_KEYS)[number];\n// Why an award grant passed over an account its teams or leagues named: it has no profile, or it is\n// a ghost, which holds no account.\nexport const AWARD_GRANT_SKIP_REASON_KEYS = ['noProfile', 'ghost'] as const;\nexport type AwardGrantSkipReason = (typeof AWARD_GRANT_SKIP_REASON_KEYS)[number];\n\n// The two badges an account shows beside its name.\nexport const FEATURED_AWARD_SLOT_KEYS = ['primary', 'secondary'] as const;\nexport type FeaturedAwardSlot = (typeof FEATURED_AWARD_SLOT_KEYS)[number];\n\nexport const PENDING_HARDWARE_LOAN_CONTRACT_STATUS = 'pending' as const satisfies HardwareLoanContractStatus;\nexport const LOANED_HARDWARE_LOAN_CONTRACT_STATUS = 'loaned' as const satisfies HardwareLoanContractStatus;\nexport const RETURNED_HARDWARE_LOAN_CONTRACT_STATUS = 'returned' as const satisfies HardwareLoanContractStatus;\n\n// What deleting a waiver template did. A template nothing names is deleted with its versions; one a\n// signature or a closed league still names is retired — kept for them, offered to no new league.\nexport const WAIVER_TEMPLATE_DELETE_OUTCOME_KEYS = ['deleted', 'retired'] as const;\nexport type WaiverTemplateDeleteOutcome = (typeof WAIVER_TEMPLATE_DELETE_OUTCOME_KEYS)[number];\n\n// What last changed the stats, as announced on the stats beacon; `link` is a ghost link moving a\n// game's lines onto an account.\nexport const STATS_BEACON_ACTION_KEYS = ['finalize', 'reopen', 'recalculate', 'correct', 'historical-update', 'link'] as const;\nexport type StatsBeaconAction = (typeof STATS_BEACON_ACTION_KEYS)[number];\n\n// The actions that describe one game, so a beacon announcing one names the game, its league, and its\n// teams; every other action names no game, and a game id left beside it would point at a stale one.\nexport const GAME_SCOPED_STATS_BEACON_ACTION_KEYS = ['finalize', 'reopen'] as const satisfies readonly StatsBeaconAction[];\nexport type GameScopedStatsBeaconAction = (typeof GAME_SCOPED_STATS_BEACON_ACTION_KEYS)[number];\n\n// The statuses a game's roster still follows its teams' memberships in: listed explicitly, so a\n// status added later is closed until it is named here, never open by default.\nexport const OPEN_GAME_STATUS_KEYS = ['scheduled', 'inprogress'] as const satisfies readonly GameStatus[];\nexport type OpenGameStatus = (typeof OPEN_GAME_STATUS_KEYS)[number];\n\n// Whether a game is still open — not yet finalized — so a scorer may still change it. Both app roots\n// ask this one predicate.\nexport function isOpenGameStatus(status: GameStatus): status is OpenGameStatus {\n return (OPEN_GAME_STATUS_KEYS as readonly GameStatus[]).includes(status);\n}\n\n// Where one membership's roster obligation stands. `pending` waits for the reconciliation worker;\n// `failed` has spent its retries and waits for an admin's retry; `reconciled` owes nothing.\nexport const MEMBERSHIP_ROSTER_SYNC_STATUS_KEYS = ['pending', 'reconciled', 'failed'] as const;\nexport type MembershipRosterSyncStatus = (typeof MEMBERSHIP_ROSTER_SYNC_STATUS_KEYS)[number];\nexport const PENDING_ROSTER_SYNC_STATUS = 'pending' as const satisfies MembershipRosterSyncStatus;\nexport const RECONCILED_ROSTER_SYNC_STATUS = 'reconciled' as const satisfies MembershipRosterSyncStatus;\nexport const FAILED_ROSTER_SYNC_STATUS = 'failed' as const satisfies MembershipRosterSyncStatus;\n\n// The authority a ghost's waiver was signed under: the witness's captaincy on the ghost's team, or\n// the global role the admin entry confirmed.\nexport const WAIVER_WITNESS_AUTHORITY_KEYS = ['captain', 'coCaptain', 'admin', 'referee'] as const;\nexport type WaiverWitnessAuthority = (typeof WAIVER_WITNESS_AUTHORITY_KEYS)[number];\n\n// Why a signing was refused, named in its details so the signing dialog answers it: `waiverChanged`\n// when the wording the signer saw — the template id and version the dialog sent — is no longer the\n// league's, so the dialog loads the current wording to read again.\nexport const WAIVER_SIGNING_REFUSAL_KEYS = ['waiverChanged'] as const;\nexport type WaiverSigningRefusal = (typeof WAIVER_SIGNING_REFUSAL_KEYS)[number];\n\n// The icon a team picks at creation; the persisted value is the icon component's name.\nexport const TEAM_ICON_KEYS = [\n 'Shield',\n 'Swords',\n 'Skull',\n 'Ghost',\n 'Cat',\n 'Dog',\n 'Bird',\n 'Fish',\n 'Rabbit',\n 'Snail',\n 'Turtle',\n 'Cherry',\n 'Apple',\n 'Grape',\n 'Rocket',\n 'Plane',\n 'Ship',\n 'Train',\n 'Car',\n 'Bike',\n 'Bolt',\n 'Star',\n 'Sun',\n 'Moon',\n 'Cloud',\n 'Crown',\n 'Diamond',\n 'Gem',\n 'Anchor',\n // Appended — the set only grows, and no stored key is ever renamed or removed. Seasonal and events.\n 'TreePine',\n 'Trees',\n 'TreeDeciduous',\n 'TreePalm',\n 'Snowflake',\n 'MountainSnow',\n 'Gift',\n 'PartyPopper',\n 'CandyCane',\n 'Candy',\n 'Lollipop',\n 'Cake',\n 'Egg',\n 'Clover',\n 'Heart',\n 'Flower',\n 'Flower2',\n 'Rose',\n 'Leaf',\n 'Sprout',\n 'Wheat',\n 'Sunrise',\n 'Rainbow',\n 'Bell',\n // Awards and sport.\n 'Trophy',\n 'Medal',\n 'Award',\n 'Ribbon',\n 'Flag',\n 'Target',\n 'Crosshair',\n 'Goal',\n 'Dumbbell',\n 'Footprints',\n // Power and the elements.\n 'Zap',\n 'Flame',\n 'FlameKindling',\n 'Bomb',\n 'Atom',\n 'Orbit',\n 'Sparkles',\n 'WandSparkles',\n 'Mountain',\n 'Tornado',\n 'Wind',\n 'Droplet',\n 'CloudLightning',\n 'MoonStar',\n // Arms and strongholds.\n 'Sword',\n 'Axe',\n 'Hammer',\n 'Pickaxe',\n 'ShieldHalf',\n 'Castle',\n // Animals.\n 'Squirrel',\n 'Rat',\n 'Panda',\n 'Shrimp',\n 'Worm',\n 'Bug',\n 'Shell',\n 'PawPrint',\n 'Feather',\n 'Bone',\n 'Origami',\n // Food.\n 'Citrus',\n 'Banana',\n 'Carrot',\n 'Pizza',\n 'Cookie',\n 'Donut',\n 'Coffee',\n // Games and music.\n 'Dices',\n 'Puzzle',\n 'Gamepad2',\n 'Spade',\n 'Club',\n 'Music',\n 'Guitar',\n 'Hexagon',\n 'Triangle',\n // Travel.\n 'Sailboat',\n 'Tractor',\n 'Truck',\n] as const;\nexport type TeamIcon = (typeof TEAM_ICON_KEYS)[number];\n\n// A picture's processed sizes, smallest first: every picture kind declares all three, and a display\n// asks for the smallest one that covers its slot.\nexport const PICTURE_VARIANT_KEYS = ['sm', 'md', 'lg'] as const;\nexport type PictureVariantKey = (typeof PICTURE_VARIANT_KEYS)[number];\n\n// What a stats check found, game tier first — a game's own numbers are the cause of the aggregate\n// findings, so Fix stats repairs games before it rebuilds what they feed.\nexport const GAME_TIER_DISCREPANCY_KIND_KEYS = [\n // A game whose document the check could not read: nothing else about it could be checked.\n 'gameUnreadable',\n 'invalidEvent',\n 'eventSequenceMismatch',\n // A game whose events do not hold exactly the sequences 1..n: a gap or a duplicate.\n 'eventSequenceGap',\n 'rollupMismatch',\n 'scoreMirrorMismatch',\n 'unrosteredStatLine',\n 'fantasyPointsStale',\n 'finalRecordMissing',\n 'finalRecordMismatch',\n 'participationSnapshotMismatch',\n 'gameHeld',\n] as const;\nexport const AGGREGATE_TIER_DISCREPANCY_KIND_KEYS = [\n 'aggregateMismatch',\n 'aggregateEntryStale',\n 'aggregateEntryMissing',\n 'hallOfFameLifetimeMismatch',\n] as const;\nexport const STATS_DISCREPANCY_KIND_KEYS = [\n ...GAME_TIER_DISCREPANCY_KIND_KEYS,\n ...AGGREGATE_TIER_DISCREPANCY_KIND_KEYS,\n] as const;\nexport type StatsDiscrepancyKind = (typeof STATS_DISCREPANCY_KIND_KEYS)[number];\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/upload-variables/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,+BAA+B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/upload-variables/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,+BAA+B,CAAC","sourcesContent":["export * from './on-progress.js';\nexport * from './picture-upload-variables.js';\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { UploadState } from '@ttt-productions/media-schemas';
|
|
3
|
+
export declare const onProgressSchema: z.ZodOptional<z.ZodCustom<(state: UploadState | null) => void, (state: UploadState | null) => void>>;
|
|
4
|
+
//# sourceMappingURL=on-progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"on-progress.d.ts","sourceRoot":"","sources":["../../src/upload-variables/on-progress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAOlE,eAAO,MAAM,gBAAgB,oCACX,WAAW,GAAG,IAAI,KAAK,IAAI,UAA3B,WAAW,GAAG,IAAI,KAAK,IAAI,EAChC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// Shared schema for the optional upload-progress callback carried in upload
|
|
3
|
+
// mutation variables. Zod 4 removed embeddable `z.function()` schemas, so this
|
|
4
|
+
// validates "is a function" at parse time and preserves the callback's type
|
|
5
|
+
// (and identity — zod 3's function schema returned a validating wrapper; this
|
|
6
|
+
// returns the original function).
|
|
7
|
+
export const onProgressSchema = z
|
|
8
|
+
.custom((value) => typeof value === 'function')
|
|
9
|
+
.optional();
|
|
10
|
+
//# sourceMappingURL=on-progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"on-progress.js","sourceRoot":"","sources":["../../src/upload-variables/on-progress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,4EAA4E;AAC5E,+EAA+E;AAC/E,4EAA4E;AAC5E,8EAA8E;AAC9E,kCAAkC;AAClC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,MAAM,CAAsC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,UAAU,CAAC;KACnF,QAAQ,EAAE,CAAC","sourcesContent":["import { z } from 'zod';\nimport type { UploadState } from '@ttt-productions/media-schemas';\n\n// Shared schema for the optional upload-progress callback carried in upload\n// mutation variables. Zod 4 removed embeddable `z.function()` schemas, so this\n// validates \"is a function\" at parse time and preserves the callback's type\n// (and identity — zod 3's function schema returned a validating wrapper; this\n// returns the original function).\nexport const onProgressSchema = z\n .custom<(state: UploadState | null) => void>((value) => typeof value === 'function')\n .optional();\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { PictureOrigin } from '../media/file-origins.js';
|
|
3
|
+
import { PICTURE_TARGETS } from '../schemas/uploads.js';
|
|
4
|
+
/** What a picture is uploaded for: its origin, and that origin's target — the owner, by id. */
|
|
5
|
+
export type PictureUploadTarget = {
|
|
6
|
+
[O in PictureOrigin]: {
|
|
7
|
+
origin: O;
|
|
8
|
+
targetInfo: z.infer<(typeof PICTURE_TARGETS)[O]['schema']>;
|
|
9
|
+
};
|
|
10
|
+
}[PictureOrigin];
|
|
11
|
+
export declare const PictureUploadTargetSchema: z.ZodType<PictureUploadTarget>;
|
|
12
|
+
export declare const PictureUploadVariablesSchema: z.ZodObject<{
|
|
13
|
+
target: z.ZodType<PictureUploadTarget, unknown, z.core.$ZodTypeInternals<PictureUploadTarget, unknown>>;
|
|
14
|
+
file: z.ZodCustom<File, File>;
|
|
15
|
+
claim: z.ZodOptional<z.ZodObject<{
|
|
16
|
+
kind: z.ZodEnum<{
|
|
17
|
+
file: "file";
|
|
18
|
+
image: "image";
|
|
19
|
+
video: "video";
|
|
20
|
+
audio: "audio";
|
|
21
|
+
}>;
|
|
22
|
+
source: z.ZodEnum<{
|
|
23
|
+
"file-picker": "file-picker";
|
|
24
|
+
"camera-capture": "camera-capture";
|
|
25
|
+
"media-recorder": "media-recorder";
|
|
26
|
+
}>;
|
|
27
|
+
}, z.core.$strict>>;
|
|
28
|
+
onProgress: z.ZodOptional<z.ZodCustom<(state: import("@ttt-productions/media-schemas").UploadState | null) => void, (state: import("@ttt-productions/media-schemas").UploadState | null) => void>>;
|
|
29
|
+
signal: z.ZodOptional<z.ZodCustom<AbortSignal, AbortSignal>>;
|
|
30
|
+
}, z.core.$strict>;
|
|
31
|
+
export type PictureUploadVariables = z.infer<typeof PictureUploadVariablesSchema>;
|
|
32
|
+
//# sourceMappingURL=picture-upload-variables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"picture-upload-variables.d.ts","sourceRoot":"","sources":["../../src/upload-variables/picture-upload-variables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD,+FAA+F;AAC/F,MAAM,MAAM,mBAAmB,GAAG;KAC/B,CAAC,IAAI,aAAa,GAAG;QAAE,MAAM,EAAE,CAAC,CAAC;QAAC,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAA;KAAE;CAChG,CAAC,aAAa,CAAC,CAAC;AAUjB,eAAO,MAAM,yBAAyB,EAGtB,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAE/C,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;kBAQ9B,CAAC;AACZ,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ClientMediaClaimSchema } from '@ttt-productions/media-schemas';
|
|
3
|
+
import { PICTURE_ORIGIN_KEYS } from '../media/file-origins.js';
|
|
4
|
+
import { PICTURE_TARGETS } from '../schemas/uploads.js';
|
|
5
|
+
import { onProgressSchema } from './on-progress.js';
|
|
6
|
+
// One member per picture origin, each pairing the origin with its own target schema, built from
|
|
7
|
+
// `PICTURE_TARGETS` so a new origin joins it with no change here.
|
|
8
|
+
const pictureUploadTargetOptions = PICTURE_ORIGIN_KEYS.map((origin) => z.object({ origin: z.literal(origin), targetInfo: PICTURE_TARGETS[origin].schema }).strict());
|
|
9
|
+
// The mapped options are one object schema per origin; TypeScript cannot follow the origin-to-target
|
|
10
|
+
// pairing through the map, so the union is typed by `PictureUploadTarget`, which states it.
|
|
11
|
+
export const PictureUploadTargetSchema = z.discriminatedUnion('origin', pictureUploadTargetOptions);
|
|
12
|
+
export const PictureUploadVariablesSchema = z.object({
|
|
13
|
+
target: PictureUploadTargetSchema,
|
|
14
|
+
file: z.instanceof(File),
|
|
15
|
+
// Untrusted client claim of what the user's action implies (advisory; the
|
|
16
|
+
// server byte inspection is the only classification authority).
|
|
17
|
+
claim: ClientMediaClaimSchema.optional(),
|
|
18
|
+
onProgress: onProgressSchema,
|
|
19
|
+
signal: z.instanceof(AbortSignal).optional(),
|
|
20
|
+
}).strict();
|
|
21
|
+
//# sourceMappingURL=picture-upload-variables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"picture-upload-variables.js","sourceRoot":"","sources":["../../src/upload-variables/picture-upload-variables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAOpD,gGAAgG;AAChG,kEAAkE;AAClE,MAAM,0BAA0B,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CACpE,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAC7F,CAAC;AAEF,qGAAqG;AACrG,4FAA4F;AAC5F,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,kBAAkB,CAC3D,QAAQ,EACR,0BAA6H,CACjF,CAAC;AAE/C,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,MAAM,EAAE,yBAAyB;IACjC,IAAI,EAAE,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC;IACxB,0EAA0E;IAC1E,gEAAgE;IAChE,KAAK,EAAE,sBAAsB,CAAC,QAAQ,EAAE;IACxC,UAAU,EAAE,gBAAgB;IAC5B,MAAM,EAAE,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,QAAQ,EAAE;CAC7C,CAAC,CAAC,MAAM,EAAE,CAAC","sourcesContent":["import { z } from 'zod';\nimport { ClientMediaClaimSchema } from '@ttt-productions/media-schemas';\nimport { PICTURE_ORIGIN_KEYS } from '../media/file-origins.js';\nimport type { PictureOrigin } from '../media/file-origins.js';\nimport { PICTURE_TARGETS } from '../schemas/uploads.js';\nimport { onProgressSchema } from './on-progress.js';\n\n/** What a picture is uploaded for: its origin, and that origin's target — the owner, by id. */\nexport type PictureUploadTarget = {\n [O in PictureOrigin]: { origin: O; targetInfo: z.infer<(typeof PICTURE_TARGETS)[O]['schema']> };\n}[PictureOrigin];\n\n// One member per picture origin, each pairing the origin with its own target schema, built from\n// `PICTURE_TARGETS` so a new origin joins it with no change here.\nconst pictureUploadTargetOptions = PICTURE_ORIGIN_KEYS.map((origin) =>\n z.object({ origin: z.literal(origin), targetInfo: PICTURE_TARGETS[origin].schema }).strict(),\n);\n\n// The mapped options are one object schema per origin; TypeScript cannot follow the origin-to-target\n// pairing through the map, so the union is typed by `PictureUploadTarget`, which states it.\nexport const PictureUploadTargetSchema = z.discriminatedUnion(\n 'origin',\n pictureUploadTargetOptions as [(typeof pictureUploadTargetOptions)[number], ...(typeof pictureUploadTargetOptions)[number][]],\n) as unknown as z.ZodType<PictureUploadTarget>;\n\nexport const PictureUploadVariablesSchema = z.object({\n target: PictureUploadTargetSchema,\n file: z.instanceof(File),\n // Untrusted client claim of what the user's action implies (advisory; the\n // server byte inspection is the only classification authority).\n claim: ClientMediaClaimSchema.optional(),\n onProgress: onProgressSchema,\n signal: z.instanceof(AbortSignal).optional(),\n}).strict();\nexport type PictureUploadVariables = z.infer<typeof PictureUploadVariablesSchema>;\n"]}
|
|
@@ -38,16 +38,30 @@ export declare function isMaintenanceRefusalDetails(details: unknown): details i
|
|
|
38
38
|
* outage is never mistaken for the designed refusal.
|
|
39
39
|
*/
|
|
40
40
|
export declare function isMaintenanceRefusalError(err: unknown): boolean;
|
|
41
|
+
/** A stored lever its schema field refused, with the raw value the document held. */
|
|
42
|
+
export interface AppConfigLeverRepair {
|
|
43
|
+
readonly lever: AppConfigLeverKey;
|
|
44
|
+
readonly storedValue: unknown;
|
|
45
|
+
}
|
|
46
|
+
/** The document a writer writes, and every stored lever the merge had to repair to write it. */
|
|
47
|
+
export interface AppConfigMerge {
|
|
48
|
+
readonly next: AppConfig;
|
|
49
|
+
readonly repairs: readonly AppConfigLeverRepair[];
|
|
50
|
+
}
|
|
41
51
|
/**
|
|
42
52
|
* The complete `_appConfig/app` document to write after applying `update` to `existing` (the
|
|
43
53
|
* document as read in the writer's transaction; `null` or `undefined` when it does not exist). The
|
|
44
54
|
* update's fields win, `existing` supplies the rest, and any field still missing comes from
|
|
45
55
|
* DEFAULT_APP_CONFIG. An `undefined` update field changes nothing. Pure.
|
|
46
56
|
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
57
|
+
* A stored lever its schema refuses never blocks a save — a console typo must not disable the
|
|
58
|
+
* maintenance switch. It is dropped, so the update's value replaces it when the update sends that
|
|
59
|
+
* lever and its DEFAULT_APP_CONFIG value (what every reader already falls back to) otherwise, and it
|
|
60
|
+
* is reported in `repairs`. A valid stored lever is carried as it is.
|
|
61
|
+
*
|
|
62
|
+
* Throws when the update itself would not parse, so an invalid document is never written.
|
|
49
63
|
*/
|
|
50
|
-
export declare function mergeAppConfigUpdate(existing: Readonly<Record<string, unknown>> | null | undefined, update: Readonly<Partial<AppConfig>>):
|
|
64
|
+
export declare function mergeAppConfigUpdate(existing: Readonly<Record<string, unknown>> | null | undefined, update: Readonly<Partial<AppConfig>>): AppConfigMerge;
|
|
51
65
|
/**
|
|
52
66
|
* One operator lever off an unvalidated `_appConfig/app` snapshot (`null` or `undefined` when the
|
|
53
67
|
* document is missing or not yet read): the stored value when its schema field accepts it, otherwise
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-config.d.ts","sourceRoot":"","sources":["../../src/utils/app-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app-config.d.ts","sourceRoot":"","sources":["../../src/utils/app-config.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE1D,0FAA0F;AAC1F,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;AAE5D,sCAAsC;AACtC,MAAM,MAAM,iBAAiB,GAAG,MAAM,eAAe,CAAC;AAEtD,0DAA0D;AAC1D,eAAO,MAAM,qBAAqB,6GAAkC,CAAC;AAErE;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,EAAE,eAM/B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,2BAA2B,4GAC8D,CAAC;AAEvG;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAG,aAAsB,CAAC;AAE/D,qEAAqE;AACrE,eAAO,MAAM,0BAA0B,EAAG,aAAsB,CAAC;AAEjE,sEAAsE;AACtE,MAAM,WAAW,yBAAyB;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AM,EAAE,OAAO,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,GAC7D,eAAe,CAMjB"}
|
package/dist/utils/app-config.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
// The `_appConfig/app` singleton at rest, and the one rule each for writing it and reading it.
|
|
2
2
|
//
|
|
3
3
|
// WRITE. `mergeAppConfigUpdate(existing, update)`: the writer's update on top of the document it
|
|
4
|
-
// read, any field that document lacks
|
|
5
|
-
// A writer that runs first on a fresh
|
|
6
|
-
//
|
|
7
|
-
// console
|
|
8
|
-
//
|
|
9
|
-
// field replaces it.
|
|
4
|
+
// read, any field that document lacks — and any lever it holds at a value its schema refuses —
|
|
5
|
+
// taken from DEFAULT_APP_CONFIG, the whole result validated. A writer that runs first on a fresh
|
|
6
|
+
// environment therefore still writes a complete, valid document rather than a partial one, and a
|
|
7
|
+
// hand edit in the console that broke one lever never blocks a save of another: the merge resets it
|
|
8
|
+
// and reports the repair with the value it replaced, which the writer records.
|
|
10
9
|
//
|
|
11
10
|
// READ. The stored document is untrusted — an operator can edit any field in the console into any
|
|
12
11
|
// shape — and a config read must never take the product down by itself. `readAppConfigLever`
|
|
@@ -77,21 +76,29 @@ function definedFields(fields) {
|
|
|
77
76
|
* update's fields win, `existing` supplies the rest, and any field still missing comes from
|
|
78
77
|
* DEFAULT_APP_CONFIG. An `undefined` update field changes nothing. Pure.
|
|
79
78
|
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
79
|
+
* A stored lever its schema refuses never blocks a save — a console typo must not disable the
|
|
80
|
+
* maintenance switch. It is dropped, so the update's value replaces it when the update sends that
|
|
81
|
+
* lever and its DEFAULT_APP_CONFIG value (what every reader already falls back to) otherwise, and it
|
|
82
|
+
* is reported in `repairs`. A valid stored lever is carried as it is.
|
|
83
|
+
*
|
|
84
|
+
* Throws when the update itself would not parse, so an invalid document is never written.
|
|
82
85
|
*/
|
|
83
86
|
export function mergeAppConfigUpdate(existing, update) {
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
const stored = definedFields(existing ?? {});
|
|
88
|
+
const repairs = [];
|
|
89
|
+
for (const lever of APP_CONFIG_LEVER_KEYS) {
|
|
90
|
+
if (!(lever in stored) || AppConfigSchema.shape[lever].safeParse(stored[lever]).success)
|
|
91
|
+
continue;
|
|
92
|
+
repairs.push({ lever, storedValue: stored[lever] });
|
|
93
|
+
delete stored[lever];
|
|
94
|
+
}
|
|
95
|
+
const parsed = AppConfigSchema.safeParse({ ...DEFAULT_APP_CONFIG, ...stored, ...definedFields(update) });
|
|
89
96
|
if (!parsed.success) {
|
|
90
97
|
const issue = parsed.error.issues[0];
|
|
91
98
|
const field = issue?.path.join('.') || 'document';
|
|
92
99
|
throw new Error(`_appConfig/app would not match its schema after this update (${field}: ${issue?.message ?? 'invalid'}). Nothing should be written.`);
|
|
93
100
|
}
|
|
94
|
-
return parsed.data;
|
|
101
|
+
return { next: parsed.data, repairs };
|
|
95
102
|
}
|
|
96
103
|
/**
|
|
97
104
|
* One operator lever off an unvalidated `_appConfig/app` snapshot (`null` or `undefined` when the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-config.js","sourceRoot":"","sources":["../../src/utils/app-config.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,EAAE;AACF,iGAAiG;AACjG,iGAAiG;AACjG,2FAA2F;AAC3F,8FAA8F;AAC9F,8FAA8F;AAC9F,kGAAkG;AAClG,qBAAqB;AACrB,EAAE;AACF,kGAAkG;AAClG,6FAA6F;AAC7F,gGAAgG;AAChG,oGAAoG;AACpG,iEAAiE;AAEjE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAS3D,0DAA0D;AAC1D,MAAM,CAAC,MAAM,qBAAqB,GAAG,eAAe,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC;AAErE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAoB,MAAM,CAAC,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C,MAAM,CAAC,CAAC,OAAO,CAAC;AACzF,CAAC;AAED,gGAAgG;AAChG,MAAM,UAAU,mBAAmB,CACjC,QAA8D;IAE9D,MAAM,MAAM,GAAgD,EAAE,CAAC;IAC/D,KAAK,MAAM,KAAK,IAAI,qBAAqB,EAAE,CAAC;QAC1C,MAAM,CAAC,KAAK,CAAC,GAAG,kBAAkB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACtD,CAAC;IACD,OAAO,MAAyB,CAAC;AACnC,CAAC","sourcesContent":["// The `_appConfig/app` singleton at rest, and the one rule each for writing it and reading it.\n//\n// WRITE. `mergeAppConfigUpdate(existing, update)`: the writer's update on top of the document it\n// read, any field that document lacks taken from DEFAULT_APP_CONFIG, the whole result validated.\n// A writer that runs first on a fresh environment therefore still writes a complete, valid\n// document rather than a partial one. A stored field that does not parse — a hand edit in the\n// console — is never written over by a save that does not send it: the merge refuses, and the\n// writer answers with the field, so the operator corrects it at the source. A save that sends the\n// field replaces it.\n//\n// READ. The stored document is untrusted — an operator can edit any field in the console into any\n// shape — and a config read must never take the product down by itself. `readAppConfigLever`\n// answers one lever at a time: the stored value when its schema field accepts it, otherwise the\n// lever's DEFAULT_APP_CONFIG value, so one bad field never costs the good ones. The server's cached\n// snapshot reader and the client's readers both read through it.\n\nimport { AppConfigSchema } from '../doc-schemas/system.js';\nimport type { AppConfig } from '../doc-schemas/system.js';\n\n/** Every operator lever of `_appConfig/app`, each at a value its schema field accepts. */\nexport type AppConfigLevers = Readonly<Required<AppConfig>>;\n\n/** The name of one operator lever. */\nexport type AppConfigLeverKey = keyof AppConfigLevers;\n\n/** Every lever name, derived from the document schema. */\nexport const APP_CONFIG_LEVER_KEYS = AppConfigSchema.keyof().options;\n\n/**\n * The document a fresh environment behaves as if it held, and the value each reader falls back to\n * for a missing or unreadable field: maintenance off, registration open, no banner.\n *\n * `appVersion` is `''` — no version has been published — so the version gate stays dormant until an\n * operator sets a real one through `updateAppConfig`, whose input refuses `''`.\n */\nexport const DEFAULT_APP_CONFIG: AppConfigLevers = Object.freeze({\n appVersion: '',\n maintenanceMode: false,\n maintenanceMessage: '',\n registrationEnabled: true,\n announcementMessage: '',\n});\n\n/**\n * The line shown while maintenance is on and the operator left `maintenanceMessage` blank — on the\n * maintenance screen and in the callable refusal alike.\n */\nexport const DEFAULT_MAINTENANCE_MESSAGE =\n 'Q-Sports is down for maintenance right now. We will be back shortly — thank you for your patience.';\n\n/**\n * The code the callable maintenance refusal is thrown with. `unavailable` is also what a real outage\n * produces, so the code alone never identifies the refusal — its details do.\n */\nexport const MAINTENANCE_REFUSAL_CODE = 'unavailable' as const;\n\n/** The `details.reason` the callable maintenance refusal carries. */\nexport const MAINTENANCE_REFUSAL_REASON = 'maintenance' as const;\n\n/** Structured details carried by the callable maintenance refusal. */\nexport interface MaintenanceRefusalDetails {\n readonly reason: typeof MAINTENANCE_REFUSAL_REASON;\n}\n\n// The refusal code as the server (`unavailable`) and the Firebase client SDK\n// (`functions/unavailable`) spell it.\nconst MAINTENANCE_REFUSAL_CODES: ReadonlySet<string> = new Set([\n MAINTENANCE_REFUSAL_CODE,\n `functions/${MAINTENANCE_REFUSAL_CODE}`,\n]);\n\n/** True when `details` is the maintenance refusal's structured details. */\nexport function isMaintenanceRefusalDetails(details: unknown): details is MaintenanceRefusalDetails {\n if (!details || typeof details !== 'object') return false;\n return (details as Record<string, unknown>).reason === MAINTENANCE_REFUSAL_REASON;\n}\n\n/**\n * True when `err` is the callable maintenance refusal — an `unavailable` error in either spelling\n * whose details carry `reason: 'maintenance'`. Works on the server-side error and on the client-side\n * callable error alike, and is decided by the code and the details, never the message, so a genuine\n * outage is never mistaken for the designed refusal.\n */\nexport function isMaintenanceRefusalError(err: unknown): boolean {\n if (!err || typeof err !== 'object') return false;\n const candidate = err as { code?: unknown; details?: unknown };\n return (\n typeof candidate.code === 'string' &&\n MAINTENANCE_REFUSAL_CODES.has(candidate.code) &&\n isMaintenanceRefusalDetails(candidate.details)\n );\n}\n\nfunction definedFields(fields: Readonly<Record<string, unknown>>): Record<string, unknown> {\n return Object.fromEntries(Object.entries(fields).filter(([, value]) => value !== undefined));\n}\n\n/**\n * The complete `_appConfig/app` document to write after applying `update` to `existing` (the\n * document as read in the writer's transaction; `null` or `undefined` when it does not exist). The\n * update's fields win, `existing` supplies the rest, and any field still missing comes from\n * DEFAULT_APP_CONFIG. An `undefined` update field changes nothing. Pure.\n *\n * Throws when the result would not parse — the update itself, or a stored field the update does not\n * replace — so an invalid document is never written.\n */\nexport function mergeAppConfigUpdate(\n existing: Readonly<Record<string, unknown>> | null | undefined,\n update: Readonly<Partial<AppConfig>>,\n): AppConfig {\n const parsed = AppConfigSchema.safeParse({\n ...DEFAULT_APP_CONFIG,\n ...definedFields(existing ?? {}),\n ...definedFields(update),\n });\n if (!parsed.success) {\n const issue = parsed.error.issues[0];\n const field = issue?.path.join('.') || 'document';\n throw new Error(\n `_appConfig/app would not match its schema after this update (${field}: ${issue?.message ?? 'invalid'}). Nothing should be written.`,\n );\n }\n return parsed.data;\n}\n\n/**\n * One operator lever off an unvalidated `_appConfig/app` snapshot (`null` or `undefined` when the\n * document is missing or not yet read): the stored value when its schema field accepts it, otherwise\n * the lever's DEFAULT_APP_CONFIG value — for an absent field and a refused one alike. Never throws.\n */\nexport function readAppConfigLever<L extends AppConfigLeverKey>(\n snapshot: Readonly<Record<string, unknown>> | null | undefined,\n lever: L,\n): AppConfigLevers[L] {\n const parsed = AppConfigSchema.shape[lever].safeParse(snapshot?.[lever]);\n return parsed.success && parsed.data !== undefined\n ? (parsed.data as AppConfigLevers[L])\n : DEFAULT_APP_CONFIG[lever];\n}\n\n/**\n * True when an unvalidated `_appConfig/app` snapshot holds `lever` with a value its schema field\n * refuses — the value every reader passes over for the default. An absent field is not refused.\n * Never throws.\n */\nexport function isAppConfigLeverRefused(\n snapshot: Readonly<Record<string, unknown>> | null | undefined,\n lever: AppConfigLeverKey,\n): boolean {\n const stored = snapshot?.[lever];\n return stored !== undefined && !AppConfigSchema.shape[lever].safeParse(stored).success;\n}\n\n/** Every lever off an unvalidated snapshot, each through `readAppConfigLever`. Never throws. */\nexport function readAppConfigLevers(\n snapshot: Readonly<Record<string, unknown>> | null | undefined,\n): AppConfigLevers {\n const levers: Partial<Record<AppConfigLeverKey, unknown>> = {};\n for (const lever of APP_CONFIG_LEVER_KEYS) {\n levers[lever] = readAppConfigLever(snapshot, lever);\n }\n return levers as AppConfigLevers;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"app-config.js","sourceRoot":"","sources":["../../src/utils/app-config.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,EAAE;AACF,iGAAiG;AACjG,+FAA+F;AAC/F,iGAAiG;AACjG,iGAAiG;AACjG,oGAAoG;AACpG,+EAA+E;AAC/E,EAAE;AACF,kGAAkG;AAClG,6FAA6F;AAC7F,gGAAgG;AAChG,oGAAoG;AACpG,iEAAiE;AAEjE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAS3D,0DAA0D;AAC1D,MAAM,CAAC,MAAM,qBAAqB,GAAG,eAAe,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC;AAErE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAoB,MAAM,CAAC,MAAM,CAAC;IAC/D,UAAU,EAAE,EAAE;IACd,eAAe,EAAE,KAAK;IACtB,kBAAkB,EAAE,EAAE;IACtB,mBAAmB,EAAE,IAAI;IACzB,mBAAmB,EAAE,EAAE;CACxB,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,2BAA2B,GACtC,oGAAoG,CAAC;AAEvG;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,aAAsB,CAAC;AAE/D,qEAAqE;AACrE,MAAM,CAAC,MAAM,0BAA0B,GAAG,aAAsB,CAAC;AAOjE,6EAA6E;AAC7E,sCAAsC;AACtC,MAAM,yBAAyB,GAAwB,IAAI,GAAG,CAAC;IAC7D,wBAAwB;IACxB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CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;AACzF,CAAC;AAED,gGAAgG;AAChG,MAAM,UAAU,mBAAmB,CACjC,QAA8D;IAE9D,MAAM,MAAM,GAAgD,EAAE,CAAC;IAC/D,KAAK,MAAM,KAAK,IAAI,qBAAqB,EAAE,CAAC;QAC1C,MAAM,CAAC,KAAK,CAAC,GAAG,kBAAkB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACtD,CAAC;IACD,OAAO,MAAyB,CAAC;AACnC,CAAC","sourcesContent":["// The `_appConfig/app` singleton at rest, and the one rule each for writing it and reading it.\n//\n// WRITE. `mergeAppConfigUpdate(existing, update)`: the writer's update on top of the document it\n// read, any field that document lacks — and any lever it holds at a value its schema refuses —\n// taken from DEFAULT_APP_CONFIG, the whole result validated. A writer that runs first on a fresh\n// environment therefore still writes a complete, valid document rather than a partial one, and a\n// hand edit in the console that broke one lever never blocks a save of another: the merge resets it\n// and reports the repair with the value it replaced, which the writer records.\n//\n// READ. The stored document is untrusted — an operator can edit any field in the console into any\n// shape — and a config read must never take the product down by itself. `readAppConfigLever`\n// answers one lever at a time: the stored value when its schema field accepts it, otherwise the\n// lever's DEFAULT_APP_CONFIG value, so one bad field never costs the good ones. The server's cached\n// snapshot reader and the client's readers both read through it.\n\nimport { AppConfigSchema } from '../doc-schemas/system.js';\nimport type { AppConfig } from '../doc-schemas/system.js';\n\n/** Every operator lever of `_appConfig/app`, each at a value its schema field accepts. */\nexport type AppConfigLevers = Readonly<Required<AppConfig>>;\n\n/** The name of one operator lever. */\nexport type AppConfigLeverKey = keyof AppConfigLevers;\n\n/** Every lever name, derived from the document schema. */\nexport const APP_CONFIG_LEVER_KEYS = AppConfigSchema.keyof().options;\n\n/**\n * The document a fresh environment behaves as if it held, and the value each reader falls back to\n * for a missing or unreadable field: maintenance off, registration open, no banner.\n *\n * `appVersion` is `''` — no version has been published — so the version gate stays dormant until an\n * operator sets a real one through `updateAppConfig`, whose input refuses `''`.\n */\nexport const DEFAULT_APP_CONFIG: AppConfigLevers = Object.freeze({\n appVersion: '',\n maintenanceMode: false,\n maintenanceMessage: '',\n registrationEnabled: true,\n announcementMessage: '',\n});\n\n/**\n * The line shown while maintenance is on and the operator left `maintenanceMessage` blank — on the\n * maintenance screen and in the callable refusal alike.\n */\nexport const DEFAULT_MAINTENANCE_MESSAGE =\n 'Q-Sports is down for maintenance right now. We will be back shortly — thank you for your patience.';\n\n/**\n * The code the callable maintenance refusal is thrown with. `unavailable` is also what a real outage\n * produces, so the code alone never identifies the refusal — its details do.\n */\nexport const MAINTENANCE_REFUSAL_CODE = 'unavailable' as const;\n\n/** The `details.reason` the callable maintenance refusal carries. */\nexport const MAINTENANCE_REFUSAL_REASON = 'maintenance' as const;\n\n/** Structured details carried by the callable maintenance refusal. */\nexport interface MaintenanceRefusalDetails {\n readonly reason: typeof MAINTENANCE_REFUSAL_REASON;\n}\n\n// The refusal code as the server (`unavailable`) and the Firebase client SDK\n// (`functions/unavailable`) spell it.\nconst MAINTENANCE_REFUSAL_CODES: ReadonlySet<string> = new Set([\n MAINTENANCE_REFUSAL_CODE,\n `functions/${MAINTENANCE_REFUSAL_CODE}`,\n]);\n\n/** True when `details` is the maintenance refusal's structured details. */\nexport function isMaintenanceRefusalDetails(details: unknown): details is MaintenanceRefusalDetails {\n if (!details || typeof details !== 'object') return false;\n return (details as Record<string, unknown>).reason === MAINTENANCE_REFUSAL_REASON;\n}\n\n/**\n * True when `err` is the callable maintenance refusal — an `unavailable` error in either spelling\n * whose details carry `reason: 'maintenance'`. Works on the server-side error and on the client-side\n * callable error alike, and is decided by the code and the details, never the message, so a genuine\n * outage is never mistaken for the designed refusal.\n */\nexport function isMaintenanceRefusalError(err: unknown): boolean {\n if (!err || typeof err !== 'object') return false;\n const candidate = err as { code?: unknown; details?: unknown };\n return (\n typeof candidate.code === 'string' &&\n MAINTENANCE_REFUSAL_CODES.has(candidate.code) &&\n isMaintenanceRefusalDetails(candidate.details)\n );\n}\n\nfunction definedFields(fields: Readonly<Record<string, unknown>>): Record<string, unknown> {\n return Object.fromEntries(Object.entries(fields).filter(([, value]) => value !== undefined));\n}\n\n/** A stored lever its schema field refused, with the raw value the document held. */\nexport interface AppConfigLeverRepair {\n readonly lever: AppConfigLeverKey;\n readonly storedValue: unknown;\n}\n\n/** The document a writer writes, and every stored lever the merge had to repair to write it. */\nexport interface AppConfigMerge {\n readonly next: AppConfig;\n readonly repairs: readonly AppConfigLeverRepair[];\n}\n\n/**\n * The complete `_appConfig/app` document to write after applying `update` to `existing` (the\n * document as read in the writer's transaction; `null` or `undefined` when it does not exist). The\n * update's fields win, `existing` supplies the rest, and any field still missing comes from\n * DEFAULT_APP_CONFIG. An `undefined` update field changes nothing. Pure.\n *\n * A stored lever its schema refuses never blocks a save — a console typo must not disable the\n * maintenance switch. It is dropped, so the update's value replaces it when the update sends that\n * lever and its DEFAULT_APP_CONFIG value (what every reader already falls back to) otherwise, and it\n * is reported in `repairs`. A valid stored lever is carried as it is.\n *\n * Throws when the update itself would not parse, so an invalid document is never written.\n */\nexport function mergeAppConfigUpdate(\n existing: Readonly<Record<string, unknown>> | null | undefined,\n update: Readonly<Partial<AppConfig>>,\n): AppConfigMerge {\n const stored = definedFields(existing ?? {});\n const repairs: AppConfigLeverRepair[] = [];\n for (const lever of APP_CONFIG_LEVER_KEYS) {\n if (!(lever in stored) || AppConfigSchema.shape[lever].safeParse(stored[lever]).success) continue;\n repairs.push({ lever, storedValue: stored[lever] });\n delete stored[lever];\n }\n const parsed = AppConfigSchema.safeParse({ ...DEFAULT_APP_CONFIG, ...stored, ...definedFields(update) });\n if (!parsed.success) {\n const issue = parsed.error.issues[0];\n const field = issue?.path.join('.') || 'document';\n throw new Error(\n `_appConfig/app would not match its schema after this update (${field}: ${issue?.message ?? 'invalid'}). Nothing should be written.`,\n );\n }\n return { next: parsed.data, repairs };\n}\n\n/**\n * One operator lever off an unvalidated `_appConfig/app` snapshot (`null` or `undefined` when the\n * document is missing or not yet read): the stored value when its schema field accepts it, otherwise\n * the lever's DEFAULT_APP_CONFIG value — for an absent field and a refused one alike. Never throws.\n */\nexport function readAppConfigLever<L extends AppConfigLeverKey>(\n snapshot: Readonly<Record<string, unknown>> | null | undefined,\n lever: L,\n): AppConfigLevers[L] {\n const parsed = AppConfigSchema.shape[lever].safeParse(snapshot?.[lever]);\n return parsed.success && parsed.data !== undefined\n ? (parsed.data as AppConfigLevers[L])\n : DEFAULT_APP_CONFIG[lever];\n}\n\n/**\n * True when an unvalidated `_appConfig/app` snapshot holds `lever` with a value its schema field\n * refuses — the value every reader passes over for the default. An absent field is not refused.\n * Never throws.\n */\nexport function isAppConfigLeverRefused(\n snapshot: Readonly<Record<string, unknown>> | null | undefined,\n lever: AppConfigLeverKey,\n): boolean {\n const stored = snapshot?.[lever];\n return stored !== undefined && !AppConfigSchema.shape[lever].safeParse(stored).success;\n}\n\n/** Every lever off an unvalidated snapshot, each through `readAppConfigLever`. Never throws. */\nexport function readAppConfigLevers(\n snapshot: Readonly<Record<string, unknown>> | null | undefined,\n): AppConfigLevers {\n const levers: Partial<Record<AppConfigLeverKey, unknown>> = {};\n for (const lever of APP_CONFIG_LEVER_KEYS) {\n levers[lever] = readAppConfigLever(snapshot, lever);\n }\n return levers as AppConfigLevers;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttt-productions/q-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Core types, Firestore path constants, zod schemas, and shared constants for Q-Sports",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -60,6 +60,10 @@
|
|
|
60
60
|
"types": "./dist/media/index.d.ts",
|
|
61
61
|
"default": "./dist/media/index.js"
|
|
62
62
|
},
|
|
63
|
+
"./upload-variables": {
|
|
64
|
+
"types": "./dist/upload-variables/index.d.ts",
|
|
65
|
+
"default": "./dist/upload-variables/index.js"
|
|
66
|
+
},
|
|
63
67
|
"./schemas": {
|
|
64
68
|
"types": "./dist/schemas/index.d.ts",
|
|
65
69
|
"default": "./dist/schemas/index.js"
|
|
@@ -87,7 +91,7 @@
|
|
|
87
91
|
"dependencies": {
|
|
88
92
|
"@ttt-productions/input-format-core": "^0.1.1",
|
|
89
93
|
"@ttt-productions/media-schemas": "^0.14.10",
|
|
90
|
-
"@ttt-productions/notification-core": "^0.15.
|
|
94
|
+
"@ttt-productions/notification-core": "^0.15.16",
|
|
91
95
|
"@ttt-productions/theme-core": "^0.12.11",
|
|
92
96
|
"zod": "^4.4.3"
|
|
93
97
|
},
|