@ttt-productions/q-core 0.1.19 → 0.1.21
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.js +2 -2
- package/dist/constants/business.js.map +1 -1
- package/dist/constants/media.js +1 -1
- package/dist/constants/media.js.map +1 -1
- package/dist/constants/sports.js +1 -1
- package/dist/constants/sports.js.map +1 -1
- package/dist/constants/telemetry.js +3 -3
- package/dist/constants/telemetry.js.map +1 -1
- package/dist/doc-schemas/admin-notifications.js +3 -3
- package/dist/doc-schemas/admin-notifications.js.map +1 -1
- package/dist/doc-schemas/aggregate-stats.js +3 -3
- package/dist/doc-schemas/aggregate-stats.js.map +1 -1
- package/dist/doc-schemas/atoms.d.ts +1 -1
- package/dist/doc-schemas/atoms.js +3 -3
- package/dist/doc-schemas/atoms.js.map +1 -1
- package/dist/doc-schemas/audit-event.js +2 -2
- package/dist/doc-schemas/audit-event.js.map +1 -1
- package/dist/doc-schemas/firestore-primitives.js +1 -1
- package/dist/doc-schemas/firestore-primitives.js.map +1 -1
- package/dist/doc-schemas/game-location.js +2 -2
- package/dist/doc-schemas/game-location.js.map +1 -1
- package/dist/doc-schemas/game-stat-history.js +1 -1
- package/dist/doc-schemas/game-stat-history.js.map +1 -1
- package/dist/doc-schemas/game-stats.js +6 -6
- package/dist/doc-schemas/game-stats.js.map +1 -1
- package/dist/doc-schemas/league-team.js +4 -4
- package/dist/doc-schemas/league-team.js.map +1 -1
- package/dist/doc-schemas/membership-roster-sync.js +2 -2
- package/dist/doc-schemas/membership-roster-sync.js.map +1 -1
- package/dist/doc-schemas/pending-media.d.ts +6 -6
- package/dist/doc-schemas/publicUser.js +1 -1
- package/dist/doc-schemas/publicUser.js.map +1 -1
- package/dist/doc-schemas/registration-start.js +1 -1
- package/dist/doc-schemas/registration-start.js.map +1 -1
- package/dist/doc-schemas/registry.d.ts +3 -3
- package/dist/doc-schemas/sport-game.js +4 -4
- package/dist/doc-schemas/sport-game.js.map +1 -1
- package/dist/doc-schemas/sport-league.js +1 -1
- package/dist/doc-schemas/sport-league.js.map +1 -1
- package/dist/doc-schemas/stats-operation.js +2 -2
- package/dist/doc-schemas/stats-operation.js.map +1 -1
- package/dist/doc-schemas/status-reconcile-queue.js +1 -1
- package/dist/doc-schemas/status-reconcile-queue.js.map +1 -1
- package/dist/doc-schemas/sweep-state.js +2 -2
- package/dist/doc-schemas/sweep-state.js.map +1 -1
- package/dist/doc-schemas/team-membership.js +1 -1
- package/dist/doc-schemas/team-membership.js.map +1 -1
- package/dist/doc-schemas/user-profile.js +1 -1
- package/dist/doc-schemas/user-profile.js.map +1 -1
- package/dist/doc-schemas/waiver-template.js +1 -1
- package/dist/doc-schemas/waiver-template.js.map +1 -1
- package/dist/doc-schemas/waivers-and-hardware.js +3 -3
- package/dist/doc-schemas/waivers-and-hardware.js.map +1 -1
- package/dist/domain-events/domain-events.js +2 -2
- package/dist/domain-events/domain-events.js.map +1 -1
- package/dist/ids/award-grant-ids.js +1 -1
- package/dist/ids/award-grant-ids.js.map +1 -1
- package/dist/ids/compound-ids.js +1 -1
- package/dist/ids/compound-ids.js.map +1 -1
- package/dist/ids/minted-ids.js +1 -1
- package/dist/ids/minted-ids.js.map +1 -1
- package/dist/ids/notification-ids.js +1 -1
- package/dist/ids/notification-ids.js.map +1 -1
- package/dist/ids/stat-event-ids.d.ts +1 -1
- package/dist/ids/stat-event-ids.js +2 -2
- package/dist/ids/stat-event-ids.js.map +1 -1
- package/dist/ids/stats-operation-ids.js +1 -1
- package/dist/ids/stats-operation-ids.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/input-formats/input-formats.js +1 -1
- package/dist/input-formats/input-formats.js.map +1 -1
- package/dist/media/file-origins.js +1 -1
- package/dist/media/file-origins.js.map +1 -1
- package/dist/media/picture-url.js +1 -1
- package/dist/media/picture-url.js.map +1 -1
- package/dist/migration-console/action-ids.js +1 -1
- package/dist/migration-console/action-ids.js.map +1 -1
- package/dist/migration-console/manifest.js +1 -1
- package/dist/migration-console/manifest.js.map +1 -1
- package/dist/notifications/admin-notification-config.js +1 -1
- package/dist/notifications/admin-notification-config.js.map +1 -1
- package/dist/notifications/occurrences.js +1 -1
- package/dist/notifications/occurrences.js.map +1 -1
- package/dist/paths/collections.js +3 -3
- package/dist/paths/collections.js.map +1 -1
- package/dist/paths/picture-owner-paths.js +1 -1
- package/dist/paths/picture-owner-paths.js.map +1 -1
- package/dist/paths/storage-paths.d.ts +1 -1
- package/dist/paths/storage-paths.js +1 -1
- package/dist/paths/storage-paths.js.map +1 -1
- package/dist/paths/utils.d.ts +1 -1
- package/dist/paths/utils.js +1 -1
- package/dist/paths/utils.js.map +1 -1
- package/dist/schemas/admin-notifications.js +1 -1
- package/dist/schemas/admin-notifications.js.map +1 -1
- package/dist/schemas/app-config.js +1 -1
- package/dist/schemas/app-config.js.map +1 -1
- package/dist/schemas/awards.js +1 -1
- package/dist/schemas/awards.js.map +1 -1
- package/dist/schemas/dead-letters.js +2 -2
- package/dist/schemas/dead-letters.js.map +1 -1
- package/dist/schemas/leagues.js +1 -1
- package/dist/schemas/leagues.js.map +1 -1
- package/dist/schemas/migration-console.js +1 -1
- package/dist/schemas/migration-console.js.map +1 -1
- package/dist/schemas/pictures.js +1 -1
- package/dist/schemas/pictures.js.map +1 -1
- package/dist/schemas/schedules.js +2 -2
- package/dist/schemas/schedules.js.map +1 -1
- package/dist/schemas/scoring.js +1 -1
- package/dist/schemas/scoring.js.map +1 -1
- package/dist/schemas/signed-waivers.js +1 -1
- package/dist/schemas/signed-waivers.js.map +1 -1
- package/dist/schemas/stats.js +6 -6
- package/dist/schemas/stats.js.map +1 -1
- package/dist/schemas/team-joining.js +3 -3
- package/dist/schemas/team-joining.js.map +1 -1
- package/dist/schemas/teams.js +7 -7
- package/dist/schemas/teams.js.map +1 -1
- package/dist/schemas/users.js +3 -3
- package/dist/schemas/users.js.map +1 -1
- package/dist/sports/basketball-scoring.js +4 -4
- package/dist/sports/basketball-scoring.js.map +1 -1
- package/dist/sports/bulk-entry.js +1 -1
- package/dist/sports/bulk-entry.js.map +1 -1
- package/dist/sports/contribution.d.ts +5 -5
- package/dist/sports/contribution.d.ts.map +1 -1
- package/dist/sports/contribution.js +4 -4
- package/dist/sports/contribution.js.map +1 -1
- package/dist/sports/curling-scoring.js +2 -2
- package/dist/sports/curling-scoring.js.map +1 -1
- package/dist/sports/football-scoring.js +2 -2
- package/dist/sports/football-scoring.js.map +1 -1
- package/dist/sports/index.js +1 -1
- package/dist/sports/index.js.map +1 -1
- package/dist/sports/ledger-continuity.js +1 -1
- package/dist/sports/ledger-continuity.js.map +1 -1
- package/dist/sports/registry.js +2 -2
- package/dist/sports/registry.js.map +1 -1
- package/dist/sports/replay.js +1 -1
- package/dist/sports/replay.js.map +1 -1
- package/dist/sports/rollup-check.js +1 -1
- package/dist/sports/rollup-check.js.map +1 -1
- package/dist/sports/score-mirror.js +1 -1
- package/dist/sports/score-mirror.js.map +1 -1
- package/dist/sports/scoring-display.d.ts +1 -1
- package/dist/sports/scoring-display.js +2 -2
- package/dist/sports/scoring-display.js.map +1 -1
- package/dist/sports/scoring.d.ts +5 -5
- package/dist/sports/scoring.d.ts.map +1 -1
- package/dist/sports/scoring.js +2 -2
- package/dist/sports/scoring.js.map +1 -1
- package/dist/sports/sport-adapter.d.ts +3 -3
- package/dist/sports/sport-adapter.d.ts.map +1 -1
- package/dist/sports/sport-adapter.js +2 -2
- package/dist/sports/sport-adapter.js.map +1 -1
- package/dist/sports/store-driver.d.ts +1 -1
- package/dist/sports/store-driver.d.ts.map +1 -1
- package/dist/sports/store-driver.js +2 -2
- package/dist/sports/store-driver.js.map +1 -1
- package/dist/types/audit.js +4 -4
- package/dist/types/audit.js.map +1 -1
- package/dist/types/claims.js +1 -1
- package/dist/types/claims.js.map +1 -1
- package/dist/types/picture-owners.js +1 -1
- package/dist/types/picture-owners.js.map +1 -1
- package/dist/types/schedules.js +1 -1
- package/dist/types/schedules.js.map +1 -1
- package/dist/types/sports.js +2 -2
- package/dist/types/sports.js.map +1 -1
- package/dist/types/stats.js +5 -5
- package/dist/types/stats.js.map +1 -1
- package/dist/types/unions.js +2 -2
- package/dist/types/unions.js.map +1 -1
- package/dist/types/uploads.js +1 -1
- package/dist/types/uploads.js.map +1 -1
- package/dist/upload-variables/picture-upload-variables.d.ts +2 -2
- package/dist/upload-variables/sign-hardware-contract-variables.d.ts +1 -1
- package/dist/upload-variables/sign-hardware-contract-variables.js +1 -1
- package/dist/upload-variables/sign-hardware-contract-variables.js.map +1 -1
- package/dist/upload-variables/sign-waiver-variables.d.ts +1 -1
- package/dist/upload-variables/sign-waiver-variables.js +1 -1
- package/dist/upload-variables/sign-waiver-variables.js.map +1 -1
- package/dist/utils/account-status.d.ts +1 -2
- package/dist/utils/account-status.d.ts.map +1 -1
- package/dist/utils/account-status.js +1 -1
- package/dist/utils/account-status.js.map +1 -1
- package/dist/utils/app-routes.js +1 -1
- package/dist/utils/app-routes.js.map +1 -1
- package/dist/utils/league-join-warning.js +1 -1
- package/dist/utils/league-join-warning.js.map +1 -1
- package/dist/utils/league-joining.js +1 -1
- package/dist/utils/league-joining.js.map +1 -1
- package/dist/utils/league-mode.js +1 -1
- package/dist/utils/league-mode.js.map +1 -1
- package/dist/utils/team-creation.js +1 -1
- package/dist/utils/team-creation.js.map +1 -1
- package/dist/utils/team-member-actions.js +1 -1
- package/dist/utils/team-member-actions.js.map +1 -1
- package/package.json +3 -3
package/dist/paths/utils.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export declare const MAX_DOCUMENT_ID_BYTES = 1500;
|
|
|
4
4
|
* Whether `id` names exactly one document under its collection: non-empty, no `/`, at most
|
|
5
5
|
* `MAX_DOCUMENT_ID_BYTES` UTF-8 bytes, not `.` or `..`, and not an id Firestore reserves (`__…__`).
|
|
6
6
|
* A `/` would address another document or a subcollection, and an empty id the collection itself,
|
|
7
|
-
* so every id atom a path is built from checks this before any path exists (ARCH-106).
|
|
7
|
+
* so every id atom a path is built from checks this before any path exists (RULE-STD-ARCH-106).
|
|
8
8
|
*/
|
|
9
9
|
export declare function isDocumentIdSegment(id: string): boolean;
|
|
10
10
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/paths/utils.js
CHANGED
|
@@ -11,7 +11,7 @@ const RESERVED_DOCUMENT_ID_PATTERN = /^__.*__$/;
|
|
|
11
11
|
* Whether `id` names exactly one document under its collection: non-empty, no `/`, at most
|
|
12
12
|
* `MAX_DOCUMENT_ID_BYTES` UTF-8 bytes, not `.` or `..`, and not an id Firestore reserves (`__…__`).
|
|
13
13
|
* A `/` would address another document or a subcollection, and an empty id the collection itself,
|
|
14
|
-
* so every id atom a path is built from checks this before any path exists (ARCH-106).
|
|
14
|
+
* so every id atom a path is built from checks this before any path exists (RULE-STD-ARCH-106).
|
|
15
15
|
*/
|
|
16
16
|
export function isDocumentIdSegment(id) {
|
|
17
17
|
if (id.length === 0 || id.includes('/'))
|
package/dist/paths/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/paths/utils.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,EAAE;AACF,2DAA2D;AAE3D,MAAM,UAAU,MAAM,CAAC,QAA2B;IAChD,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC;AAED,sDAAsD;AACtD,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAE1C,MAAM,4BAA4B,GAAG,UAAU,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAAU;IAC5C,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IACtD,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC5C,IAAI,4BAA4B,CAAC,IAAI,CAAC,EAAE,CAAC;QAAE,OAAO,KAAK,CAAC;IACxD,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,IAAI,qBAAqB,CAAC;AACtE,CAAC","sourcesContent":["// Utility to convert path tuples to slash-delimited strings for Admin SDK.\n//\n// Usage: db.doc(toPath(PATH_BUILDERS.userProfile(userId)))\n\nexport function toPath(segments: readonly string[]): string {\n return segments.join('/');\n}\n\n// Firestore's limit on a document id, in UTF-8 bytes.\nexport const MAX_DOCUMENT_ID_BYTES = 1500;\n\nconst RESERVED_DOCUMENT_ID_PATTERN = /^__.*__$/;\n\n/**\n * Whether `id` names exactly one document under its collection: non-empty, no `/`, at most\n * `MAX_DOCUMENT_ID_BYTES` UTF-8 bytes, not `.` or `..`, and not an id Firestore reserves (`__…__`).\n * A `/` would address another document or a subcollection, and an empty id the collection itself,\n * so every id atom a path is built from checks this before any path exists (ARCH-106).\n */\nexport function isDocumentIdSegment(id: string): boolean {\n if (id.length === 0 || id.includes('/')) return false;\n if (id === '.' || id === '..') return false;\n if (RESERVED_DOCUMENT_ID_PATTERN.test(id)) return false;\n return new TextEncoder().encode(id).length <= MAX_DOCUMENT_ID_BYTES;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/paths/utils.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,EAAE;AACF,2DAA2D;AAE3D,MAAM,UAAU,MAAM,CAAC,QAA2B;IAChD,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC;AAED,sDAAsD;AACtD,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAE1C,MAAM,4BAA4B,GAAG,UAAU,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAAU;IAC5C,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IACtD,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC5C,IAAI,4BAA4B,CAAC,IAAI,CAAC,EAAE,CAAC;QAAE,OAAO,KAAK,CAAC;IACxD,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,IAAI,qBAAqB,CAAC;AACtE,CAAC","sourcesContent":["// Utility to convert path tuples to slash-delimited strings for Admin SDK.\n//\n// Usage: db.doc(toPath(PATH_BUILDERS.userProfile(userId)))\n\nexport function toPath(segments: readonly string[]): string {\n return segments.join('/');\n}\n\n// Firestore's limit on a document id, in UTF-8 bytes.\nexport const MAX_DOCUMENT_ID_BYTES = 1500;\n\nconst RESERVED_DOCUMENT_ID_PATTERN = /^__.*__$/;\n\n/**\n * Whether `id` names exactly one document under its collection: non-empty, no `/`, at most\n * `MAX_DOCUMENT_ID_BYTES` UTF-8 bytes, not `.` or `..`, and not an id Firestore reserves (`__…__`).\n * A `/` would address another document or a subcollection, and an empty id the collection itself,\n * so every id atom a path is built from checks this before any path exists (RULE-STD-ARCH-106).\n */\nexport function isDocumentIdSegment(id: string): boolean {\n if (id.length === 0 || id.includes('/')) return false;\n if (id === '.' || id === '..') return false;\n if (RESERVED_DOCUMENT_ID_PATTERN.test(id)) return false;\n return new TextEncoder().encode(id).length <= MAX_DOCUMENT_ID_BYTES;\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// and reading how an archive-all is going. The occurrences the delivery worker gave up on are listed
|
|
3
3
|
// and replayed through the operator's dead letters (./dead-letters.ts). Admin only; a card is never
|
|
4
4
|
// created by a client — the callable that owns each notified action writes its occurrence
|
|
5
|
-
// (BACKEND-306).
|
|
5
|
+
// (RULE-STD-BACKEND-306).
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
import { parseNotificationArchiveAllJobId } from '../ids/notification-ids.js';
|
|
8
8
|
import { ADMIN_NOTIFICATION_CATEGORY, NOTIFICATION_ARCHIVE_ALL_JOB_STATE_KEYS, } from '../types/notifications.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-notifications.js","sourceRoot":"","sources":["../../src/schemas/admin-notifications.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,qGAAqG;AACrG,oGAAoG;AACpG,0FAA0F;AAC1F,
|
|
1
|
+
{"version":3,"file":"admin-notifications.js","sourceRoot":"","sources":["../../src/schemas/admin-notifications.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,qGAAqG;AACrG,oGAAoG;AACpG,0FAA0F;AAC1F,0BAA0B;AAE1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gCAAgC,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EACL,2BAA2B,EAC3B,uCAAuC,GACxC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,iGAAiG;AACjG,gGAAgG;AAChG,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC;KACvC,MAAM,EAAE;KACR,KAAK,CAAC,sBAAsB,EAAE,wBAAwB,CAAC,CAAC;AAE3D,kGAAkG;AAClG,iGAAiG;AACjG,mBAAmB;AACnB,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEnE,oGAAoG;AACpG,iEAAiE;AACjE,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAEpD,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC;KAC/C,MAAM,EAAE;KACR,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,gCAAgC,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,4BAA4B,CAAC,CAAC;AAE/F,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC;KACjD,MAAM,CAAC;IACN,SAAS,EAAE,2BAA2B;IACtC,cAAc,EAAE,yBAAyB;IACzC,0BAA0B,EAAE,wBAAwB;CACrD,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,+FAA+F;AAC/F,mFAAmF;AACnF,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAGjG,MAAM,CAAC,MAAM,uCAAuC,GAAG,CAAC;KACrD,MAAM,CAAC,EAAE,SAAS,EAAE,2BAA2B,EAAE,CAAC;KAClD,MAAM,EAAE,CAAC;AAIZ,MAAM,CAAC,MAAM,wCAAwC,GAAG,CAAC;KACtD,MAAM,CAAC,EAAE,KAAK,EAAE,iCAAiC,EAAE,CAAC;KACpD,MAAM,EAAE,CAAC;AAKZ,MAAM,CAAC,MAAM,+CAA+C,GAAG,CAAC;KAC7D,MAAM,CAAC,EAAE,KAAK,EAAE,iCAAiC,EAAE,CAAC;KACpD,MAAM,EAAE,CAAC;AAIZ,8FAA8F;AAC9F,kGAAkG;AAClG,wEAAwE;AACxE,MAAM,CAAC,MAAM,gDAAgD,GAAG,CAAC;KAC9D,MAAM,CAAC;IACN,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,uCAAuC,CAAC;IACtD,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,2BAA2B,CAAC;IAChD,QAAQ,EAAE,WAAW;IACrB,WAAW,EAAE,WAAW,CAAC,QAAQ,EAAE;IACnC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC7B,CAAC;KACD,MAAM,EAAE,CAAC","sourcesContent":["// Callable contracts for the shared admin notifications: archiving one, archiving all of them,\n// and reading how an archive-all is going. The occurrences the delivery worker gave up on are listed\n// and replayed through the operator's dead letters (./dead-letters.ts). Admin only; a card is never\n// created by a client — the callable that owns each notified action writes its occurrence\n// (RULE-STD-BACKEND-306).\n\nimport { z } from 'zod';\nimport { parseNotificationArchiveAllJobId } from '../ids/notification-ids.js';\nimport {\n ADMIN_NOTIFICATION_CATEGORY,\n NOTIFICATION_ARCHIVE_ALL_JOB_STATE_KEYS,\n} from '../types/notifications.js';\nimport { countSchema } from '../doc-schemas/atoms.js';\n\n// A card's document id as notification-core derives it: a hex digest. Bounding it to letters and\n// digits keeps a client-sent id from addressing anything but a document of the card collection.\nexport const adminNotificationIdSchema = z\n .string()\n .regex(/^[A-Za-z0-9]{1,128}$/, 'Not a notification id.');\n\n// The opaque generation token a card carried when the admin saw it. An action on the card applies\n// only while the card still carries it, so activity that arrived after the admin looked is never\n// archived unseen.\nexport const activityGenerationSchema = z.string().min(1).max(128);\n\n// A fresh UUID per click. An archive's history entry and an archive-all's job are keyed by it, so a\n// retry of the same click lands on what the first attempt wrote.\nexport const notificationRequestIdSchema = z.uuid();\n\nexport const notificationArchiveAllJobIdSchema = z\n .string()\n .refine((id) => parseNotificationArchiveAllJobId(id) !== null, 'Not an archive-all job id.');\n\nexport const AdminArchiveNotificationInputSchema = z\n .object({\n requestId: notificationRequestIdSchema,\n notificationId: adminNotificationIdSchema,\n observedActivityGeneration: activityGenerationSchema,\n })\n .strict();\nexport type AdminArchiveNotificationInput = z.infer<typeof AdminArchiveNotificationInputSchema>;\n// `archived` is false when there was nothing to archive at the generation named: another admin\n// archived the card first, or new activity lit it again, and it stays on the list.\nexport const AdminArchiveNotificationResultSchema = z.object({ archived: z.boolean() }).strict();\nexport type AdminArchiveNotificationResult = z.infer<typeof AdminArchiveNotificationResultSchema>;\n\nexport const AdminArchiveAllNotificationsInputSchema = z\n .object({ requestId: notificationRequestIdSchema })\n .strict();\nexport type AdminArchiveAllNotificationsInput = z.infer<\n typeof AdminArchiveAllNotificationsInputSchema\n>;\nexport const AdminArchiveAllNotificationsResultSchema = z\n .object({ jobId: notificationArchiveAllJobIdSchema })\n .strict();\nexport type AdminArchiveAllNotificationsResult = z.infer<\n typeof AdminArchiveAllNotificationsResultSchema\n>;\n\nexport const AdminGetNotificationArchiveAllStatusInputSchema = z\n .object({ jobId: notificationArchiveAllJobIdSchema })\n .strict();\nexport type AdminGetNotificationArchiveAllStatusInput = z.infer<\n typeof AdminGetNotificationArchiveAllStatusInputSchema\n>;\n// notification-core's archive-all snapshot: the job's state, the category it drains, how many\n// cards it has archived, and — on a completed job that left cards behind — how many it could not.\n// A job that ran out of attempts with cards left reads as `incomplete`.\nexport const AdminGetNotificationArchiveAllStatusResultSchema = z\n .object({\n state: z.enum(NOTIFICATION_ARCHIVE_ALL_JOB_STATE_KEYS),\n category: z.literal(ADMIN_NOTIFICATION_CATEGORY),\n archived: countSchema,\n notArchived: countSchema.optional(),\n error: z.string().optional(),\n })\n .strict();\nexport type AdminGetNotificationArchiveAllStatusResult = z.infer<\n typeof AdminGetNotificationArchiveAllStatusResultSchema\n>;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Callable contracts for the `_appConfig` documents an admin edits: the app-wide operational levers
|
|
2
|
-
// and the landing page copy. Each input is a named field set (BACKEND-209) — never a document id
|
|
2
|
+
// and the landing page copy. Each input is a named field set (RULE-STD-BACKEND-209) — never a document id
|
|
3
3
|
// and a `data` blob.
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { epochMsSchema, textFieldSchema } from '../doc-schemas/atoms.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-config.js","sourceRoot":"","sources":["../../src/schemas/app-config.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,
|
|
1
|
+
{"version":3,"file":"app-config.js","sourceRoot":"","sources":["../../src/schemas/app-config.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,0GAA0G;AAC1G,qBAAqB;AAErB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OA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ACtE,YAAY,EAAE,eAAe,CAAC,+BAA+B,CAAC,CAAC,QAAQ,EAAE;CAC1E,CAAC;KACD,MAAM,EAAE;KACR,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,EAAE;IAC5E,OAAO,EAAE,4BAA4B;CACtC,CAAC,CAAC;AAGL,oFAAoF;AACpF,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC;KAChD,MAAM,CAAC;IACN,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,SAAS,EAAE,aAAa;CACzB,CAAC;KACD,MAAM,EAAE,CAAC","sourcesContent":["// Callable contracts for the `_appConfig` documents an admin edits: the app-wide operational levers\n// and the landing page copy. Each input is a named field set (RULE-STD-BACKEND-209) — never a document id\n// and a `data` blob.\n\nimport { z } from 'zod';\nimport { epochMsSchema, textFieldSchema } from '../doc-schemas/atoms.js';\nimport {\n ANNOUNCEMENT_MESSAGE_INPUT_FORMAT,\n APP_VERSION_INPUT_FORMAT,\n LANDING_ABOUT_TEXT_INPUT_FORMAT,\n LANDING_HERO_TITLE_INPUT_FORMAT,\n MAINTENANCE_MESSAGE_INPUT_FORMAT,\n} from '../input-formats/input-formats.js';\nimport { AppConfigSchema } from '../doc-schemas/system.js';\n\n// An admin changes one or more levers on `_appConfig/app`. A lever left out keeps its value.\nexport const UpdateAppConfigInputSchema = z\n .object({\n // A published version is never blank: `''` is only the dormant default of a fresh environment.\n appVersion: textFieldSchema(APP_VERSION_INPUT_FORMAT).optional(),\n maintenanceMode: z.boolean().optional(),\n maintenanceMessage: textFieldSchema(MAINTENANCE_MESSAGE_INPUT_FORMAT).optional(),\n registrationEnabled: z.boolean().optional(),\n // `''` clears the banner.\n announcementMessage: textFieldSchema(ANNOUNCEMENT_MESSAGE_INPUT_FORMAT).optional(),\n })\n .strict()\n .refine((input) => Object.values(input).some((value) => value !== undefined), {\n message: 'Change at least one setting.',\n });\nexport type UpdateAppConfigInput = z.infer<typeof UpdateAppConfigInputSchema>;\n\nexport const UpdateAppConfigResultSchema = z\n .object({ updatedFields: z.array(AppConfigSchema.keyof()) })\n .strict();\nexport type UpdateAppConfigResult = z.infer<typeof UpdateAppConfigResultSchema>;\n\n// An admin edits the landing page copy on `_appConfig/landingPage`. The editor sends only the\n// fields the admin changed, so saving one never rewrites the other with what this editor last read.\n// The landing gallery is not part of this: only the picture core writes it.\nexport const AdminUpdateLandingPageInputSchema = z\n .object({\n heroTitle: textFieldSchema(LANDING_HERO_TITLE_INPUT_FORMAT).optional(),\n aboutCompany: textFieldSchema(LANDING_ABOUT_TEXT_INPUT_FORMAT).optional(),\n })\n .strict()\n .refine((input) => Object.values(input).some((value) => value !== undefined), {\n message: 'Change at least one field.',\n });\nexport type AdminUpdateLandingPageInput = z.infer<typeof AdminUpdateLandingPageInputSchema>;\n\n// The copy as committed, so the caller can apply it to its cached landing document.\nexport const AdminUpdateLandingPageResultSchema = z\n .object({\n heroTitle: z.string(),\n aboutCompany: z.string(),\n updatedAt: epochMsSchema,\n })\n .strict();\nexport type AdminUpdateLandingPageResult = z.infer<typeof AdminUpdateLandingPageResultSchema>;\n"]}
|
package/dist/schemas/awards.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
//
|
|
3
3
|
// An award is created by its first badge's publication (the `award-badge` upload, ./uploads.ts), so
|
|
4
4
|
// no callable here creates one. Grants and revokes to named accounts share one input — two named
|
|
5
|
-
// lists, never an action discriminator (BACKEND-002) — like the role roster's. A team's or a whole
|
|
5
|
+
// lists, never an action discriminator (RULE-STD-BACKEND-002) — like the role roster's. A team's or a whole
|
|
6
6
|
// league's grant is its own decision, carried out a page of people at a time.
|
|
7
7
|
import { z } from 'zod';
|
|
8
8
|
import { MAX_AWARD_GRANT_TARGETS } from '../const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EAAE,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAGnG,2EAA2E;AAC3E,MAAM,CAAC,MAAM,sCAAsC,GAAG,CAAC;KACpD,MAAM,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;KACxD,MAAM,EAAE,CAAC;AAKZ,iGAAiG;AACjG,kGAAkG;AAClG,kGAAkG;AAClG,4FAA4F;AAC5F,MAAM,uBAAuB,GAAG,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;AACjE,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,kBAAkB,CAAC,QAAQ,EAAE;IAC5E,CAAC;SACE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,uBAAuB,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;SAC3F,MAAM,EAAE;IACX,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,uBAAuB,EAAE,CAAC,CAAC,MAAM,EAAE;IAChF,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE;CACjD,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC;KAC9C,MAAM,CAAC;IACN,MAAM,EAAE,YAAY;IACpB,cAAc,EAAE,aAAa,CAAC,QAAQ,EAAE;IACxC,gBAAgB,EAAE,aAAa,CAAC,QAAQ,EAAE;IAC1C,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACrB,CAAC;KACD,MAAM,EAAE,CAAC","sourcesContent":["// Callable contracts for the award catalog, award grants, and the badges an account features.\n//\n// An award is created by its first badge's publication (the `award-badge` upload, ./uploads.ts), so\n// no callable here creates one. Grants and revokes to named accounts share one input — two named\n// lists, never an action discriminator (BACKEND-002) — like the role roster's. A team's or a whole\n// league's grant is its own decision, carried out a page of people at a time.\n\nimport { z } from 'zod';\nimport { MAX_AWARD_GRANT_TARGETS } from '../constants/business.js';\nimport {\n awardGroupGrantActionSchema,\n awardGroupGrantDecisionSchema,\n awardGroupGrantStatusSchema,\n awardGroupTypeSchema,\n} from '../doc-schemas/award-group-grant.js';\nimport {\n countSchema,\n documentIdSegmentSchema,\n epochMsSchema,\n userIdSchema,\n} from '../doc-schemas/atoms.js';\nimport { awardIdSchema } from '../doc-schemas/catalogs.js';\nimport { AWARD_GRANT_SKIP_REASON_KEYS, FEATURED_AWARD_SLOT_KEYS } from '../types/unions.js';\n\nconst targetList = <T extends z.ZodTypeAny>(atom: T) =>\n z.array(atom).max(MAX_AWARD_GRANT_TARGETS).optional();\n\n// An admin grants an award to named accounts and revokes it from named accounts, in one commit.\n// Recipients are deduplicated on the server; a ghost holds no account and is skipped.\nexport const AdminUpdateAwardGrantsInputSchema = z\n .object({\n awardId: awardIdSchema,\n grantUserIds: targetList(userIdSchema),\n revokeUserIds: targetList(userIdSchema),\n })\n .strict()\n .refine(\n (input) =>\n [input.grantUserIds, input.revokeUserIds].some(\n (list) => list !== undefined && list.length > 0,\n ),\n { message: 'Name someone to grant the award to or revoke it from.' },\n )\n .refine(\n (input) =>\n !(input.grantUserIds ?? []).some((userId) => (input.revokeUserIds ?? []).includes(userId)),\n {\n message: 'An account cannot be granted and revoked the award in one change.',\n path: ['revokeUserIds'],\n },\n );\nexport type AdminUpdateAwardGrantsInput = z.infer<typeof AdminUpdateAwardGrantsInputSchema>;\n\nexport const AwardGrantSkipSchema = z\n .object({ userId: userIdSchema, reason: z.enum(AWARD_GRANT_SKIP_REASON_KEYS) })\n .strict();\nexport type AwardGrantSkip = z.infer<typeof AwardGrantSkipSchema>;\n\n// What the change did for each account it reached: granted now, already held, revoked now, not held\n// to begin with, or skipped with its reason. A retried call reports the accounts its first call\n// changed as already held or not held, and writes nothing again.\nexport const AdminUpdateAwardGrantsResultSchema = z\n .object({\n awardId: awardIdSchema,\n granted: z.array(userIdSchema),\n alreadyHeld: z.array(userIdSchema),\n revoked: z.array(userIdSchema),\n notHeld: z.array(userIdSchema),\n skipped: z.array(AwardGrantSkipSchema),\n })\n .strict();\nexport type AdminUpdateAwardGrantsResult = z.infer<typeof AdminUpdateAwardGrantsResultSchema>;\n\n// The group a group grant reaches: every active member of one team, or of one whole league.\n// `groupId` is that team's or league's id.\nexport const AwardGroupSchema = z\n .object({ groupType: awardGroupTypeSchema, groupId: documentIdSegmentSchema })\n .strict();\nexport type AwardGroup = z.infer<typeof AwardGroupSchema>;\n\n// An admin grants an award to a group, or takes back what the group's grants gave. The decision opens\n// at once and its people are reached a page at a time after the answer; a request the group's latest\n// decision already settles (granting what is granted, taking back what is not) opens nothing.\nexport const AdminUpdateAwardGroupGrantInputSchema = z\n .object({ awardId: awardIdSchema, action: awardGroupGrantActionSchema, group: AwardGroupSchema })\n .strict();\nexport type AdminUpdateAwardGroupGrantInput = z.infer<typeof AdminUpdateAwardGroupGrantInputSchema>;\n\n// Where one decision on an award for a group stands. `peopleReached` is how many people it has dealt\n// with so far: a grant's recorded people, or the people a revoke has taken the award back from or left\n// holding it. A pending decision that failed carries its failure and how many times it has tried; the\n// scheduled resume tries it again.\nexport const AwardGroupGrantProgressSchema = z\n .object({\n grantId: z.string().min(1),\n action: awardGroupGrantActionSchema,\n decision: awardGroupGrantDecisionSchema,\n status: awardGroupGrantStatusSchema,\n peopleReached: countSchema,\n attemptCount: countSchema,\n lastError: z.string().nullable(),\n createdAt: epochMsSchema,\n completedAt: epochMsSchema.nullable(),\n })\n .strict();\nexport type AwardGroupGrantProgress = z.infer<typeof AwardGroupGrantProgressSchema>;\n\n// `opened` is false when the group's latest decision already settled the request; `grant` is then that\n// decision, or null when the group has none.\nexport const AdminUpdateAwardGroupGrantResultSchema = z\n .object({\n awardId: awardIdSchema,\n opened: z.boolean(),\n grant: AwardGroupGrantProgressSchema.nullable(),\n })\n .strict();\nexport type AdminUpdateAwardGroupGrantResult = z.infer<\n typeof AdminUpdateAwardGroupGrantResultSchema\n>;\n\n// An admin reads the latest decision on an award for a group, so the progress survives a closed page.\nexport const AdminGetAwardGroupGrantStatusInputSchema = z\n .object({ awardId: awardIdSchema, group: AwardGroupSchema })\n .strict();\nexport type AdminGetAwardGroupGrantStatusInput = z.infer<\n typeof AdminGetAwardGroupGrantStatusInputSchema\n>;\nexport const AdminGetAwardGroupGrantStatusResultSchema = z\n .object({ grant: AwardGroupGrantProgressSchema.nullable() })\n .strict();\nexport type AdminGetAwardGroupGrantStatusResult = z.infer<\n typeof AdminGetAwardGroupGrantStatusResultSchema\n>;\n\n// An admin deletes an award nobody holds. Its badge's files are retired with it.\nexport const AdminDeleteAwardDefinitionInputSchema = z.object({ awardId: awardIdSchema }).strict();\nexport type AdminDeleteAwardDefinitionInput = z.infer<typeof AdminDeleteAwardDefinitionInputSchema>;\n\n// `deleted` is false when the award was already gone: nothing was written.\nexport const AdminDeleteAwardDefinitionResultSchema = z\n .object({ awardId: awardIdSchema, deleted: z.boolean() })\n .strict();\nexport type AdminDeleteAwardDefinitionResult = z.infer<\n typeof AdminDeleteAwardDefinitionResultSchema\n>;\n\n// The signed-in account chooses which of its own awards to show beside its name: a primary and a\n// secondary badge, each an award it holds, or none. The input is the one change the person made —\n// set a slot, clear a slot, or swap the two — and the core applies it to the pair as stored, so a\n// change to one slot never writes back a stale value of the other. No user id is ever sent.\nconst featuredAwardSlotSchema = z.enum(FEATURED_AWARD_SLOT_KEYS);\nexport const UpdateFeaturedAwardsInputSchema = z.discriminatedUnion('action', [\n z\n .object({ action: z.literal('set'), slot: featuredAwardSlotSchema, awardId: awardIdSchema })\n .strict(),\n z.object({ action: z.literal('clear'), slot: featuredAwardSlotSchema }).strict(),\n z.object({ action: z.literal('swap') }).strict(),\n]);\nexport type UpdateFeaturedAwardsInput = z.infer<typeof UpdateFeaturedAwardsInputSchema>;\n\nexport const UpdateFeaturedAwardsResultSchema = z\n .object({\n userId: userIdSchema,\n primaryAwardId: awardIdSchema.nullable(),\n secondaryAwardId: awardIdSchema.nullable(),\n changed: z.boolean(),\n })\n .strict();\nexport type UpdateFeaturedAwardsResult = z.infer<typeof UpdateFeaturedAwardsResultSchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"awards.js","sourceRoot":"","sources":["../../src/schemas/awards.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,EAAE;AACF,oGAAoG;AACpG,iGAAiG;AACjG,4GAA4G;AAC5G,8EAA8E;AAE9E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EACL,2BAA2B,EAC3B,6BAA6B,EAC7B,2BAA2B,EAC3B,oBAAoB,GACrB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,WAAW,EACX,uBAAuB,EACvB,aAAa,EACb,YAAY,GACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,4BAA4B,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAE5F,MAAM,UAAU,GAAG,CAAyB,IAAO,EAAE,EAAE,CACrD,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC,QAAQ,EAAE,CAAC;AAExD,gGAAgG;AAChG,sFAAsF;AACtF,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC;KAC/C,MAAM,CAAC;IACN,OAAO,EAAE,aAAa;IACtB,YAAY,EAAE,UAAU,CAAC,YAAY,CAAC;IACtC,aAAa,EAAE,UAAU,CAAC,YAAY,CAAC;CACxC,CAAC;KACD,MAAM,EAAE;KACR,MAAM,CACL,CAAC,KAAK,EAAE,EAAE,CACR,CAAC,KAAK,CAAC,YAAY,EAAE,K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;IAC1C,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACrB,CAAC;KACD,MAAM,EAAE,CAAC","sourcesContent":["// Callable contracts for the award catalog, award grants, and the badges an account features.\n//\n// An award is created by its first badge's publication (the `award-badge` upload, ./uploads.ts), so\n// no callable here creates one. Grants and revokes to named accounts share one input — two named\n// lists, never an action discriminator (RULE-STD-BACKEND-002) — like the role roster's. A team's or a whole\n// league's grant is its own decision, carried out a page of people at a time.\n\nimport { z } from 'zod';\nimport { MAX_AWARD_GRANT_TARGETS } from '../constants/business.js';\nimport {\n awardGroupGrantActionSchema,\n awardGroupGrantDecisionSchema,\n awardGroupGrantStatusSchema,\n awardGroupTypeSchema,\n} from '../doc-schemas/award-group-grant.js';\nimport {\n countSchema,\n documentIdSegmentSchema,\n epochMsSchema,\n userIdSchema,\n} from '../doc-schemas/atoms.js';\nimport { awardIdSchema } from '../doc-schemas/catalogs.js';\nimport { AWARD_GRANT_SKIP_REASON_KEYS, FEATURED_AWARD_SLOT_KEYS } from '../types/unions.js';\n\nconst targetList = <T extends z.ZodTypeAny>(atom: T) =>\n z.array(atom).max(MAX_AWARD_GRANT_TARGETS).optional();\n\n// An admin grants an award to named accounts and revokes it from named accounts, in one commit.\n// Recipients are deduplicated on the server; a ghost holds no account and is skipped.\nexport const AdminUpdateAwardGrantsInputSchema = z\n .object({\n awardId: awardIdSchema,\n grantUserIds: targetList(userIdSchema),\n revokeUserIds: targetList(userIdSchema),\n })\n .strict()\n .refine(\n (input) =>\n [input.grantUserIds, input.revokeUserIds].some(\n (list) => list !== undefined && list.length > 0,\n ),\n { message: 'Name someone to grant the award to or revoke it from.' },\n )\n .refine(\n (input) =>\n !(input.grantUserIds ?? []).some((userId) => (input.revokeUserIds ?? []).includes(userId)),\n {\n message: 'An account cannot be granted and revoked the award in one change.',\n path: ['revokeUserIds'],\n },\n );\nexport type AdminUpdateAwardGrantsInput = z.infer<typeof AdminUpdateAwardGrantsInputSchema>;\n\nexport const AwardGrantSkipSchema = z\n .object({ userId: userIdSchema, reason: z.enum(AWARD_GRANT_SKIP_REASON_KEYS) })\n .strict();\nexport type AwardGrantSkip = z.infer<typeof AwardGrantSkipSchema>;\n\n// What the change did for each account it reached: granted now, already held, revoked now, not held\n// to begin with, or skipped with its reason. A retried call reports the accounts its first call\n// changed as already held or not held, and writes nothing again.\nexport const AdminUpdateAwardGrantsResultSchema = z\n .object({\n awardId: awardIdSchema,\n granted: z.array(userIdSchema),\n alreadyHeld: z.array(userIdSchema),\n revoked: z.array(userIdSchema),\n notHeld: z.array(userIdSchema),\n skipped: z.array(AwardGrantSkipSchema),\n })\n .strict();\nexport type AdminUpdateAwardGrantsResult = z.infer<typeof AdminUpdateAwardGrantsResultSchema>;\n\n// The group a group grant reaches: every active member of one team, or of one whole league.\n// `groupId` is that team's or league's id.\nexport const AwardGroupSchema = z\n .object({ groupType: awardGroupTypeSchema, groupId: documentIdSegmentSchema })\n .strict();\nexport type AwardGroup = z.infer<typeof AwardGroupSchema>;\n\n// An admin grants an award to a group, or takes back what the group's grants gave. The decision opens\n// at once and its people are reached a page at a time after the answer; a request the group's latest\n// decision already settles (granting what is granted, taking back what is not) opens nothing.\nexport const AdminUpdateAwardGroupGrantInputSchema = z\n .object({ awardId: awardIdSchema, action: awardGroupGrantActionSchema, group: AwardGroupSchema })\n .strict();\nexport type AdminUpdateAwardGroupGrantInput = z.infer<typeof AdminUpdateAwardGroupGrantInputSchema>;\n\n// Where one decision on an award for a group stands. `peopleReached` is how many people it has dealt\n// with so far: a grant's recorded people, or the people a revoke has taken the award back from or left\n// holding it. A pending decision that failed carries its failure and how many times it has tried; the\n// scheduled resume tries it again.\nexport const AwardGroupGrantProgressSchema = z\n .object({\n grantId: z.string().min(1),\n action: awardGroupGrantActionSchema,\n decision: awardGroupGrantDecisionSchema,\n status: awardGroupGrantStatusSchema,\n peopleReached: countSchema,\n attemptCount: countSchema,\n lastError: z.string().nullable(),\n createdAt: epochMsSchema,\n completedAt: epochMsSchema.nullable(),\n })\n .strict();\nexport type AwardGroupGrantProgress = z.infer<typeof AwardGroupGrantProgressSchema>;\n\n// `opened` is false when the group's latest decision already settled the request; `grant` is then that\n// decision, or null when the group has none.\nexport const AdminUpdateAwardGroupGrantResultSchema = z\n .object({\n awardId: awardIdSchema,\n opened: z.boolean(),\n grant: AwardGroupGrantProgressSchema.nullable(),\n })\n .strict();\nexport type AdminUpdateAwardGroupGrantResult = z.infer<\n typeof AdminUpdateAwardGroupGrantResultSchema\n>;\n\n// An admin reads the latest decision on an award for a group, so the progress survives a closed page.\nexport const AdminGetAwardGroupGrantStatusInputSchema = z\n .object({ awardId: awardIdSchema, group: AwardGroupSchema })\n .strict();\nexport type AdminGetAwardGroupGrantStatusInput = z.infer<\n typeof AdminGetAwardGroupGrantStatusInputSchema\n>;\nexport const AdminGetAwardGroupGrantStatusResultSchema = z\n .object({ grant: AwardGroupGrantProgressSchema.nullable() })\n .strict();\nexport type AdminGetAwardGroupGrantStatusResult = z.infer<\n typeof AdminGetAwardGroupGrantStatusResultSchema\n>;\n\n// An admin deletes an award nobody holds. Its badge's files are retired with it.\nexport const AdminDeleteAwardDefinitionInputSchema = z.object({ awardId: awardIdSchema }).strict();\nexport type AdminDeleteAwardDefinitionInput = z.infer<typeof AdminDeleteAwardDefinitionInputSchema>;\n\n// `deleted` is false when the award was already gone: nothing was written.\nexport const AdminDeleteAwardDefinitionResultSchema = z\n .object({ awardId: awardIdSchema, deleted: z.boolean() })\n .strict();\nexport type AdminDeleteAwardDefinitionResult = z.infer<\n typeof AdminDeleteAwardDefinitionResultSchema\n>;\n\n// The signed-in account chooses which of its own awards to show beside its name: a primary and a\n// secondary badge, each an award it holds, or none. The input is the one change the person made —\n// set a slot, clear a slot, or swap the two — and the core applies it to the pair as stored, so a\n// change to one slot never writes back a stale value of the other. No user id is ever sent.\nconst featuredAwardSlotSchema = z.enum(FEATURED_AWARD_SLOT_KEYS);\nexport const UpdateFeaturedAwardsInputSchema = z.discriminatedUnion('action', [\n z\n .object({ action: z.literal('set'), slot: featuredAwardSlotSchema, awardId: awardIdSchema })\n .strict(),\n z.object({ action: z.literal('clear'), slot: featuredAwardSlotSchema }).strict(),\n z.object({ action: z.literal('swap') }).strict(),\n]);\nexport type UpdateFeaturedAwardsInput = z.infer<typeof UpdateFeaturedAwardsInputSchema>;\n\nexport const UpdateFeaturedAwardsResultSchema = z\n .object({\n userId: userIdSchema,\n primaryAwardId: awardIdSchema.nullable(),\n secondaryAwardId: awardIdSchema.nullable(),\n changed: z.boolean(),\n })\n .strict();\nexport type UpdateFeaturedAwardsResult = z.infer<typeof UpdateFeaturedAwardsResultSchema>;\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Callable contracts for the operator's dead letters: the read-only list of the durable rows every
|
|
2
2
|
// supported pipeline stopped retrying, and the replay that puts one back to work after the cause is
|
|
3
|
-
// fixed. The replay is a repair, so it takes the admin's reason (BACKEND-212). The caller names a lane
|
|
3
|
+
// fixed. The replay is a repair, so it takes the admin's reason (RULE-STD-BACKEND-212). The caller names a lane
|
|
4
4
|
// and a row id, never a Firestore path: the backend's lane registry derives the document from them
|
|
5
|
-
// (ARCH-106).
|
|
5
|
+
// (RULE-STD-ARCH-106).
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
import { countSchema, documentIdSegmentSchema, epochMsSchema, repairReasonSchema, } from '../doc-schemas/atoms.js';
|
|
8
8
|
/** Every ledger the dead-letter replay supports. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dead-letters.js","sourceRoot":"","sources":["../../src/schemas/dead-letters.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,oGAAoG;AACpG,
|
|
1
|
+
{"version":3,"file":"dead-letters.js","sourceRoot":"","sources":["../../src/schemas/dead-letters.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,oGAAoG;AACpG,gHAAgH;AAChH,mGAAmG;AACnG,uBAAuB;AAEvB,OAAO,EAAE,CAAC,EAAE,MAAM,KAA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E,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC;IAClC,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;CACvB,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,oGAAoG;AACpG,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC;KAC9C,MAAM,CAAC;IACN,UAAU,EAAE,0BAA0B;IACtC,KAAK,EAAE,uBAAuB;IAC9B,MAAM,EAAE,kBAAkB;IAC1B,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,qGAAqG;AACrG,2EAA2E;AAC3E,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC;KAC/C,MAAM,CAAC;IACN,UAAU,EAAE,0BAA0B;IACtC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;IACpC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;IAClC,aAAa,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACrC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACpC,CAAC;KACD,MAAM,EAAE,CAAC","sourcesContent":["// Callable contracts for the operator's dead letters: the read-only list of the durable rows every\n// supported pipeline stopped retrying, and the replay that puts one back to work after the cause is\n// fixed. The replay is a repair, so it takes the admin's reason (RULE-STD-BACKEND-212). The caller names a lane\n// and a row id, never a Firestore path: the backend's lane registry derives the document from them\n// (RULE-STD-ARCH-106).\n\nimport { z } from 'zod';\nimport {\n countSchema,\n documentIdSegmentSchema,\n epochMsSchema,\n repairReasonSchema,\n} from '../doc-schemas/atoms.js';\n\n/** Every ledger the dead-letter replay supports. */\nexport const DEAD_LETTER_COLLECTION_KEYS = ['notificationDeliveries'] as const;\nexport const DeadLetterCollectionSchema = z.enum(DEAD_LETTER_COLLECTION_KEYS);\nexport type DeadLetterCollection = z.infer<typeof DeadLetterCollectionSchema>;\n\n/** What the operator's screen calls each lane, beside its raw collection id. */\nexport const DEAD_LETTER_COLLECTION_LABELS: { readonly [K in DeadLetterCollection]: string } = {\n notificationDeliveries: 'Admin notification delivery',\n};\n\n/** The most rows the list returns per lane. */\nexport const MAX_DEAD_LETTERS_LISTED = 200;\n\n// The list: every lane, or one; at most `limit` rows per lane, under the callable's own ceiling.\nexport const GetDeadLettersInputSchema = z\n .object({\n collection: DeadLetterCollectionSchema.optional(),\n limit: z.number().int().min(1).max(MAX_DEAD_LETTERS_LISTED).optional(),\n })\n .strict()\n .nullish();\nexport type GetDeadLettersInput = z.infer<typeof GetDeadLettersInputSchema>;\n\n// One parked row, a projection over the lanes' own row shapes: each names its dead-letter time, last\n// error, and attempts in its own fields, and the list maps them onto these.\nexport const DeadLetterRowSchema = z\n .object({\n collection: DeadLetterCollectionSchema,\n docId: z.string().min(1),\n deadLetteredAt: epochMsSchema.nullable(),\n lastError: z.string().nullable(),\n attemptCount: countSchema.nullable(),\n })\n .strict();\nexport type DeadLetterRow = z.infer<typeof DeadLetterRowSchema>;\n\n// `truncated` is true when any lane hit the row cap: more parked rows exist than shown.\nexport const GetDeadLettersResultSchema = z\n .object({\n generatedAt: epochMsSchema,\n rows: z.array(DeadLetterRowSchema),\n truncated: z.boolean(),\n })\n .strict();\nexport type GetDeadLettersResult = z.infer<typeof GetDeadLettersResultSchema>;\n\n// `dryRun` inspects the row — its status, and what a replay would reset it to — and writes nothing.\nexport const AdminReplayDeadLetterInputSchema = z\n .object({\n collection: DeadLetterCollectionSchema,\n docId: documentIdSegmentSchema,\n reason: repairReasonSchema,\n dryRun: z.boolean().optional(),\n })\n .strict();\nexport type AdminReplayDeadLetterInput = z.infer<typeof AdminReplayDeadLetterInputSchema>;\n\n// A performed replay answers `replayed` and the active value the row was reset to; a dry run answers\n// `dryRun`, the row's current status, and what a replay would reset it to.\nexport const AdminReplayDeadLetterResultSchema = z\n .object({\n collection: DeadLetterCollectionSchema,\n docId: z.string().min(1),\n replayed: z.literal(true).optional(),\n resetTo: z.string().optional(),\n dryRun: z.literal(true).optional(),\n currentStatus: z.unknown().optional(),\n wouldResetTo: z.string().optional(),\n })\n .strict();\nexport type AdminReplayDeadLetterResult = z.infer<typeof AdminReplayDeadLetterResultSchema>;\n"]}
|
package/dist/schemas/leagues.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Callable contracts for the league: creation, the settings edit, the status move, and the mode
|
|
2
2
|
// switch. Every one is admin authority, and the acting admin is `request.auth.uid` — never an input
|
|
3
|
-
// field (ARCH-106).
|
|
3
|
+
// field (RULE-STD-ARCH-106).
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { MAX_PLAYOFF_CUTOFF } from '../constants/business.js';
|
|
6
6
|
import { LEAGUE_DESCRIPTION_INPUT_FORMAT, LEAGUE_TITLE_INPUT_FORMAT, } from '../input-formats/input-formats.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"leagues.js","sourceRoot":"","sources":["../../src/schemas/leagues.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,oGAAoG;AACpG,
|
|
1
|
+
{"version":3,"file":"leagues.js","sourceRoot":"","sources":["../../src/schemas/leagues.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,oGAAoG;AACpG,6BAA6B;AAE7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EACL,+BAA+B,EAC/B,yBAAyB,GAC1B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,aAAa,EACb,cAA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,EAAE,cAAc,EAAE,MAAM,EAAE,kBAAkB,EAAE,GAAG,wBAAwB,EAAE,CAAC;KAC7F,MAAM,EAAE,CAAC;AAKZ,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC;KACzC,MAAM,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC;KAC/D,MAAM,EAAE,CAAC;AAEZ,sFAAsF;AACtF,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC;KAC1C,MAAM,CAAC;IACN,QAAQ,EAAE,cAAc;IACxB,UAAU,EAAE,gBAAgB;IAC5B,YAAY,EAAE,WAAW;IACzB,GAAG,wBAAwB;CAC5B,CAAC;KACD,MAAM,EAAE,CAAC","sourcesContent":["// Callable contracts for the league: creation, the settings edit, the status move, and the mode\n// switch. Every one is admin authority, and the acting admin is `request.auth.uid` — never an input\n// field (RULE-STD-ARCH-106).\n\nimport { z } from 'zod';\nimport { MAX_PLAYOFF_CUTOFF } from '../constants/business.js';\nimport {\n LEAGUE_DESCRIPTION_INPUT_FORMAT,\n LEAGUE_TITLE_INPUT_FORMAT,\n} from '../input-formats/input-formats.js';\nimport {\n calendarDateSchema,\n textFieldSchema,\n countSchema,\n epochMsSchema,\n leagueIdSchema,\n leagueModeSchema,\n leagueStatusSchema,\n leagueTypeSchema,\n} from '../doc-schemas/atoms.js';\nimport { playoffCutoffCountSchema, refineLeagueSettings } from '../doc-schemas/sport-league.js';\nimport { waiverTemplateIdSchema } from '../doc-schemas/waiver-template.js';\n\n// The title and description, each built from its field's one declaration, so the form and the wire\n// run the same check.\nexport const leagueTitleSchema = textFieldSchema(LEAGUE_TITLE_INPUT_FORMAT);\nexport const leagueDescriptionSchema = textFieldSchema(LEAGUE_DESCRIPTION_INPUT_FORMAT);\nexport const playoffCutoffSchema = playoffCutoffCountSchema.max(MAX_PLAYOFF_CUTOFF);\n\n// The settings an admin sets at creation and edits afterwards, in the order the update's result and\n// audit event list them. Sport and mode are not settings: the sport is fixed at\n// creation, and the mode changes only through the mode switch, which retypes the league's teams.\nexport const LEAGUE_SETTINGS_FIELD_KEYS = [\n 'leagueTitle',\n 'description',\n 'leagueStartDate',\n 'leagueEndDate',\n 'playoffCutoff',\n 'playoffCutoffComp',\n 'playoffCutoffRec',\n 'requiresWaiver',\n 'waiverTemplateId',\n] as const;\nexport type LeagueSettingsField = (typeof LEAGUE_SETTINGS_FIELD_KEYS)[number];\nexport const leagueSettingsFieldSchema = z.enum(LEAGUE_SETTINGS_FIELD_KEYS);\n\n// The playoff cutoffs among the settings: a league whose mode sorts its teams by type shows the\n// competitive and recreational pair, any other league the single cutoff.\nexport const PLAYOFF_CUTOFF_FIELD_KEYS = [\n 'playoffCutoff',\n 'playoffCutoffComp',\n 'playoffCutoffRec',\n] as const satisfies readonly LeagueSettingsField[];\nexport type PlayoffCutoffField = (typeof PLAYOFF_CUTOFF_FIELD_KEYS)[number];\n\n// Every cutoff is sent whether or not the league's mode shows it, so a later mode switch finds the\n// other mode's cutoffs already set.\nconst leagueSettingsShape = {\n leagueTitle: leagueTitleSchema,\n description: leagueDescriptionSchema,\n leagueStartDate: calendarDateSchema,\n leagueEndDate: calendarDateSchema,\n playoffCutoff: playoffCutoffSchema,\n playoffCutoffComp: playoffCutoffSchema,\n playoffCutoffRec: playoffCutoffSchema,\n requiresWaiver: z.boolean(),\n waiverTemplateId: waiverTemplateIdSchema.optional(),\n} satisfies Record<LeagueSettingsField, z.ZodType>;\n\nexport const AdminCreateSportLeagueInputSchema = z\n .object({ ...leagueSettingsShape, leagueType: leagueTypeSchema, leagueMode: leagueModeSchema })\n .strict()\n .superRefine(refineLeagueSettings);\nexport type AdminCreateSportLeagueInput = z.infer<typeof AdminCreateSportLeagueInputSchema>;\nexport const AdminCreateSportLeagueResultSchema = z.object({ leagueId: leagueIdSchema }).strict();\nexport type AdminCreateSportLeagueResult = z.infer<typeof AdminCreateSportLeagueResultSchema>;\n\n// The whole settings set, every time: the callable writes exactly these fields, and a waiver\n// requirement turned off drops the template reference with it. `expectedUpdatedAt` is the league's\n// `updatedAt` as the admin loaded it: a save that would change a league written since is refused,\n// so a stale form never writes its old values over another admin's edit.\nexport const AdminUpdateSportLeagueInputSchema = z\n .object({ leagueId: leagueIdSchema, expectedUpdatedAt: epochMsSchema, ...leagueSettingsShape })\n .strict()\n .superRefine(refineLeagueSettings);\nexport type AdminUpdateSportLeagueInput = z.infer<typeof AdminUpdateSportLeagueInputSchema>;\n// `changedFields` is empty when the settings already held every value sent. `updatedAt` is the\n// league's `updatedAt` once the save is done — the value written, or the stored one when nothing\n// changed — and the league it names holds exactly the settings sent, so it is the form's next\n// `expectedUpdatedAt` and a second save from the same form is not refused as stale.\nexport const AdminUpdateSportLeagueResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n changedFields: z.array(leagueSettingsFieldSchema),\n updatedAt: epochMsSchema,\n })\n .strict();\nexport type AdminUpdateSportLeagueResult = z.infer<typeof AdminUpdateSportLeagueResultSchema>;\n\nexport const AdminUpdateSportLeagueStatusInputSchema = z\n .object({ leagueId: leagueIdSchema, status: leagueStatusSchema })\n .strict();\nexport type AdminUpdateSportLeagueStatusInput = z.infer<\n typeof AdminUpdateSportLeagueStatusInputSchema\n>;\n\n// The league's `updatedAt` before and after a status move or a mode switch, equal when nothing moved.\n// Neither changes a setting and neither checks the settings form, so a form advances its\n// `expectedUpdatedAt` to `updatedAt` only when it was loaded at `previousUpdatedAt`. A form loaded\n// at any other value was already stale, and advancing it would let its old values overwrite the\n// edit that made it stale.\nconst leagueUpdatedAtMoveShape = { previousUpdatedAt: epochMsSchema, updatedAt: epochMsSchema };\n\nexport const AdminUpdateSportLeagueStatusResultSchema = z\n .object({ leagueId: leagueIdSchema, status: leagueStatusSchema, ...leagueUpdatedAtMoveShape })\n .strict();\nexport type AdminUpdateSportLeagueStatusResult = z.infer<\n typeof AdminUpdateSportLeagueStatusResultSchema\n>;\n\nexport const SwitchLeagueModeInputSchema = z\n .object({ leagueId: leagueIdSchema, newMode: leagueModeSchema })\n .strict();\nexport type SwitchLeagueModeInput = z.infer<typeof SwitchLeagueModeInputSchema>;\n// `teamsUpdated` is 0 when the league was already in `newMode`: nothing is rewritten.\nexport const SwitchLeagueModeResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n leagueMode: leagueModeSchema,\n teamsUpdated: countSchema,\n ...leagueUpdatedAtMoveShape,\n })\n .strict();\nexport type SwitchLeagueModeResult = z.infer<typeof SwitchLeagueModeResultSchema>;\n"]}
|
|
@@ -16,7 +16,7 @@ const MAX_RECORDED_OPERATION_IDS = 10;
|
|
|
16
16
|
export const RunMigrationActionInputSchema = z
|
|
17
17
|
.object({
|
|
18
18
|
operationId: migrationOperationIdSchema,
|
|
19
|
-
// Required on every page (BACKEND-212); the run keeps the one its first page gave.
|
|
19
|
+
// Required on every page (RULE-STD-BACKEND-212); the run keeps the one its first page gave.
|
|
20
20
|
reason: repairReasonSchema,
|
|
21
21
|
// A preview: read, transform, and report, writing nothing. A verification only reads either way.
|
|
22
22
|
dryRun: z.boolean(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-console.js","sourceRoot":"","sources":["../../src/schemas/migration-console.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,EAAE;AACF,mGAAmG;AACnG,sGAAsG;AACtG,qGAAqG;AACrG,oGAAoG;AACpG,0GAA0G;AAE1G,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,uBAAuB,EACvB,6BAA6B,GAC9B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,yBAAyB,CAAC;AAEjC,8FAA8F;AAC9F,0DAA0D;AAC1D,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAEtC,wCAAwC;AACxC,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC;KAC3C,MAAM,CAAC;IACN,WAAW,EAAE,0BAA0B;IACvC,
|
|
1
|
+
{"version":3,"file":"migration-console.js","sourceRoot":"","sources":["../../src/schemas/migration-console.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,EAAE;AACF,mGAAmG;AACnG,sGAAsG;AACtG,qGAAqG;AACrG,oGAAoG;AACpG,0GAA0G;AAE1G,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,uBAAuB,EACvB,6BAA6B,GAC9B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,yBAAyB,CAAC;AAEjC,8FAA8F;AAC9F,0DAA0D;AAC1D,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAEtC,wCAAwC;AACxC,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC;KAC3C,MAAM,CAAC;IACN,WAAW,EAAE,0BAA0B;IACvC,4FAA4F;IAC5F,MAAM,EAAE,kBAAkB;IAC1B,iGAAiG;IACjG,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;IACnB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,uBAAuB,CAAC;IAC9D,gGAAgG;IAChG,yDAAyD;IACzD,iBAAiB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACzC,8FAA8F;IAC9F,8FAA8F;IAC9F,8FAA8F;IAC9F,0FAA0F;I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B,CAAC;IAC3C,gGAAgG;IAChG,mCAAmC;IACnC,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE;IAC3B,MAAM,EAAE,wBAAwB,CAAC,QAAQ,EAAE;CAC5C,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC;KAC7C,MAAM,CAAC;IACN,OAAO,EAAE,sBAAsB;IAC/B,2CAA2C;IAC3C,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,wBAAwB,CAAC;IACxC,MAAM,EAAE,aAAa;CACtB,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,mFAAmF;AACnF,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC;KAClD,MAAM,CAAC;IACN,QAAQ,EAAE,uBAAuB;IACjC,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC,GAAG,CAAC,0BAA0B,CAAC;IAC7E,MAAM,EAAE,kBAAkB;CAC3B,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,qEAAqE;AACrE,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC;KAClD,MAAM,CAAC;IACN,QAAQ,EAAE,uBAAuB;IACjC,QAAQ,EAAE,uBAAuB;CAClC,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,oEAAoE;AACpE,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAGnG,uGAAuG;AACvG,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC;KAC7C,MAAM,CAAC;IACN,QAAQ,EAAE,uBAAuB;IACjC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,6BAA6B,CAAC;IAC9C,MAAM,EAAE,wBAAwB;CACjC,CAAC;KACD,MAAM,EAAE,CAAC","sourcesContent":["// The migration console's callables. Every one is admin-only, asking its auth gate for admin.\n//\n// Each executable cutover action has its own callable (`MigrationStep.callable`), and every one of\n// them takes `RunMigrationActionInputSchema` and answers `MigrationActionPageResultSchema` — one page\n// per call. The console holds each run's resume key itself, so a browser that lost its place resumes\n// the same logical run by sending the same operation id; a new operation id starts the action over.\n// The line resolution is the one action with its own input (`AdminResolveUnrosteredStatLineInputSchema`).\n\nimport { z } from 'zod';\nimport {\n MigrationActionRunSchema,\n MigrationConsoleSchema,\n MigrationFindingSchema,\n MigrationRunRecordSchema,\n migrationActionIdSchema,\n migrationEvidenceSchema,\n migrationOperationIdSchema,\n} from '../doc-schemas/migration-console.js';\nimport {\n MAX_MIGRATION_PAGE_SIZE,\n MIGRATION_RECORD_OUTCOME_KEYS,\n} from '../migration-console/run-state.js';\nimport {\n countSchema,\n epochMsSchema,\n repairReasonSchema,\n statsOperationIdSchema,\n} from '../doc-schemas/atoms.js';\n\n// The operation ids a product control's record names: one per sport for the hall of fame, one\n// otherwise, none for a control that writes no operation.\nconst MAX_RECORDED_OPERATION_IDS = 10;\n\n/** One page of an executable action. */\nexport const RunMigrationActionInputSchema = z\n .object({\n operationId: migrationOperationIdSchema,\n // Required on every page (RULE-STD-BACKEND-212); the run keeps the one its first page gave.\n reason: repairReasonSchema,\n // A preview: read, transform, and report, writing nothing. A verification only reads either way.\n dryRun: z.boolean(),\n pageSize: z.number().int().min(1).max(MAX_MIGRATION_PAGE_SIZE),\n // A verification's declaration, read at the run's first page, that its source really is empty —\n // without it a sweep that checked nothing does not pass.\n expectEmptySource: z.boolean().optional(),\n // `verify.v1Pictures` only, read at the run's first page: the operator, having reviewed them,\n // acknowledges the picture sources the verification cannot examine — in another bucket (every\n // source, in a rehearsal, which copies Firestore only), or every one on a page unavailable or\n // refused — so they are reported instead of failing the run. Any other action refuses it.\n acknowledgeUnexaminedSources: z.boolean().optional(),\n })\n .strict();\nexport type RunMigrationActionInput = z.infer<typeof RunMigrationActionInputSchema>;\n\n/** What one page did, and the run it belongs to as recorded after it. */\nexport const MigrationActionPageResultSchema = z\n .object({\n actionId: migrationActionIdSchema,\n operationId: migrationOperationIdSchema,\n dryRun: z.boolean(),\n // The page's own counts; a write action fills read, written, and skipped, a verification checked,\n // missing, and mismatched.\n read: countSchema,\n written: countSchema,\n skipped: countSchema,\n checked: countSchema,\n missing: countSchema,\n mismatched: countSchema,\n details: z.record(z.string().min(1), countSchema),\n // Every document the page reported, in full.\n findings: z.array(MigrationFindingSchema),\n nextResumeAfter: z.string().min(1).nullable(),\n // The run reached its end with this page.\n complete: z.boolean(),\n run: MigrationRunRecordSchema,\n })\n .strict();\nexport type MigrationActionPageResult = z.infer<typeof MigrationActionPageResultSchema>;\n\n/** The console as it stands: the marker, the lock, and every step's recorded state. */\nexport const GetMigrationConsoleInputSchema = z.object({}).strict();\nexport type GetMigrationConsoleInput = z.infer<typeof GetMigrationConsoleInputSchema>;\n\nexport const MigrationStepStateSchema = z\n .object({\n actionId: migrationActionIdSchema,\n // Every dependency satisfied: the step may run.\n unlocked: z.boolean(),\n // The step itself is satisfied for its dependents.\n satisfied: z.boolean(),\n // A dependency not yet satisfied, each named.\n waitingOn: z.array(migrationActionIdSchema),\n // Its latest preview reached its end since its dependencies were last done: a step that removes\n // data starts a new run only then.\n previewCurrent: z.boolean(),\n record: MigrationActionRunSchema.nullable(),\n })\n .strict();\nexport type MigrationStepState = z.infer<typeof MigrationStepStateSchema>;\n\nexport const GetMigrationConsoleResultSchema = z\n .object({\n console: MigrationConsoleSchema,\n // In cutover order, one per manifest step.\n steps: z.array(MigrationStepStateSchema),\n readAt: epochMsSchema,\n })\n .strict();\nexport type GetMigrationConsoleResult = z.infer<typeof GetMigrationConsoleResultSchema>;\n\n/** A product control's run, recorded once the console has checked its evidence. */\nexport const RecordMigrationControlRunInputSchema = z\n .object({\n actionId: migrationActionIdSchema,\n operationIds: z.array(statsOperationIdSchema).max(MAX_RECORDED_OPERATION_IDS),\n reason: repairReasonSchema,\n })\n .strict();\nexport type RecordMigrationControlRunInput = z.infer<typeof RecordMigrationControlRunInputSchema>;\n\n/** An operator checkpoint, recorded with the operator's evidence. */\nexport const RecordMigrationCheckpointInputSchema = z\n .object({\n actionId: migrationActionIdSchema,\n evidence: migrationEvidenceSchema,\n })\n .strict();\nexport type RecordMigrationCheckpointInput = z.infer<typeof RecordMigrationCheckpointInputSchema>;\n\n/** The cutover: from here on the product owns every destination. */\nexport const RecordMigrationCutoverInputSchema = z.object({ reason: repairReasonSchema }).strict();\nexport type RecordMigrationCutoverInput = z.infer<typeof RecordMigrationCutoverInputSchema>;\n\n/** What a record call answers: the step as now recorded. A second identical record changes nothing. */\nexport const RecordMigrationStepResultSchema = z\n .object({\n actionId: migrationActionIdSchema,\n outcome: z.enum(MIGRATION_RECORD_OUTCOME_KEYS),\n record: MigrationActionRunSchema,\n })\n .strict();\nexport type RecordMigrationStepResult = z.infer<typeof RecordMigrationStepResultSchema>;\n"]}
|
package/dist/schemas/pictures.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// featured picture, and removing a gallery picture or a location's picture. Admin only.
|
|
3
3
|
//
|
|
4
4
|
// Each result carries the one entry it changed, so a client patches that entry into the gallery
|
|
5
|
-
// pages it holds instead of refetching them (FRONTEND-103), and the owner's own update event, which
|
|
5
|
+
// pages it holds instead of refetching them (RULE-STD-FRONTEND-103), and the owner's own update event, which
|
|
6
6
|
// refreshes the owner document that carries the gallery's summary.
|
|
7
7
|
import { z } from 'zod';
|
|
8
8
|
import { GalleryPictureSchema, pictureIdSchema } from '../doc-schemas/gallery.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pictures.js","sourceRoot":"","sources":["../../src/schemas/pictures.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,wFAAwF;AACxF,EAAE;AACF,gGAAgG;AAChG,
|
|
1
|
+
{"version":3,"file":"pictures.js","sourceRoot":"","sources":["../../src/schemas/pictures.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,wFAAwF;AACxF,EAAE;AACF,gGAAgG;A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5C,MAAM,CAAC,EAAE,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC;KAC9F,MAAM,EAAE,CAAC","sourcesContent":["// Callable contracts for managing pictures already published: ordering a gallery, choosing its\n// featured picture, and removing a gallery picture or a location's picture. Admin only.\n//\n// Each result carries the one entry it changed, so a client patches that entry into the gallery\n// pages it holds instead of refetching them (RULE-STD-FRONTEND-103), and the owner's own update event, which\n// refreshes the owner document that carries the gallery's summary.\n\nimport { z } from 'zod';\nimport { GalleryPictureSchema, pictureIdSchema } from '../doc-schemas/gallery.js';\nimport { PictureOwnerRefSchema } from '../doc-schemas/pending-media.js';\nimport { DomainEventSchema } from '../domain-events/domain-events.js';\n\n// A gallery picture as a client holds it in its cached pages: the document with its id.\nexport const GalleryPictureEntrySchema = GalleryPictureSchema.extend({\n id: pictureIdSchema,\n}).strict();\nexport type GalleryPictureEntry = z.infer<typeof GalleryPictureEntrySchema>;\n\nexport const AdminMovePictureInputSchema = z\n .object({\n pictureId: pictureIdSchema,\n // The picture it goes directly after, in the same gallery; `null` puts it first.\n afterPictureId: pictureIdSchema.nullable(),\n })\n .strict();\nexport type AdminMovePictureInput = z.infer<typeof AdminMovePictureInputSchema>;\nexport const AdminMovePictureResultSchema = z\n .object({ picture: GalleryPictureEntrySchema, event: DomainEventSchema })\n .strict();\nexport type AdminMovePictureResult = z.infer<typeof AdminMovePictureResultSchema>;\n\nexport const AdminUpdateFeaturedPictureInputSchema = z\n .object({ pictureId: pictureIdSchema })\n .strict();\nexport type AdminUpdateFeaturedPictureInput = z.infer<typeof AdminUpdateFeaturedPictureInputSchema>;\nexport const AdminUpdateFeaturedPictureResultSchema = z\n .object({ picture: GalleryPictureEntrySchema, event: DomainEventSchema })\n .strict();\nexport type AdminUpdateFeaturedPictureResult = z.infer<\n typeof AdminUpdateFeaturedPictureResultSchema\n>;\n\nexport const AdminDeletePictureInputSchema = z\n .object({\n // The owner the admin is removing it from. A gallery picture must belong to it, and a location's\n // must be its current picture; an award's badge is never removed, only replaced.\n owner: PictureOwnerRefSchema,\n pictureId: pictureIdSchema,\n })\n .strict();\nexport type AdminDeletePictureInput = z.infer<typeof AdminDeletePictureInputSchema>;\nexport const AdminDeletePictureResultSchema = z\n .object({ owner: PictureOwnerRefSchema, pictureId: pictureIdSchema, event: DomainEventSchema })\n .strict();\nexport type AdminDeletePictureResult = z.infer<typeof AdminDeletePictureResultSchema>;\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Callable contracts for a league's schedule: a week created with its games, a week's shared fields
|
|
2
2
|
// edited, a week deleted with its games; one game added to a week, edited — moved, rescheduled, or
|
|
3
3
|
// its teams replaced — or deleted. Every one is admin authority, and the acting admin is
|
|
4
|
-
// `request.auth.uid`, never an input field (ARCH-106). Venue labels, calendar days, the sport, and
|
|
4
|
+
// `request.auth.uid`, never an input field (RULE-STD-ARCH-106). Venue labels, calendar days, the sport, and
|
|
5
5
|
// every stat field are derived by the server, never sent.
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
import { MAX_SCHEDULE_WEEK_GAMES } from '../constants/business.js';
|
|
@@ -51,7 +51,7 @@ export const AdminCreateScheduleWeekResultSchema = z
|
|
|
51
51
|
.strict();
|
|
52
52
|
// Only the week's shared fields the admin changed: a field left out keeps what each game holds, so
|
|
53
53
|
// two admins editing different fields of one week never write each other's loaded values back
|
|
54
|
-
// (BACKEND-116). The venue is named by id, and the week shows its name.
|
|
54
|
+
// (RULE-STD-BACKEND-116). The venue is named by id, and the week shows its name.
|
|
55
55
|
export const AdminUpdateScheduleWeekInputSchema = z
|
|
56
56
|
.object({
|
|
57
57
|
leagueId: leagueIdSchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedules.js","sourceRoot":"","sources":["../../src/schemas/schedules.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,mGAAmG;AACnG,yFAAyF;AACzF,mGAAmG;AACnG,0DAA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AAkG;AAClG,kGAAkG;AAClG,yEAAyE;AACzE,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC;KAC7C,MAAM,CAAC;IACN,MAAM,EAAE,YAAY;IACpB,iBAAiB,EAAE,aAAa;IAChC,MAAM,EAAE,oBAAoB;IAC5B,KAAK,EAAE,uBAAuB;IAC9B,SAAS,EAAE,aAAa;IACxB,cAAc,EAAE,oBAAoB,CAAC,QAAQ,EAAE;IAC/C,WAAW,EAAE,6BAA6B,CAAC,QAAQ,EAAE;CACtD,CAAC;KACD,MAAM,EAAE;KACR,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,KAAK,SAAS,IAAI,KAAK,CAAC,cAAc,KAAK,SAAS,EAAE;IACxF,OAAO,EAAE,mCAAmC;IAC5C,IAAI,EAAE,CAAC,aAAa,CAAC;CACtB,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC;KAC9C,MAAM,CAAC;IACN,MAAM,EAAE,YAAY;IACpB,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,4BAA4B,CAAC;IACpD,SAAS,EAAE,aAAa;CACzB,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,gGAAgG;AAChG,qGAAqG;AACrG,sEAAsE;AACtE,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAE3F,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC;KAC9C,MAAM,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,sBAAsB,EAAE,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;KAC5F,MAAM,EAAE,CAAC","sourcesContent":["// Callable contracts for a league's schedule: a week created with its games, a week's shared fields\n// edited, a week deleted with its games; one game added to a week, edited — moved, rescheduled, or\n// its teams replaced — or deleted. Every one is admin authority, and the acting admin is\n// `request.auth.uid`, never an input field (ARCH-106). Venue labels, calendar days, the sport, and\n// every stat field are derived by the server, never sent.\n\nimport { z } from 'zod';\nimport { MAX_SCHEDULE_WEEK_GAMES } from '../constants/business.js';\nimport { textFieldSchema } from '../doc-schemas/atoms.js';\nimport { SCHEDULE_WEEK_TITLE_INPUT_FORMAT } from '../input-formats/input-formats.js';\nimport {\n countSchema,\n epochMsSchema,\n gameIdSchema,\n leagueIdSchema,\n scheduleWeekIdSchema,\n statsOperationIdSchema,\n teamIdSchema,\n} from '../doc-schemas/atoms.js';\nimport { gameLocationIdSchema } from '../doc-schemas/game-location.js';\nimport { isByeTeamId } from '../ids/minted-ids.js';\nimport { SCHEDULE_WEEK_FIELD_KEYS, SPORT_GAME_SCHEDULE_FIELD_KEYS } from '../types/schedules.js';\nimport { gameLocationSubLocationSchema } from './game-locations.js';\n\nexport const scheduleWeekTitleSchema = textFieldSchema(SCHEDULE_WEEK_TITLE_INPUT_FORMAT);\n\n// A game's two team slots, by position: team one, then team two. A slot names a team of the league\n// or BYE_TEAM_ID; a game has at least one real team, and never one team twice.\nexport const scheduleGameTeamsSchema = z\n .tuple([teamIdSchema, teamIdSchema])\n .refine(\n ([first, second]) => !(isByeTeamId(first) && isByeTeamId(second)),\n 'A game needs at least one team.',\n )\n .refine(([first, second]) => first !== second, 'A game needs two different teams.');\nexport type ScheduleGameTeams = z.infer<typeof scheduleGameTeamsSchema>;\n\n// Where and when one game is played. The venue is named by id, and the server writes the label the\n// schedule shows from the venue's own name and the chosen court.\nconst scheduleGameShape = {\n teams: scheduleGameTeamsSchema,\n startTime: epochMsSchema,\n gameLocationId: gameLocationIdSchema,\n subLocation: gameLocationSubLocationSchema.optional(),\n};\n\nexport const ScheduleGameInputSchema = z.object(scheduleGameShape).strict();\nexport type ScheduleGameInput = z.infer<typeof ScheduleGameInputSchema>;\n\nexport const sportGameScheduleFieldSchema = z.enum(SPORT_GAME_SCHEDULE_FIELD_KEYS);\nexport const scheduleWeekFieldSchema = z.enum(SCHEDULE_WEEK_FIELD_KEYS);\n\n// A new week and its games, saved together. `weekStartDate` is the week's first day as the admin's\n// form reads it; the week's venue is the default each game's form starts from, and its name is the\n// week's `weekLocation`.\nexport const AdminCreateScheduleWeekInputSchema = z\n .object({\n leagueId: leagueIdSchema,\n weekTitle: scheduleWeekTitleSchema,\n weekStartDate: epochMsSchema,\n weekGameLocationId: gameLocationIdSchema,\n games: z.array(ScheduleGameInputSchema).min(1).max(MAX_SCHEDULE_WEEK_GAMES),\n })\n .strict();\nexport type AdminCreateScheduleWeekInput = z.infer<typeof AdminCreateScheduleWeekInputSchema>;\nexport const AdminCreateScheduleWeekResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n weekId: scheduleWeekIdSchema,\n gameIds: z.array(gameIdSchema),\n })\n .strict();\nexport type AdminCreateScheduleWeekResult = z.infer<typeof AdminCreateScheduleWeekResultSchema>;\n\n// Only the week's shared fields the admin changed: a field left out keeps what each game holds, so\n// two admins editing different fields of one week never write each other's loaded values back\n// (BACKEND-116). The venue is named by id, and the week shows its name.\nexport const AdminUpdateScheduleWeekInputSchema = z\n .object({\n leagueId: leagueIdSchema,\n weekId: scheduleWeekIdSchema,\n weekTitle: scheduleWeekTitleSchema.optional(),\n weekStartDate: epochMsSchema.optional(),\n weekGameLocationId: gameLocationIdSchema.optional(),\n })\n .strict()\n .refine(\n (input) =>\n input.weekTitle !== undefined ||\n input.weekStartDate !== undefined ||\n input.weekGameLocationId !== undefined,\n 'Name at least one field to change.',\n );\nexport type AdminUpdateScheduleWeekInput = z.infer<typeof AdminUpdateScheduleWeekInputSchema>;\nexport const AdminUpdateScheduleWeekResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n weekId: scheduleWeekIdSchema,\n changedFields: z.array(scheduleWeekFieldSchema),\n gamesUpdated: countSchema,\n })\n .strict();\nexport type AdminUpdateScheduleWeekResult = z.infer<typeof AdminUpdateScheduleWeekResultSchema>;\n\n// A whole week and every game in it. A game with events takes more than one step to delete, so a\n// call that runs out of time answers `complete: false` with the games still standing, and running\n// it again continues. A week with no game left answers complete.\nexport const AdminDeleteScheduleWeekInputSchema = z\n .object({ leagueId: leagueIdSchema, weekId: scheduleWeekIdSchema })\n .strict();\nexport type AdminDeleteScheduleWeekInput = z.infer<typeof AdminDeleteScheduleWeekInputSchema>;\nexport const AdminDeleteScheduleWeekResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n weekId: scheduleWeekIdSchema,\n deletedGameIds: z.array(gameIdSchema),\n remainingGameIds: z.array(gameIdSchema),\n complete: z.boolean(),\n })\n .strict();\nexport type AdminDeleteScheduleWeekResult = z.infer<typeof AdminDeleteScheduleWeekResultSchema>;\n\n// One game added to a saved week, which gives it the week's shared fields.\nexport const AdminCreateSportGameInputSchema = z\n .object({ leagueId: leagueIdSchema, weekId: scheduleWeekIdSchema, ...scheduleGameShape })\n .strict();\nexport type AdminCreateSportGameInput = z.infer<typeof AdminCreateSportGameInputSchema>;\nexport const AdminCreateSportGameResultSchema = z\n .object({ leagueId: leagueIdSchema, weekId: scheduleWeekIdSchema, gameId: gameIdSchema })\n .strict();\nexport type AdminCreateSportGameResult = z.infer<typeof AdminCreateSportGameResultSchema>;\n\n// One game's schedule, whole: its week (a reschedule into another saved week), its teams, its start\n// time, and its venue. `expectedUpdatedAt` is the game's `updatedAt` as the admin loaded it, so a\n// stale form never writes its old values over a newer change. A game that names no venue may keep\n// its stored label by naming none; a court is named only with its venue.\nexport const AdminUpdateSportGameInputSchema = z\n .object({\n gameId: gameIdSchema,\n expectedUpdatedAt: epochMsSchema,\n weekId: scheduleWeekIdSchema,\n teams: scheduleGameTeamsSchema,\n startTime: epochMsSchema,\n gameLocationId: gameLocationIdSchema.optional(),\n subLocation: gameLocationSubLocationSchema.optional(),\n })\n .strict()\n .refine((input) => input.subLocation === undefined || input.gameLocationId !== undefined, {\n message: 'A court is chosen within a venue.',\n path: ['subLocation'],\n });\nexport type AdminUpdateSportGameInput = z.infer<typeof AdminUpdateSportGameInputSchema>;\nexport const AdminUpdateSportGameResultSchema = z\n .object({\n gameId: gameIdSchema,\n changedFields: z.array(sportGameScheduleFieldSchema),\n updatedAt: epochMsSchema,\n })\n .strict();\nexport type AdminUpdateSportGameResult = z.infer<typeof AdminUpdateSportGameResultSchema>;\n\n// One game, with its events and roster. The server derives the deletion's operation id from the\n// game (`buildGameDeletionOperationId`), so a retry of a finished delete is acknowledged and a retry\n// of an interrupted one continues it; the caller names only the game.\nexport const AdminDeleteSportGameInputSchema = z.object({ gameId: gameIdSchema }).strict();\nexport type AdminDeleteSportGameInput = z.infer<typeof AdminDeleteSportGameInputSchema>;\nexport const AdminDeleteSportGameResultSchema = z\n .object({ gameId: gameIdSchema, operationId: statsOperationIdSchema, complete: z.boolean() })\n .strict();\nexport type AdminDeleteSportGameResult = z.infer<typeof AdminDeleteSportGameResultSchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"schedules.js","sourceRoot":"","sources":["../../src/schemas/schedules.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,mGAAmG;AACnG,yFAAyF;AACzF,4GAA4G;AAC5G,0DAA0D;AAE1D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AACrF,OAAO,EACL,WAAW,EACX,aAAa,EACb,YAAY,EACZ,cAAc,EACd,oBAAoB,EACpB,sBAAsB,EACtB,YAAY,GACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AACjG,OAAO,EAAE,6BAA6B,EAAE,MAA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AAC,CAAC;AAEL,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC;KAC9C,MAAM,CAAC;IACN,MAAM,EAAE,YAAY;IACpB,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,4BAA4B,CAAC;IACpD,SAAS,EAAE,aAAa;CACzB,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,gGAAgG;AAChG,qGAAqG;AACrG,sEAAsE;AACtE,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAE3F,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC;KAC9C,MAAM,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,sBAAsB,EAAE,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;KAC5F,MAAM,EAAE,CAAC","sourcesContent":["// Callable contracts for a league's schedule: a week created with its games, a week's shared fields\n// edited, a week deleted with its games; one game added to a week, edited — moved, rescheduled, or\n// its teams replaced — or deleted. Every one is admin authority, and the acting admin is\n// `request.auth.uid`, never an input field (RULE-STD-ARCH-106). Venue labels, calendar days, the sport, and\n// every stat field are derived by the server, never sent.\n\nimport { z } from 'zod';\nimport { MAX_SCHEDULE_WEEK_GAMES } from '../constants/business.js';\nimport { textFieldSchema } from '../doc-schemas/atoms.js';\nimport { SCHEDULE_WEEK_TITLE_INPUT_FORMAT } from '../input-formats/input-formats.js';\nimport {\n countSchema,\n epochMsSchema,\n gameIdSchema,\n leagueIdSchema,\n scheduleWeekIdSchema,\n statsOperationIdSchema,\n teamIdSchema,\n} from '../doc-schemas/atoms.js';\nimport { gameLocationIdSchema } from '../doc-schemas/game-location.js';\nimport { isByeTeamId } from '../ids/minted-ids.js';\nimport { SCHEDULE_WEEK_FIELD_KEYS, SPORT_GAME_SCHEDULE_FIELD_KEYS } from '../types/schedules.js';\nimport { gameLocationSubLocationSchema } from './game-locations.js';\n\nexport const scheduleWeekTitleSchema = textFieldSchema(SCHEDULE_WEEK_TITLE_INPUT_FORMAT);\n\n// A game's two team slots, by position: team one, then team two. A slot names a team of the league\n// or BYE_TEAM_ID; a game has at least one real team, and never one team twice.\nexport const scheduleGameTeamsSchema = z\n .tuple([teamIdSchema, teamIdSchema])\n .refine(\n ([first, second]) => !(isByeTeamId(first) && isByeTeamId(second)),\n 'A game needs at least one team.',\n )\n .refine(([first, second]) => first !== second, 'A game needs two different teams.');\nexport type ScheduleGameTeams = z.infer<typeof scheduleGameTeamsSchema>;\n\n// Where and when one game is played. The venue is named by id, and the server writes the label the\n// schedule shows from the venue's own name and the chosen court.\nconst scheduleGameShape = {\n teams: scheduleGameTeamsSchema,\n startTime: epochMsSchema,\n gameLocationId: gameLocationIdSchema,\n subLocation: gameLocationSubLocationSchema.optional(),\n};\n\nexport const ScheduleGameInputSchema = z.object(scheduleGameShape).strict();\nexport type ScheduleGameInput = z.infer<typeof ScheduleGameInputSchema>;\n\nexport const sportGameScheduleFieldSchema = z.enum(SPORT_GAME_SCHEDULE_FIELD_KEYS);\nexport const scheduleWeekFieldSchema = z.enum(SCHEDULE_WEEK_FIELD_KEYS);\n\n// A new week and its games, saved together. `weekStartDate` is the week's first day as the admin's\n// form reads it; the week's venue is the default each game's form starts from, and its name is the\n// week's `weekLocation`.\nexport const AdminCreateScheduleWeekInputSchema = z\n .object({\n leagueId: leagueIdSchema,\n weekTitle: scheduleWeekTitleSchema,\n weekStartDate: epochMsSchema,\n weekGameLocationId: gameLocationIdSchema,\n games: z.array(ScheduleGameInputSchema).min(1).max(MAX_SCHEDULE_WEEK_GAMES),\n })\n .strict();\nexport type AdminCreateScheduleWeekInput = z.infer<typeof AdminCreateScheduleWeekInputSchema>;\nexport const AdminCreateScheduleWeekResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n weekId: scheduleWeekIdSchema,\n gameIds: z.array(gameIdSchema),\n })\n .strict();\nexport type AdminCreateScheduleWeekResult = z.infer<typeof AdminCreateScheduleWeekResultSchema>;\n\n// Only the week's shared fields the admin changed: a field left out keeps what each game holds, so\n// two admins editing different fields of one week never write each other's loaded values back\n// (RULE-STD-BACKEND-116). The venue is named by id, and the week shows its name.\nexport const AdminUpdateScheduleWeekInputSchema = z\n .object({\n leagueId: leagueIdSchema,\n weekId: scheduleWeekIdSchema,\n weekTitle: scheduleWeekTitleSchema.optional(),\n weekStartDate: epochMsSchema.optional(),\n weekGameLocationId: gameLocationIdSchema.optional(),\n })\n .strict()\n .refine(\n (input) =>\n input.weekTitle !== undefined ||\n input.weekStartDate !== undefined ||\n input.weekGameLocationId !== undefined,\n 'Name at least one field to change.',\n );\nexport type AdminUpdateScheduleWeekInput = z.infer<typeof AdminUpdateScheduleWeekInputSchema>;\nexport const AdminUpdateScheduleWeekResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n weekId: scheduleWeekIdSchema,\n changedFields: z.array(scheduleWeekFieldSchema),\n gamesUpdated: countSchema,\n })\n .strict();\nexport type AdminUpdateScheduleWeekResult = z.infer<typeof AdminUpdateScheduleWeekResultSchema>;\n\n// A whole week and every game in it. A game with events takes more than one step to delete, so a\n// call that runs out of time answers `complete: false` with the games still standing, and running\n// it again continues. A week with no game left answers complete.\nexport const AdminDeleteScheduleWeekInputSchema = z\n .object({ leagueId: leagueIdSchema, weekId: scheduleWeekIdSchema })\n .strict();\nexport type AdminDeleteScheduleWeekInput = z.infer<typeof AdminDeleteScheduleWeekInputSchema>;\nexport const AdminDeleteScheduleWeekResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n weekId: scheduleWeekIdSchema,\n deletedGameIds: z.array(gameIdSchema),\n remainingGameIds: z.array(gameIdSchema),\n complete: z.boolean(),\n })\n .strict();\nexport type AdminDeleteScheduleWeekResult = z.infer<typeof AdminDeleteScheduleWeekResultSchema>;\n\n// One game added to a saved week, which gives it the week's shared fields.\nexport const AdminCreateSportGameInputSchema = z\n .object({ leagueId: leagueIdSchema, weekId: scheduleWeekIdSchema, ...scheduleGameShape })\n .strict();\nexport type AdminCreateSportGameInput = z.infer<typeof AdminCreateSportGameInputSchema>;\nexport const AdminCreateSportGameResultSchema = z\n .object({ leagueId: leagueIdSchema, weekId: scheduleWeekIdSchema, gameId: gameIdSchema })\n .strict();\nexport type AdminCreateSportGameResult = z.infer<typeof AdminCreateSportGameResultSchema>;\n\n// One game's schedule, whole: its week (a reschedule into another saved week), its teams, its start\n// time, and its venue. `expectedUpdatedAt` is the game's `updatedAt` as the admin loaded it, so a\n// stale form never writes its old values over a newer change. A game that names no venue may keep\n// its stored label by naming none; a court is named only with its venue.\nexport const AdminUpdateSportGameInputSchema = z\n .object({\n gameId: gameIdSchema,\n expectedUpdatedAt: epochMsSchema,\n weekId: scheduleWeekIdSchema,\n teams: scheduleGameTeamsSchema,\n startTime: epochMsSchema,\n gameLocationId: gameLocationIdSchema.optional(),\n subLocation: gameLocationSubLocationSchema.optional(),\n })\n .strict()\n .refine((input) => input.subLocation === undefined || input.gameLocationId !== undefined, {\n message: 'A court is chosen within a venue.',\n path: ['subLocation'],\n });\nexport type AdminUpdateSportGameInput = z.infer<typeof AdminUpdateSportGameInputSchema>;\nexport const AdminUpdateSportGameResultSchema = z\n .object({\n gameId: gameIdSchema,\n changedFields: z.array(sportGameScheduleFieldSchema),\n updatedAt: epochMsSchema,\n })\n .strict();\nexport type AdminUpdateSportGameResult = z.infer<typeof AdminUpdateSportGameResultSchema>;\n\n// One game, with its events and roster. The server derives the deletion's operation id from the\n// game (`buildGameDeletionOperationId`), so a retry of a finished delete is acknowledged and a retry\n// of an interrupted one continues it; the caller names only the game.\nexport const AdminDeleteSportGameInputSchema = z.object({ gameId: gameIdSchema }).strict();\nexport type AdminDeleteSportGameInput = z.infer<typeof AdminDeleteSportGameInputSchema>;\nexport const AdminDeleteSportGameResultSchema = z\n .object({ gameId: gameIdSchema, operationId: statsOperationIdSchema, complete: z.boolean() })\n .strict();\nexport type AdminDeleteSportGameResult = z.infer<typeof AdminDeleteSportGameResultSchema>;\n"]}
|
package/dist/schemas/scoring.js
CHANGED
|
@@ -15,7 +15,7 @@ const SERVER_DERIVED_FIELDS = new Set([
|
|
|
15
15
|
]);
|
|
16
16
|
/**
|
|
17
17
|
* A stored event's fields as its caller sends them: without the sequence and recorder facts the
|
|
18
|
-
* writing core derives (ARCH-106), and without a name snapshot, which only a copied event carries.
|
|
18
|
+
* writing core derives (RULE-STD-ARCH-106), and without a name snapshot, which only a copied event carries.
|
|
19
19
|
* Built from the stored event's own declaration, so the wire and the document cannot drift.
|
|
20
20
|
*/
|
|
21
21
|
function callerShape(shape, omitted = []) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scoring.js","sourceRoot":"","sources":["../../src/schemas/scoring.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,oGAAoG;AACpG,mGAAmG;AACnG,8DAA8D;AAE9D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EACL,mCAAmC,EACnC,6BAA6B,EAC7B,6BAA6B,EAC7B,gCAAgC,EAChC,4BAA4B,EAC5B,0BAA0B,EAC1B,4BAA4B,EAC5B,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,gCAAgC,EAChC,8BAA8B,EAC9B,uBAAuB,EACvB,8BAA8B,GAC/B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,WAAW,EACX,YAAY,EACZ,wBAAwB,EACxB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,YAAY,GACb,MAAM,yBAAyB,CAAC;AAOjC,MAAM,qBAAqB,GAAwB,IAAI,GAAG,CAAC;IACzD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AAC;AAGZ,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC;KACxC,MAAM,CAAC;IACN,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACrB,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,gGAAgG;AAChG,8FAA8F;AAC9F,gGAAgG;AAEhG,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC;KAC3C,MAAM,CAAC;IACN,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;CACrB,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC;KAC5C,MAAM,CAAC;IACN,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACrB,CAAC;KACD,MAAM,EAAE,CAAC","sourcesContent":["// Callable contracts for live scoring: recording stat events, marking a roster entry absent, a\n// scorer's memo, and the jump-ball possession arrow. Each action is two entries over one core — the\n// member entry for a captain or co-captain of one of the game's two teams, and the admin entry for\n// an admin or referee — which share one input and one result.\n\nimport { z } from 'zod';\nimport { MAX_STAT_EVENTS_PER_WRITE } from '../constants/sports.js';\nimport { isSportStatEventId } from '../ids/stat-event-ids.js';\nimport { GAME_MEMO_INPUT_FORMAT } from '../input-formats/input-formats.js';\nimport {\n BasketballAssistableShotEventSchema,\n BasketballBulkEditEventSchema,\n BasketballOnePointEventSchema,\n BasketballPlayerTallyEventSchema,\n BasketballTimeoutEventSchema,\n CurlingBlankEndEventSchema,\n CurlingRoundScoreEventSchema,\n FootballBulkEditEventSchema,\n FootballScoreEventSchema,\n StatCorrectionEventSchema,\n StatVoidEventSchema,\n} from '../doc-schemas/game-stats.js';\nimport {\n RECORDED_STAT_EVENT_OUTCOME_KEYS,\n STAT_EVENT_RECORDER_FIELD_KEYS,\n STAT_EVENT_REFUSAL_KEYS,\n STAT_EVENT_SNAPSHOT_FIELD_KEYS,\n} from '../types/stats.js';\nimport type { StatEventRecorderField, StatEventSnapshotField } from '../types/stats.js';\nimport {\n countSchema,\n gameIdSchema,\n gameRosterPlayerIdSchema,\n statEventIdSchema,\n teamIdSchema,\n textFieldSchema,\n userIdSchema,\n} from '../doc-schemas/atoms.js';\n\n// ---------------------------------------------------------------------------------------------\n// Recording stat events\n// ---------------------------------------------------------------------------------------------\n\ntype ServerDerivedField = StatEventRecorderField | StatEventSnapshotField;\nconst SERVER_DERIVED_FIELDS: ReadonlySet<string> = new Set([\n ...STAT_EVENT_RECORDER_FIELD_KEYS,\n ...STAT_EVENT_SNAPSHOT_FIELD_KEYS,\n]);\n\n/**\n * A stored event's fields as its caller sends them: without the sequence and recorder facts the\n * writing core derives (ARCH-106), and without a name snapshot, which only a copied event carries.\n * Built from the stored event's own declaration, so the wire and the document cannot drift.\n */\nfunction callerShape<Shape extends z.ZodRawShape, Omitted extends keyof Shape = never>(\n shape: Shape,\n omitted: readonly Omitted[] = [],\n): Omit<Shape, ServerDerivedField | Omitted> {\n const dropped = new Set<PropertyKey>([...SERVER_DERIVED_FIELDS, ...omitted]);\n return Object.fromEntries(Object.entries(shape).filter(([field]) => !dropped.has(field))) as Omit<\n Shape,\n ServerDerivedField | Omitted\n >;\n}\n\n// A sport event's id as its caller sends it — the id minted at the tap, or, as a void's target, one a\n// copied event kept. It becomes a document path, so it is held to the shape a sport event id has.\nexport const sportStatEventIdSchema = statEventIdSchema.refine(\n isSportStatEventId,\n 'Not a stat event id.',\n);\n\nconst sportEventId = { eventId: sportStatEventIdSchema };\n\n/**\n * One event of a scoring write, as the tap minted it: a sport event with its id and `recordedAt`, or\n * a void naming its target, whose own id the core derives. A bulk edit carries `previousValue`, the\n * value the form showed, so a stale form is refused. A correction parses so the core can answer it\n * with its refusal: only the game-reconcile core appends one.\n */\nexport const StatEventSubmissionSchema = z.discriminatedUnion('type', [\n z.strictObject({ ...callerShape(BasketballOnePointEventSchema.shape), ...sportEventId }),\n z.strictObject({ ...callerShape(BasketballAssistableShotEventSchema.shape), ...sportEventId }),\n z.strictObject({ ...callerShape(BasketballPlayerTallyEventSchema.shape), ...sportEventId }),\n z.strictObject({ ...callerShape(BasketballTimeoutEventSchema.shape), ...sportEventId }),\n z.strictObject({\n ...callerShape(BasketballBulkEditEventSchema.shape),\n ...sportEventId,\n previousValue: countSchema,\n }),\n z.strictObject({ ...callerShape(CurlingRoundScoreEventSchema.shape), ...sportEventId }),\n z.strictObject({ ...callerShape(CurlingBlankEndEventSchema.shape), ...sportEventId }),\n z.strictObject({ ...callerShape(FootballScoreEventSchema.shape), ...sportEventId }),\n z.strictObject({ ...callerShape(FootballBulkEditEventSchema.shape), ...sportEventId }),\n z.strictObject({\n ...callerShape(StatVoidEventSchema.shape, ['eventId']),\n targetEventId: sportStatEventIdSchema,\n }),\n z.strictObject(callerShape(StatCorrectionEventSchema.shape)),\n]);\nexport type StatEventSubmission = z.infer<typeof StatEventSubmissionSchema>;\n\n// A queue drain, a bulk-entry submission, or an undo: one ordered batch, applied whole or not at all.\nexport const RecordGameStatEventsInputSchema = z\n .object({\n gameId: gameIdSchema,\n events: z.array(StatEventSubmissionSchema).min(1).max(MAX_STAT_EVENTS_PER_WRITE),\n })\n .strict();\nexport type RecordGameStatEventsInput = z.infer<typeof RecordGameStatEventsInputSchema>;\n\n// Each event sent, in order: stored now, or found already stored by an earlier send.\nexport const RecordedStatEventSchema = z\n .object({\n eventId: statEventIdSchema,\n outcome: z.enum(RECORDED_STAT_EVENT_OUTCOME_KEYS),\n sequence: z.number().int().positive(),\n })\n .strict();\nexport type RecordedStatEvent = z.infer<typeof RecordedStatEventSchema>;\n\nexport const RecordGameStatEventsResultSchema = z\n .object({\n gameId: gameIdSchema,\n events: z.array(RecordedStatEventSchema),\n })\n .strict();\nexport type RecordGameStatEventsResult = z.infer<typeof RecordGameStatEventsResultSchema>;\n\n// What a refused scoring write names in its error details: why, and the first event it refused. No\n// event of the batch was stored, and the scorekeeper's failed list shows the refusal's copy beside\n// that event.\nexport const StatEventRefusalDetailsSchema = z\n .object({\n refusal: z.enum(STAT_EVENT_REFUSAL_KEYS),\n eventId: statEventIdSchema,\n })\n .strict();\nexport type StatEventRefusalDetails = z.infer<typeof StatEventRefusalDetailsSchema>;\n\n// ---------------------------------------------------------------------------------------------\n// Absence — per roster entry, so a person on both teams can be absent on one side only\n// ---------------------------------------------------------------------------------------------\n\nexport const UpdateGameAbsentPlayersInputSchema = z\n .object({\n gameId: gameIdSchema,\n gameRosterPlayerId: gameRosterPlayerIdSchema,\n absent: z.boolean(),\n })\n .strict();\nexport type UpdateGameAbsentPlayersInput = z.infer<typeof UpdateGameAbsentPlayersInputSchema>;\n\n// `changed` is false when the entry was already marked that way; nothing was written.\nexport const UpdateGameAbsentPlayersResultSchema = z\n .object({\n gameId: gameIdSchema,\n gameRosterPlayerId: gameRosterPlayerIdSchema,\n absent: z.boolean(),\n changed: z.boolean(),\n })\n .strict();\nexport type UpdateGameAbsentPlayersResult = z.infer<typeof UpdateGameAbsentPlayersResultSchema>;\n\n// ---------------------------------------------------------------------------------------------\n// The memo — a scorer's note on one person in a live game (\"red shirt\", \"#9\")\n// ---------------------------------------------------------------------------------------------\n\n// Built from the memo's one declaration, so the memo form and the callable accept exactly the same\n// text: trimmed, one line, empty allowed — an empty memo clears the person's note.\nexport const gameMemoSchema = textFieldSchema(GAME_MEMO_INPUT_FORMAT);\n\nexport const UpdateGameMemoInputSchema = z\n .object({\n gameId: gameIdSchema,\n userId: userIdSchema,\n memo: gameMemoSchema,\n })\n .strict();\nexport type UpdateGameMemoInput = z.infer<typeof UpdateGameMemoInputSchema>;\n\nexport const UpdateGameMemoResultSchema = z\n .object({\n gameId: gameIdSchema,\n userId: userIdSchema,\n memo: z.string(),\n changed: z.boolean(),\n })\n .strict();\nexport type UpdateGameMemoResult = z.infer<typeof UpdateGameMemoResultSchema>;\n\n// ---------------------------------------------------------------------------------------------\n// The jump-ball possession arrow — set to a team, so a retried call lands where the first did\n// ---------------------------------------------------------------------------------------------\n\nexport const UpdateGameJumpBallInputSchema = z\n .object({\n gameId: gameIdSchema,\n teamId: teamIdSchema,\n })\n .strict();\nexport type UpdateGameJumpBallInput = z.infer<typeof UpdateGameJumpBallInputSchema>;\n\nexport const UpdateGameJumpBallResultSchema = z\n .object({\n gameId: gameIdSchema,\n teamId: teamIdSchema,\n changed: z.boolean(),\n })\n .strict();\nexport type UpdateGameJumpBallResult = z.infer<typeof UpdateGameJumpBallResultSchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"scoring.js","sourceRoot":"","sources":["../../src/schemas/scoring.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,oGAAoG;AACpG,mGAAmG;AACnG,8DAA8D;AAE9D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EACL,mCAAmC,EACnC,6BAA6B,EAC7B,6BAA6B,EAC7B,gCAAgC,EAChC,4BAA4B,EAC5B,0BAA0B,EAC1B,4BAA4B,EAC5B,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,gCAAgC,EAChC,8BAA8B,EAC9B,uBAAuB,EACvB,8BAA8B,GAC/B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,WAAW,EACX,YAAY,EACZ,wBAAwB,EACxB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,YAAY,GACb,MAAM,yBAAyB,CAAC;AAOjC,MAAM,qBAAqB,GAAwB,IAAI,GAAG,CAAC;IACzD,GAAG,8BAA8B;IACjC,GAAG,8BAA8B;CAClC,C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,CAAC;KACxC,MAAM,CAAC;IACN,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACrB,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,gGAAgG;AAChG,8FAA8F;AAC9F,gGAAgG;AAEhG,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC;KAC3C,MAAM,CAAC;IACN,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;CACrB,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC;KAC5C,MAAM,CAAC;IACN,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACrB,CAAC;KACD,MAAM,EAAE,CAAC","sourcesContent":["// Callable contracts for live scoring: recording stat events, marking a roster entry absent, a\n// scorer's memo, and the jump-ball possession arrow. Each action is two entries over one core — the\n// member entry for a captain or co-captain of one of the game's two teams, and the admin entry for\n// an admin or referee — which share one input and one result.\n\nimport { z } from 'zod';\nimport { MAX_STAT_EVENTS_PER_WRITE } from '../constants/sports.js';\nimport { isSportStatEventId } from '../ids/stat-event-ids.js';\nimport { GAME_MEMO_INPUT_FORMAT } from '../input-formats/input-formats.js';\nimport {\n BasketballAssistableShotEventSchema,\n BasketballBulkEditEventSchema,\n BasketballOnePointEventSchema,\n BasketballPlayerTallyEventSchema,\n BasketballTimeoutEventSchema,\n CurlingBlankEndEventSchema,\n CurlingRoundScoreEventSchema,\n FootballBulkEditEventSchema,\n FootballScoreEventSchema,\n StatCorrectionEventSchema,\n StatVoidEventSchema,\n} from '../doc-schemas/game-stats.js';\nimport {\n RECORDED_STAT_EVENT_OUTCOME_KEYS,\n STAT_EVENT_RECORDER_FIELD_KEYS,\n STAT_EVENT_REFUSAL_KEYS,\n STAT_EVENT_SNAPSHOT_FIELD_KEYS,\n} from '../types/stats.js';\nimport type { StatEventRecorderField, StatEventSnapshotField } from '../types/stats.js';\nimport {\n countSchema,\n gameIdSchema,\n gameRosterPlayerIdSchema,\n statEventIdSchema,\n teamIdSchema,\n textFieldSchema,\n userIdSchema,\n} from '../doc-schemas/atoms.js';\n\n// ---------------------------------------------------------------------------------------------\n// Recording stat events\n// ---------------------------------------------------------------------------------------------\n\ntype ServerDerivedField = StatEventRecorderField | StatEventSnapshotField;\nconst SERVER_DERIVED_FIELDS: ReadonlySet<string> = new Set([\n ...STAT_EVENT_RECORDER_FIELD_KEYS,\n ...STAT_EVENT_SNAPSHOT_FIELD_KEYS,\n]);\n\n/**\n * A stored event's fields as its caller sends them: without the sequence and recorder facts the\n * writing core derives (RULE-STD-ARCH-106), and without a name snapshot, which only a copied event carries.\n * Built from the stored event's own declaration, so the wire and the document cannot drift.\n */\nfunction callerShape<Shape extends z.ZodRawShape, Omitted extends keyof Shape = never>(\n shape: Shape,\n omitted: readonly Omitted[] = [],\n): Omit<Shape, ServerDerivedField | Omitted> {\n const dropped = new Set<PropertyKey>([...SERVER_DERIVED_FIELDS, ...omitted]);\n return Object.fromEntries(Object.entries(shape).filter(([field]) => !dropped.has(field))) as Omit<\n Shape,\n ServerDerivedField | Omitted\n >;\n}\n\n// A sport event's id as its caller sends it — the id minted at the tap, or, as a void's target, one a\n// copied event kept. It becomes a document path, so it is held to the shape a sport event id has.\nexport const sportStatEventIdSchema = statEventIdSchema.refine(\n isSportStatEventId,\n 'Not a stat event id.',\n);\n\nconst sportEventId = { eventId: sportStatEventIdSchema };\n\n/**\n * One event of a scoring write, as the tap minted it: a sport event with its id and `recordedAt`, or\n * a void naming its target, whose own id the core derives. A bulk edit carries `previousValue`, the\n * value the form showed, so a stale form is refused. A correction parses so the core can answer it\n * with its refusal: only the game-reconcile core appends one.\n */\nexport const StatEventSubmissionSchema = z.discriminatedUnion('type', [\n z.strictObject({ ...callerShape(BasketballOnePointEventSchema.shape), ...sportEventId }),\n z.strictObject({ ...callerShape(BasketballAssistableShotEventSchema.shape), ...sportEventId }),\n z.strictObject({ ...callerShape(BasketballPlayerTallyEventSchema.shape), ...sportEventId }),\n z.strictObject({ ...callerShape(BasketballTimeoutEventSchema.shape), ...sportEventId }),\n z.strictObject({\n ...callerShape(BasketballBulkEditEventSchema.shape),\n ...sportEventId,\n previousValue: countSchema,\n }),\n z.strictObject({ ...callerShape(CurlingRoundScoreEventSchema.shape), ...sportEventId }),\n z.strictObject({ ...callerShape(CurlingBlankEndEventSchema.shape), ...sportEventId }),\n z.strictObject({ ...callerShape(FootballScoreEventSchema.shape), ...sportEventId }),\n z.strictObject({ ...callerShape(FootballBulkEditEventSchema.shape), ...sportEventId }),\n z.strictObject({\n ...callerShape(StatVoidEventSchema.shape, ['eventId']),\n targetEventId: sportStatEventIdSchema,\n }),\n z.strictObject(callerShape(StatCorrectionEventSchema.shape)),\n]);\nexport type StatEventSubmission = z.infer<typeof StatEventSubmissionSchema>;\n\n// A queue drain, a bulk-entry submission, or an undo: one ordered batch, applied whole or not at all.\nexport const RecordGameStatEventsInputSchema = z\n .object({\n gameId: gameIdSchema,\n events: z.array(StatEventSubmissionSchema).min(1).max(MAX_STAT_EVENTS_PER_WRITE),\n })\n .strict();\nexport type RecordGameStatEventsInput = z.infer<typeof RecordGameStatEventsInputSchema>;\n\n// Each event sent, in order: stored now, or found already stored by an earlier send.\nexport const RecordedStatEventSchema = z\n .object({\n eventId: statEventIdSchema,\n outcome: z.enum(RECORDED_STAT_EVENT_OUTCOME_KEYS),\n sequence: z.number().int().positive(),\n })\n .strict();\nexport type RecordedStatEvent = z.infer<typeof RecordedStatEventSchema>;\n\nexport const RecordGameStatEventsResultSchema = z\n .object({\n gameId: gameIdSchema,\n events: z.array(RecordedStatEventSchema),\n })\n .strict();\nexport type RecordGameStatEventsResult = z.infer<typeof RecordGameStatEventsResultSchema>;\n\n// What a refused scoring write names in its error details: why, and the first event it refused. No\n// event of the batch was stored, and the scorekeeper's failed list shows the refusal's copy beside\n// that event.\nexport const StatEventRefusalDetailsSchema = z\n .object({\n refusal: z.enum(STAT_EVENT_REFUSAL_KEYS),\n eventId: statEventIdSchema,\n })\n .strict();\nexport type StatEventRefusalDetails = z.infer<typeof StatEventRefusalDetailsSchema>;\n\n// ---------------------------------------------------------------------------------------------\n// Absence — per roster entry, so a person on both teams can be absent on one side only\n// ---------------------------------------------------------------------------------------------\n\nexport const UpdateGameAbsentPlayersInputSchema = z\n .object({\n gameId: gameIdSchema,\n gameRosterPlayerId: gameRosterPlayerIdSchema,\n absent: z.boolean(),\n })\n .strict();\nexport type UpdateGameAbsentPlayersInput = z.infer<typeof UpdateGameAbsentPlayersInputSchema>;\n\n// `changed` is false when the entry was already marked that way; nothing was written.\nexport const UpdateGameAbsentPlayersResultSchema = z\n .object({\n gameId: gameIdSchema,\n gameRosterPlayerId: gameRosterPlayerIdSchema,\n absent: z.boolean(),\n changed: z.boolean(),\n })\n .strict();\nexport type UpdateGameAbsentPlayersResult = z.infer<typeof UpdateGameAbsentPlayersResultSchema>;\n\n// ---------------------------------------------------------------------------------------------\n// The memo — a scorer's note on one person in a live game (\"red shirt\", \"#9\")\n// ---------------------------------------------------------------------------------------------\n\n// Built from the memo's one declaration, so the memo form and the callable accept exactly the same\n// text: trimmed, one line, empty allowed — an empty memo clears the person's note.\nexport const gameMemoSchema = textFieldSchema(GAME_MEMO_INPUT_FORMAT);\n\nexport const UpdateGameMemoInputSchema = z\n .object({\n gameId: gameIdSchema,\n userId: userIdSchema,\n memo: gameMemoSchema,\n })\n .strict();\nexport type UpdateGameMemoInput = z.infer<typeof UpdateGameMemoInputSchema>;\n\nexport const UpdateGameMemoResultSchema = z\n .object({\n gameId: gameIdSchema,\n userId: userIdSchema,\n memo: z.string(),\n changed: z.boolean(),\n })\n .strict();\nexport type UpdateGameMemoResult = z.infer<typeof UpdateGameMemoResultSchema>;\n\n// ---------------------------------------------------------------------------------------------\n// The jump-ball possession arrow — set to a team, so a retried call lands where the first did\n// ---------------------------------------------------------------------------------------------\n\nexport const UpdateGameJumpBallInputSchema = z\n .object({\n gameId: gameIdSchema,\n teamId: teamIdSchema,\n })\n .strict();\nexport type UpdateGameJumpBallInput = z.infer<typeof UpdateGameJumpBallInputSchema>;\n\nexport const UpdateGameJumpBallResultSchema = z\n .object({\n gameId: gameIdSchema,\n teamId: teamIdSchema,\n changed: z.boolean(),\n })\n .strict();\nexport type UpdateGameJumpBallResult = z.infer<typeof UpdateGameJumpBallResultSchema>;\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Callable contracts for signing a league's waiver and reading the result. The signer is always
|
|
2
2
|
// `request.auth.uid`. A signature image arrives only as the staging path the signer uploaded it to;
|
|
3
3
|
// the server rebuilds that path from the signer's own uid and derives where the image is kept from
|
|
4
|
-
// the records, never from the payload (MEDIA-002).
|
|
4
|
+
// the records, never from the payload (RULE-STD-MEDIA-002).
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { epochMsSchema, leagueIdSchema, teamIdSchema, userIdSchema, waiverWitnessAuthoritySchema, } from '../doc-schemas/atoms.js';
|
|
7
7
|
import { waiverTemplateIdSchema, waiverTemplateVersionNumberSchema, } from '../doc-schemas/waiver-template.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signed-waivers.js","sourceRoot":"","sources":["../../src/schemas/signed-waivers.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,oGAAoG;AACpG,mGAAmG;AACnG,
|
|
1
|
+
{"version":3,"file":"signed-waivers.js","sourceRoot":"","sources":["../../src/schemas/signed-waivers.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,oGAAoG;AACpG,mGAAmG;AACnG,4DAA4D;AAE5D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,aAAa,EACb,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,4BAA4B,GAC7B,MAAM,yBAAyB,CAAC;AACjC,O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MAAM,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAKlG,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC;KAC1C,MAAM,CAAC;IACN,MAAM,EAAE,YAAY;IACpB,wCAAwC;IACxC,QAAQ,EAAE,aAAa,CAAC,QAAQ,EAAE;IAClC,uFAAuF;IACvF,aAAa,EAAE,YAAY,CAAC,QAAQ,EAAE;IACtC,gBAAgB,EAAE,4BAA4B,CAAC,QAAQ,EAAE;CAC1D,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,MAAM,CAAC,MAAM,uCAAuC,GAAG,CAAC;KACrD,MAAM,CAAC;IACN,QAAQ,EAAE,cAAc;IACxB,MAAM,EAAE,YAAY;IACpB,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE;IAC3B,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,4BAA4B,CAAC;CAChD,CAAC;KACD,MAAM,EAAE,CAAC;AAKZ,mGAAmG;AACnG,gGAAgG;AAChG,8CAA8C;AAC9C,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC;KAC5C,MAAM,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,CAAC,QAAQ,EAAE,EAAE,CAAC;KAC3F,MAAM,EAAE,CAAC;AAGZ,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC;KACvC,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;KAClE,MAAM,EAAE,CAAC","sourcesContent":["// Callable contracts for signing a league's waiver and reading the result. The signer is always\n// `request.auth.uid`. A signature image arrives only as the staging path the signer uploaded it to;\n// the server rebuilds that path from the signer's own uid and derives where the image is kept from\n// the records, never from the payload (RULE-STD-MEDIA-002).\n\nimport { z } from 'zod';\nimport {\n epochMsSchema,\n leagueIdSchema,\n teamIdSchema,\n userIdSchema,\n waiverWitnessAuthoritySchema,\n} from '../doc-schemas/atoms.js';\nimport {\n waiverTemplateIdSchema,\n waiverTemplateVersionNumberSchema,\n} from '../doc-schemas/waiver-template.js';\nimport { stagingUploadPathSchema } from './uploads.js';\n\n// Signing for a ghost: the ghost, and the team whose membership makes the signer its witness.\nexport const ghostWaiverSubjectSchema = z\n .object({ ghostUserId: userIdSchema, teamId: teamIdSchema })\n .strict();\n\n// The wording the signer saw: the template id and version the signing dialog displayed. A signature\n// records exactly that wording, so the core refuses one whose id or version is no longer the league's\n// (`waiverChanged`), and the dialog loads the current wording to read again.\nconst displayedWaiverFields = {\n waiverTemplateId: waiverTemplateIdSchema,\n waiverTemplateVersion: waiverTemplateVersionNumberSchema,\n};\n\n// `createSignedWaiver` — the member entry: a player signs their own waiver, or the ghost's team's\n// captain or co-captain signs a ghost's. `storagePath` is the full staging path the signer uploaded\n// to, under the one name every accepting callable takes it by; only its last segment, the staging\n// id, is taken from it.\nexport const CreateSignedWaiverInputSchema = z\n .object({\n leagueId: leagueIdSchema,\n ...displayedWaiverFields,\n storagePath: stagingUploadPathSchema,\n ghost: ghostWaiverSubjectSchema.optional(),\n })\n .strict();\nexport type CreateSignedWaiverInput = z.infer<typeof CreateSignedWaiverInputSchema>;\n\n// `adminCreateSignedWaiver` — the admin entry: an admin or a referee signs a ghost's waiver.\nexport const AdminCreateSignedWaiverInputSchema = z\n .object({\n leagueId: leagueIdSchema,\n ...displayedWaiverFields,\n storagePath: stagingUploadPathSchema,\n ghost: ghostWaiverSubjectSchema,\n })\n .strict();\nexport type AdminCreateSignedWaiverInput = z.infer<typeof AdminCreateSignedWaiverInputSchema>;\n\n// `alreadySigned` is true when the call found the waiver already recorded with this very signature —\n// a retry of a signing that committed — and wrote nothing.\nexport const CreateSignedWaiverResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n userId: userIdSchema,\n signedAt: epochMsSchema,\n alreadySigned: z.boolean(),\n })\n .strict();\nexport type CreateSignedWaiverResult = z.infer<typeof CreateSignedWaiverResultSchema>;\n\n// `getLeagueTeamWaiverStatuses` — a team's captain or co-captain reads whether each member of the\n// team has signed the league's waiver. Admins and referees read the records directly.\nexport const GetLeagueTeamWaiverStatusesInputSchema = z.object({ teamId: teamIdSchema }).strict();\nexport type GetLeagueTeamWaiverStatusesInput = z.infer<\n typeof GetLeagueTeamWaiverStatusesInputSchema\n>;\n\nexport const leagueTeamWaiverStatusSchema = z\n .object({\n userId: userIdSchema,\n // Null while the member has not signed.\n signedAt: epochMsSchema.nullable(),\n // Present on a ghost's waiver: who signed it for the ghost, and under which authority.\n witnessUserId: userIdSchema.nullable(),\n witnessAuthority: waiverWitnessAuthoritySchema.nullable(),\n })\n .strict();\nexport type LeagueTeamWaiverStatus = z.infer<typeof leagueTeamWaiverStatusSchema>;\n\nexport const GetLeagueTeamWaiverStatusesResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n requiresWaiver: z.boolean(),\n statuses: z.array(leagueTeamWaiverStatusSchema),\n })\n .strict();\nexport type GetLeagueTeamWaiverStatusesResult = z.infer<\n typeof GetLeagueTeamWaiverStatusesResultSchema\n>;\n\n// `getSignedWaiverFile` — the kept signature image, for its audience only. A captain or co-captain\n// names `teamId`, the team they manage, because a player may be on two teams in one league; the\n// subject, an admin, and a referee need none.\nexport const GetSignedWaiverFileInputSchema = z\n .object({ leagueId: leagueIdSchema, userId: userIdSchema, teamId: teamIdSchema.optional() })\n .strict();\nexport type GetSignedWaiverFileInput = z.infer<typeof GetSignedWaiverFileInputSchema>;\n\nexport const SignatureFileResultSchema = z\n .object({ contentType: z.string().min(1), dataBase64: z.string() })\n .strict();\nexport type SignatureFileResult = z.infer<typeof SignatureFileResultSchema>;\n"]}
|