@ttt-productions/q-core 0.1.40 → 0.1.41
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/sports.d.ts +0 -6
- package/dist/constants/sports.d.ts.map +1 -1
- package/dist/constants/sports.js +0 -6
- package/dist/constants/sports.js.map +1 -1
- package/dist/doc-schemas/atoms.d.ts +0 -1
- package/dist/doc-schemas/atoms.d.ts.map +1 -1
- package/dist/doc-schemas/audit-event.d.ts +0 -2
- package/dist/doc-schemas/audit-event.d.ts.map +1 -1
- package/dist/doc-schemas/registry.d.ts +0 -75
- package/dist/doc-schemas/registry.d.ts.map +1 -1
- package/dist/doc-schemas/sport-game.d.ts +0 -6
- package/dist/doc-schemas/sport-game.d.ts.map +1 -1
- package/dist/doc-schemas/sport-game.js +1 -2
- package/dist/doc-schemas/sport-game.js.map +1 -1
- package/dist/doc-schemas/stats-operation.d.ts +0 -141
- package/dist/doc-schemas/stats-operation.d.ts.map +1 -1
- package/dist/doc-schemas/stats-operation.js +2 -41
- package/dist/doc-schemas/stats-operation.js.map +1 -1
- package/dist/doc-schemas/system.d.ts +0 -3
- package/dist/doc-schemas/system.d.ts.map +1 -1
- package/dist/ids/index.d.ts +0 -1
- package/dist/ids/index.d.ts.map +1 -1
- package/dist/ids/index.js +0 -1
- package/dist/ids/index.js.map +1 -1
- package/dist/schemas/schedules.d.ts +0 -4
- package/dist/schemas/schedules.d.ts.map +1 -1
- package/dist/schemas/schedules.js +2 -6
- package/dist/schemas/schedules.js.map +1 -1
- package/dist/schemas/stats.d.ts +0 -1
- package/dist/schemas/stats.d.ts.map +1 -1
- package/dist/schemas/teams.d.ts +4 -16
- package/dist/schemas/teams.d.ts.map +1 -1
- package/dist/schemas/teams.js +4 -16
- package/dist/schemas/teams.js.map +1 -1
- package/dist/sports/contribution.d.ts +3 -10
- package/dist/sports/contribution.d.ts.map +1 -1
- package/dist/sports/contribution.js +10 -9
- package/dist/sports/contribution.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 +0 -1
- 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 +3 -7
- package/dist/types/stats.d.ts.map +1 -1
- package/dist/types/stats.js +1 -16
- package/dist/types/stats.js.map +1 -1
- package/dist/types/unions.d.ts +2 -2
- package/dist/types/unions.d.ts.map +1 -1
- package/dist/types/unions.js +0 -1
- package/dist/types/unions.js.map +1 -1
- package/package.json +1 -1
- package/dist/ids/stats-operation-ids.d.ts +0 -3
- package/dist/ids/stats-operation-ids.d.ts.map +0 -1
- package/dist/ids/stats-operation-ids.js +0 -10
- package/dist/ids/stats-operation-ids.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats-operation.js","sourceRoot":"","sources":["../../src/doc-schemas/stats-operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,kCAAkC,EAClC,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,WAAW,EACX,aAAa,EACb,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,YAAY,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAEzD,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,YAAY,CAAC;IACvD,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,WAAW;IACpB,OAAO,EAAE,WAAW;CACrB,CAAC,CAAC;AAGH,MAAM,aAAa,GAAG;IACpB,eAAe,EAAE,YAAY;IAC7B,SAAS,EAAE,aAAa;IACxB,SAAS,EAAE,aAAa;IACxB,MAAM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_MEMBERSHIP_OUTCOME_KEYS,\n STATS_OPERATION_STATUS_KEYS,\n STATS_VALIDATION_PHASE_KEYS,\n} from '../types/stats.js';\nimport type { GhostStatsOperationAction, StatsOperationKind } from '../types/stats.js';\nimport {\n countSchema,\n epochMsSchema,\n gameIdSchema,\n leagueIdSchema,\n repairReasonSchema,\n sportKeySchema,\n teamIdSchema,\n userIdSchema,\n} from './atoms.js';\nimport { StatsValidationScopeSchema } from './system.js';\n\nexport const StatsOperationCountsSchema = z.strictObject({\n read: countSchema,\n changed: countSchema,\n skipped: countSchema,\n});\nexport type StatsOperationCounts = z.infer<typeof StatsOperationCountsSchema>;\n\nconst operationBase = {\n startedByUserId: userIdSchema,\n startedAt: epochMsSchema,\n updatedAt: epochMsSchema,\n status: z.enum(STATS_OPERATION_STATUS_KEYS),\n resumeAfter: z.string().min(1).optional(),\n counts: StatsOperationCountsSchema,\n};\n\nconst rebuildFields = {\n ...operationBase,\n reason: repairReasonSchema,\n stoppedOnGameIds: z.array(gameIdSchema),\n};\n\nconst gameScope = z.strictObject({ gameId: gameIdSchema });\n\n// `hashStatsOperationRequest` of the values the operation was opened with. Optional: an operation\n// stored before it existed still resumes.\nconst requestHashSchema = z.string().regex(/^[0-9a-f]{64}$/);\n\nexport const LeagueStatsRebuildOperationSchema = z.strictObject({\n ...rebuildFields,\n kind: z.literal('leagueStatsRebuild' satisfies StatsOperationKind),\n scope: z.strictObject({ leagueId: leagueIdSchema.optional() }),\n});\n\nexport const LifetimeStatsRebuildOperationSchema = z.strictObject({\n ...rebuildFields,\n kind: z.literal('lifetimeStatsRebuild' satisfies StatsOperationKind),\n scope: z.strictObject({ userId: userIdSchema.optional() }),\n});\n\nexport const HallOfFameRebuildOperationSchema = z.strictObject({\n ...rebuildFields,\n kind: z.literal('hallOfFameRebuild' satisfies StatsOperationKind),\n scope: z.strictObject({ sportKey: sportKeySchema, userId: userIdSchema.optional() }),\n});\n\nexport const StatsValidationOperationSchema = z.strictObject({\n ...operationBase,\n kind: z.literal('statsValidation' satisfies StatsOperationKind),\n scope: StatsValidationScopeSchema,\n phase: z.enum(STATS_VALIDATION_PHASE_KEYS),\n});\n\nexport const GameStatsCorrectionOperationSchema = z.strictObject({\n ...operationBase,\n kind: z.literal('gameStatsCorrection' satisfies StatsOperationKind),\n scope: gameScope,\n reason: repairReasonSchema,\n requestHash: requestHashSchema.optional(),\n});\n\nexport const GameStatsRecalculationOperationSchema = z.strictObject({\n ...operationBase,\n kind: z.literal('gameStatsRecalculation' satisfies StatsOperationKind),\n scope: gameScope,\n reason: repairReasonSchema,\n});\n\nexport const HistoricalStatsUpdateOperationSchema = z.strictObject({\n ...operationBase,\n kind: z.literal('historicalStatsUpdate' satisfies StatsOperationKind),\n scope: z.strictObject({ userId: userIdSchema, sportKey: sportKeySchema }),\n reason: repairReasonSchema,\n requestHash: requestHashSchema.optional(),\n});\n\nexport const GhostRemovedFinishedEntrySchema = z.strictObject({\n gameId: gameIdSchema,\n wasAbsent: z.boolean(),\n wasNonScoring: z.boolean(),\n});\nexport type GhostRemovedFinishedEntry = z.infer<typeof GhostRemovedFinishedEntrySchema>;\n\nexport const GhostLinkedGameSchema = z.strictObject({\n gameId: gameIdSchema,\n completed: z.boolean(),\n merged: z.boolean(),\n});\nexport type GhostLinkedGame = z.infer<typeof GhostLinkedGameSchema>;\n\nexport const StatsDestinationChangeSchema = z.strictObject({\n ref: z.string().min(1),\n field: z.string().min(1),\n before: z.record(z.string(), z.number()).nullable(),\n after: z.record(z.string(), z.number()).nullable(),\n});\nexport type StatsDestinationChange = z.infer<typeof StatsDestinationChangeSchema>;\n\nexport const GhostPlayerStatsOperationSchema = z\n .strictObject({\n ...operationBase,\n kind: z.literal('ghostPlayerStats' satisfies StatsOperationKind),\n scope: z.discriminatedUnion('action', [\n z.strictObject({\n action: z.literal('link' satisfies GhostStatsOperationAction),\n teamId: teamIdSchema,\n ghostUserId: userIdSchema,\n userId: userIdSchema,\n }),\n z.strictObject({\n action: z.literal('removal' satisfies GhostStatsOperationAction),\n teamId: teamIdSchema,\n ghostUserId: userIdSchema,\n }),\n ]),\n // Present only on an operation stored with a reason. A removal's is dropped on read; a link's\n // is kept, so its stored operation still resumes.\n reason: repairReasonSchema.optional(),\n removedFinishedGameEntries: z.array(GhostRemovedFinishedEntrySchema).optional(),\n removedOpenGameIds: z.array(gameIdSchema).optional(),\n linkedGames: z.array(GhostLinkedGameSchema).optional(),\n destinationChanges: z.array(StatsDestinationChangeSchema).optional(),\n membershipOutcome: z.enum(GHOST_LINK_MEMBERSHIP_OUTCOME_KEYS).optional(),\n })\n .overwrite((operation) => {\n if (operation.scope.action !== 'removal' || operation.reason === undefined) return operation;\n const { reason: _reason, ...withoutReason } = operation;\n return withoutReason;\n });\nexport type GhostPlayerStatsOperation = z.infer<typeof GhostPlayerStatsOperationSchema>;\n\nexport const GameDeletionOperationSchema = z.strictObject({\n ...operationBase,\n kind: z.literal('gameDeletion' satisfies StatsOperationKind),\n scope: gameScope,\n});\n\nexport const StatsOperationSchema = z.discriminatedUnion('kind', [\n LeagueStatsRebuildOperationSchema,\n LifetimeStatsRebuildOperationSchema,\n HallOfFameRebuildOperationSchema,\n StatsValidationOperationSchema,\n GameStatsCorrectionOperationSchema,\n GameStatsRecalculationOperationSchema,\n HistoricalStatsUpdateOperationSchema,\n GhostPlayerStatsOperationSchema,\n GameDeletionOperationSchema,\n]);\nexport type StatsOperation = z.infer<typeof StatsOperationSchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"stats-operation.js","sourceRoot":"","sources":["../../src/doc-schemas/stats-operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAE7F,OAAO,EACL,WAAW,EACX,aAAa,EACb,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,YAAY,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAA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","sourcesContent":["import { z } from 'zod';\nimport { STATS_OPERATION_STATUS_KEYS, STATS_VALIDATION_PHASE_KEYS } from '../types/stats.js';\nimport type { StatsOperationKind } from '../types/stats.js';\nimport {\n countSchema,\n epochMsSchema,\n gameIdSchema,\n leagueIdSchema,\n repairReasonSchema,\n sportKeySchema,\n userIdSchema,\n} from './atoms.js';\nimport { StatsValidationScopeSchema } from './system.js';\n\nexport const StatsOperationCountsSchema = z.strictObject({\n read: countSchema,\n changed: countSchema,\n skipped: countSchema,\n});\nexport type StatsOperationCounts = z.infer<typeof StatsOperationCountsSchema>;\n\nconst operationBase = {\n startedByUserId: userIdSchema,\n startedAt: epochMsSchema,\n updatedAt: epochMsSchema,\n status: z.enum(STATS_OPERATION_STATUS_KEYS),\n resumeAfter: z.string().min(1).optional(),\n counts: StatsOperationCountsSchema,\n};\n\nconst rebuildFields = {\n ...operationBase,\n reason: repairReasonSchema,\n stoppedOnGameIds: z.array(gameIdSchema),\n};\n\nconst gameScope = z.strictObject({ gameId: gameIdSchema });\n\n// `hashStatsOperationRequest` of the values the operation was opened with. Optional: an operation\n// stored before it existed still resumes.\nconst requestHashSchema = z.string().regex(/^[0-9a-f]{64}$/);\n\nexport const LeagueStatsRebuildOperationSchema = z.strictObject({\n ...rebuildFields,\n kind: z.literal('leagueStatsRebuild' satisfies StatsOperationKind),\n scope: z.strictObject({ leagueId: leagueIdSchema.optional() }),\n});\n\nexport const LifetimeStatsRebuildOperationSchema = z.strictObject({\n ...rebuildFields,\n kind: z.literal('lifetimeStatsRebuild' satisfies StatsOperationKind),\n scope: z.strictObject({ userId: userIdSchema.optional() }),\n});\n\nexport const HallOfFameRebuildOperationSchema = z.strictObject({\n ...rebuildFields,\n kind: z.literal('hallOfFameRebuild' satisfies StatsOperationKind),\n scope: z.strictObject({ sportKey: sportKeySchema, userId: userIdSchema.optional() }),\n});\n\nexport const StatsValidationOperationSchema = z.strictObject({\n ...operationBase,\n kind: z.literal('statsValidation' satisfies StatsOperationKind),\n scope: StatsValidationScopeSchema,\n phase: z.enum(STATS_VALIDATION_PHASE_KEYS),\n});\n\nexport const GameStatsCorrectionOperationSchema = z.strictObject({\n ...operationBase,\n kind: z.literal('gameStatsCorrection' satisfies StatsOperationKind),\n scope: gameScope,\n reason: repairReasonSchema,\n requestHash: requestHashSchema.optional(),\n});\n\nexport const GameStatsRecalculationOperationSchema = z.strictObject({\n ...operationBase,\n kind: z.literal('gameStatsRecalculation' satisfies StatsOperationKind),\n scope: gameScope,\n reason: repairReasonSchema,\n});\n\nexport const HistoricalStatsUpdateOperationSchema = z.strictObject({\n ...operationBase,\n kind: z.literal('historicalStatsUpdate' satisfies StatsOperationKind),\n scope: z.strictObject({ userId: userIdSchema, sportKey: sportKeySchema }),\n reason: repairReasonSchema,\n requestHash: requestHashSchema.optional(),\n});\n\nexport const GhostRemovedFinishedEntrySchema = z.strictObject({\n gameId: gameIdSchema,\n wasAbsent: z.boolean(),\n wasNonScoring: z.boolean(),\n});\nexport type GhostRemovedFinishedEntry = z.infer<typeof GhostRemovedFinishedEntrySchema>;\n\nexport const GhostLinkedGameSchema = z.strictObject({\n gameId: gameIdSchema,\n completed: z.boolean(),\n merged: z.boolean(),\n});\nexport type GhostLinkedGame = z.infer<typeof GhostLinkedGameSchema>;\n\nexport const StatsDestinationChangeSchema = z.strictObject({\n ref: z.string().min(1),\n field: z.string().min(1),\n before: z.record(z.string(), z.number()).nullable(),\n after: z.record(z.string(), z.number()).nullable(),\n});\nexport type StatsDestinationChange = z.infer<typeof StatsDestinationChangeSchema>;\n\nexport const StatsOperationSchema = z.discriminatedUnion('kind', [\n LeagueStatsRebuildOperationSchema,\n LifetimeStatsRebuildOperationSchema,\n HallOfFameRebuildOperationSchema,\n StatsValidationOperationSchema,\n GameStatsCorrectionOperationSchema,\n GameStatsRecalculationOperationSchema,\n HistoricalStatsUpdateOperationSchema,\n]);\nexport type StatsOperation = z.infer<typeof StatsOperationSchema>;\n"]}
|
|
@@ -53,7 +53,6 @@ export declare const StatsDiscrepancySchema: z.ZodObject<{
|
|
|
53
53
|
finalRecordMissing: "finalRecordMissing";
|
|
54
54
|
finalRecordMismatch: "finalRecordMismatch";
|
|
55
55
|
participationSnapshotMismatch: "participationSnapshotMismatch";
|
|
56
|
-
gameHeld: "gameHeld";
|
|
57
56
|
aggregateMismatch: "aggregateMismatch";
|
|
58
57
|
aggregateEntryStale: "aggregateEntryStale";
|
|
59
58
|
aggregateEntryMissing: "aggregateEntryMissing";
|
|
@@ -103,7 +102,6 @@ export declare const StatsValidationReportSchema: z.ZodObject<{
|
|
|
103
102
|
finalRecordMissing: "finalRecordMissing";
|
|
104
103
|
finalRecordMismatch: "finalRecordMismatch";
|
|
105
104
|
participationSnapshotMismatch: "participationSnapshotMismatch";
|
|
106
|
-
gameHeld: "gameHeld";
|
|
107
105
|
aggregateMismatch: "aggregateMismatch";
|
|
108
106
|
aggregateEntryStale: "aggregateEntryStale";
|
|
109
107
|
aggregateEntryMissing: "aggregateEntryMissing";
|
|
@@ -128,7 +126,6 @@ export declare const StatsValidationReportSchema: z.ZodObject<{
|
|
|
128
126
|
finalRecordMissing: "finalRecordMissing";
|
|
129
127
|
finalRecordMismatch: "finalRecordMismatch";
|
|
130
128
|
participationSnapshotMismatch: "participationSnapshotMismatch";
|
|
131
|
-
gameHeld: "gameHeld";
|
|
132
129
|
aggregateMismatch: "aggregateMismatch";
|
|
133
130
|
aggregateEntryStale: "aggregateEntryStale";
|
|
134
131
|
aggregateEntryMissing: "aggregateEntryMissing";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../src/doc-schemas/system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAwBxB,eAAO,MAAM,eAAe;;;;;;iBAO1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,uBA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,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,0BAA0B;;;kBAKpC,CAAC;AACJ,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,eAAO,MAAM,4BAA4B;;;;;;kBAMvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAUtC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
|
package/dist/ids/index.d.ts
CHANGED
|
@@ -4,6 +4,5 @@ export * from './stat-event-ids.js';
|
|
|
4
4
|
export * from './waiver-template-ids.js';
|
|
5
5
|
export * from './picture-ids.js';
|
|
6
6
|
export * from './notification-ids.js';
|
|
7
|
-
export * from './stats-operation-ids.js';
|
|
8
7
|
export * from './award-grant-ids.js';
|
|
9
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/ids/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ids/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ids/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC"}
|
package/dist/ids/index.js
CHANGED
|
@@ -4,6 +4,5 @@ export * from './stat-event-ids.js';
|
|
|
4
4
|
export * from './waiver-template-ids.js';
|
|
5
5
|
export * from './picture-ids.js';
|
|
6
6
|
export * from './notification-ids.js';
|
|
7
|
-
export * from './stats-operation-ids.js';
|
|
8
7
|
export * from './award-grant-ids.js';
|
|
9
8
|
//# sourceMappingURL=index.js.map
|
package/dist/ids/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ids/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ids/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC","sourcesContent":["export * from './compound-ids.js';\nexport * from './minted-ids.js';\nexport * from './stat-event-ids.js';\nexport * from './waiver-template-ids.js';\nexport * from './picture-ids.js';\nexport * from './notification-ids.js';\nexport * from './award-grant-ids.js';\n"]}
|
|
@@ -69,8 +69,6 @@ export declare const AdminDeleteScheduleWeekResultSchema: z.ZodObject<{
|
|
|
69
69
|
leagueId: z.ZodString;
|
|
70
70
|
weekId: z.ZodString;
|
|
71
71
|
deletedGameIds: z.ZodArray<z.ZodString>;
|
|
72
|
-
remainingGameIds: z.ZodArray<z.ZodString>;
|
|
73
|
-
complete: z.ZodBoolean;
|
|
74
72
|
}, z.core.$strict>;
|
|
75
73
|
export type AdminDeleteScheduleWeekResult = z.infer<typeof AdminDeleteScheduleWeekResultSchema>;
|
|
76
74
|
export declare const AdminCreateSportGameInputSchema: z.ZodObject<{
|
|
@@ -117,8 +115,6 @@ export declare const AdminDeleteSportGameInputSchema: z.ZodObject<{
|
|
|
117
115
|
export type AdminDeleteSportGameInput = z.infer<typeof AdminDeleteSportGameInputSchema>;
|
|
118
116
|
export declare const AdminDeleteSportGameResultSchema: z.ZodObject<{
|
|
119
117
|
gameId: z.ZodString;
|
|
120
|
-
operationId: z.ZodString;
|
|
121
|
-
complete: z.ZodBoolean;
|
|
122
118
|
}, z.core.$strict>;
|
|
123
119
|
export type AdminDeleteSportGameResult = z.infer<typeof AdminDeleteSportGameResultSchema>;
|
|
124
120
|
//# sourceMappingURL=schedules.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedules.d.ts","sourceRoot":"","sources":["../../src/schemas/schedules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"schedules.d.ts","sourceRoot":"","sources":["../../src/schemas/schedules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiBxB,eAAO,MAAM,uBAAuB,wDAA6C,CAAC;AAElF,eAAO,MAAM,uBAAuB,8CAMiD,CAAC;AACtF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AASxE,eAAO,MAAM,uBAAuB;;;;;kBAAuC,CAAC;AAC5E,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,4BAA4B;;;;;;;EAAyC,CAAC;AACnF,eAAO,MAAM,uBAAuB;;;;EAAmC,CAAC;AAExE,eA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M,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAE1F,eAAO,MAAM,+BAA+B;;kBAA8C,CAAC;AAC3F,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AACxF,eAAO,MAAM,gCAAgC;;kBAA8C,CAAC;AAC5F,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { MAX_SCHEDULE_WEEK_GAMES } from '../constants/business.js';
|
|
3
3
|
import { textFieldSchema } from './text-field.js';
|
|
4
4
|
import { SCHEDULE_WEEK_TITLE_INPUT } from '../constants/text-fields.js';
|
|
5
|
-
import { countSchema, epochMsSchema, gameIdSchema, leagueIdSchema, scheduleWeekIdSchema,
|
|
5
|
+
import { countSchema, epochMsSchema, gameIdSchema, leagueIdSchema, scheduleWeekIdSchema, teamIdSchema, } from '../doc-schemas/atoms.js';
|
|
6
6
|
import { gameLocationIdSchema } from '../doc-schemas/game-location.js';
|
|
7
7
|
import { isByeTeamId } from '../ids/minted-ids.js';
|
|
8
8
|
import { SCHEDULE_WEEK_FIELD_KEYS, SPORT_GAME_SCHEDULE_FIELD_KEYS } from '../types/schedules.js';
|
|
@@ -65,8 +65,6 @@ export const AdminDeleteScheduleWeekResultSchema = z
|
|
|
65
65
|
leagueId: leagueIdSchema,
|
|
66
66
|
weekId: scheduleWeekIdSchema,
|
|
67
67
|
deletedGameIds: z.array(gameIdSchema),
|
|
68
|
-
remainingGameIds: z.array(gameIdSchema),
|
|
69
|
-
complete: z.boolean(),
|
|
70
68
|
})
|
|
71
69
|
.strict();
|
|
72
70
|
export const AdminCreateSportGameInputSchema = z
|
|
@@ -98,7 +96,5 @@ export const AdminUpdateSportGameResultSchema = z
|
|
|
98
96
|
})
|
|
99
97
|
.strict();
|
|
100
98
|
export const AdminDeleteSportGameInputSchema = z.object({ gameId: gameIdSchema }).strict();
|
|
101
|
-
export const AdminDeleteSportGameResultSchema = z
|
|
102
|
-
.object({ gameId: gameIdSchema, operationId: statsOperationIdSchema, complete: z.boolean() })
|
|
103
|
-
.strict();
|
|
99
|
+
export const AdminDeleteSportGameResultSchema = z.object({ gameId: gameIdSchema }).strict();
|
|
104
100
|
//# sourceMappingURL=schedules.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedules.js","sourceRoot":"","sources":["../../src/schemas/schedules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EACL,WAAW,EACX,aAAa,EACb,YAAY,EACZ,cAAc,EACd,oBAAoB,EACpB,
|
|
1
|
+
{"version":3,"file":"schedules.js","sourceRoot":"","sources":["../../src/schemas/schedules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EACL,WAAW,EACX,aAAa,EACb,YAAY,EACZ,cAAc,EACd,oBAAoB,EACpB,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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E3F,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC","sourcesContent":["import { z } from 'zod';\nimport { MAX_SCHEDULE_WEEK_GAMES } from '../constants/business.js';\nimport { textFieldSchema } from './text-field.js';\nimport { SCHEDULE_WEEK_TITLE_INPUT } from '../constants/text-fields.js';\nimport {\n countSchema,\n epochMsSchema,\n gameIdSchema,\n leagueIdSchema,\n scheduleWeekIdSchema,\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 '../doc-schemas/game-location.js';\n\nexport const scheduleWeekTitleSchema = textFieldSchema(SCHEDULE_WEEK_TITLE_INPUT);\n\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\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\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\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\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 })\n .strict();\nexport type AdminDeleteScheduleWeekResult = z.infer<typeof AdminDeleteScheduleWeekResultSchema>;\n\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\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\nexport const AdminDeleteSportGameInputSchema = z.object({ gameId: gameIdSchema }).strict();\nexport type AdminDeleteSportGameInput = z.infer<typeof AdminDeleteSportGameInputSchema>;\nexport const AdminDeleteSportGameResultSchema = z.object({ gameId: gameIdSchema }).strict();\nexport type AdminDeleteSportGameResult = z.infer<typeof AdminDeleteSportGameResultSchema>;\n"]}
|
package/dist/schemas/stats.d.ts
CHANGED
|
@@ -340,7 +340,6 @@ export declare const RunStatsValidationResultSchema: z.ZodObject<{
|
|
|
340
340
|
finalRecordMissing: "finalRecordMissing";
|
|
341
341
|
finalRecordMismatch: "finalRecordMismatch";
|
|
342
342
|
participationSnapshotMismatch: "participationSnapshotMismatch";
|
|
343
|
-
gameHeld: "gameHeld";
|
|
344
343
|
aggregateMismatch: "aggregateMismatch";
|
|
345
344
|
aggregateEntryStale: "aggregateEntryStale";
|
|
346
345
|
aggregateEntryMissing: "aggregateEntryMissing";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/schemas/stats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAyCxB,eAAO,MAAM,uBAAuB;;kBAA8C,CAAC;AACnF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,wBAAwB;;;;;;;;kBAO1B,CAAC;AACZ,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,eAAO,MAAM,qBAAqB;;;kBAEvB,CAAC;AACZ,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,sBAAsB;;;;;;;kBAMxB,CAAC;AACZ,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,yCAAyC;;;;;;kBAQ3C,CAAC;AACZ,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,KAAK,CACvD,OAAO,yCAAyC,CACjD,CAAC;AAEF,eAAO,MAAM,0CAA0C;;;;;;;;;kBAQ5C,CAAC;AACZ,MAAM,MAAM,oCAAoC,GAAG,CAAC,CAAC,KAAK,CACxD,OAAO,0CAA0C,CAClD,CAAC;AAgBF,eAAO,MAAM,iCAAiC;;;;;;kBAGO,CAAC;AACtD,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAC;AAE5F,eAAO,MAAM,oCAAoC;;;;;kBAGI,C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O,MAAM,6BAA6B;;;;;;kBAE/B,CAAC;AACZ,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEpF,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAOhC,CAAC;AACZ,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF,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/teams.d.ts
CHANGED
|
@@ -332,14 +332,12 @@ export declare const LinkGhostPlayerResultSchema: z.ZodObject<{
|
|
|
332
332
|
teamId: z.ZodString;
|
|
333
333
|
ghostUserId: z.ZodString;
|
|
334
334
|
userId: z.ZodString;
|
|
335
|
-
|
|
336
|
-
gamesMoved: z.ZodNumber;
|
|
337
|
-
membershipOutcome: z.ZodOptional<z.ZodEnum<{
|
|
335
|
+
membershipOutcome: z.ZodEnum<{
|
|
338
336
|
handedOver: "handedOver";
|
|
339
337
|
created: "created";
|
|
340
338
|
merged: "merged";
|
|
341
339
|
kept: "kept";
|
|
342
|
-
}
|
|
340
|
+
}>;
|
|
343
341
|
publicUserDeleted: z.ZodBoolean;
|
|
344
342
|
}, z.core.$strict>;
|
|
345
343
|
export type LinkGhostPlayerResult = z.infer<typeof LinkGhostPlayerResultSchema>;
|
|
@@ -354,14 +352,12 @@ export declare const AdminLinkClosedLeagueGhostPlayerResultSchema: z.ZodObject<{
|
|
|
354
352
|
teamId: z.ZodString;
|
|
355
353
|
ghostUserId: z.ZodString;
|
|
356
354
|
userId: z.ZodString;
|
|
357
|
-
|
|
358
|
-
gamesMoved: z.ZodNumber;
|
|
359
|
-
membershipOutcome: z.ZodOptional<z.ZodEnum<{
|
|
355
|
+
membershipOutcome: z.ZodEnum<{
|
|
360
356
|
handedOver: "handedOver";
|
|
361
357
|
created: "created";
|
|
362
358
|
merged: "merged";
|
|
363
359
|
kept: "kept";
|
|
364
|
-
}
|
|
360
|
+
}>;
|
|
365
361
|
publicUserDeleted: z.ZodBoolean;
|
|
366
362
|
}, z.core.$strict>;
|
|
367
363
|
export type AdminLinkClosedLeagueGhostPlayerResult = LinkGhostPlayerResult;
|
|
@@ -413,20 +409,15 @@ export declare const DeleteTeamGhostPlayerResultSchema: z.ZodObject<{
|
|
|
413
409
|
leagueId: z.ZodString;
|
|
414
410
|
teamId: z.ZodString;
|
|
415
411
|
ghostUserId: z.ZodString;
|
|
416
|
-
complete: z.ZodBoolean;
|
|
417
412
|
finishedGameEntriesRemoved: z.ZodNumber;
|
|
418
413
|
publicUserDeleted: z.ZodBoolean;
|
|
419
414
|
}, z.core.$strict>;
|
|
420
415
|
export type DeleteTeamGhostPlayerResult = z.infer<typeof DeleteTeamGhostPlayerResultSchema>;
|
|
421
416
|
export declare const GhostRemovalRefusalDetailsSchema: z.ZodObject<{
|
|
422
417
|
reason: z.ZodEnum<{
|
|
423
|
-
gameHeld: "gameHeld";
|
|
424
418
|
ghostHasPlayed: "ghostHasPlayed";
|
|
425
|
-
removalStopped: "removalStopped";
|
|
426
|
-
ghostBeingLinked: "ghostBeingLinked";
|
|
427
419
|
captainNotRemovable: "captainNotRemovable";
|
|
428
420
|
}>;
|
|
429
|
-
finishedGameEntriesRemoved: z.ZodOptional<z.ZodNumber>;
|
|
430
421
|
}, z.core.$strict>;
|
|
431
422
|
export type GhostRemovalRefusalDetails = z.infer<typeof GhostRemovalRefusalDetailsSchema>;
|
|
432
423
|
export declare const AdminUpdateLeagueTeamCaptainInputSchema: z.ZodObject<{
|
|
@@ -478,8 +469,6 @@ export declare const AdminDeleteLeagueTeamInputSchema: z.ZodObject<{
|
|
|
478
469
|
export type AdminDeleteLeagueTeamInput = z.infer<typeof AdminDeleteLeagueTeamInputSchema>;
|
|
479
470
|
export declare const AdminDeleteLeagueTeamResultSchema: z.ZodObject<{
|
|
480
471
|
teamId: z.ZodString;
|
|
481
|
-
complete: z.ZodBoolean;
|
|
482
|
-
remainingGameCount: z.ZodNumber;
|
|
483
472
|
}, z.core.$strict>;
|
|
484
473
|
export type AdminDeleteLeagueTeamResult = z.infer<typeof AdminDeleteLeagueTeamResultSchema>;
|
|
485
474
|
export declare const LEAGUE_TEAM_DELETE_REFUSAL_KEYS: readonly ["teamHasPlayed"];
|
|
@@ -488,7 +477,6 @@ export declare const LeagueTeamDeleteRefusalDetailsSchema: z.ZodObject<{
|
|
|
488
477
|
reason: z.ZodEnum<{
|
|
489
478
|
teamHasPlayed: "teamHasPlayed";
|
|
490
479
|
}>;
|
|
491
|
-
deletedGameCount: z.ZodNumber;
|
|
492
480
|
}, z.core.$strict>;
|
|
493
481
|
export type LeagueTeamDeleteRefusalDetails = z.infer<typeof LeagueTeamDeleteRefusalDetailsSchema>;
|
|
494
482
|
//# sourceMappingURL=teams.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"teams.d.ts","sourceRoot":"","sources":["../../src/schemas/teams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA+BxB,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAwC,CAAC;AACjF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ema,
|
|
88
|
-
|
|
89
|
-
gamesMoved: countSchema,
|
|
90
|
-
membershipOutcome: z.enum(GHOST_LINK_MEMBERSHIP_OUTCOME_KEYS).optional(),
|
|
88
|
+
membershipOutcome: z.enum(GHOST_LINK_MEMBERSHIP_OUTCOME_KEYS),
|
|
91
89
|
publicUserDeleted: z.boolean(),
|
|
92
90
|
})
|
|
93
91
|
.strict();
|
|
@@ -133,16 +131,12 @@ export const DeleteTeamGhostPlayerResultSchema = z
|
|
|
133
131
|
leagueId: leagueIdSchema,
|
|
134
132
|
teamId: teamIdSchema,
|
|
135
133
|
ghostUserId: userIdSchema,
|
|
136
|
-
complete: z.boolean(),
|
|
137
134
|
finishedGameEntriesRemoved: countSchema,
|
|
138
135
|
publicUserDeleted: z.boolean(),
|
|
139
136
|
})
|
|
140
137
|
.strict();
|
|
141
138
|
export const GhostRemovalRefusalDetailsSchema = z
|
|
142
|
-
.object({
|
|
143
|
-
reason: z.enum(GHOST_REMOVAL_REFUSAL_KEYS),
|
|
144
|
-
finishedGameEntriesRemoved: countSchema.optional(),
|
|
145
|
-
})
|
|
139
|
+
.object({ reason: z.enum(GHOST_REMOVAL_REFUSAL_KEYS) })
|
|
146
140
|
.strict();
|
|
147
141
|
export const AdminUpdateLeagueTeamCaptainInputSchema = z
|
|
148
142
|
.object({ teamId: teamIdSchema, captainUserId: userIdSchema })
|
|
@@ -170,15 +164,9 @@ export const AdminUpdateLeagueTeamContactInputSchema = z
|
|
|
170
164
|
.strict();
|
|
171
165
|
export const AdminUpdateLeagueTeamContactResultSchema = AdminUpdateLeagueTeamResultSchema;
|
|
172
166
|
export const AdminDeleteLeagueTeamInputSchema = z.object({ teamId: teamIdSchema }).strict();
|
|
173
|
-
export const AdminDeleteLeagueTeamResultSchema = z
|
|
174
|
-
.object({
|
|
175
|
-
teamId: teamIdSchema,
|
|
176
|
-
complete: z.boolean(),
|
|
177
|
-
remainingGameCount: countSchema,
|
|
178
|
-
})
|
|
179
|
-
.strict();
|
|
167
|
+
export const AdminDeleteLeagueTeamResultSchema = z.object({ teamId: teamIdSchema }).strict();
|
|
180
168
|
export const LEAGUE_TEAM_DELETE_REFUSAL_KEYS = ['teamHasPlayed'];
|
|
181
169
|
export const LeagueTeamDeleteRefusalDetailsSchema = z
|
|
182
|
-
.object({ reason: z.enum(LEAGUE_TEAM_DELETE_REFUSAL_KEYS)
|
|
170
|
+
.object({ reason: z.enum(LEAGUE_TEAM_DELETE_REFUSAL_KEYS) })
|
|
183
171
|
.strict();
|
|
184
172
|
//# sourceMappingURL=teams.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"teams.js","sourceRoot":"","sources":["../../src/schemas/teams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,8BAA8B,EAC9B,8BAA8B,GAC/B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,WAAW,EACX,uBAAuB,EACvB,YAAY,EACZ,cAAc,EACd,gCAAgC,EAChC,cAAc,EACd,YAAY,EACZ,cAAc,EACd,cAAc,EACd,YAAY,GACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,0BAA0B,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,kCAAkC,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AACnG,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEnF,MAAM,kBAAkB,GAAG;IACzB,QAAQ,EAAE,cAAc;IACxB,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,cAAc;IACpB,QAAQ,EAAE,cAAc,CAAC,QAAQ,EAAE;IACnC,YAAY,EAAE,kBAAkB;CACjC,CAAC;AAEF,MAAM,CA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countSchema,\n documentIdSegmentSchema,\n gameIdSchema,\n leagueIdSchema,\n membershipRosterSyncStatusSchema,\n teamIconSchema,\n teamIdSchema,\n teamRoleSchema,\n teamTypeSchema,\n userIdSchema,\n} from '../doc-schemas/atoms.js';\nimport { buildGhostUserIdForRequest, isGhostUserId } from '../ids/minted-ids.js';\nimport { isDocumentIdSegment } from '../paths/utils.js';\nimport { GHOST_LINK_MEMBERSHIP_OUTCOME_KEYS, GHOST_REMOVAL_REFUSAL_KEYS } from '../types/stats.js';\nimport { MEMBER_ASSIGNABLE_TEAM_ROLES } from '../types/unions.js';\nimport { contactPhoneSchema, displayNameSchema, teamNameSchema } from './atoms.js';\n\nconst teamCreationFields = {\n leagueId: leagueIdSchema,\n name: teamNameSchema,\n icon: teamIconSchema,\n teamType: teamTypeSchema.optional(),\n contactPhone: contactPhoneSchema,\n};\n\nexport const CreateLeagueTeamInputSchema = z.object(teamCreationFields).strict();\nexport type CreateLeagueTeamInput = z.infer<typeof CreateLeagueTeamInputSchema>;\n\nexport const AdminCreateLeagueTeamInputSchema = z\n .object({ ...teamCreationFields, captainDisplayName: displayNameSchema })\n .strict();\nexport type AdminCreateLeagueTeamInput = z.infer<typeof AdminCreateLeagueTeamInputSchema>;\n\nexport const CreateLeagueTeamResultSchema = z\n .object({ leagueId: leagueIdSchema, teamId: teamIdSchema, captainUserId: userIdSchema })\n .strict();\nexport type CreateLeagueTeamResult = z.infer<typeof CreateLeagueTeamResultSchema>;\n\nexport const ghostCreateRequestIdSchema = documentIdSegmentSchema.refine(\n (requestId) => isDocumentIdSegment(buildGhostUserIdForRequest(requestId)),\n 'Not a ghost add request id.',\n);\n\nexport const CreateTeamGhostPlayerInputSchema = z\n .object({\n teamId: teamIdSchema,\n displayName: displayNameSchema,\n requestId: ghostCreateRequestIdSchema,\n })\n .strict();\nexport type CreateTeamGhostPlayerInput = z.infer<typeof CreateTeamGhostPlayerInputSchema>;\n\nexport const CreateGameGhostPlayerInputSchema = z\n .object({\n gameId: gameIdSchema,\n teamId: teamIdSchema,\n displayName: displayNameSchema,\n requestId: ghostCreateRequestIdSchema,\n })\n .strict();\nexport type CreateGameGhostPlayerInput = z.infer<typeof CreateGameGhostPlayerInputSchema>;\n\nexport const CreateGhostPlayerResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n ghostUserId: userIdSchema,\n rosterSyncStatus: membershipRosterSyncStatusSchema,\n })\n .strict();\nexport type CreateGhostPlayerResult = z.infer<typeof CreateGhostPlayerResultSchema>;\n\nexport const GetLeagueJoinWarningInputSchema = z\n .object({\n leagueId: leagueIdSchema,\n userId: userIdSchema,\n targetTeamId: teamIdSchema.optional(),\n actedOn: leagueJoinWarningActedOnSchema.optional(),\n })\n .strict();\nexport type GetLeagueJoinWarningInput = z.infer<typeof GetLeagueJoinWarningInputSchema>;\n\nexport const GetLeagueJoinWarningResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n userId: userIdSchema,\n findings: z.array(leagueJoinWarningFindingSchema),\n })\n .strict();\nexport type GetLeagueJoinWarningResult = z.infer<typeof GetLeagueJoinWarningResultSchema>;\n\nexport const AdminRetryLeagueTeamRosterSyncInputSchema = z\n .object({ teamId: teamIdSchema })\n .strict();\nexport type AdminRetryLeagueTeamRosterSyncInput = z.infer<\n typeof AdminRetryLeagueTeamRosterSyncInputSchema\n>;\n\nexport const AdminRetryLeagueTeamRosterSyncResultSchema = z\n .object({\n teamId: teamIdSchema,\n retried: countSchema,\n // null when the immediate attempt after the commit did not run; the scheduler still finishes\n // every obligation the retry re-armed.\n reconciled: countSchema.nullable(),\n damagedTeamMembershipIds: z.array(z.string().min(1)),\n })\n .strict();\nexport type AdminRetryLeagueTeamRosterSyncResult = z.infer<\n typeof AdminRetryLeagueTeamRosterSyncResultSchema\n>;\n\nexport const LinkGhostPlayerInputSchema = z\n .object({\n teamId: teamIdSchema,\n ghostUserId: userIdSchema,\n userId: userIdSchema,\n })\n .strict();\nexport type LinkGhostPlayerInput = z.infer<typeof LinkGhostPlayerInputSchema>;\n\nexport const LinkGhostPlayerResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n ghostUserId: userIdSchema,\n userId: userIdSchema,\n complete: z.boolean(),\n gamesMoved: countSchema,\n membershipOutcome: z.enum(GHOST_LINK_MEMBERSHIP_OUTCOME_KEYS).optional(),\n publicUserDeleted: z.boolean(),\n })\n .strict();\nexport type LinkGhostPlayerResult = z.infer<typeof LinkGhostPlayerResultSchema>;\n\nexport const AdminLinkClosedLeagueGhostPlayerInputSchema = LinkGhostPlayerInputSchema;\nexport type AdminLinkClosedLeagueGhostPlayerInput = LinkGhostPlayerInput;\nexport const AdminLinkClosedLeagueGhostPlayerResultSchema = LinkGhostPlayerResultSchema;\nexport type AdminLinkClosedLeagueGhostPlayerResult = LinkGhostPlayerResult;\n\nexport const ghostUserIdSchema = userIdSchema.refine(isGhostUserId, 'Not a ghost player.');\n\nexport const UpdateTeamMembershipRoleInputSchema = z\n .object({\n teamId: teamIdSchema,\n userId: userIdSchema,\n role: z.enum(MEMBER_ASSIGNABLE_TEAM_ROLES),\n })\n .strict();\nexport type UpdateTeamMembershipRoleInput = z.infer<typeof UpdateTeamMembershipRoleInputSchema>;\n\nexport const UpdateTeamMembershipRoleResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n userId: userIdSchema,\n role: teamRoleSchema,\n changed: z.boolean(),\n })\n .strict();\nexport type UpdateTeamMembershipRoleResult = z.infer<typeof UpdateTeamMembershipRoleResultSchema>;\n\nexport const DeleteTeamMembershipInputSchema = z\n .object({\n teamId: teamIdSchema,\n userId: userIdSchema.refine(\n (userId) => !isGhostUserId(userId),\n 'A ghost player is removed as a ghost player.',\n ),\n })\n .strict();\nexport type DeleteTeamMembershipInput = z.infer<typeof DeleteTeamMembershipInputSchema>;\n\nexport const DeleteTeamMembershipResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n userId: userIdSchema,\n deleted: z.boolean(),\n rosterSyncStatus: membershipRosterSyncStatusSchema,\n })\n .strict();\nexport type DeleteTeamMembershipResult = z.infer<typeof DeleteTeamMembershipResultSchema>;\n\nexport const DeleteTeamGhostPlayerInputSchema = z\n .object({ teamId: teamIdSchema, ghostUserId: ghostUserIdSchema })\n .strict();\nexport type DeleteTeamGhostPlayerInput = z.infer<typeof DeleteTeamGhostPlayerInputSchema>;\n\nexport const DeleteTeamGhostPlayerResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n ghostUserId: userIdSchema,\n complete: z.boolean(),\n finishedGameEntriesRemoved: countSchema,\n publicUserDeleted: z.boolean(),\n })\n .strict();\nexport type DeleteTeamGhostPlayerResult = z.infer<typeof DeleteTeamGhostPlayerResultSchema>;\n\nexport const GhostRemovalRefusalDetailsSchema = z\n .object({\n reason: z.enum(GHOST_REMOVAL_REFUSAL_KEYS),\n finishedGameEntriesRemoved: countSchema.optional(),\n })\n .strict();\nexport type GhostRemovalRefusalDetails = z.infer<typeof GhostRemovalRefusalDetailsSchema>;\n\nexport const AdminUpdateLeagueTeamCaptainInputSchema = z\n .object({ teamId: teamIdSchema, captainUserId: userIdSchema })\n .strict();\nexport type AdminUpdateLeagueTeamCaptainInput = z.infer<\n typeof AdminUpdateLeagueTeamCaptainInputSchema\n>;\n\nexport const AdminUpdateLeagueTeamCaptainResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n captainUserId: userIdSchema,\n demotedUserIds: z.array(userIdSchema),\n changed: z.boolean(),\n })\n .strict();\nexport type AdminUpdateLeagueTeamCaptainResult = z.infer<\n typeof AdminUpdateLeagueTeamCaptainResultSchema\n>;\n\nexport const AdminUpdateLeagueTeamNameInputSchema = z\n .object({ teamId: teamIdSchema, name: teamNameSchema })\n .strict();\nexport type AdminUpdateLeagueTeamNameInput = z.infer<typeof AdminUpdateLeagueTeamNameInputSchema>;\n\nexport const AdminUpdateLeagueTeamTypeInputSchema = z\n .object({ teamId: teamIdSchema, teamType: teamTypeSchema })\n .strict();\nexport type AdminUpdateLeagueTeamTypeInput = z.infer<typeof AdminUpdateLeagueTeamTypeInputSchema>;\n\nexport const AdminUpdateLeagueTeamResultSchema = z\n .object({ leagueId: leagueIdSchema, teamId: teamIdSchema, changed: z.boolean() })\n .strict();\nexport type AdminUpdateLeagueTeamResult = z.infer<typeof AdminUpdateLeagueTeamResultSchema>;\n\nexport const AdminUpdateLeagueTeamContactInputSchema = z\n .object({ teamId: teamIdSchema, contactPhone: contactPhoneSchema })\n .strict();\nexport type AdminUpdateLeagueTeamContactInput = z.infer<\n typeof AdminUpdateLeagueTeamContactInputSchema\n>;\n\nexport const AdminUpdateLeagueTeamContactResultSchema = AdminUpdateLeagueTeamResultSchema;\nexport type AdminUpdateLeagueTeamContactResult = AdminUpdateLeagueTeamResult;\n\nexport const AdminDeleteLeagueTeamInputSchema = z.object({ teamId: teamIdSchema }).strict();\nexport type AdminDeleteLeagueTeamInput = z.infer<typeof AdminDeleteLeagueTeamInputSchema>;\n\nexport const AdminDeleteLeagueTeamResultSchema = z\n .object({\n teamId: teamIdSchema,\n complete: z.boolean(),\n remainingGameCount: countSchema,\n })\n .strict();\nexport type AdminDeleteLeagueTeamResult = z.infer<typeof AdminDeleteLeagueTeamResultSchema>;\n\nexport const LEAGUE_TEAM_DELETE_REFUSAL_KEYS = ['teamHasPlayed'] as const;\nexport type LeagueTeamDeleteRefusal = (typeof LEAGUE_TEAM_DELETE_REFUSAL_KEYS)[number];\nexport const LeagueTeamDeleteRefusalDetailsSchema = z\n .object({ reason: z.enum(LEAGUE_TEAM_DELETE_REFUSAL_KEYS), deletedGameCount: countSchema })\n .strict();\nexport type LeagueTeamDeleteRefusalDetails = z.infer<typeof LeagueTeamDeleteRefusalDetailsSchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"teams.js","sourceRoot":"","sources":["../../src/schemas/teams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAA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CAAC,CAAC,MAAM,EAAE,CAAC;AAG5F,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAG7F,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,eAAe,CAAU,CAAC;AAE1E,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC;KAClD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,+BAA+B,CAAC,EAAE,CAAC;KAC3D,MAAM,EAAE,CAAC","sourcesContent":["import { z } from 'zod';\nimport {\n leagueJoinWarningActedOnSchema,\n leagueJoinWarningFindingSchema,\n} from '../utils/league-join-warning.js';\nimport {\n countSchema,\n documentIdSegmentSchema,\n gameIdSchema,\n leagueIdSchema,\n membershipRosterSyncStatusSchema,\n teamIconSchema,\n teamIdSchema,\n teamRoleSchema,\n teamTypeSchema,\n userIdSchema,\n} from '../doc-schemas/atoms.js';\nimport { buildGhostUserIdForRequest, isGhostUserId } from '../ids/minted-ids.js';\nimport { isDocumentIdSegment } from '../paths/utils.js';\nimport { GHOST_LINK_MEMBERSHIP_OUTCOME_KEYS, GHOST_REMOVAL_REFUSAL_KEYS } from '../types/stats.js';\nimport { MEMBER_ASSIGNABLE_TEAM_ROLES } from '../types/unions.js';\nimport { contactPhoneSchema, displayNameSchema, teamNameSchema } from './atoms.js';\n\nconst teamCreationFields = {\n leagueId: leagueIdSchema,\n name: teamNameSchema,\n icon: teamIconSchema,\n teamType: teamTypeSchema.optional(),\n contactPhone: contactPhoneSchema,\n};\n\nexport const CreateLeagueTeamInputSchema = z.object(teamCreationFields).strict();\nexport type CreateLeagueTeamInput = z.infer<typeof CreateLeagueTeamInputSchema>;\n\nexport const AdminCreateLeagueTeamInputSchema = z\n .object({ ...teamCreationFields, captainDisplayName: displayNameSchema })\n .strict();\nexport type AdminCreateLeagueTeamInput = z.infer<typeof AdminCreateLeagueTeamInputSchema>;\n\nexport const CreateLeagueTeamResultSchema = z\n .object({ leagueId: leagueIdSchema, teamId: teamIdSchema, captainUserId: userIdSchema })\n .strict();\nexport type CreateLeagueTeamResult = z.infer<typeof CreateLeagueTeamResultSchema>;\n\nexport const ghostCreateRequestIdSchema = documentIdSegmentSchema.refine(\n (requestId) => isDocumentIdSegment(buildGhostUserIdForRequest(requestId)),\n 'Not a ghost add request id.',\n);\n\nexport const CreateTeamGhostPlayerInputSchema = z\n .object({\n teamId: teamIdSchema,\n displayName: displayNameSchema,\n requestId: ghostCreateRequestIdSchema,\n })\n .strict();\nexport type CreateTeamGhostPlayerInput = z.infer<typeof CreateTeamGhostPlayerInputSchema>;\n\nexport const CreateGameGhostPlayerInputSchema = z\n .object({\n gameId: gameIdSchema,\n teamId: teamIdSchema,\n displayName: displayNameSchema,\n requestId: ghostCreateRequestIdSchema,\n })\n .strict();\nexport type CreateGameGhostPlayerInput = z.infer<typeof CreateGameGhostPlayerInputSchema>;\n\nexport const CreateGhostPlayerResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n ghostUserId: userIdSchema,\n rosterSyncStatus: membershipRosterSyncStatusSchema,\n })\n .strict();\nexport type CreateGhostPlayerResult = z.infer<typeof CreateGhostPlayerResultSchema>;\n\nexport const GetLeagueJoinWarningInputSchema = z\n .object({\n leagueId: leagueIdSchema,\n userId: userIdSchema,\n targetTeamId: teamIdSchema.optional(),\n actedOn: leagueJoinWarningActedOnSchema.optional(),\n })\n .strict();\nexport type GetLeagueJoinWarningInput = z.infer<typeof GetLeagueJoinWarningInputSchema>;\n\nexport const GetLeagueJoinWarningResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n userId: userIdSchema,\n findings: z.array(leagueJoinWarningFindingSchema),\n })\n .strict();\nexport type GetLeagueJoinWarningResult = z.infer<typeof GetLeagueJoinWarningResultSchema>;\n\nexport const AdminRetryLeagueTeamRosterSyncInputSchema = z\n .object({ teamId: teamIdSchema })\n .strict();\nexport type AdminRetryLeagueTeamRosterSyncInput = z.infer<\n typeof AdminRetryLeagueTeamRosterSyncInputSchema\n>;\n\nexport const AdminRetryLeagueTeamRosterSyncResultSchema = z\n .object({\n teamId: teamIdSchema,\n retried: countSchema,\n // null when the immediate attempt after the commit did not run; the scheduler still finishes\n // every obligation the retry re-armed.\n reconciled: countSchema.nullable(),\n damagedTeamMembershipIds: z.array(z.string().min(1)),\n })\n .strict();\nexport type AdminRetryLeagueTeamRosterSyncResult = z.infer<\n typeof AdminRetryLeagueTeamRosterSyncResultSchema\n>;\n\nexport const LinkGhostPlayerInputSchema = z\n .object({\n teamId: teamIdSchema,\n ghostUserId: userIdSchema,\n userId: userIdSchema,\n })\n .strict();\nexport type LinkGhostPlayerInput = z.infer<typeof LinkGhostPlayerInputSchema>;\n\nexport const LinkGhostPlayerResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n ghostUserId: userIdSchema,\n userId: userIdSchema,\n membershipOutcome: z.enum(GHOST_LINK_MEMBERSHIP_OUTCOME_KEYS),\n publicUserDeleted: z.boolean(),\n })\n .strict();\nexport type LinkGhostPlayerResult = z.infer<typeof LinkGhostPlayerResultSchema>;\n\nexport const AdminLinkClosedLeagueGhostPlayerInputSchema = LinkGhostPlayerInputSchema;\nexport type AdminLinkClosedLeagueGhostPlayerInput = LinkGhostPlayerInput;\nexport const AdminLinkClosedLeagueGhostPlayerResultSchema = LinkGhostPlayerResultSchema;\nexport type AdminLinkClosedLeagueGhostPlayerResult = LinkGhostPlayerResult;\n\nexport const ghostUserIdSchema = userIdSchema.refine(isGhostUserId, 'Not a ghost player.');\n\nexport const UpdateTeamMembershipRoleInputSchema = z\n .object({\n teamId: teamIdSchema,\n userId: userIdSchema,\n role: z.enum(MEMBER_ASSIGNABLE_TEAM_ROLES),\n })\n .strict();\nexport type UpdateTeamMembershipRoleInput = z.infer<typeof UpdateTeamMembershipRoleInputSchema>;\n\nexport const UpdateTeamMembershipRoleResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n userId: userIdSchema,\n role: teamRoleSchema,\n changed: z.boolean(),\n })\n .strict();\nexport type UpdateTeamMembershipRoleResult = z.infer<typeof UpdateTeamMembershipRoleResultSchema>;\n\nexport const DeleteTeamMembershipInputSchema = z\n .object({\n teamId: teamIdSchema,\n userId: userIdSchema.refine(\n (userId) => !isGhostUserId(userId),\n 'A ghost player is removed as a ghost player.',\n ),\n })\n .strict();\nexport type DeleteTeamMembershipInput = z.infer<typeof DeleteTeamMembershipInputSchema>;\n\nexport const DeleteTeamMembershipResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n userId: userIdSchema,\n deleted: z.boolean(),\n rosterSyncStatus: membershipRosterSyncStatusSchema,\n })\n .strict();\nexport type DeleteTeamMembershipResult = z.infer<typeof DeleteTeamMembershipResultSchema>;\n\nexport const DeleteTeamGhostPlayerInputSchema = z\n .object({ teamId: teamIdSchema, ghostUserId: ghostUserIdSchema })\n .strict();\nexport type DeleteTeamGhostPlayerInput = z.infer<typeof DeleteTeamGhostPlayerInputSchema>;\n\nexport const DeleteTeamGhostPlayerResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n ghostUserId: userIdSchema,\n finishedGameEntriesRemoved: countSchema,\n publicUserDeleted: z.boolean(),\n })\n .strict();\nexport type DeleteTeamGhostPlayerResult = z.infer<typeof DeleteTeamGhostPlayerResultSchema>;\n\nexport const GhostRemovalRefusalDetailsSchema = z\n .object({ reason: z.enum(GHOST_REMOVAL_REFUSAL_KEYS) })\n .strict();\nexport type GhostRemovalRefusalDetails = z.infer<typeof GhostRemovalRefusalDetailsSchema>;\n\nexport const AdminUpdateLeagueTeamCaptainInputSchema = z\n .object({ teamId: teamIdSchema, captainUserId: userIdSchema })\n .strict();\nexport type AdminUpdateLeagueTeamCaptainInput = z.infer<\n typeof AdminUpdateLeagueTeamCaptainInputSchema\n>;\n\nexport const AdminUpdateLeagueTeamCaptainResultSchema = z\n .object({\n leagueId: leagueIdSchema,\n teamId: teamIdSchema,\n captainUserId: userIdSchema,\n demotedUserIds: z.array(userIdSchema),\n changed: z.boolean(),\n })\n .strict();\nexport type AdminUpdateLeagueTeamCaptainResult = z.infer<\n typeof AdminUpdateLeagueTeamCaptainResultSchema\n>;\n\nexport const AdminUpdateLeagueTeamNameInputSchema = z\n .object({ teamId: teamIdSchema, name: teamNameSchema })\n .strict();\nexport type AdminUpdateLeagueTeamNameInput = z.infer<typeof AdminUpdateLeagueTeamNameInputSchema>;\n\nexport const AdminUpdateLeagueTeamTypeInputSchema = z\n .object({ teamId: teamIdSchema, teamType: teamTypeSchema })\n .strict();\nexport type AdminUpdateLeagueTeamTypeInput = z.infer<typeof AdminUpdateLeagueTeamTypeInputSchema>;\n\nexport const AdminUpdateLeagueTeamResultSchema = z\n .object({ leagueId: leagueIdSchema, teamId: teamIdSchema, changed: z.boolean() })\n .strict();\nexport type AdminUpdateLeagueTeamResult = z.infer<typeof AdminUpdateLeagueTeamResultSchema>;\n\nexport const AdminUpdateLeagueTeamContactInputSchema = z\n .object({ teamId: teamIdSchema, contactPhone: contactPhoneSchema })\n .strict();\nexport type AdminUpdateLeagueTeamContactInput = z.infer<\n typeof AdminUpdateLeagueTeamContactInputSchema\n>;\n\nexport const AdminUpdateLeagueTeamContactResultSchema = AdminUpdateLeagueTeamResultSchema;\nexport type AdminUpdateLeagueTeamContactResult = AdminUpdateLeagueTeamResult;\n\nexport const AdminDeleteLeagueTeamInputSchema = z.object({ teamId: teamIdSchema }).strict();\nexport type AdminDeleteLeagueTeamInput = z.infer<typeof AdminDeleteLeagueTeamInputSchema>;\n\nexport const AdminDeleteLeagueTeamResultSchema = z.object({ teamId: teamIdSchema }).strict();\nexport type AdminDeleteLeagueTeamResult = z.infer<typeof AdminDeleteLeagueTeamResultSchema>;\n\nexport const LEAGUE_TEAM_DELETE_REFUSAL_KEYS = ['teamHasPlayed'] as const;\nexport type LeagueTeamDeleteRefusal = (typeof LEAGUE_TEAM_DELETE_REFUSAL_KEYS)[number];\nexport const LeagueTeamDeleteRefusalDetailsSchema = z\n .object({ reason: z.enum(LEAGUE_TEAM_DELETE_REFUSAL_KEYS) })\n .strict();\nexport type LeagueTeamDeleteRefusalDetails = z.infer<typeof LeagueTeamDeleteRefusalDetailsSchema>;\n"]}
|
|
@@ -32,16 +32,9 @@ export interface SignedContribution {
|
|
|
32
32
|
readonly sign: 1 | -1;
|
|
33
33
|
}
|
|
34
34
|
export declare function sumGameContributions(deriveLine: ContributionSpec['deriveLine'], signed: readonly SignedContribution[]): GameContribution;
|
|
35
|
-
export type StatLineChange = {
|
|
36
|
-
readonly ok: true;
|
|
37
|
-
readonly after: StatLineValues | null;
|
|
38
|
-
} | {
|
|
39
|
-
readonly ok: false;
|
|
40
|
-
readonly field: string;
|
|
41
|
-
};
|
|
42
35
|
/**
|
|
43
|
-
* A counter
|
|
44
|
-
*
|
|
36
|
+
* A counter a decrease would take below zero is written as zero, so a stored total never goes
|
|
37
|
+
* below zero (RULE-STD-BACKEND-119).
|
|
45
38
|
*/
|
|
46
|
-
export declare function applyStatLineDelta(deriveLine: ContributionSpec['deriveLine'], kind: StatLineKind, before: StatLineValues | undefined, delta: StatLineValues, sign: 1 | -1):
|
|
39
|
+
export declare function applyStatLineDelta(deriveLine: ContributionSpec['deriveLine'], kind: StatLineKind, before: StatLineValues | undefined, delta: StatLineValues, sign: 1 | -1): StatLineValues | null;
|
|
47
40
|
//# sourceMappingURL=contribution.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contribution.d.ts","sourceRoot":"","sources":["../../src/sports/contribution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAG9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO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AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,cAAc,EACrB,IAAI,GAAE,CAAC,GAAG,CAAC,CAAK,GACf,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CASxB;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,gBAAgB,EACtB,IAAI,EAAE,aAAa,GAClB,gBAAgB,CAgDlB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,YAAY,EAAE,gBAAgB,CAAC;IACxC,QAAQ,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACvB;AAED,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,gBAAgB,CAAC,YAAY,CAAC,EAC1C,MAAM,EAAE,SAAS,kBAAkB,EAAE,GACpC,gBAAgB,CAuBlB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,gBAAgB,CAAC,YAAY,CAAC,EAC1C,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,cAAc,GAAG,SAAS,EAClC,KAAK,EAAE,cAAc,EACrB,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,GACX,cAAc,GAAG,IAAI,CAQvB"}
|
|
@@ -113,16 +113,17 @@ export function sumGameContributions(deriveLine, signed) {
|
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
115
|
/**
|
|
116
|
-
* A counter
|
|
117
|
-
*
|
|
116
|
+
* A counter a decrease would take below zero is written as zero, so a stored total never goes
|
|
117
|
+
* below zero (RULE-STD-BACKEND-119).
|
|
118
118
|
*/
|
|
119
119
|
export function applyStatLineDelta(deriveLine, kind, before, delta, sign) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
120
|
+
const moved = addStatLines(before ?? {}, delta, sign);
|
|
121
|
+
const floored = {};
|
|
122
|
+
for (const [field, value] of Object.entries(moved))
|
|
123
|
+
floored[field] = Math.max(0, value);
|
|
124
|
+
// A derived field is recomputed from the floored counters, never moved itself, so a stale stored
|
|
125
|
+
// FP can neither go below zero nor survive.
|
|
126
|
+
const after = deriveLine(kind, floored);
|
|
127
|
+
return isZeroStatLine(after) ? null : after;
|
|
127
128
|
}
|
|
128
129
|
//# sourceMappingURL=contribution.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contribution.js","sourceRoot":"","sources":["../../src/sports/contribution.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAkB7C,MAAM,CAAC,MAAM,uBAAuB,GAAqB;IACvD,SAAS,EAAE,EAAE;IACb,cAAc,EAAE,EAAE;IAClB,WAAW,EAAE,EAAE;CAChB,CAAC;AASF,SAAS,OAAO,CAAC,IAAgC,EAAE,KAAa;IAC9D,MAAM,KAAK,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC;IAC5B,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAoB;IACjD,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC;AACxF,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,IAAuE,EACvE,KAAgB,EAChB,eAAkC,EAClC,qBAAwC;IAExC,IAAI,CAAC,IAAI,CAAC,oBAAoB;QAAE,OAAO,EAAE,CAAC;IAC1C,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,qBAAqB,CAAC,CAAC;IAC9C,MAAM,WAAW,GA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,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;AACnE,CAAC","sourcesContent":["import type { GameStats } from '../doc-schemas/sport-game.js';\nimport { parseGameRosterPlayerId } from '../ids/compound-ids.js';\nimport { isGhostUserId } from '../ids/minted-ids.js';\nimport type { LeagueType } from '../types/sports.js';\nimport type { StatLineKind } from '../types/stats.js';\nimport { isAllZeroLine } from './scoring.js';\nimport type { StatLineValues } from './scoring.js';\n\nexport interface FinalizedGame {\n readonly leagueType: LeagueType;\n readonly teamIds: readonly string[];\n readonly stats: GameStats;\n readonly rosterPlayerIds: readonly string[];\n readonly absentRosterPlayerIds: readonly string[];\n readonly nonScoringRosterPlayerIds: readonly string[];\n}\n\nexport interface GameContribution {\n readonly teamLines: Readonly<Record<string, StatLineValues>>;\n readonly membershipRows: Readonly<Record<string, StatLineValues>>;\n readonly personLines: Readonly<Record<string, StatLineValues>>;\n}\n\nexport const EMPTY_GAME_CONTRIBUTION: GameContribution = {\n teamLines: {},\n membershipRows: {},\n personLines: {},\n};\n\nexport interface ContributionSpec {\n readonly playerStatKeys: readonly string[];\n readonly teamSeasonPlayerSums: readonly string[];\n readonly zeroLineIsNonScoring: boolean;\n readonly deriveLine: (kind: StatLineKind, line: StatLineValues) => StatLineValues;\n}\n\nfunction counter(line: StatLineValues | undefined, field: string): number {\n const value = line?.[field];\n return typeof value === 'number' ? value : 0;\n}\n\nexport function isZeroStatLine(line: StatLineValues): boolean {\n return Object.values(line).every((value) => typeof value !== 'number' || value === 0);\n}\n\nexport function decideParticipation(\n spec: Pick<ContributionSpec, 'playerStatKeys' | 'zeroLineIsNonScoring'>,\n stats: GameStats,\n rosterPlayerIds: readonly string[],\n absentRosterPlayerIds: readonly string[],\n): string[] {\n if (!spec.zeroLineIsNonScoring) return [];\n const absent = new Set(absentRosterPlayerIds);\n const playerStats = stats.playerStats as Readonly<Record<string, StatLineValues>>;\n return rosterPlayerIds.filter((entryId) => {\n if (absent.has(entryId)) return true;\n const line = playerStats[entryId];\n return line === undefined || isAllZeroLine(line, spec.playerStatKeys);\n });\n}\n\nexport function isCreditedGamePlayed(\n game: Pick<FinalizedGame, 'absentRosterPlayerIds' | 'nonScoringRosterPlayerIds'>,\n entryId: string,\n): boolean {\n return (\n !game.absentRosterPlayerIds.includes(entryId) &&\n !game.nonScoringRosterPlayerIds.includes(entryId)\n );\n}\n\nexport function addStatLines(\n left: StatLineValues,\n right: StatLineValues,\n sign: 1 | -1 = 1,\n): Record<string, number> {\n const sum: Record<string, number> = {};\n for (const field of new Set([...Object.keys(left), ...Object.keys(right)])) {\n const [a, b] = [left[field], right[field]];\n if ((a !== undefined && typeof a !== 'number') || (b !== undefined && typeof b !== 'number'))\n continue;\n sum[field] = (a ?? 0) + sign * (b ?? 0);\n }\n return sum;\n}\n\nexport function buildGameContribution(\n spec: ContributionSpec,\n game: FinalizedGame,\n): GameContribution {\n const teamStats = game.stats.teamStats as Readonly<Record<string, StatLineValues>>;\n const playerStats = game.stats.playerStats as Readonly<Record<string, StatLineValues>>;\n const opponentOf = (teamId: string): string | undefined =>\n game.teamIds.find((other) => other !== teamId);\n const counted = new Set(game.teamIds.filter((teamId) => opponentOf(teamId) !== undefined));\n\n const teamLines: Record<string, StatLineValues> = {};\n for (const teamId of counted) {\n const scored = counter(teamStats[teamId], 'score');\n const allowed = counter(teamStats[opponentOf(teamId) as string], 'score');\n const line: Record<string, number> = {\n gamesPlayed: 1,\n wins: scored > allowed ? 1 : 0,\n losses: scored < allowed ? 1 : 0,\n ties: scored === allowed ? 1 : 0,\n pointsFor: scored,\n pointsAgainst: allowed,\n };\n for (const field of spec.teamSeasonPlayerSums) line[field] = 0;\n for (const [entryId, playerLine] of Object.entries(playerStats)) {\n if (parseGameRosterPlayerId(entryId)?.teamId !== teamId) continue;\n for (const field of spec.teamSeasonPlayerSums)\n line[field] = (line[field] ?? 0) + counter(playerLine, field);\n }\n teamLines[teamId] = spec.deriveLine('teamSeason', line);\n }\n\n const membershipRows: Record<string, StatLineValues> = {};\n const personTotals = new Map<string, Record<string, number>>();\n const entryIds = [...new Set([...game.rosterPlayerIds, ...Object.keys(playerStats)])].sort();\n for (const entryId of entryIds) {\n const entry = parseGameRosterPlayerId(entryId);\n if (entry === null || !counted.has(entry.teamId)) continue;\n const row: Record<string, number> = {\n gamesPlayed: isCreditedGamePlayed(game, entryId) ? 1 : 0,\n };\n for (const field of spec.playerStatKeys) row[field] = counter(playerStats[entryId], field);\n if (isZeroStatLine(row)) continue;\n membershipRows[entryId] = spec.deriveLine('membershipRow', row);\n if (isGhostUserId(entry.userId)) continue;\n personTotals.set(entry.userId, addStatLines(personTotals.get(entry.userId) ?? {}, row));\n }\n\n const personLines: Record<string, StatLineValues> = {};\n for (const [userId, line] of personTotals)\n personLines[userId] = spec.deriveLine('lifetime', line);\n return { teamLines, membershipRows, personLines };\n}\n\nexport interface SignedContribution {\n readonly contribution: GameContribution;\n readonly sign: 1 | -1;\n}\n\nexport function sumGameContributions(\n deriveLine: ContributionSpec['deriveLine'],\n signed: readonly SignedContribution[],\n): GameContribution {\n const fold = (\n pick: (contribution: GameContribution) => Readonly<Record<string, StatLineValues>>,\n kind: StatLineKind,\n ) => {\n const totals = new Map<string, Record<string, number>>();\n for (const { contribution, sign } of signed) {\n for (const [key, line] of Object.entries(pick(contribution))) {\n totals.set(key, addStatLines(totals.get(key) ?? {}, line, sign));\n }\n }\n const lines: Record<string, StatLineValues> = {};\n for (const [key, line] of totals) {\n const derived = deriveLine(kind, line);\n if (!isZeroStatLine(derived)) lines[key] = derived;\n }\n return lines;\n };\n return {\n teamLines: fold((contribution) => contribution.teamLines, 'teamSeason'),\n membershipRows: fold((contribution) => contribution.membershipRows, 'membershipRow'),\n personLines: fold((contribution) => contribution.personLines, 'lifetime'),\n };\n}\n\nexport type StatLineChange =\n | { readonly ok: true; readonly after: StatLineValues | null }\n | { readonly ok: false; readonly field: string };\n\n/**\n * A counter that would go below zero is refused, never clamped: it means the stored line no longer\n * holds what the games put there.\n */\nexport function applyStatLineDelta(\n deriveLine: ContributionSpec['deriveLine'],\n kind: StatLineKind,\n before: StatLineValues | undefined,\n delta: StatLineValues,\n sign: 1 | -1,\n): StatLineChange {\n // A derived field is recomputed from the moved counters, never moved itself, so a stale stored FP\n // can neither go below zero nor survive.\n const after = deriveLine(kind, addStatLines(before ?? {}, delta, sign));\n const below = Object.entries(after).find(([, value]) => typeof value === 'number' && value < 0);\n if (below) return { ok: false, field: below[0] };\n return { ok: true, after: isZeroStatLine(after) ? null : after };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"contribution.js","sourceRoot":"","sources":["../../src/sports/contribution.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAkB7C,MAAM,CAAC,MAAM,uBAAuB,GAAqB;IACvD,SAAS,EAAE,EAAE;IACb,cAAc,EAAE,EAAE;IAClB,WAAW,EAAE,EAAE;CAChB,CAAC;AASF,SAAS,OAAO,CAAC,IAAgC,EAAE,KAAa;IAC9D,MAAM,KAAK,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC;IAC5B,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAoB;IACjD,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC;AACxF,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,IAAuE,EACvE,KAAgB,EAChB,eAAkC,EAClC,qBAAwC;IAExC,IAAI,CAAC,IAAI,CAAC,oBAAoB;QAAE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AAO,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AAC9C,CAAC","sourcesContent":["import type { GameStats } from '../doc-schemas/sport-game.js';\nimport { parseGameRosterPlayerId } from '../ids/compound-ids.js';\nimport { isGhostUserId } from '../ids/minted-ids.js';\nimport type { LeagueType } from '../types/sports.js';\nimport type { StatLineKind } from '../types/stats.js';\nimport { isAllZeroLine } from './scoring.js';\nimport type { StatLineValues } from './scoring.js';\n\nexport interface FinalizedGame {\n readonly leagueType: LeagueType;\n readonly teamIds: readonly string[];\n readonly stats: GameStats;\n readonly rosterPlayerIds: readonly string[];\n readonly absentRosterPlayerIds: readonly string[];\n readonly nonScoringRosterPlayerIds: readonly string[];\n}\n\nexport interface GameContribution {\n readonly teamLines: Readonly<Record<string, StatLineValues>>;\n readonly membershipRows: Readonly<Record<string, StatLineValues>>;\n readonly personLines: Readonly<Record<string, StatLineValues>>;\n}\n\nexport const EMPTY_GAME_CONTRIBUTION: GameContribution = {\n teamLines: {},\n membershipRows: {},\n personLines: {},\n};\n\nexport interface ContributionSpec {\n readonly playerStatKeys: readonly string[];\n readonly teamSeasonPlayerSums: readonly string[];\n readonly zeroLineIsNonScoring: boolean;\n readonly deriveLine: (kind: StatLineKind, line: StatLineValues) => StatLineValues;\n}\n\nfunction counter(line: StatLineValues | undefined, field: string): number {\n const value = line?.[field];\n return typeof value === 'number' ? value : 0;\n}\n\nexport function isZeroStatLine(line: StatLineValues): boolean {\n return Object.values(line).every((value) => typeof value !== 'number' || value === 0);\n}\n\nexport function decideParticipation(\n spec: Pick<ContributionSpec, 'playerStatKeys' | 'zeroLineIsNonScoring'>,\n stats: GameStats,\n rosterPlayerIds: readonly string[],\n absentRosterPlayerIds: readonly string[],\n): string[] {\n if (!spec.zeroLineIsNonScoring) return [];\n const absent = new Set(absentRosterPlayerIds);\n const playerStats = stats.playerStats as Readonly<Record<string, StatLineValues>>;\n return rosterPlayerIds.filter((entryId) => {\n if (absent.has(entryId)) return true;\n const line = playerStats[entryId];\n return line === undefined || isAllZeroLine(line, spec.playerStatKeys);\n });\n}\n\nexport function isCreditedGamePlayed(\n game: Pick<FinalizedGame, 'absentRosterPlayerIds' | 'nonScoringRosterPlayerIds'>,\n entryId: string,\n): boolean {\n return (\n !game.absentRosterPlayerIds.includes(entryId) &&\n !game.nonScoringRosterPlayerIds.includes(entryId)\n );\n}\n\nexport function addStatLines(\n left: StatLineValues,\n right: StatLineValues,\n sign: 1 | -1 = 1,\n): Record<string, number> {\n const sum: Record<string, number> = {};\n for (const field of new Set([...Object.keys(left), ...Object.keys(right)])) {\n const [a, b] = [left[field], right[field]];\n if ((a !== undefined && typeof a !== 'number') || (b !== undefined && typeof b !== 'number'))\n continue;\n sum[field] = (a ?? 0) + sign * (b ?? 0);\n }\n return sum;\n}\n\nexport function buildGameContribution(\n spec: ContributionSpec,\n game: FinalizedGame,\n): GameContribution {\n const teamStats = game.stats.teamStats as Readonly<Record<string, StatLineValues>>;\n const playerStats = game.stats.playerStats as Readonly<Record<string, StatLineValues>>;\n const opponentOf = (teamId: string): string | undefined =>\n game.teamIds.find((other) => other !== teamId);\n const counted = new Set(game.teamIds.filter((teamId) => opponentOf(teamId) !== undefined));\n\n const teamLines: Record<string, StatLineValues> = {};\n for (const teamId of counted) {\n const scored = counter(teamStats[teamId], 'score');\n const allowed = counter(teamStats[opponentOf(teamId) as string], 'score');\n const line: Record<string, number> = {\n gamesPlayed: 1,\n wins: scored > allowed ? 1 : 0,\n losses: scored < allowed ? 1 : 0,\n ties: scored === allowed ? 1 : 0,\n pointsFor: scored,\n pointsAgainst: allowed,\n };\n for (const field of spec.teamSeasonPlayerSums) line[field] = 0;\n for (const [entryId, playerLine] of Object.entries(playerStats)) {\n if (parseGameRosterPlayerId(entryId)?.teamId !== teamId) continue;\n for (const field of spec.teamSeasonPlayerSums)\n line[field] = (line[field] ?? 0) + counter(playerLine, field);\n }\n teamLines[teamId] = spec.deriveLine('teamSeason', line);\n }\n\n const membershipRows: Record<string, StatLineValues> = {};\n const personTotals = new Map<string, Record<string, number>>();\n const entryIds = [...new Set([...game.rosterPlayerIds, ...Object.keys(playerStats)])].sort();\n for (const entryId of entryIds) {\n const entry = parseGameRosterPlayerId(entryId);\n if (entry === null || !counted.has(entry.teamId)) continue;\n const row: Record<string, number> = {\n gamesPlayed: isCreditedGamePlayed(game, entryId) ? 1 : 0,\n };\n for (const field of spec.playerStatKeys) row[field] = counter(playerStats[entryId], field);\n if (isZeroStatLine(row)) continue;\n membershipRows[entryId] = spec.deriveLine('membershipRow', row);\n if (isGhostUserId(entry.userId)) continue;\n personTotals.set(entry.userId, addStatLines(personTotals.get(entry.userId) ?? {}, row));\n }\n\n const personLines: Record<string, StatLineValues> = {};\n for (const [userId, line] of personTotals)\n personLines[userId] = spec.deriveLine('lifetime', line);\n return { teamLines, membershipRows, personLines };\n}\n\nexport interface SignedContribution {\n readonly contribution: GameContribution;\n readonly sign: 1 | -1;\n}\n\nexport function sumGameContributions(\n deriveLine: ContributionSpec['deriveLine'],\n signed: readonly SignedContribution[],\n): GameContribution {\n const fold = (\n pick: (contribution: GameContribution) => Readonly<Record<string, StatLineValues>>,\n kind: StatLineKind,\n ) => {\n const totals = new Map<string, Record<string, number>>();\n for (const { contribution, sign } of signed) {\n for (const [key, line] of Object.entries(pick(contribution))) {\n totals.set(key, addStatLines(totals.get(key) ?? {}, line, sign));\n }\n }\n const lines: Record<string, StatLineValues> = {};\n for (const [key, line] of totals) {\n const derived = deriveLine(kind, line);\n if (!isZeroStatLine(derived)) lines[key] = derived;\n }\n return lines;\n };\n return {\n teamLines: fold((contribution) => contribution.teamLines, 'teamSeason'),\n membershipRows: fold((contribution) => contribution.membershipRows, 'membershipRow'),\n personLines: fold((contribution) => contribution.personLines, 'lifetime'),\n };\n}\n\n/**\n * A counter a decrease would take below zero is written as zero, so a stored total never goes\n * below zero (RULE-STD-BACKEND-119).\n */\nexport function applyStatLineDelta(\n deriveLine: ContributionSpec['deriveLine'],\n kind: StatLineKind,\n before: StatLineValues | undefined,\n delta: StatLineValues,\n sign: 1 | -1,\n): StatLineValues | null {\n const moved = addStatLines(before ?? {}, delta, sign);\n const floored: Record<string, number> = {};\n for (const [field, value] of Object.entries(moved)) floored[field] = Math.max(0, value);\n // A derived field is recomputed from the floored counters, never moved itself, so a stale stored\n // FP can neither go below zero nor survive.\n const after = deriveLine(kind, floored);\n return isZeroStatLine(after) ? null : after;\n}\n"]}
|