@ttt-productions/q-core 0.1.49 → 0.1.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants/business.d.ts +3 -4
- package/dist/constants/business.d.ts.map +1 -1
- package/dist/constants/business.js +3 -4
- package/dist/constants/business.js.map +1 -1
- package/dist/constants/sports.d.ts +0 -13
- package/dist/constants/sports.d.ts.map +1 -1
- package/dist/constants/sports.js +0 -13
- package/dist/constants/sports.js.map +1 -1
- package/dist/constants/text-fields.d.ts +0 -6
- package/dist/constants/text-fields.d.ts.map +1 -1
- package/dist/constants/text-fields.js +0 -6
- package/dist/constants/text-fields.js.map +1 -1
- package/dist/doc-schemas/admin-notifications.d.ts +1 -1
- package/dist/doc-schemas/atoms.d.ts.map +1 -1
- package/dist/doc-schemas/atoms.js +1 -1
- package/dist/doc-schemas/atoms.js.map +1 -1
- package/dist/doc-schemas/audit-event.d.ts +4 -8
- package/dist/doc-schemas/audit-event.d.ts.map +1 -1
- package/dist/doc-schemas/game-stat-history.d.ts +0 -1
- package/dist/doc-schemas/game-stat-history.d.ts.map +1 -1
- package/dist/doc-schemas/game-stats.d.ts +0 -2
- package/dist/doc-schemas/game-stats.d.ts.map +1 -1
- package/dist/doc-schemas/game-stats.js +1 -2
- package/dist/doc-schemas/game-stats.js.map +1 -1
- package/dist/doc-schemas/index.d.ts +2 -2
- package/dist/doc-schemas/index.d.ts.map +1 -1
- package/dist/doc-schemas/index.js +2 -2
- package/dist/doc-schemas/index.js.map +1 -1
- package/dist/doc-schemas/migration-console.d.ts +6 -20
- package/dist/doc-schemas/migration-console.d.ts.map +1 -1
- package/dist/doc-schemas/migration-console.js +2 -7
- package/dist/doc-schemas/migration-console.js.map +1 -1
- package/dist/doc-schemas/pending-media.d.ts +35 -55
- package/dist/doc-schemas/pending-media.d.ts.map +1 -1
- package/dist/doc-schemas/registry.d.ts +49 -229
- package/dist/doc-schemas/registry.d.ts.map +1 -1
- package/dist/doc-schemas/registry.js +3 -7
- package/dist/doc-schemas/registry.js.map +1 -1
- package/dist/doc-schemas/stats-changes.d.ts +21 -0
- package/dist/doc-schemas/stats-changes.d.ts.map +1 -0
- package/dist/doc-schemas/stats-changes.js +19 -0
- package/dist/doc-schemas/stats-changes.js.map +1 -0
- package/dist/doc-schemas/stats-job.d.ts +36 -0
- package/dist/doc-schemas/stats-job.d.ts.map +1 -0
- package/dist/doc-schemas/stats-job.js +26 -0
- package/dist/doc-schemas/stats-job.js.map +1 -0
- package/dist/doc-schemas/system.d.ts +1 -1
- package/dist/doc-schemas/system.d.ts.map +1 -1
- package/dist/doc-schemas/system.js +2 -2
- package/dist/doc-schemas/system.js.map +1 -1
- package/dist/domain-events/domain-events.d.ts +16 -24
- package/dist/domain-events/domain-events.d.ts.map +1 -1
- package/dist/domain-events/domain-events.js +11 -11
- package/dist/domain-events/domain-events.js.map +1 -1
- package/dist/ids/index.d.ts +2 -1
- package/dist/ids/index.d.ts.map +1 -1
- package/dist/ids/index.js +2 -1
- package/dist/ids/index.js.map +1 -1
- package/dist/ids/notification-ids.d.ts +2 -4
- package/dist/ids/notification-ids.d.ts.map +1 -1
- package/dist/ids/notification-ids.js +3 -12
- package/dist/ids/notification-ids.js.map +1 -1
- package/dist/ids/request-job-ids.d.ts +7 -0
- package/dist/ids/request-job-ids.d.ts.map +1 -0
- package/dist/ids/request-job-ids.js +18 -0
- package/dist/ids/request-job-ids.js.map +1 -0
- package/dist/ids/stats-ids.d.ts +7 -0
- package/dist/ids/stats-ids.d.ts.map +1 -0
- package/dist/ids/stats-ids.js +17 -0
- package/dist/ids/stats-ids.js.map +1 -0
- package/dist/migration-console/action-ids.d.ts +1 -3
- package/dist/migration-console/action-ids.d.ts.map +1 -1
- package/dist/migration-console/action-ids.js +1 -3
- package/dist/migration-console/action-ids.js.map +1 -1
- package/dist/migration-console/manifest.d.ts +1 -2
- package/dist/migration-console/manifest.d.ts.map +1 -1
- package/dist/migration-console/manifest.js +12 -43
- package/dist/migration-console/manifest.js.map +1 -1
- package/dist/paths/collection-groups.d.ts +0 -1
- package/dist/paths/collection-groups.d.ts.map +1 -1
- package/dist/paths/collection-groups.js +1 -2
- package/dist/paths/collection-groups.js.map +1 -1
- package/dist/paths/collection-refs.d.ts +1 -2
- package/dist/paths/collection-refs.d.ts.map +1 -1
- package/dist/paths/collection-refs.js +1 -2
- package/dist/paths/collection-refs.js.map +1 -1
- package/dist/paths/collections.d.ts +1 -5
- package/dist/paths/collections.d.ts.map +1 -1
- package/dist/paths/collections.js +1 -5
- package/dist/paths/collections.js.map +1 -1
- package/dist/paths/path-builders.d.ts +1 -4
- package/dist/paths/path-builders.d.ts.map +1 -1
- package/dist/paths/path-builders.js +2 -17
- package/dist/paths/path-builders.js.map +1 -1
- package/dist/schemas/admin-notifications.d.ts +1 -1
- package/dist/schemas/awards.d.ts +5 -75
- package/dist/schemas/awards.d.ts.map +1 -1
- package/dist/schemas/awards.js +6 -30
- package/dist/schemas/awards.js.map +1 -1
- package/dist/schemas/dead-letters.d.ts +7 -1
- package/dist/schemas/dead-letters.d.ts.map +1 -1
- package/dist/schemas/dead-letters.js +2 -1
- package/dist/schemas/dead-letters.js.map +1 -1
- package/dist/schemas/migration-console.d.ts +16 -57
- package/dist/schemas/migration-console.d.ts.map +1 -1
- package/dist/schemas/migration-console.js +3 -10
- package/dist/schemas/migration-console.js.map +1 -1
- package/dist/schemas/pictures.d.ts +21 -33
- package/dist/schemas/pictures.d.ts.map +1 -1
- package/dist/schemas/scoring.d.ts +6 -12
- package/dist/schemas/scoring.d.ts.map +1 -1
- package/dist/schemas/scoring.js +9 -5
- package/dist/schemas/scoring.js.map +1 -1
- package/dist/schemas/stats.d.ts +66 -101
- package/dist/schemas/stats.d.ts.map +1 -1
- package/dist/schemas/stats.js +39 -72
- package/dist/schemas/stats.js.map +1 -1
- package/dist/sports/basketball-scoring.d.ts.map +1 -1
- package/dist/sports/basketball-scoring.js +16 -7
- package/dist/sports/basketball-scoring.js.map +1 -1
- package/dist/sports/bulk-entry.d.ts +7 -2
- package/dist/sports/bulk-entry.d.ts.map +1 -1
- package/dist/sports/bulk-entry.js.map +1 -1
- package/dist/sports/football-scoring.d.ts.map +1 -1
- package/dist/sports/football-scoring.js +13 -10
- package/dist/sports/football-scoring.js.map +1 -1
- package/dist/sports/replay.d.ts.map +1 -1
- package/dist/sports/replay.js +16 -1
- package/dist/sports/replay.js.map +1 -1
- package/dist/sports/scoring.d.ts +18 -2
- package/dist/sports/scoring.d.ts.map +1 -1
- package/dist/sports/scoring.js.map +1 -1
- package/dist/sports/store-driver.d.ts +2 -1
- package/dist/sports/store-driver.d.ts.map +1 -1
- package/dist/sports/store-driver.js +30 -15
- package/dist/sports/store-driver.js.map +1 -1
- package/dist/types/audit.d.ts +1 -1
- package/dist/types/audit.d.ts.map +1 -1
- package/dist/types/audit.js +1 -3
- package/dist/types/audit.js.map +1 -1
- package/dist/types/schedules.d.ts +1 -1
- package/dist/types/schedules.d.ts.map +1 -1
- package/dist/types/schedules.js +1 -2
- package/dist/types/schedules.js.map +1 -1
- package/dist/types/stats.d.ts +13 -13
- package/dist/types/stats.d.ts.map +1 -1
- package/dist/types/stats.js +13 -33
- package/dist/types/stats.js.map +1 -1
- package/dist/types/unions.d.ts +0 -6
- package/dist/types/unions.d.ts.map +1 -1
- package/dist/types/unions.js +0 -3
- package/dist/types/unions.js.map +1 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +0 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/doc-schemas/award-group-grant.d.ts +0 -54
- package/dist/doc-schemas/award-group-grant.d.ts.map +0 -1
- package/dist/doc-schemas/award-group-grant.js +0 -55
- package/dist/doc-schemas/award-group-grant.js.map +0 -1
- package/dist/doc-schemas/stats-operation.d.ts +0 -348
- package/dist/doc-schemas/stats-operation.d.ts.map +0 -1
- package/dist/doc-schemas/stats-operation.js +0 -92
- package/dist/doc-schemas/stats-operation.js.map +0 -1
- package/dist/ids/award-grant-ids.d.ts +0 -9
- package/dist/ids/award-grant-ids.d.ts.map +0 -1
- package/dist/ids/award-grant-ids.js +0 -10
- package/dist/ids/award-grant-ids.js.map +0 -1
- package/dist/utils/stats-operation-request.d.ts +0 -20
- package/dist/utils/stats-operation-request.d.ts.map +0 -1
- package/dist/utils/stats-operation-request.js +0 -10
- package/dist/utils/stats-operation-request.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scoring.js","sourceRoot":"","sources":["../../src/schemas/scoring.ts"],"names":[],"mappings":"AAAA,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,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,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,YAAY,GACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGlD,MAAM,qBAAqB,GAAwB,IAAI,GAAG,CAAC;IACzD,GAAG,8BAA8B;IACjC,GAAG,8BAA8B;CAClC,CAAC,CAAC;AAEH,SAAS,WAAW,CAClB,KAAY,EACZ,UAA8B,EAAE;IAEhC,MAAM,OAAO,GAAG,IAAI,G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C,MAAM,mCAAmC,GAAG,CAAC;KACjD,MAAM,CAAC;IACN,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACrB,CAAC;KACD,MAAM,EAAE,CAAC","sourcesContent":["import { 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 } from '../constants/text-fields.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 userIdSchema,\n} from '../doc-schemas/atoms.js';\nimport { textFieldSchema } from './text-field.js';\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\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\nexport const sportStatEventIdSchema = statEventIdSchema.refine(\n isSportStatEventId,\n 'Not a stat event id.',\n);\n\nconst sportEventId = { eventId: sportStatEventIdSchema };\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\nexport const CreateGameStatEventInputSchema = z\n .object({\n gameId: gameIdSchema,\n events: z.array(StatEventSubmissionSchema).min(1).max(MAX_STAT_EVENTS_PER_WRITE),\n })\n .strict();\nexport type CreateGameStatEventInput = z.infer<typeof CreateGameStatEventInputSchema>;\n\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 CreateGameStatEventResultSchema = z\n .object({\n gameId: gameIdSchema,\n events: z.array(RecordedStatEventSchema),\n })\n .strict();\nexport type CreateGameStatEventResult = z.infer<typeof CreateGameStatEventResultSchema>;\n\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\nexport const UpdateSportGameAbsentPlayersInputSchema = z\n .object({\n gameId: gameIdSchema,\n gameRosterPlayerId: gameRosterPlayerIdSchema,\n absent: z.boolean(),\n })\n .strict();\nexport type UpdateSportGameAbsentPlayersInput = z.infer<\n typeof UpdateSportGameAbsentPlayersInputSchema\n>;\n\nexport const UpdateSportGameAbsentPlayersResultSchema = z\n .object({\n gameId: gameIdSchema,\n gameRosterPlayerId: gameRosterPlayerIdSchema,\n absent: z.boolean(),\n changed: z.boolean(),\n })\n .strict();\nexport type UpdateSportGameAbsentPlayersResult = z.infer<\n typeof UpdateSportGameAbsentPlayersResultSchema\n>;\n\nexport const gameMemoSchema = textFieldSchema(GAME_MEMO_INPUT);\n\nexport const UpdateSportGameMemoInputSchema = z\n .object({\n gameId: gameIdSchema,\n userId: userIdSchema,\n memo: gameMemoSchema,\n })\n .strict();\nexport type UpdateSportGameMemoInput = z.infer<typeof UpdateSportGameMemoInputSchema>;\n\nexport const UpdateSportGameMemoResultSchema = z\n .object({\n gameId: gameIdSchema,\n userId: userIdSchema,\n memo: z.string(),\n changed: z.boolean(),\n })\n .strict();\nexport type UpdateSportGameMemoResult = z.infer<typeof UpdateSportGameMemoResultSchema>;\n\nexport const UpdateSportGameJumpBallInputSchema = z\n .object({\n gameId: gameIdSchema,\n teamId: teamIdSchema,\n })\n .strict();\nexport type UpdateSportGameJumpBallInput = z.infer<typeof UpdateSportGameJumpBallInputSchema>;\n\nexport const UpdateSportGameJumpBallResultSchema = z\n .object({\n gameId: gameIdSchema,\n teamId: teamIdSchema,\n changed: z.boolean(),\n })\n .strict();\nexport type UpdateSportGameJumpBallResult = z.infer<typeof UpdateSportGameJumpBallResultSchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"scoring.js","sourceRoot":"","sources":["../../src/schemas/scoring.ts"],"names":[],"mappings":"AAAA,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,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,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,sBAAsB,EACtB,YAAY,EACZ,wBAAwB,EACxB,iBAAiB,EACjB,YAAY,EACZ,YAAY,GACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGlD,MAAM,qBAAqB,GAAwB,IAAI,GAAG,CAAC;IACzD,GAAG,8BAA8B;IACjC,GAAG,8BAA8B;CAClC,CAAC,CAAC;AAEH,SAAS,WAAW,CAClB,KAAY,EACZ,UAA8B,EAAE;IAEhC,MAAM,OAAO,GAAG,IAAI,GAAG,CAAc,CAAC,GAAG,qBAAqB,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC;IAC7E,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE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CAAC;KACD,MAAM,EAAE,CAAC","sourcesContent":["import { 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 } from '../constants/text-fields.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 enteredStatCountSchema,\n gameIdSchema,\n gameRosterPlayerIdSchema,\n statEventIdSchema,\n teamIdSchema,\n userIdSchema,\n} from '../doc-schemas/atoms.js';\nimport { textFieldSchema } from './text-field.js';\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\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\nexport const sportStatEventIdSchema = statEventIdSchema.refine(\n isSportStatEventId,\n 'Not a stat event id.',\n);\n\nconst sportEventId = { eventId: sportStatEventIdSchema };\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, ['value', 'previousValue']),\n ...sportEventId,\n target: enteredStatCountSchema,\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({\n ...callerShape(FootballBulkEditEventSchema.shape, ['value', 'previousValue']),\n ...sportEventId,\n target: enteredStatCountSchema,\n }),\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\nexport const CreateGameStatEventInputSchema = z\n .object({\n gameId: gameIdSchema,\n events: z.array(StatEventSubmissionSchema).min(1).max(MAX_STAT_EVENTS_PER_WRITE),\n })\n .strict();\nexport type CreateGameStatEventInput = z.infer<typeof CreateGameStatEventInputSchema>;\n\nexport const RecordedStatEventSchema = z\n .object({\n eventId: statEventIdSchema,\n outcome: z.enum(RECORDED_STAT_EVENT_OUTCOME_KEYS),\n sequence: countSchema,\n })\n .strict();\nexport type RecordedStatEvent = z.infer<typeof RecordedStatEventSchema>;\n\nexport const CreateGameStatEventResultSchema = z\n .object({\n gameId: gameIdSchema,\n events: z.array(RecordedStatEventSchema),\n })\n .strict();\nexport type CreateGameStatEventResult = z.infer<typeof CreateGameStatEventResultSchema>;\n\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\nexport const UpdateSportGameAbsentPlayersInputSchema = z\n .object({\n gameId: gameIdSchema,\n gameRosterPlayerId: gameRosterPlayerIdSchema,\n absent: z.boolean(),\n })\n .strict();\nexport type UpdateSportGameAbsentPlayersInput = z.infer<\n typeof UpdateSportGameAbsentPlayersInputSchema\n>;\n\nexport const UpdateSportGameAbsentPlayersResultSchema = z\n .object({\n gameId: gameIdSchema,\n gameRosterPlayerId: gameRosterPlayerIdSchema,\n absent: z.boolean(),\n changed: z.boolean(),\n })\n .strict();\nexport type UpdateSportGameAbsentPlayersResult = z.infer<\n typeof UpdateSportGameAbsentPlayersResultSchema\n>;\n\nexport const gameMemoSchema = textFieldSchema(GAME_MEMO_INPUT);\n\nexport const UpdateSportGameMemoInputSchema = z\n .object({\n gameId: gameIdSchema,\n userId: userIdSchema,\n memo: gameMemoSchema,\n })\n .strict();\nexport type UpdateSportGameMemoInput = z.infer<typeof UpdateSportGameMemoInputSchema>;\n\nexport const UpdateSportGameMemoResultSchema = z\n .object({\n gameId: gameIdSchema,\n userId: userIdSchema,\n memo: z.string(),\n changed: z.boolean(),\n })\n .strict();\nexport type UpdateSportGameMemoResult = z.infer<typeof UpdateSportGameMemoResultSchema>;\n\nexport const UpdateSportGameJumpBallInputSchema = z\n .object({\n gameId: gameIdSchema,\n teamId: teamIdSchema,\n })\n .strict();\nexport type UpdateSportGameJumpBallInput = z.infer<typeof UpdateSportGameJumpBallInputSchema>;\n\nexport const UpdateSportGameJumpBallResultSchema = z\n .object({\n gameId: gameIdSchema,\n teamId: teamIdSchema,\n changed: z.boolean(),\n })\n .strict();\nexport type UpdateSportGameJumpBallResult = z.infer<typeof UpdateSportGameJumpBallResultSchema>;\n"]}
|
package/dist/schemas/stats.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ export declare const UpdateSportGameFinalizeResultSchema: z.ZodObject<{
|
|
|
15
15
|
export type UpdateSportGameFinalizeResult = z.infer<typeof UpdateSportGameFinalizeResultSchema>;
|
|
16
16
|
export declare const AdminUpdateSportGameReopenInputSchema: z.ZodObject<{
|
|
17
17
|
gameId: z.ZodString;
|
|
18
|
-
reason: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
19
18
|
}, z.core.$strict>;
|
|
20
19
|
export type AdminUpdateSportGameReopenInput = z.infer<typeof AdminUpdateSportGameReopenInputSchema>;
|
|
21
20
|
export declare const AdminUpdateSportGameReopenResultSchema: z.ZodObject<{
|
|
@@ -31,7 +30,6 @@ export declare const AdminCreateGameRosterPlayerInputSchema: z.ZodObject<{
|
|
|
31
30
|
gameId: z.ZodString;
|
|
32
31
|
userId: z.ZodString;
|
|
33
32
|
teamId: z.ZodString;
|
|
34
|
-
reason: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
35
33
|
dryRun: z.ZodOptional<z.ZodBoolean>;
|
|
36
34
|
}, z.core.$strict>;
|
|
37
35
|
export type AdminCreateGameRosterPlayerInput = z.infer<typeof AdminCreateGameRosterPlayerInputSchema>;
|
|
@@ -47,58 +45,20 @@ export declare const AdminCreateGameRosterPlayerResultSchema: z.ZodObject<{
|
|
|
47
45
|
}, z.core.$strict>;
|
|
48
46
|
export type AdminCreateGameRosterPlayerResult = z.infer<typeof AdminCreateGameRosterPlayerResultSchema>;
|
|
49
47
|
export declare const AdminUpdateSportLeagueStatsRecalculateInputSchema: z.ZodObject<{
|
|
50
|
-
reason: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
51
48
|
operationId: z.ZodString;
|
|
52
49
|
dryRun: z.ZodBoolean;
|
|
53
|
-
resumeAfter: z.ZodOptional<z.ZodString>;
|
|
54
50
|
leagueId: z.ZodString;
|
|
55
51
|
}, z.core.$strict>;
|
|
56
52
|
export type AdminUpdateSportLeagueStatsRecalculateInput = z.infer<typeof AdminUpdateSportLeagueStatsRecalculateInputSchema>;
|
|
57
|
-
export declare const RecalculateAllLeagueStatsInputSchema: z.ZodObject<{
|
|
58
|
-
reason: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
59
|
-
operationId: z.ZodString;
|
|
60
|
-
dryRun: z.ZodBoolean;
|
|
61
|
-
resumeAfter: z.ZodOptional<z.ZodString>;
|
|
62
|
-
}, z.core.$strict>;
|
|
63
|
-
export type RecalculateAllLeagueStatsInput = z.infer<typeof RecalculateAllLeagueStatsInputSchema>;
|
|
64
53
|
export declare const AdminUpdateUserProfileStatsRecalculateInputSchema: z.ZodObject<{
|
|
65
|
-
reason: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
66
54
|
operationId: z.ZodString;
|
|
67
55
|
dryRun: z.ZodBoolean;
|
|
68
|
-
resumeAfter: z.ZodOptional<z.ZodString>;
|
|
69
56
|
userId: z.ZodString;
|
|
70
57
|
}, z.core.$strict>;
|
|
71
58
|
export type AdminUpdateUserProfileStatsRecalculateInput = z.infer<typeof AdminUpdateUserProfileStatsRecalculateInputSchema>;
|
|
72
|
-
export declare const RecalculateAllUserStatsInputSchema: z.ZodObject<{
|
|
73
|
-
reason: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
74
|
-
operationId: z.ZodString;
|
|
75
|
-
dryRun: z.ZodBoolean;
|
|
76
|
-
resumeAfter: z.ZodOptional<z.ZodString>;
|
|
77
|
-
}, z.core.$strict>;
|
|
78
|
-
export type RecalculateAllUserStatsInput = z.infer<typeof RecalculateAllUserStatsInputSchema>;
|
|
79
|
-
export declare const RecalculateHallOfFameInputSchema: z.ZodObject<{
|
|
80
|
-
reason: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
81
|
-
operationId: z.ZodString;
|
|
82
|
-
dryRun: z.ZodBoolean;
|
|
83
|
-
resumeAfter: z.ZodOptional<z.ZodString>;
|
|
84
|
-
sportKey: z.ZodEnum<{
|
|
85
|
-
basketball: "basketball";
|
|
86
|
-
curling: "curling";
|
|
87
|
-
football: "football";
|
|
88
|
-
}>;
|
|
89
|
-
userId: z.ZodOptional<z.ZodString>;
|
|
90
|
-
}, z.core.$strict>;
|
|
91
|
-
export type RecalculateHallOfFameInput = z.infer<typeof RecalculateHallOfFameInputSchema>;
|
|
92
59
|
export declare const StatsRebuildResultSchema: z.ZodObject<{
|
|
93
60
|
operationId: z.ZodString;
|
|
94
61
|
dryRun: z.ZodBoolean;
|
|
95
|
-
complete: z.ZodBoolean;
|
|
96
|
-
nextResumeAfter: z.ZodNullable<z.ZodString>;
|
|
97
|
-
counts: z.ZodObject<{
|
|
98
|
-
read: z.ZodNumber;
|
|
99
|
-
changed: z.ZodNumber;
|
|
100
|
-
skipped: z.ZodNumber;
|
|
101
|
-
}, z.core.$strip>;
|
|
102
62
|
changes: z.ZodArray<z.ZodObject<{
|
|
103
63
|
ref: z.ZodString;
|
|
104
64
|
field: z.ZodString;
|
|
@@ -106,61 +66,79 @@ export declare const StatsRebuildResultSchema: z.ZodObject<{
|
|
|
106
66
|
after: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
107
67
|
}, z.core.$strip>>;
|
|
108
68
|
changesTruncated: z.ZodBoolean;
|
|
109
|
-
scopeChanged: z.ZodBoolean;
|
|
110
69
|
}, z.core.$strict>;
|
|
111
70
|
export type StatsRebuildResult = z.infer<typeof StatsRebuildResultSchema>;
|
|
112
|
-
export declare const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
71
|
+
export declare const statsJobRequestIdSchema: z.ZodUUID;
|
|
72
|
+
export declare const statsJobIdSchema: z.ZodString;
|
|
73
|
+
export declare const AdminCreateStatsJobInputSchema: z.ZodObject<{
|
|
74
|
+
requestId: z.ZodUUID;
|
|
75
|
+
}, z.core.$strict>;
|
|
76
|
+
export type AdminCreateStatsJobInput = z.infer<typeof AdminCreateStatsJobInputSchema>;
|
|
77
|
+
export declare const AdminCreateStatsJobResultSchema: z.ZodObject<{
|
|
78
|
+
jobId: z.ZodString;
|
|
79
|
+
}, z.core.$strict>;
|
|
80
|
+
export type AdminCreateStatsJobResult = z.infer<typeof AdminCreateStatsJobResultSchema>;
|
|
81
|
+
export declare const AdminGetStatsJobInputSchema: z.ZodObject<{
|
|
82
|
+
kind: z.ZodEnum<{
|
|
83
|
+
rebuild: "rebuild";
|
|
84
|
+
check: "check";
|
|
121
85
|
}>;
|
|
122
|
-
value: z.ZodNumber;
|
|
123
86
|
}, z.core.$strict>;
|
|
124
|
-
export type
|
|
125
|
-
export declare const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
87
|
+
export type AdminGetStatsJobInput = z.infer<typeof AdminGetStatsJobInputSchema>;
|
|
88
|
+
export declare const StatsJobProgressSchema: z.ZodObject<{
|
|
89
|
+
jobId: z.ZodString;
|
|
90
|
+
kind: z.ZodEnum<{
|
|
91
|
+
rebuild: "rebuild";
|
|
92
|
+
check: "check";
|
|
93
|
+
}>;
|
|
94
|
+
state: z.ZodEnum<{
|
|
95
|
+
complete: "complete";
|
|
96
|
+
"in-progress": "in-progress";
|
|
97
|
+
failed: "failed";
|
|
98
|
+
}>;
|
|
99
|
+
stage: z.ZodEnum<{
|
|
100
|
+
hallOfFame: "hallOfFame";
|
|
101
|
+
games: "games";
|
|
102
|
+
leagues: "leagues";
|
|
103
|
+
people: "people";
|
|
104
|
+
}>;
|
|
105
|
+
stageDone: z.ZodNumber;
|
|
106
|
+
changed: z.ZodNumber;
|
|
107
|
+
deadLettered: z.ZodBoolean;
|
|
108
|
+
completedAt: z.ZodNullable<z.ZodNumber>;
|
|
109
|
+
}, z.core.$strict>;
|
|
110
|
+
export type StatsJobProgress = z.infer<typeof StatsJobProgressSchema>;
|
|
111
|
+
export declare const AdminGetStatsJobResultSchema: z.ZodObject<{
|
|
112
|
+
job: z.ZodNullable<z.ZodObject<{
|
|
113
|
+
jobId: z.ZodString;
|
|
114
|
+
kind: z.ZodEnum<{
|
|
115
|
+
rebuild: "rebuild";
|
|
116
|
+
check: "check";
|
|
136
117
|
}>;
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
118
|
+
state: z.ZodEnum<{
|
|
119
|
+
complete: "complete";
|
|
120
|
+
"in-progress": "in-progress";
|
|
121
|
+
failed: "failed";
|
|
122
|
+
}>;
|
|
123
|
+
stage: z.ZodEnum<{
|
|
124
|
+
hallOfFame: "hallOfFame";
|
|
125
|
+
games: "games";
|
|
126
|
+
leagues: "leagues";
|
|
127
|
+
people: "people";
|
|
128
|
+
}>;
|
|
129
|
+
stageDone: z.ZodNumber;
|
|
130
|
+
changed: z.ZodNumber;
|
|
131
|
+
deadLettered: z.ZodBoolean;
|
|
132
|
+
completedAt: z.ZodNullable<z.ZodNumber>;
|
|
133
|
+
}, z.core.$strict>>;
|
|
143
134
|
}, z.core.$strict>;
|
|
144
|
-
export type
|
|
135
|
+
export type AdminGetStatsJobResult = z.infer<typeof AdminGetStatsJobResultSchema>;
|
|
145
136
|
export declare const AdminUpdateSportGameStatsRecalculateInputSchema: z.ZodObject<{
|
|
146
|
-
gameId: z.ZodString;
|
|
147
|
-
reason: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
148
137
|
operationId: z.ZodString;
|
|
149
138
|
dryRun: z.ZodBoolean;
|
|
139
|
+
gameId: z.ZodString;
|
|
150
140
|
}, z.core.$strict>;
|
|
151
141
|
export type AdminUpdateSportGameStatsRecalculateInput = z.infer<typeof AdminUpdateSportGameStatsRecalculateInputSchema>;
|
|
152
|
-
export declare const GameStatsCorrectionSchema: z.ZodObject<{
|
|
153
|
-
lineKey: z.ZodString;
|
|
154
|
-
field: z.ZodEnum<{
|
|
155
|
-
score: "score";
|
|
156
|
-
timeouts: "timeouts";
|
|
157
|
-
points: "points";
|
|
158
|
-
rebounds: "rebounds";
|
|
159
|
-
assists: "assists";
|
|
160
|
-
}>;
|
|
161
|
-
value: z.ZodNumber;
|
|
162
|
-
}, z.core.$strict>;
|
|
163
|
-
export type GameStatsCorrection = z.infer<typeof GameStatsCorrectionSchema>;
|
|
164
142
|
export declare const GameRepairChangesSchema: z.ZodObject<{
|
|
165
143
|
lines: z.ZodArray<z.ZodObject<{
|
|
166
144
|
lineKey: z.ZodString;
|
|
@@ -200,21 +178,9 @@ export declare const GameStatsRepairResultSchema: z.ZodObject<{
|
|
|
200
178
|
operationId: z.ZodString;
|
|
201
179
|
dryRun: z.ZodBoolean;
|
|
202
180
|
outcome: z.ZodEnum<{
|
|
203
|
-
reconciled: "reconciled";
|
|
204
181
|
unchanged: "unchanged";
|
|
205
|
-
|
|
182
|
+
reconciled: "reconciled";
|
|
206
183
|
}>;
|
|
207
|
-
corrections: z.ZodArray<z.ZodObject<{
|
|
208
|
-
lineKey: z.ZodString;
|
|
209
|
-
field: z.ZodEnum<{
|
|
210
|
-
score: "score";
|
|
211
|
-
timeouts: "timeouts";
|
|
212
|
-
points: "points";
|
|
213
|
-
rebounds: "rebounds";
|
|
214
|
-
assists: "assists";
|
|
215
|
-
}>;
|
|
216
|
-
value: z.ZodNumber;
|
|
217
|
-
}, z.core.$strict>>;
|
|
218
184
|
gameChanged: z.ZodBoolean;
|
|
219
185
|
gameChanges: z.ZodObject<{
|
|
220
186
|
lines: z.ZodArray<z.ZodObject<{
|
|
@@ -269,7 +235,6 @@ export declare const AdminUpdateHistoricalStatInputSchema: z.ZodObject<{
|
|
|
269
235
|
assists: z.ZodNumber;
|
|
270
236
|
gamesPlayed: z.ZodNumber;
|
|
271
237
|
}, z.core.$strict>;
|
|
272
|
-
reason: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
273
238
|
operationId: z.ZodString;
|
|
274
239
|
dryRun: z.ZodBoolean;
|
|
275
240
|
}, z.core.$strict>;
|
|
@@ -284,9 +249,8 @@ export declare const AdminUpdateHistoricalStatResultSchema: z.ZodObject<{
|
|
|
284
249
|
operationId: z.ZodString;
|
|
285
250
|
dryRun: z.ZodBoolean;
|
|
286
251
|
outcome: z.ZodEnum<{
|
|
287
|
-
reconciled: "reconciled";
|
|
288
252
|
unchanged: "unchanged";
|
|
289
|
-
|
|
253
|
+
reconciled: "reconciled";
|
|
290
254
|
}>;
|
|
291
255
|
baselineBefore: z.ZodNullable<z.ZodObject<{
|
|
292
256
|
points: z.ZodNumber;
|
|
@@ -303,15 +267,16 @@ export declare const AdminUpdateHistoricalStatResultSchema: z.ZodObject<{
|
|
|
303
267
|
}, z.core.$strict>;
|
|
304
268
|
export type AdminUpdateHistoricalStatResult = z.infer<typeof AdminUpdateHistoricalStatResultSchema>;
|
|
305
269
|
export declare const AdminCreateStatsValidationReportInputSchema: z.ZodObject<{
|
|
306
|
-
operationId: z.ZodString;
|
|
307
270
|
scope: z.ZodObject<{
|
|
308
271
|
gameId: z.ZodOptional<z.ZodString>;
|
|
309
272
|
leagueId: z.ZodOptional<z.ZodString>;
|
|
310
273
|
}, z.core.$strict>;
|
|
274
|
+
requestId: z.ZodOptional<z.ZodUUID>;
|
|
311
275
|
}, z.core.$strict>;
|
|
312
276
|
export type AdminCreateStatsValidationReportInput = z.infer<typeof AdminCreateStatsValidationReportInputSchema>;
|
|
313
277
|
export declare const AdminCreateStatsValidationReportResultSchema: z.ZodObject<{
|
|
314
278
|
reportId: z.ZodString;
|
|
279
|
+
jobId: z.ZodOptional<z.ZodString>;
|
|
315
280
|
complete: z.ZodBoolean;
|
|
316
281
|
summary: z.ZodObject<{
|
|
317
282
|
totalGamesChecked: z.ZodNumber;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../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B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAW7B,CAAC;AACZ,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAWhF,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;kBAQtC,CAAC;AACZ,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC;AAElG,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;kBAUvC,CAAC;AACZ,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qCAAqC,CAAC,CAAC;AAEpG,eAAO,MAAM,2CAA2C;;;;;;kBAWrD,CAAC;AACJ,MAAM,MAAM,qCAAqC,GAAG,CAAC,CAAC,KAAK,CACzD,OAAO,2CAA2C,CACnD,CAAC;AAEF,eAAO,MAAM,4CAA4C;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAQ9C,CAAC;AACZ,MAAM,MAAM,sCAAsC,GAAG,CAAC,CAAC,KAAK,CAC1D,OAAO,4CAA4C,CACpD,CAAC;AAEF,eAAO,MAAM,2CAA2C;;kBAE7C,CAAC;AACZ,MAAM,MAAM,qCAAqC,GAAG,CAAC,CAAC,KAAK,CACzD,OAAO,2CAA2C,CACnD,CAAC;AAEF,eAAO,MAAM,4CAA4C;;kBAE9C,CAAC;AACZ,MAAM,MAAM,sCAAsC,GAAG,CAAC,CAAC,KAAK,CAC1D,OAAO,4CAA4C,CACpD,CAAC"}
|
package/dist/schemas/stats.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { CURLING_ROUND_COUNT, MAX_CURLING_ROUND_POINTS
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { CURLING_ROUND_COUNT, MAX_CURLING_ROUND_POINTS } from '../constants/sports.js';
|
|
3
|
+
import { parseStatsJobId } from '../ids/stats-ids.js';
|
|
4
|
+
import { countSchema, enteredStatCountSchema, epochMsSchema, gameIdSchema, gameRosterPlayerIdSchema, leagueIdSchema, sportKeySchema, statsOperationIdSchema, statsValidationReportIdSchema, teamIdSchema, userIdSchema, } from '../doc-schemas/atoms.js';
|
|
5
|
+
import { StatsDestinationChangeSchema } from '../doc-schemas/stats-changes.js';
|
|
5
6
|
import { StatsValidationReportSchema, StatsValidationScopeSchema, StatsValidationSummarySchema, } from '../doc-schemas/system.js';
|
|
6
7
|
import { HISTORICAL_STAT_KEYS, HistoricalStatsSchema, } from '../doc-schemas/user-profile.js';
|
|
7
|
-
import { GAME_FINALIZE_OUTCOME_KEYS, GAME_REOPEN_OUTCOME_KEYS, GAME_STATS_REPAIR_OUTCOME_KEYS, UNROSTERED_STAT_LINE_RESOLUTION_OUTCOME_KEYS, } from '../types/stats.js';
|
|
8
|
+
import { GAME_FINALIZE_OUTCOME_KEYS, GAME_REOPEN_OUTCOME_KEYS, GAME_STATS_REPAIR_OUTCOME_KEYS, STATS_JOB_KIND_KEYS, STATS_JOB_STAGE_KEYS, STATS_JOB_STATE_KEYS, UNROSTERED_STAT_LINE_RESOLUTION_OUTCOME_KEYS, } from '../types/stats.js';
|
|
8
9
|
export const UpdateSportGameFinalizeInputSchema = z.object({ gameId: gameIdSchema }).strict();
|
|
9
10
|
export const UpdateSportGameFinalizeResultSchema = z
|
|
10
11
|
.object({
|
|
@@ -14,9 +15,7 @@ export const UpdateSportGameFinalizeResultSchema = z
|
|
|
14
15
|
nonScoringRosterPlayerIds: z.array(gameRosterPlayerIdSchema),
|
|
15
16
|
})
|
|
16
17
|
.strict();
|
|
17
|
-
export const AdminUpdateSportGameReopenInputSchema = z
|
|
18
|
-
.object({ gameId: gameIdSchema, reason: repairReasonSchema })
|
|
19
|
-
.strict();
|
|
18
|
+
export const AdminUpdateSportGameReopenInputSchema = z.object({ gameId: gameIdSchema }).strict();
|
|
20
19
|
export const AdminUpdateSportGameReopenResultSchema = z
|
|
21
20
|
.object({
|
|
22
21
|
gameId: gameIdSchema,
|
|
@@ -29,7 +28,6 @@ export const AdminCreateGameRosterPlayerInputSchema = z
|
|
|
29
28
|
gameId: gameIdSchema,
|
|
30
29
|
userId: userIdSchema,
|
|
31
30
|
teamId: teamIdSchema,
|
|
32
|
-
reason: repairReasonSchema,
|
|
33
31
|
dryRun: z.boolean().optional(),
|
|
34
32
|
})
|
|
35
33
|
.strict();
|
|
@@ -43,84 +41,49 @@ export const AdminCreateGameRosterPlayerResultSchema = z
|
|
|
43
41
|
})
|
|
44
42
|
.strict();
|
|
45
43
|
const statsRepairFields = {
|
|
46
|
-
reason: repairReasonSchema,
|
|
47
44
|
operationId: statsOperationIdSchema,
|
|
48
45
|
dryRun: z.boolean(),
|
|
49
|
-
resumeAfter: z.string().min(1).optional(),
|
|
50
|
-
};
|
|
51
|
-
const cursorOnlyOnDryRun = (input) => input.dryRun || input.resumeAfter === undefined;
|
|
52
|
-
const CURSOR_ONLY_ON_DRY_RUN = {
|
|
53
|
-
message: 'A real run resumes from its operation; only a dry run takes a cursor.',
|
|
54
|
-
path: ['resumeAfter'],
|
|
55
46
|
};
|
|
56
47
|
export const AdminUpdateSportLeagueStatsRecalculateInputSchema = z
|
|
57
48
|
.object({ leagueId: leagueIdSchema, ...statsRepairFields })
|
|
58
|
-
.strict()
|
|
59
|
-
.refine(cursorOnlyOnDryRun, CURSOR_ONLY_ON_DRY_RUN);
|
|
60
|
-
export const RecalculateAllLeagueStatsInputSchema = z
|
|
61
|
-
.object({ ...statsRepairFields })
|
|
62
|
-
.strict()
|
|
63
|
-
.refine(cursorOnlyOnDryRun, CURSOR_ONLY_ON_DRY_RUN);
|
|
49
|
+
.strict();
|
|
64
50
|
export const AdminUpdateUserProfileStatsRecalculateInputSchema = z
|
|
65
51
|
.object({ userId: userIdSchema, ...statsRepairFields })
|
|
66
|
-
.strict()
|
|
67
|
-
.refine(cursorOnlyOnDryRun, CURSOR_ONLY_ON_DRY_RUN);
|
|
68
|
-
export const RecalculateAllUserStatsInputSchema = z
|
|
69
|
-
.object({ ...statsRepairFields })
|
|
70
|
-
.strict()
|
|
71
|
-
.refine(cursorOnlyOnDryRun, CURSOR_ONLY_ON_DRY_RUN);
|
|
72
|
-
export const RecalculateHallOfFameInputSchema = z
|
|
73
|
-
.object({ sportKey: sportKeySchema, userId: userIdSchema.optional(), ...statsRepairFields })
|
|
74
|
-
.strict()
|
|
75
|
-
.refine(cursorOnlyOnDryRun, CURSOR_ONLY_ON_DRY_RUN);
|
|
52
|
+
.strict();
|
|
76
53
|
export const StatsRebuildResultSchema = z
|
|
77
54
|
.object({
|
|
78
55
|
operationId: statsOperationIdSchema,
|
|
79
56
|
dryRun: z.boolean(),
|
|
80
|
-
complete: z.boolean(),
|
|
81
|
-
nextResumeAfter: z.string().min(1).nullable(),
|
|
82
|
-
counts: StatsOperationCountsSchema,
|
|
83
57
|
changes: z.array(StatsDestinationChangeSchema),
|
|
84
58
|
changesTruncated: z.boolean(),
|
|
85
|
-
scopeChanged: z.boolean(),
|
|
86
59
|
})
|
|
87
60
|
.strict();
|
|
88
|
-
export const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
})
|
|
61
|
+
export const statsJobRequestIdSchema = z.uuid();
|
|
62
|
+
export const statsJobIdSchema = z
|
|
63
|
+
.string()
|
|
64
|
+
.refine((id) => parseStatsJobId(id) !== null, 'Not a stats job id.');
|
|
65
|
+
export const AdminCreateStatsJobInputSchema = z
|
|
66
|
+
.object({ requestId: statsJobRequestIdSchema })
|
|
95
67
|
.strict();
|
|
96
|
-
export const
|
|
68
|
+
export const AdminCreateStatsJobResultSchema = z.object({ jobId: statsJobIdSchema }).strict();
|
|
69
|
+
export const AdminGetStatsJobInputSchema = z.object({ kind: z.enum(STATS_JOB_KIND_KEYS) }).strict();
|
|
70
|
+
export const StatsJobProgressSchema = z
|
|
97
71
|
.object({
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
operationId: statsOperationIdSchema,
|
|
107
|
-
dryRun: z.boolean(),
|
|
108
|
-
})
|
|
109
|
-
.strict()
|
|
110
|
-
.refine((input) => (input.targets === undefined) !== (input.keepStored === undefined), {
|
|
111
|
-
message: 'Give the values to set, or keep the stored numbers — one of the two.',
|
|
112
|
-
path: ['targets'],
|
|
113
|
-
});
|
|
114
|
-
export const AdminUpdateSportGameStatsRecalculateInputSchema = z
|
|
115
|
-
.object({
|
|
116
|
-
gameId: gameIdSchema,
|
|
117
|
-
reason: repairReasonSchema,
|
|
118
|
-
operationId: statsOperationIdSchema,
|
|
119
|
-
dryRun: z.boolean(),
|
|
72
|
+
jobId: statsJobIdSchema,
|
|
73
|
+
kind: z.enum(STATS_JOB_KIND_KEYS),
|
|
74
|
+
state: z.enum(STATS_JOB_STATE_KEYS),
|
|
75
|
+
stage: z.enum(STATS_JOB_STAGE_KEYS),
|
|
76
|
+
stageDone: countSchema,
|
|
77
|
+
changed: countSchema,
|
|
78
|
+
deadLettered: z.boolean(),
|
|
79
|
+
completedAt: epochMsSchema.nullable(),
|
|
120
80
|
})
|
|
121
81
|
.strict();
|
|
122
|
-
export const
|
|
123
|
-
.object({
|
|
82
|
+
export const AdminGetStatsJobResultSchema = z
|
|
83
|
+
.object({ job: StatsJobProgressSchema.nullable() })
|
|
84
|
+
.strict();
|
|
85
|
+
export const AdminUpdateSportGameStatsRecalculateInputSchema = z
|
|
86
|
+
.object({ gameId: gameIdSchema, ...statsRepairFields })
|
|
124
87
|
.strict();
|
|
125
88
|
const roundSlotValueSchema = z.number().int().min(0).max(MAX_CURLING_ROUND_POINTS).nullable();
|
|
126
89
|
// Two team lines of a game, each holding its sport's fixed round slots.
|
|
@@ -169,7 +132,6 @@ export const GameStatsRepairResultSchema = z
|
|
|
169
132
|
operationId: statsOperationIdSchema,
|
|
170
133
|
dryRun: z.boolean(),
|
|
171
134
|
outcome: z.enum(GAME_STATS_REPAIR_OUTCOME_KEYS),
|
|
172
|
-
corrections: z.array(GameStatsCorrectionSchema),
|
|
173
135
|
gameChanged: z.boolean(),
|
|
174
136
|
gameChanges: GameRepairChangesSchema,
|
|
175
137
|
destinationChanges: z.array(StatsDestinationChangeSchema),
|
|
@@ -183,7 +145,6 @@ export const AdminUpdateHistoricalStatInputSchema = z
|
|
|
183
145
|
userId: userIdSchema,
|
|
184
146
|
sportKey: sportKeySchema,
|
|
185
147
|
stats: EnteredHistoricalStatsSchema,
|
|
186
|
-
reason: repairReasonSchema,
|
|
187
148
|
operationId: statsOperationIdSchema,
|
|
188
149
|
dryRun: z.boolean(),
|
|
189
150
|
})
|
|
@@ -200,11 +161,17 @@ export const AdminUpdateHistoricalStatResultSchema = z
|
|
|
200
161
|
})
|
|
201
162
|
.strict();
|
|
202
163
|
export const AdminCreateStatsValidationReportInputSchema = z
|
|
203
|
-
.object({
|
|
204
|
-
.strict()
|
|
164
|
+
.object({
|
|
165
|
+
scope: StatsValidationScopeSchema.strict(),
|
|
166
|
+
requestId: statsJobRequestIdSchema.optional(),
|
|
167
|
+
})
|
|
168
|
+
.strict()
|
|
169
|
+
.refine((input) => (input.requestId !== undefined) ===
|
|
170
|
+
(input.scope.gameId === undefined && input.scope.leagueId === undefined), { message: 'A check of everything, and only that, carries a request id.', path: ['requestId'] });
|
|
205
171
|
export const AdminCreateStatsValidationReportResultSchema = z
|
|
206
172
|
.object({
|
|
207
|
-
reportId:
|
|
173
|
+
reportId: statsValidationReportIdSchema,
|
|
174
|
+
jobId: statsJobIdSchema.optional(),
|
|
208
175
|
complete: z.boolean(),
|
|
209
176
|
summary: StatsValidationSummarySchema,
|
|
210
177
|
discrepancyCounts: StatsValidationReportSchema.shape.discrepancyCounts,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats.js","sourceRoot":"","sources":["../../src/schemas/stats.ts"],"names":[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C,OAAO,EAAE;IACrB,OAAO,EAAE,4BAA4B;IACrC,iBAAiB,EAAE,2BAA2B,CAAC,KAAK,CAAC,iBAAiB;CACvE,CAAC;KACD,MAAM,EAAE,CAAC;AAKZ,MAAM,CAAC,MAAM,2CAA2C,GAAG,CAAC;KACzD,MAAM,CAAC,EAAE,QAAQ,EAAE,6BAA6B,EAAE,CAAC;KACnD,MAAM,EAAE,CAAC;AAKZ,MAAM,CAAC,MAAM,4CAA4C,GAAG,CAAC;KAC1D,MAAM,CAAC,EAAE,QAAQ,EAAE,6BAA6B,EAAE,CAAC;KACnD,MAAM,EAAE,CAAC","sourcesContent":["import { z } from 'zod';\nimport {\n CURLING_ROUND_COUNT,\n MAX_CURLING_ROUND_POINTS,\n MAX_GAME_STATS_CORRECTION_TARGETS,\n} from '../constants/sports.js';\nimport {\n countSchema,\n enteredStatCountSchema,\n gameIdSchema,\n gameRosterPlayerIdSchema,\n leagueIdSchema,\n repairReasonSchema,\n sportKeySchema,\n statCounterKeySchema,\n statsOperationIdSchema,\n statsValidationReportIdSchema,\n teamIdSchema,\n userIdSchema,\n} from '../doc-schemas/atoms.js';\nimport {\n StatsDestinationChangeSchema,\n StatsOperationCountsSchema,\n} from '../doc-schemas/stats-operation.js';\nimport {\n StatsValidationReportSchema,\n StatsValidationScopeSchema,\n StatsValidationSummarySchema,\n} from '../doc-schemas/system.js';\nimport {\n HISTORICAL_STAT_KEYS,\n HistoricalStatsSchema,\n type HistoricalStats,\n} from '../doc-schemas/user-profile.js';\nimport {\n GAME_FINALIZE_OUTCOME_KEYS,\n GAME_REOPEN_OUTCOME_KEYS,\n GAME_STATS_REPAIR_OUTCOME_KEYS,\n UNROSTERED_STAT_LINE_RESOLUTION_OUTCOME_KEYS,\n} from '../types/stats.js';\n\nexport const UpdateSportGameFinalizeInputSchema = z.object({ gameId: gameIdSchema }).strict();\nexport type UpdateSportGameFinalizeInput = z.infer<typeof UpdateSportGameFinalizeInputSchema>;\n\nexport const UpdateSportGameFinalizeResultSchema = z\n .object({\n gameId: gameIdSchema,\n leagueId: leagueIdSchema,\n outcome: z.enum(GAME_FINALIZE_OUTCOME_KEYS),\n nonScoringRosterPlayerIds: z.array(gameRosterPlayerIdSchema),\n })\n .strict();\nexport type UpdateSportGameFinalizeResult = z.infer<typeof UpdateSportGameFinalizeResultSchema>;\n\nexport const AdminUpdateSportGameReopenInputSchema = z\n .object({ gameId: gameIdSchema, reason: repairReasonSchema })\n .strict();\nexport type AdminUpdateSportGameReopenInput = z.infer<typeof AdminUpdateSportGameReopenInputSchema>;\n\nexport const AdminUpdateSportGameReopenResultSchema = z\n .object({\n gameId: gameIdSchema,\n leagueId: leagueIdSchema,\n outcome: z.enum(GAME_REOPEN_OUTCOME_KEYS),\n })\n .strict();\nexport type AdminUpdateSportGameReopenResult = z.infer<\n typeof AdminUpdateSportGameReopenResultSchema\n>;\n\nexport const AdminCreateGameRosterPlayerInputSchema = z\n .object({\n gameId: gameIdSchema,\n userId: userIdSchema,\n teamId: teamIdSchema,\n reason: repairReasonSchema,\n dryRun: z.boolean().optional(),\n })\n .strict();\nexport type AdminCreateGameRosterPlayerInput = z.infer<\n typeof AdminCreateGameRosterPlayerInputSchema\n>;\n\nexport const AdminCreateGameRosterPlayerResultSchema = z\n .object({\n gameId: gameIdSchema,\n userId: userIdSchema,\n teamId: teamIdSchema,\n outcome: z.enum(UNROSTERED_STAT_LINE_RESOLUTION_OUTCOME_KEYS),\n gameConverts: z.boolean(),\n })\n .strict();\nexport type AdminCreateGameRosterPlayerResult = z.infer<\n typeof AdminCreateGameRosterPlayerResultSchema\n>;\n\nconst statsRepairFields = {\n reason: repairReasonSchema,\n operationId: statsOperationIdSchema,\n dryRun: z.boolean(),\n resumeAfter: z.string().min(1).optional(),\n};\n\nconst cursorOnlyOnDryRun = (input: { dryRun: boolean; resumeAfter?: string }): boolean =>\n input.dryRun || input.resumeAfter === undefined;\nconst CURSOR_ONLY_ON_DRY_RUN = {\n message: 'A real run resumes from its operation; only a dry run takes a cursor.',\n path: ['resumeAfter'],\n};\n\nexport const AdminUpdateSportLeagueStatsRecalculateInputSchema = z\n .object({ leagueId: leagueIdSchema, ...statsRepairFields })\n .strict()\n .refine(cursorOnlyOnDryRun, CURSOR_ONLY_ON_DRY_RUN);\nexport type AdminUpdateSportLeagueStatsRecalculateInput = z.infer<\n typeof AdminUpdateSportLeagueStatsRecalculateInputSchema\n>;\n\nexport const RecalculateAllLeagueStatsInputSchema = z\n .object({ ...statsRepairFields })\n .strict()\n .refine(cursorOnlyOnDryRun, CURSOR_ONLY_ON_DRY_RUN);\nexport type RecalculateAllLeagueStatsInput = z.infer<typeof RecalculateAllLeagueStatsInputSchema>;\n\nexport const AdminUpdateUserProfileStatsRecalculateInputSchema = z\n .object({ userId: userIdSchema, ...statsRepairFields })\n .strict()\n .refine(cursorOnlyOnDryRun, CURSOR_ONLY_ON_DRY_RUN);\nexport type AdminUpdateUserProfileStatsRecalculateInput = z.infer<\n typeof AdminUpdateUserProfileStatsRecalculateInputSchema\n>;\n\nexport const RecalculateAllUserStatsInputSchema = z\n .object({ ...statsRepairFields })\n .strict()\n .refine(cursorOnlyOnDryRun, CURSOR_ONLY_ON_DRY_RUN);\nexport type RecalculateAllUserStatsInput = z.infer<typeof RecalculateAllUserStatsInputSchema>;\n\nexport const RecalculateHallOfFameInputSchema = z\n .object({ sportKey: sportKeySchema, userId: userIdSchema.optional(), ...statsRepairFields })\n .strict()\n .refine(cursorOnlyOnDryRun, CURSOR_ONLY_ON_DRY_RUN);\nexport type RecalculateHallOfFameInput = z.infer<typeof RecalculateHallOfFameInputSchema>;\n\nexport const StatsRebuildResultSchema = z\n .object({\n operationId: statsOperationIdSchema,\n dryRun: z.boolean(),\n complete: z.boolean(),\n nextResumeAfter: z.string().min(1).nullable(),\n counts: StatsOperationCountsSchema,\n changes: z.array(StatsDestinationChangeSchema),\n changesTruncated: z.boolean(),\n scopeChanged: z.boolean(),\n })\n .strict();\nexport type StatsRebuildResult = z.infer<typeof StatsRebuildResultSchema>;\n\nexport const GameStatsCorrectionTargetSchema = z\n .object({\n teamId: teamIdSchema,\n playerUserId: userIdSchema.optional(),\n stat: statCounterKeySchema,\n value: enteredStatCountSchema,\n })\n .strict();\nexport type GameStatsCorrectionTarget = z.infer<typeof GameStatsCorrectionTargetSchema>;\n\nexport const AdminCorrectGameStatsInputSchema = z\n .object({\n gameId: gameIdSchema,\n targets: z\n .array(GameStatsCorrectionTargetSchema)\n .min(1)\n .max(MAX_GAME_STATS_CORRECTION_TARGETS)\n .optional(),\n keepStored: z.literal(true).optional(),\n reason: repairReasonSchema,\n operationId: statsOperationIdSchema,\n dryRun: z.boolean(),\n })\n .strict()\n .refine((input) => (input.targets === undefined) !== (input.keepStored === undefined), {\n message: 'Give the values to set, or keep the stored numbers — one of the two.',\n path: ['targets'],\n });\nexport type AdminCorrectGameStatsInput = z.infer<typeof AdminCorrectGameStatsInputSchema>;\n\nexport const AdminUpdateSportGameStatsRecalculateInputSchema = z\n .object({\n gameId: gameIdSchema,\n reason: repairReasonSchema,\n operationId: statsOperationIdSchema,\n dryRun: z.boolean(),\n })\n .strict();\nexport type AdminUpdateSportGameStatsRecalculateInput = z.infer<\n typeof AdminUpdateSportGameStatsRecalculateInputSchema\n>;\n\nexport const GameStatsCorrectionSchema = z\n .object({ lineKey: z.string().min(1), field: statCounterKeySchema, value: z.number().int() })\n .strict();\nexport type GameStatsCorrection = z.infer<typeof GameStatsCorrectionSchema>;\n\nconst roundSlotValueSchema = z.number().int().min(0).max(MAX_CURLING_ROUND_POINTS).nullable();\n\n// Two team lines of a game, each holding its sport's fixed round slots.\nconst MAX_ROUND_SLOT_CHANGES = 2 * CURLING_ROUND_COUNT;\n\nconst replacedEntryListSchema = z\n .object({ stored: z.array(gameRosterPlayerIdSchema), rebuilt: z.array(gameRosterPlayerIdSchema) })\n .strict();\n\nexport const GameRepairChangesSchema = z\n .object({\n lines: z.array(\n z\n .object({\n lineKey: z.string().min(1),\n field: z.string().min(1),\n stored: z.number(),\n rebuilt: z.number(),\n })\n .strict(),\n ),\n scores: z.array(\n z.object({ teamId: teamIdSchema, stored: z.number(), rebuilt: z.number() }).strict(),\n ),\n // Present when a round slot changed: each changed slot of a line, a null slot unplayed.\n roundSlots: z\n .array(\n z\n .object({\n lineKey: z.string().min(1),\n slotIndex: z\n .number()\n .int()\n .min(0)\n .max(CURLING_ROUND_COUNT - 1),\n stored: roundSlotValueSchema,\n rebuilt: roundSlotValueSchema,\n })\n .strict(),\n )\n .min(1)\n .max(MAX_ROUND_SLOT_CHANGES)\n .optional(),\n absentRosterPlayerIds: replacedEntryListSchema.optional(),\n nonScoringRosterPlayerIds: replacedEntryListSchema.optional(),\n statEventSequence: z.object({ stored: countSchema, rebuilt: countSchema }).strict().optional(),\n recordRewritten: z.literal(true).optional(),\n })\n .strict();\nexport type GameRepairChanges = z.infer<typeof GameRepairChangesSchema>;\n\nexport const GameStatsRepairResultSchema = z\n .object({\n gameId: gameIdSchema,\n leagueId: leagueIdSchema,\n operationId: statsOperationIdSchema,\n dryRun: z.boolean(),\n outcome: z.enum(GAME_STATS_REPAIR_OUTCOME_KEYS),\n corrections: z.array(GameStatsCorrectionSchema),\n gameChanged: z.boolean(),\n gameChanges: GameRepairChangesSchema,\n destinationChanges: z.array(StatsDestinationChangeSchema),\n })\n .strict();\nexport type GameStatsRepairResult = z.infer<typeof GameStatsRepairResultSchema>;\n\nconst EnteredHistoricalStatsSchema = z\n .object(\n Object.fromEntries(HISTORICAL_STAT_KEYS.map((key) => [key, enteredStatCountSchema])) as Record<\n keyof HistoricalStats,\n typeof enteredStatCountSchema\n >,\n )\n .strict();\n\nexport const AdminUpdateHistoricalStatInputSchema = z\n .object({\n userId: userIdSchema,\n sportKey: sportKeySchema,\n stats: EnteredHistoricalStatsSchema,\n reason: repairReasonSchema,\n operationId: statsOperationIdSchema,\n dryRun: z.boolean(),\n })\n .strict();\nexport type AdminUpdateHistoricalStatInput = z.infer<typeof AdminUpdateHistoricalStatInputSchema>;\n\nexport const AdminUpdateHistoricalStatResultSchema = z\n .object({\n userId: userIdSchema,\n sportKey: sportKeySchema,\n operationId: statsOperationIdSchema,\n dryRun: z.boolean(),\n outcome: z.enum(GAME_STATS_REPAIR_OUTCOME_KEYS),\n baselineBefore: HistoricalStatsSchema.nullable(),\n changes: z.array(StatsDestinationChangeSchema),\n })\n .strict();\nexport type AdminUpdateHistoricalStatResult = z.infer<typeof AdminUpdateHistoricalStatResultSchema>;\n\nexport const AdminCreateStatsValidationReportInputSchema = z\n .object({ operationId: statsOperationIdSchema, scope: StatsValidationScopeSchema.strict() })\n .strict();\nexport type AdminCreateStatsValidationReportInput = z.infer<\n typeof AdminCreateStatsValidationReportInputSchema\n>;\n\nexport const AdminCreateStatsValidationReportResultSchema = z\n .object({\n reportId: z.string().min(1),\n complete: z.boolean(),\n summary: StatsValidationSummarySchema,\n discrepancyCounts: StatsValidationReportSchema.shape.discrepancyCounts,\n })\n .strict();\nexport type AdminCreateStatsValidationReportResult = z.infer<\n typeof AdminCreateStatsValidationReportResultSchema\n>;\n\nexport const AdminDeleteStatsValidationReportInputSchema = z\n .object({ reportId: statsValidationReportIdSchema })\n .strict();\nexport type AdminDeleteStatsValidationReportInput = z.infer<\n typeof AdminDeleteStatsValidationReportInputSchema\n>;\n\nexport const AdminDeleteStatsValidationReportResultSchema = z\n .object({ reportId: statsValidationReportIdSchema })\n .strict();\nexport type AdminDeleteStatsValidationReportResult = z.infer<\n typeof AdminDeleteStatsValidationReportResultSchema\n>;\n"]}
|
|
1
|
+
{"version":3,"file":"stats.js","sourceRoot":"","sources":["../../src/schemas/stats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EACL,WAAW,EACX,sBAAsB,EACtB,aAAa,EACb,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;IAClC,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;IACrB,OAAO,EAAE,4BAA4B;IACrC,iBAAiB,EAAE,2BAA2B,CAAC,KAAK,CAAC,iBAAiB;CACvE,CAAC;KACD,MAAM,EAAE,CAAC;AAKZ,MAAM,CAAC,MAAM,2CAA2C,GAAG,CAAC;KACzD,MAAM,CAAC,EAAE,QAAQ,EAAE,6BAA6B,EAAE,CAAC;KACnD,MAAM,EAAE,CAAC;AAKZ,MAAM,CAAC,MAAM,4CAA4C,GAAG,CAAC;KAC1D,MAAM,CAAC,EAAE,QAAQ,EAAE,6BAA6B,EAAE,CAAC;KACnD,MAAM,EAAE,CAAC","sourcesContent":["import { z } from 'zod';\nimport { CURLING_ROUND_COUNT, MAX_CURLING_ROUND_POINTS } from '../constants/sports.js';\nimport { parseStatsJobId } from '../ids/stats-ids.js';\nimport {\n countSchema,\n enteredStatCountSchema,\n epochMsSchema,\n gameIdSchema,\n gameRosterPlayerIdSchema,\n leagueIdSchema,\n sportKeySchema,\n statsOperationIdSchema,\n statsValidationReportIdSchema,\n teamIdSchema,\n userIdSchema,\n} from '../doc-schemas/atoms.js';\nimport { StatsDestinationChangeSchema } from '../doc-schemas/stats-changes.js';\nimport {\n StatsValidationReportSchema,\n StatsValidationScopeSchema,\n StatsValidationSummarySchema,\n} from '../doc-schemas/system.js';\nimport {\n HISTORICAL_STAT_KEYS,\n HistoricalStatsSchema,\n type HistoricalStats,\n} from '../doc-schemas/user-profile.js';\nimport {\n GAME_FINALIZE_OUTCOME_KEYS,\n GAME_REOPEN_OUTCOME_KEYS,\n GAME_STATS_REPAIR_OUTCOME_KEYS,\n STATS_JOB_KIND_KEYS,\n STATS_JOB_STAGE_KEYS,\n STATS_JOB_STATE_KEYS,\n UNROSTERED_STAT_LINE_RESOLUTION_OUTCOME_KEYS,\n} from '../types/stats.js';\n\nexport const UpdateSportGameFinalizeInputSchema = z.object({ gameId: gameIdSchema }).strict();\nexport type UpdateSportGameFinalizeInput = z.infer<typeof UpdateSportGameFinalizeInputSchema>;\n\nexport const UpdateSportGameFinalizeResultSchema = z\n .object({\n gameId: gameIdSchema,\n leagueId: leagueIdSchema,\n outcome: z.enum(GAME_FINALIZE_OUTCOME_KEYS),\n nonScoringRosterPlayerIds: z.array(gameRosterPlayerIdSchema),\n })\n .strict();\nexport type UpdateSportGameFinalizeResult = z.infer<typeof UpdateSportGameFinalizeResultSchema>;\n\nexport const AdminUpdateSportGameReopenInputSchema = z.object({ gameId: gameIdSchema }).strict();\nexport type AdminUpdateSportGameReopenInput = z.infer<typeof AdminUpdateSportGameReopenInputSchema>;\n\nexport const AdminUpdateSportGameReopenResultSchema = z\n .object({\n gameId: gameIdSchema,\n leagueId: leagueIdSchema,\n outcome: z.enum(GAME_REOPEN_OUTCOME_KEYS),\n })\n .strict();\nexport type AdminUpdateSportGameReopenResult = z.infer<\n typeof AdminUpdateSportGameReopenResultSchema\n>;\n\nexport const AdminCreateGameRosterPlayerInputSchema = z\n .object({\n gameId: gameIdSchema,\n userId: userIdSchema,\n teamId: teamIdSchema,\n dryRun: z.boolean().optional(),\n })\n .strict();\nexport type AdminCreateGameRosterPlayerInput = z.infer<\n typeof AdminCreateGameRosterPlayerInputSchema\n>;\n\nexport const AdminCreateGameRosterPlayerResultSchema = z\n .object({\n gameId: gameIdSchema,\n userId: userIdSchema,\n teamId: teamIdSchema,\n outcome: z.enum(UNROSTERED_STAT_LINE_RESOLUTION_OUTCOME_KEYS),\n gameConverts: z.boolean(),\n })\n .strict();\nexport type AdminCreateGameRosterPlayerResult = z.infer<\n typeof AdminCreateGameRosterPlayerResultSchema\n>;\n\nconst statsRepairFields = {\n operationId: statsOperationIdSchema,\n dryRun: z.boolean(),\n};\n\nexport const AdminUpdateSportLeagueStatsRecalculateInputSchema = z\n .object({ leagueId: leagueIdSchema, ...statsRepairFields })\n .strict();\nexport type AdminUpdateSportLeagueStatsRecalculateInput = z.infer<\n typeof AdminUpdateSportLeagueStatsRecalculateInputSchema\n>;\n\nexport const AdminUpdateUserProfileStatsRecalculateInputSchema = z\n .object({ userId: userIdSchema, ...statsRepairFields })\n .strict();\nexport type AdminUpdateUserProfileStatsRecalculateInput = z.infer<\n typeof AdminUpdateUserProfileStatsRecalculateInputSchema\n>;\n\nexport const StatsRebuildResultSchema = z\n .object({\n operationId: statsOperationIdSchema,\n dryRun: z.boolean(),\n changes: z.array(StatsDestinationChangeSchema),\n changesTruncated: z.boolean(),\n })\n .strict();\nexport type StatsRebuildResult = z.infer<typeof StatsRebuildResultSchema>;\n\nexport const statsJobRequestIdSchema = z.uuid();\n\nexport const statsJobIdSchema = z\n .string()\n .refine((id) => parseStatsJobId(id) !== null, 'Not a stats job id.');\n\nexport const AdminCreateStatsJobInputSchema = z\n .object({ requestId: statsJobRequestIdSchema })\n .strict();\nexport type AdminCreateStatsJobInput = z.infer<typeof AdminCreateStatsJobInputSchema>;\n\nexport const AdminCreateStatsJobResultSchema = z.object({ jobId: statsJobIdSchema }).strict();\nexport type AdminCreateStatsJobResult = z.infer<typeof AdminCreateStatsJobResultSchema>;\n\nexport const AdminGetStatsJobInputSchema = z.object({ kind: z.enum(STATS_JOB_KIND_KEYS) }).strict();\nexport type AdminGetStatsJobInput = z.infer<typeof AdminGetStatsJobInputSchema>;\n\nexport const StatsJobProgressSchema = z\n .object({\n jobId: statsJobIdSchema,\n kind: z.enum(STATS_JOB_KIND_KEYS),\n state: z.enum(STATS_JOB_STATE_KEYS),\n stage: z.enum(STATS_JOB_STAGE_KEYS),\n stageDone: countSchema,\n changed: countSchema,\n deadLettered: z.boolean(),\n completedAt: epochMsSchema.nullable(),\n })\n .strict();\nexport type StatsJobProgress = z.infer<typeof StatsJobProgressSchema>;\n\nexport const AdminGetStatsJobResultSchema = z\n .object({ job: StatsJobProgressSchema.nullable() })\n .strict();\nexport type AdminGetStatsJobResult = z.infer<typeof AdminGetStatsJobResultSchema>;\n\nexport const AdminUpdateSportGameStatsRecalculateInputSchema = z\n .object({ gameId: gameIdSchema, ...statsRepairFields })\n .strict();\nexport type AdminUpdateSportGameStatsRecalculateInput = z.infer<\n typeof AdminUpdateSportGameStatsRecalculateInputSchema\n>;\n\nconst roundSlotValueSchema = z.number().int().min(0).max(MAX_CURLING_ROUND_POINTS).nullable();\n\n// Two team lines of a game, each holding its sport's fixed round slots.\nconst MAX_ROUND_SLOT_CHANGES = 2 * CURLING_ROUND_COUNT;\n\nconst replacedEntryListSchema = z\n .object({ stored: z.array(gameRosterPlayerIdSchema), rebuilt: z.array(gameRosterPlayerIdSchema) })\n .strict();\n\nexport const GameRepairChangesSchema = z\n .object({\n lines: z.array(\n z\n .object({\n lineKey: z.string().min(1),\n field: z.string().min(1),\n stored: z.number(),\n rebuilt: z.number(),\n })\n .strict(),\n ),\n scores: z.array(\n z.object({ teamId: teamIdSchema, stored: z.number(), rebuilt: z.number() }).strict(),\n ),\n // Present when a round slot changed: each changed slot of a line, a null slot unplayed.\n roundSlots: z\n .array(\n z\n .object({\n lineKey: z.string().min(1),\n slotIndex: z\n .number()\n .int()\n .min(0)\n .max(CURLING_ROUND_COUNT - 1),\n stored: roundSlotValueSchema,\n rebuilt: roundSlotValueSchema,\n })\n .strict(),\n )\n .min(1)\n .max(MAX_ROUND_SLOT_CHANGES)\n .optional(),\n absentRosterPlayerIds: replacedEntryListSchema.optional(),\n nonScoringRosterPlayerIds: replacedEntryListSchema.optional(),\n statEventSequence: z.object({ stored: countSchema, rebuilt: countSchema }).strict().optional(),\n recordRewritten: z.literal(true).optional(),\n })\n .strict();\nexport type GameRepairChanges = z.infer<typeof GameRepairChangesSchema>;\n\nexport const GameStatsRepairResultSchema = z\n .object({\n gameId: gameIdSchema,\n leagueId: leagueIdSchema,\n operationId: statsOperationIdSchema,\n dryRun: z.boolean(),\n outcome: z.enum(GAME_STATS_REPAIR_OUTCOME_KEYS),\n gameChanged: z.boolean(),\n gameChanges: GameRepairChangesSchema,\n destinationChanges: z.array(StatsDestinationChangeSchema),\n })\n .strict();\nexport type GameStatsRepairResult = z.infer<typeof GameStatsRepairResultSchema>;\n\nconst EnteredHistoricalStatsSchema = z\n .object(\n Object.fromEntries(HISTORICAL_STAT_KEYS.map((key) => [key, enteredStatCountSchema])) as Record<\n keyof HistoricalStats,\n typeof enteredStatCountSchema\n >,\n )\n .strict();\n\nexport const AdminUpdateHistoricalStatInputSchema = z\n .object({\n userId: userIdSchema,\n sportKey: sportKeySchema,\n stats: EnteredHistoricalStatsSchema,\n operationId: statsOperationIdSchema,\n dryRun: z.boolean(),\n })\n .strict();\nexport type AdminUpdateHistoricalStatInput = z.infer<typeof AdminUpdateHistoricalStatInputSchema>;\n\nexport const AdminUpdateHistoricalStatResultSchema = z\n .object({\n userId: userIdSchema,\n sportKey: sportKeySchema,\n operationId: statsOperationIdSchema,\n dryRun: z.boolean(),\n outcome: z.enum(GAME_STATS_REPAIR_OUTCOME_KEYS),\n baselineBefore: HistoricalStatsSchema.nullable(),\n changes: z.array(StatsDestinationChangeSchema),\n })\n .strict();\nexport type AdminUpdateHistoricalStatResult = z.infer<typeof AdminUpdateHistoricalStatResultSchema>;\n\nexport const AdminCreateStatsValidationReportInputSchema = z\n .object({\n scope: StatsValidationScopeSchema.strict(),\n requestId: statsJobRequestIdSchema.optional(),\n })\n .strict()\n .refine(\n (input) =>\n (input.requestId !== undefined) ===\n (input.scope.gameId === undefined && input.scope.leagueId === undefined),\n { message: 'A check of everything, and only that, carries a request id.', path: ['requestId'] },\n );\nexport type AdminCreateStatsValidationReportInput = z.infer<\n typeof AdminCreateStatsValidationReportInputSchema\n>;\n\nexport const AdminCreateStatsValidationReportResultSchema = z\n .object({\n reportId: statsValidationReportIdSchema,\n jobId: statsJobIdSchema.optional(),\n complete: z.boolean(),\n summary: StatsValidationSummarySchema,\n discrepancyCounts: StatsValidationReportSchema.shape.discrepancyCounts,\n })\n .strict();\nexport type AdminCreateStatsValidationReportResult = z.infer<\n typeof AdminCreateStatsValidationReportResultSchema\n>;\n\nexport const AdminDeleteStatsValidationReportInputSchema = z\n .object({ reportId: statsValidationReportIdSchema })\n .strict();\nexport type AdminDeleteStatsValidationReportInput = z.infer<\n typeof AdminDeleteStatsValidationReportInputSchema\n>;\n\nexport const AdminDeleteStatsValidationReportResultSchema = z\n .object({ reportId: statsValidationReportIdSchema })\n .strict();\nexport type AdminDeleteStatsValidationReportResult = z.infer<\n typeof AdminDeleteStatsValidationReportResultSchema\n>;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basketball-scoring.d.ts","sourceRoot":"","sources":["../../src/sports/basketball-scoring.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,EACd,MAAM,8BAA8B,CAAC;AAkBtC,OAAO,KAAK,EACV,uBAAuB,EAGxB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAIL,KAAK,oBAAoB,EAG1B,MAAM,iBAAiB,CAAC;AAMzB,OAAO,EASL,KAAK,YAAY,EAKlB,MAAM,cAAc,CAAC;AACtB,OAAO,EAGL,KAAK,wBAAwB,EAC7B,KAAK,UAAU,EAEf,KAAK,qBAAqB,EAE3B,MAAM,sBAAsB,CAAC;AAiB9B,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,IAAI,CAAC,qBAAqB,EAAE,uBAAuB,CAAC,GACzD,MAAM,CAKR;AAKD,wBAAgB,uBAAuB,IAAI,mBAAmB,CAI7D;
|
|
1
|
+
{"version":3,"file":"basketball-scoring.d.ts","sourceRoot":"","sources":["../../src/sports/basketball-scoring.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,EACd,MAAM,8BAA8B,CAAC;AAkBtC,OAAO,KAAK,EACV,uBAAuB,EAGxB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAIL,KAAK,oBAAoB,EAG1B,MAAM,iBAAiB,CAAC;AAMzB,OAAO,EASL,KAAK,YAAY,EAKlB,MAAM,cAAc,CAAC;AACtB,OAAO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