tenniscommon 1.0.1

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.
Files changed (207) hide show
  1. package/README.md +40 -0
  2. package/dist/cjs/common/general/generalInterfaces.d.ts +16 -0
  3. package/dist/cjs/common/general/generalInterfaces.js +2 -0
  4. package/dist/cjs/common/general/generalUtils.d.ts +88 -0
  5. package/dist/cjs/common/general/generalUtils.js +148 -0
  6. package/dist/cjs/common/general/index.d.ts +2 -0
  7. package/dist/cjs/common/general/index.js +18 -0
  8. package/dist/cjs/common/matchplay/index.d.ts +4 -0
  9. package/dist/cjs/common/matchplay/index.js +20 -0
  10. package/dist/cjs/common/matchplay/initialData.d.ts +3 -0
  11. package/dist/cjs/common/matchplay/initialData.js +65 -0
  12. package/dist/cjs/common/matchplay/initialStats.d.ts +7 -0
  13. package/dist/cjs/common/matchplay/initialStats.js +105 -0
  14. package/dist/cjs/common/matchplay/initialTotals.d.ts +4 -0
  15. package/dist/cjs/common/matchplay/initialTotals.js +72 -0
  16. package/dist/cjs/common/matchplay/interfaces.d.ts +184 -0
  17. package/dist/cjs/common/matchplay/interfaces.js +106 -0
  18. package/dist/cjs/common/matchplay/validation.d.ts +783 -0
  19. package/dist/cjs/common/matchplay/validation.js +108 -0
  20. package/dist/cjs/common/opponent/index.d.ts +3 -0
  21. package/dist/cjs/common/opponent/index.js +19 -0
  22. package/dist/cjs/common/opponent/initialData.d.ts +3 -0
  23. package/dist/cjs/common/opponent/initialData.js +25 -0
  24. package/dist/cjs/common/opponent/interfaces.d.ts +22 -0
  25. package/dist/cjs/common/opponent/interfaces.js +8 -0
  26. package/dist/cjs/common/opponent/validation.d.ts +23 -0
  27. package/dist/cjs/common/opponent/validation.js +13 -0
  28. package/dist/cjs/common/performance/index.d.ts +3 -0
  29. package/dist/cjs/common/performance/index.js +19 -0
  30. package/dist/cjs/common/performance/initialData.d.ts +2 -0
  31. package/dist/cjs/common/performance/initialData.js +13 -0
  32. package/dist/cjs/common/performance/interfaces.d.ts +68 -0
  33. package/dist/cjs/common/performance/interfaces.js +37 -0
  34. package/dist/cjs/common/performance/validation.d.ts +17 -0
  35. package/dist/cjs/common/performance/validation.js +11 -0
  36. package/dist/cjs/common/player/index.d.ts +3 -0
  37. package/dist/cjs/common/player/index.js +19 -0
  38. package/dist/cjs/common/player/initialData.d.ts +37 -0
  39. package/dist/cjs/common/player/initialData.js +60 -0
  40. package/dist/cjs/common/player/interfaces.d.ts +28 -0
  41. package/dist/cjs/common/player/interfaces.js +2 -0
  42. package/dist/cjs/common/player/validation.d.ts +204 -0
  43. package/dist/cjs/common/player/validation.js +38 -0
  44. package/dist/cjs/common/spending/index.d.ts +4 -0
  45. package/dist/cjs/common/spending/index.js +20 -0
  46. package/dist/cjs/common/spending/initialData.d.ts +2 -0
  47. package/dist/cjs/common/spending/initialData.js +15 -0
  48. package/dist/cjs/common/spending/initialStats.d.ts +2 -0
  49. package/dist/cjs/common/spending/initialStats.js +29 -0
  50. package/dist/cjs/common/spending/initialTotals.d.ts +2 -0
  51. package/dist/cjs/common/spending/initialTotals.js +29 -0
  52. package/dist/cjs/common/spending/interfaces.d.ts +61 -0
  53. package/dist/cjs/common/spending/interfaces.js +41 -0
  54. package/dist/cjs/common/spending/validation.d.ts +39 -0
  55. package/dist/cjs/common/spending/validation.js +22 -0
  56. package/dist/cjs/common/tournament/index.d.ts +3 -0
  57. package/dist/cjs/common/tournament/index.js +19 -0
  58. package/dist/cjs/common/tournament/initialData.d.ts +3 -0
  59. package/dist/cjs/common/tournament/initialData.js +27 -0
  60. package/dist/cjs/common/tournament/interfaces.d.ts +43 -0
  61. package/dist/cjs/common/tournament/interfaces.js +27 -0
  62. package/dist/cjs/common/tournament/validation.d.ts +49 -0
  63. package/dist/cjs/common/tournament/validation.js +25 -0
  64. package/dist/cjs/common/training/index.d.ts +4 -0
  65. package/dist/cjs/common/training/index.js +20 -0
  66. package/dist/cjs/common/training/initialData.d.ts +2 -0
  67. package/dist/cjs/common/training/initialData.js +14 -0
  68. package/dist/cjs/common/training/initialStats.d.ts +2 -0
  69. package/dist/cjs/common/training/initialStats.js +27 -0
  70. package/dist/cjs/common/training/initialTotals.d.ts +2 -0
  71. package/dist/cjs/common/training/initialTotals.js +27 -0
  72. package/dist/cjs/common/training/interfaces.d.ts +40 -0
  73. package/dist/cjs/common/training/interfaces.js +17 -0
  74. package/dist/cjs/common/training/validation.d.ts +20 -0
  75. package/dist/cjs/common/training/validation.js +11 -0
  76. package/dist/cjs/common/trainingWeekly/index.d.ts +3 -0
  77. package/dist/cjs/common/trainingWeekly/index.js +19 -0
  78. package/dist/cjs/common/trainingWeekly/initialData.d.ts +2 -0
  79. package/dist/cjs/common/trainingWeekly/initialData.js +17 -0
  80. package/dist/cjs/common/trainingWeekly/interfaces.d.ts +12 -0
  81. package/dist/cjs/common/trainingWeekly/interfaces.js +2 -0
  82. package/dist/cjs/common/trainingWeekly/validation.d.ts +23 -0
  83. package/dist/cjs/common/trainingWeekly/validation.js +12 -0
  84. package/dist/esm/common/general/generalInterfaces.d.ts +16 -0
  85. package/dist/esm/common/general/generalInterfaces.js +1 -0
  86. package/dist/esm/common/general/generalUtils.d.ts +88 -0
  87. package/dist/esm/common/general/generalUtils.js +133 -0
  88. package/dist/esm/common/general/index.d.ts +2 -0
  89. package/dist/esm/common/general/index.js +2 -0
  90. package/dist/esm/common/matchplay/index.d.ts +4 -0
  91. package/dist/esm/common/matchplay/index.js +4 -0
  92. package/dist/esm/common/matchplay/initialData.d.ts +3 -0
  93. package/dist/esm/common/matchplay/initialData.js +61 -0
  94. package/dist/esm/common/matchplay/initialStats.d.ts +7 -0
  95. package/dist/esm/common/matchplay/initialStats.js +96 -0
  96. package/dist/esm/common/matchplay/initialTotals.d.ts +4 -0
  97. package/dist/esm/common/matchplay/initialTotals.js +66 -0
  98. package/dist/esm/common/matchplay/interfaces.d.ts +184 -0
  99. package/dist/esm/common/matchplay/interfaces.js +103 -0
  100. package/dist/esm/common/matchplay/validation.d.ts +783 -0
  101. package/dist/esm/common/matchplay/validation.js +105 -0
  102. package/dist/esm/common/opponent/index.d.ts +3 -0
  103. package/dist/esm/common/opponent/index.js +3 -0
  104. package/dist/esm/common/opponent/initialData.d.ts +3 -0
  105. package/dist/esm/common/opponent/initialData.js +21 -0
  106. package/dist/esm/common/opponent/interfaces.d.ts +22 -0
  107. package/dist/esm/common/opponent/interfaces.js +5 -0
  108. package/dist/esm/common/opponent/validation.d.ts +23 -0
  109. package/dist/esm/common/opponent/validation.js +10 -0
  110. package/dist/esm/common/performance/index.d.ts +3 -0
  111. package/dist/esm/common/performance/index.js +3 -0
  112. package/dist/esm/common/performance/initialData.d.ts +2 -0
  113. package/dist/esm/common/performance/initialData.js +10 -0
  114. package/dist/esm/common/performance/interfaces.d.ts +68 -0
  115. package/dist/esm/common/performance/interfaces.js +34 -0
  116. package/dist/esm/common/performance/validation.d.ts +17 -0
  117. package/dist/esm/common/performance/validation.js +8 -0
  118. package/dist/esm/common/player/index.d.ts +3 -0
  119. package/dist/esm/common/player/index.js +3 -0
  120. package/dist/esm/common/player/initialData.d.ts +37 -0
  121. package/dist/esm/common/player/initialData.js +55 -0
  122. package/dist/esm/common/player/interfaces.d.ts +28 -0
  123. package/dist/esm/common/player/interfaces.js +1 -0
  124. package/dist/esm/common/player/validation.d.ts +204 -0
  125. package/dist/esm/common/player/validation.js +35 -0
  126. package/dist/esm/common/spending/index.d.ts +4 -0
  127. package/dist/esm/common/spending/index.js +4 -0
  128. package/dist/esm/common/spending/initialData.d.ts +2 -0
  129. package/dist/esm/common/spending/initialData.js +12 -0
  130. package/dist/esm/common/spending/initialStats.d.ts +2 -0
  131. package/dist/esm/common/spending/initialStats.js +25 -0
  132. package/dist/esm/common/spending/initialTotals.d.ts +2 -0
  133. package/dist/esm/common/spending/initialTotals.js +25 -0
  134. package/dist/esm/common/spending/interfaces.d.ts +61 -0
  135. package/dist/esm/common/spending/interfaces.js +37 -0
  136. package/dist/esm/common/spending/validation.d.ts +39 -0
  137. package/dist/esm/common/spending/validation.js +19 -0
  138. package/dist/esm/common/tournament/index.d.ts +3 -0
  139. package/dist/esm/common/tournament/index.js +3 -0
  140. package/dist/esm/common/tournament/initialData.d.ts +3 -0
  141. package/dist/esm/common/tournament/initialData.js +23 -0
  142. package/dist/esm/common/tournament/interfaces.d.ts +43 -0
  143. package/dist/esm/common/tournament/interfaces.js +24 -0
  144. package/dist/esm/common/tournament/validation.d.ts +49 -0
  145. package/dist/esm/common/tournament/validation.js +22 -0
  146. package/dist/esm/common/training/index.d.ts +4 -0
  147. package/dist/esm/common/training/index.js +4 -0
  148. package/dist/esm/common/training/initialData.d.ts +2 -0
  149. package/dist/esm/common/training/initialData.js +11 -0
  150. package/dist/esm/common/training/initialStats.d.ts +2 -0
  151. package/dist/esm/common/training/initialStats.js +23 -0
  152. package/dist/esm/common/training/initialTotals.d.ts +2 -0
  153. package/dist/esm/common/training/initialTotals.js +23 -0
  154. package/dist/esm/common/training/interfaces.d.ts +40 -0
  155. package/dist/esm/common/training/interfaces.js +14 -0
  156. package/dist/esm/common/training/validation.d.ts +20 -0
  157. package/dist/esm/common/training/validation.js +8 -0
  158. package/dist/esm/common/trainingWeekly/index.d.ts +3 -0
  159. package/dist/esm/common/trainingWeekly/index.js +3 -0
  160. package/dist/esm/common/trainingWeekly/initialData.d.ts +2 -0
  161. package/dist/esm/common/trainingWeekly/initialData.js +14 -0
  162. package/dist/esm/common/trainingWeekly/interfaces.d.ts +12 -0
  163. package/dist/esm/common/trainingWeekly/interfaces.js +1 -0
  164. package/dist/esm/common/trainingWeekly/validation.d.ts +23 -0
  165. package/dist/esm/common/trainingWeekly/validation.js +9 -0
  166. package/dist/types/common/general/generalInterfaces.d.ts +16 -0
  167. package/dist/types/common/general/generalUtils.d.ts +88 -0
  168. package/dist/types/common/general/index.d.ts +2 -0
  169. package/dist/types/common/matchplay/index.d.ts +4 -0
  170. package/dist/types/common/matchplay/initialData.d.ts +3 -0
  171. package/dist/types/common/matchplay/initialStats.d.ts +7 -0
  172. package/dist/types/common/matchplay/initialTotals.d.ts +4 -0
  173. package/dist/types/common/matchplay/interfaces.d.ts +184 -0
  174. package/dist/types/common/matchplay/validation.d.ts +783 -0
  175. package/dist/types/common/opponent/index.d.ts +3 -0
  176. package/dist/types/common/opponent/initialData.d.ts +3 -0
  177. package/dist/types/common/opponent/interfaces.d.ts +22 -0
  178. package/dist/types/common/opponent/validation.d.ts +23 -0
  179. package/dist/types/common/performance/index.d.ts +3 -0
  180. package/dist/types/common/performance/initialData.d.ts +2 -0
  181. package/dist/types/common/performance/interfaces.d.ts +68 -0
  182. package/dist/types/common/performance/validation.d.ts +17 -0
  183. package/dist/types/common/player/index.d.ts +3 -0
  184. package/dist/types/common/player/initialData.d.ts +37 -0
  185. package/dist/types/common/player/interfaces.d.ts +28 -0
  186. package/dist/types/common/player/validation.d.ts +204 -0
  187. package/dist/types/common/spending/index.d.ts +4 -0
  188. package/dist/types/common/spending/initialData.d.ts +2 -0
  189. package/dist/types/common/spending/initialStats.d.ts +2 -0
  190. package/dist/types/common/spending/initialTotals.d.ts +2 -0
  191. package/dist/types/common/spending/interfaces.d.ts +61 -0
  192. package/dist/types/common/spending/validation.d.ts +39 -0
  193. package/dist/types/common/tournament/index.d.ts +3 -0
  194. package/dist/types/common/tournament/initialData.d.ts +3 -0
  195. package/dist/types/common/tournament/interfaces.d.ts +43 -0
  196. package/dist/types/common/tournament/validation.d.ts +49 -0
  197. package/dist/types/common/training/index.d.ts +4 -0
  198. package/dist/types/common/training/initialData.d.ts +2 -0
  199. package/dist/types/common/training/initialStats.d.ts +2 -0
  200. package/dist/types/common/training/initialTotals.d.ts +2 -0
  201. package/dist/types/common/training/interfaces.d.ts +40 -0
  202. package/dist/types/common/training/validation.d.ts +20 -0
  203. package/dist/types/common/trainingWeekly/index.d.ts +3 -0
  204. package/dist/types/common/trainingWeekly/initialData.d.ts +2 -0
  205. package/dist/types/common/trainingWeekly/interfaces.d.ts +12 -0
  206. package/dist/types/common/trainingWeekly/validation.d.ts +23 -0
  207. package/package.json +95 -0
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.doublesMatchplayItemSchema = exports.singlesMatchplayItemSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ // Add a match to Singles
6
+ exports.singlesMatchplayItemSchema = zod_1.z.object({
7
+ playerId: zod_1.z.string().min(1, 'PlayerId is required.'),
8
+ date: zod_1.z.preprocess(arg => (typeof arg === 'string' || arg instanceof Date ? new Date(arg) : undefined), zod_1.z.date().refine(date => !isNaN(date.getTime()), 'Invalid date.')),
9
+ tournamentId: zod_1.z.string().min(1, 'Tournament is required.'),
10
+ tournamentYearId: zod_1.z.string().min(1, 'Tournament Year is required.'),
11
+ matchFormat: zod_1.z.string().min(1, 'Match Format is required.'),
12
+ matchAgeGroup: zod_1.z.string().min(1, 'Match Age Group is required.'),
13
+ matchRound: zod_1.z.string().min(1, 'Tournament Round is required.'),
14
+ matchSurface: zod_1.z.string().min(1, 'Match Surface is required.'),
15
+ matchLocation: zod_1.z.string().min(1, 'Match Location is required.'),
16
+ matchSetFormat: zod_1.z.string().min(1, 'Match Set Format is required.'),
17
+ matchResult: zod_1.z.string().min(1, 'Match Result is required.'),
18
+ partnerId: zod_1.z.string().optional(),
19
+ opponentId: zod_1.z.string().min(1, 'Opponent is required.'),
20
+ opponentIdTeo: zod_1.z.string().optional(),
21
+ firstSetWon: zod_1.z.string().min(1, 'First Set Winner is required.'),
22
+ secondSetWon: zod_1.z.string().min(1, 'Second Set Winner is required.'),
23
+ decidingSetFormat: zod_1.z.string().optional(),
24
+ decidingSetWon: zod_1.z.string().optional(),
25
+ firstSet: zod_1.z.string().min(1, 'First Set Score is required.'),
26
+ firstSetTieBreak: zod_1.z.string().optional(),
27
+ secondSet: zod_1.z.string().min(1, 'Second Set Score is required.'),
28
+ secondSetTieBreak: zod_1.z.string().optional(),
29
+ decidingSet: zod_1.z.string().optional(),
30
+ decidingSetTieBreak: zod_1.z.string().optional(),
31
+ comment: zod_1.z.string().optional(),
32
+ })
33
+ .refine(data => !(data.firstSet === '7-6' || data.firstSet === '6-7') || !!data.firstSetTieBreak, {
34
+ message: 'First Set Tie Break Score is required',
35
+ path: ['firstSetTieBreak'],
36
+ })
37
+ .refine(data => !(data.secondSet === '7-6' || data.secondSet === '6-7') || !!data.secondSetTieBreak, {
38
+ message: 'Second Set Tie Break Score is required',
39
+ path: ['secondSetTieBreak'],
40
+ })
41
+ .refine(data => data.firstSetWon === data.secondSetWon || !!data.decidingSetFormat, {
42
+ message: 'Deciding Set format is required.',
43
+ path: ['decidingSetFormat'],
44
+ })
45
+ .refine(data => data.firstSetWon === data.secondSetWon || !!data.decidingSetWon, {
46
+ message: 'Deciding Set Winner is required',
47
+ path: ['decidingSetWon'],
48
+ })
49
+ .refine(data => data.firstSetWon === data.secondSetWon || !!data.decidingSet, {
50
+ message: 'Deciding Set Score is required',
51
+ path: ['decidingSet'],
52
+ })
53
+ .refine(data => data.firstSetWon === data.secondSetWon || !(data.decidingSet === '7-6' || data.decidingSet === '6-7') || !!data.decidingSetTieBreak, {
54
+ message: 'Deciding Set Tie Break is required',
55
+ path: ['decidingSetTieBreak'],
56
+ });
57
+ // Add a match to Doubles
58
+ exports.doublesMatchplayItemSchema = zod_1.z.object({
59
+ playerId: zod_1.z.string().min(1, 'PlayerId is required.'),
60
+ date: zod_1.z.preprocess(arg => (typeof arg === 'string' || arg instanceof Date ? new Date(arg) : undefined), zod_1.z.date().refine(date => !isNaN(date.getTime()), 'Invalid date.')),
61
+ tournamentId: zod_1.z.string().min(1, 'Tournament is required.'),
62
+ tournamentYearId: zod_1.z.string().min(1, 'Tournament Year is required.'),
63
+ matchFormat: zod_1.z.string().min(1, 'Match Format is required.'),
64
+ matchAgeGroup: zod_1.z.string().min(1, 'Match Age Group is required.'),
65
+ matchRound: zod_1.z.string().min(1, 'Tournament Round is required.'),
66
+ matchSurface: zod_1.z.string().min(1, 'Match Surface is required.'),
67
+ matchLocation: zod_1.z.string().min(1, 'Match Location is required.'),
68
+ matchSetFormat: zod_1.z.string().min(1, 'Match Set Format is required.'),
69
+ matchResult: zod_1.z.string().min(1, 'Match Result is required.'),
70
+ partnerId: zod_1.z.string().min(1, 'Partner is required.'),
71
+ opponentId: zod_1.z.string().min(1, 'Opponent is required.'),
72
+ opponentIdTwo: zod_1.z.string().min(1, 'Opponent two is required.'),
73
+ firstSetWon: zod_1.z.string().min(1, 'First Set Winner is required.'),
74
+ secondSetWon: zod_1.z.string().min(1, 'Second Set Winner is required.'),
75
+ decidingSetFormat: zod_1.z.string().optional(),
76
+ decidingSetWon: zod_1.z.string().optional(),
77
+ firstSet: zod_1.z.string().min(1, 'First Set Score is required.'),
78
+ firstSetTieBreak: zod_1.z.string().optional(),
79
+ secondSet: zod_1.z.string().min(1, 'Second Set Score is required.'),
80
+ secondSetTieBreak: zod_1.z.string().optional(),
81
+ decidingSet: zod_1.z.string().optional(),
82
+ decidingSetTieBreak: zod_1.z.string().optional(),
83
+ comment: zod_1.z.string().optional(),
84
+ })
85
+ .refine(data => !(data.firstSet === '7-6' || data.firstSet === '6-7') || !!data.firstSetTieBreak, {
86
+ message: 'First Set Tie Break Score is required',
87
+ path: ['firstSetTieBreak'],
88
+ })
89
+ .refine(data => !(data.secondSet === '7-6' || data.secondSet === '6-7') || !!data.secondSetTieBreak, {
90
+ message: 'Second Set Tie Break Score is required',
91
+ path: ['secondSetTieBreak'],
92
+ })
93
+ .refine(data => data.firstSetWon === data.secondSetWon || !!data.decidingSetFormat, {
94
+ message: 'Deciding Set format is required.',
95
+ path: ['decidingSetFormat'],
96
+ })
97
+ .refine(data => data.firstSetWon === data.secondSetWon || !!data.decidingSetWon, {
98
+ message: 'Deciding Set Winner is required',
99
+ path: ['decidingSetWon'],
100
+ })
101
+ .refine(data => data.firstSetWon === data.secondSetWon || !!data.decidingSet, {
102
+ message: 'Deciding Set Score is required',
103
+ path: ['decidingSet'],
104
+ })
105
+ .refine(data => data.firstSetWon === data.secondSetWon || !(data.decidingSet === '7-6' || data.decidingSet === '6-7') || !!data.decidingSetTieBreak, {
106
+ message: 'Deciding Set Tie Break is required',
107
+ path: ['decidingSetTieBreak'],
108
+ });
@@ -0,0 +1,3 @@
1
+ export * from './interfaces';
2
+ export * from './initialData';
3
+ export * from './validation';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./interfaces"), exports);
18
+ __exportStar(require("./initialData"), exports);
19
+ __exportStar(require("./validation"), exports);
@@ -0,0 +1,3 @@
1
+ import { OpponentItem, OpponentStats } from './interfaces';
2
+ export declare function createInitialOpponentItem(playerId: string, born: number): OpponentItem;
3
+ export declare function createOpponentStats(name: string, hand: string): OpponentStats;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createInitialOpponentItem = createInitialOpponentItem;
4
+ exports.createOpponentStats = createOpponentStats;
5
+ const interfaces_1 = require("./interfaces");
6
+ const general_1 = require("../general");
7
+ const matchplay_1 = require("../matchplay");
8
+ function createInitialOpponentItem(playerId, born) {
9
+ return {
10
+ _id: '',
11
+ playerId: playerId,
12
+ name: '',
13
+ born: born,
14
+ hand: interfaces_1.HAND.Right,
15
+ show: general_1.COMMONS.BOOLEAN.Yes,
16
+ comment: '',
17
+ };
18
+ }
19
+ function createOpponentStats(name, hand) {
20
+ return {
21
+ name: name,
22
+ hand: hand,
23
+ basicStatsPack: (0, matchplay_1.createBasicStatsPack)(),
24
+ };
25
+ }
@@ -0,0 +1,22 @@
1
+ import { BOOLEAN_UNION } from '../general';
2
+ import { BasicStatsPack } from '../matchplay';
3
+ export declare const HAND: {
4
+ readonly Left: "Left";
5
+ readonly Right: "Right";
6
+ };
7
+ export type HAND_UNION = typeof HAND[keyof typeof HAND];
8
+ export declare const HAND_ARRAY: HAND_UNION[];
9
+ export interface OpponentItem {
10
+ _id: string;
11
+ playerId: string;
12
+ name: string;
13
+ born: number;
14
+ hand: HAND_UNION;
15
+ show: BOOLEAN_UNION;
16
+ comment: string;
17
+ }
18
+ export interface OpponentStats {
19
+ name: string;
20
+ hand: string;
21
+ basicStatsPack: BasicStatsPack;
22
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HAND_ARRAY = exports.HAND = void 0;
4
+ exports.HAND = {
5
+ Left: 'Left',
6
+ Right: 'Right',
7
+ };
8
+ exports.HAND_ARRAY = Object.values(exports.HAND);
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ export declare const opponentItemSchema: z.ZodObject<{
3
+ playerId: z.ZodString;
4
+ name: z.ZodString;
5
+ born: z.ZodNumber;
6
+ hand: z.ZodString;
7
+ show: z.ZodString;
8
+ comment: z.ZodOptional<z.ZodString>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ name: string;
11
+ show: string;
12
+ playerId: string;
13
+ born: number;
14
+ hand: string;
15
+ comment?: string | undefined;
16
+ }, {
17
+ name: string;
18
+ show: string;
19
+ playerId: string;
20
+ born: number;
21
+ hand: string;
22
+ comment?: string | undefined;
23
+ }>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.opponentItemSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ // Add opponent to
6
+ exports.opponentItemSchema = zod_1.z.object({
7
+ playerId: zod_1.z.string().min(1, 'PlayerId is required.'),
8
+ name: zod_1.z.string().min(1, 'Name is required.'),
9
+ born: zod_1.z.number().int().gte(1950, 'Year must be greater than 1950.'),
10
+ hand: zod_1.z.string().min(1, 'Dominant Hand is required.'),
11
+ show: zod_1.z.string().min(1, 'Show is required.'),
12
+ comment: zod_1.z.string().optional(),
13
+ });
@@ -0,0 +1,3 @@
1
+ export * from './interfaces';
2
+ export * from './initialData';
3
+ export * from './validation';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./interfaces"), exports);
18
+ __exportStar(require("./initialData"), exports);
19
+ __exportStar(require("./validation"), exports);
@@ -0,0 +1,2 @@
1
+ import { PerformanceItem } from './interfaces';
2
+ export declare function createInitialPerformanceItem(playerId: string, date: Date): PerformanceItem;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createInitialPerformanceItem = createInitialPerformanceItem;
4
+ const interfaces_1 = require("./interfaces");
5
+ function createInitialPerformanceItem(playerId, date) {
6
+ return {
7
+ _id: '',
8
+ playerId: playerId,
9
+ date: date,
10
+ type: interfaces_1.PERFORMANCE.ACTIVITY.CourtSpeedTest1,
11
+ cost: 0,
12
+ };
13
+ }
@@ -0,0 +1,68 @@
1
+ import { ValueOf } from '../general';
2
+ export declare const PERFORMANCE: {
3
+ readonly ACTIVITY: {
4
+ readonly CourtSpeedTest1: "Court Speed Test 1";
5
+ readonly CourtSpeedTest2: "Court Speed Test 2";
6
+ readonly MurrayAgilityExercise: "Murray Agility Exercise";
7
+ readonly SixPointAgilityExercise: "Six Point Agility Exercise";
8
+ readonly SitAndReachFlexibility: "Sit And Reach Flexibility";
9
+ readonly PlankCoreTest: "Plank Core Test";
10
+ readonly VerticalPowerJumpTest: "Vertical Power Jump Test";
11
+ readonly WallThrows: "Wall Throws";
12
+ readonly SkipTest90Secs: "Skip Test 90Secs";
13
+ readonly BleepTest20m: "Bleep Test 20m";
14
+ readonly FourKmRun: "Four Km Run";
15
+ readonly HillSprints: "Hill Sprints";
16
+ };
17
+ readonly UNITS: {
18
+ readonly CourtSpeedTest1: "seconds";
19
+ readonly CourtSpeedTest2: "seconds";
20
+ readonly MurrayAgilityExercise: "centimeters";
21
+ readonly SixPointAgilityExercise: "centimeters";
22
+ readonly SitAndReachFlexibility: "centimeters";
23
+ readonly PlankCoreTest: "kg";
24
+ readonly VerticalPowerJumpTest: "centimeters";
25
+ readonly WallThrows: "throws";
26
+ readonly SkipTest90Secs: "jumps";
27
+ readonly BleepTest20m: "levels";
28
+ readonly FourKmRun: "minutes";
29
+ readonly HillSprints: "seconds";
30
+ };
31
+ };
32
+ export type PERFORMANCE_ACTIVITY_UNION = ValueOf<typeof PERFORMANCE.ACTIVITY>;
33
+ export declare const PERFORMANCE_ARRAYS: {
34
+ ACTIVITY: PERFORMANCE_ACTIVITY_UNION[];
35
+ };
36
+ export interface PerformanceType {
37
+ type: PERFORMANCE_ACTIVITY_UNION;
38
+ unit: string;
39
+ }
40
+ export declare const PERFORMANCE_TYPES: PerformanceType[];
41
+ export interface PerformanceItem {
42
+ _id: string;
43
+ playerId: string;
44
+ date: Date;
45
+ type: PERFORMANCE_ACTIVITY_UNION;
46
+ cost: number;
47
+ }
48
+ export interface PerformanceTotals {
49
+ TotalsPerYear: {
50
+ year: number;
51
+ totalCost: number;
52
+ totalCostLastMonth: number;
53
+ averageSpendingPerMonth: number;
54
+ budget: number;
55
+ budgetRemaining: number;
56
+ costPerType: {
57
+ [type: string]: number;
58
+ };
59
+ costPerMonth: {
60
+ [month: string]: number;
61
+ };
62
+ costPerMonthPerType: {
63
+ [month: string]: {
64
+ [type: string]: number;
65
+ };
66
+ };
67
+ }[];
68
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PERFORMANCE_TYPES = exports.PERFORMANCE_ARRAYS = exports.PERFORMANCE = void 0;
4
+ exports.PERFORMANCE = {
5
+ ACTIVITY: {
6
+ CourtSpeedTest1: 'Court Speed Test 1',
7
+ CourtSpeedTest2: 'Court Speed Test 2',
8
+ MurrayAgilityExercise: 'Murray Agility Exercise',
9
+ SixPointAgilityExercise: 'Six Point Agility Exercise',
10
+ SitAndReachFlexibility: 'Sit And Reach Flexibility',
11
+ PlankCoreTest: 'Plank Core Test',
12
+ VerticalPowerJumpTest: 'Vertical Power Jump Test',
13
+ WallThrows: 'Wall Throws',
14
+ SkipTest90Secs: 'Skip Test 90Secs',
15
+ BleepTest20m: 'Bleep Test 20m',
16
+ FourKmRun: 'Four Km Run',
17
+ HillSprints: 'Hill Sprints',
18
+ },
19
+ UNITS: {
20
+ CourtSpeedTest1: 'seconds',
21
+ CourtSpeedTest2: 'seconds',
22
+ MurrayAgilityExercise: 'centimeters',
23
+ SixPointAgilityExercise: 'centimeters',
24
+ SitAndReachFlexibility: 'centimeters',
25
+ PlankCoreTest: 'kg',
26
+ VerticalPowerJumpTest: 'centimeters',
27
+ WallThrows: 'throws',
28
+ SkipTest90Secs: 'jumps',
29
+ BleepTest20m: 'levels',
30
+ FourKmRun: 'minutes',
31
+ HillSprints: 'seconds',
32
+ },
33
+ };
34
+ exports.PERFORMANCE_ARRAYS = {
35
+ ACTIVITY: Object.values(exports.PERFORMANCE.ACTIVITY),
36
+ };
37
+ exports.PERFORMANCE_TYPES = Object.entries(exports.PERFORMANCE.UNITS).map(([type, unit]) => ({ type, unit }));
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+ export declare const performanceItemSchema: z.ZodObject<{
3
+ playerId: z.ZodString;
4
+ date: z.ZodEffects<z.ZodEffects<z.ZodDate, Date, Date>, Date, unknown>;
5
+ type: z.ZodString;
6
+ cost: z.ZodNumber;
7
+ }, "strip", z.ZodTypeAny, {
8
+ type: string;
9
+ date: Date;
10
+ playerId: string;
11
+ cost: number;
12
+ }, {
13
+ type: string;
14
+ playerId: string;
15
+ cost: number;
16
+ date?: unknown;
17
+ }>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.performanceItemSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ // Add performance testing to
6
+ exports.performanceItemSchema = zod_1.z.object({
7
+ playerId: zod_1.z.string().min(1, 'PlayerId is required.'),
8
+ date: zod_1.z.preprocess((arg) => (typeof arg === 'string' || arg instanceof Date ? new Date(arg) : undefined), zod_1.z.date().refine(date => !isNaN(date.getTime()), 'Invalid date.')),
9
+ type: zod_1.z.string().min(1, 'Type is required.'),
10
+ cost: zod_1.z.number(),
11
+ });
@@ -0,0 +1,3 @@
1
+ export * from './interfaces';
2
+ export * from './initialData';
3
+ export * from './validation';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./interfaces"), exports);
18
+ __exportStar(require("./initialData"), exports);
19
+ __exportStar(require("./validation"), exports);
@@ -0,0 +1,37 @@
1
+ import { PlayerConfig, PlayerData } from './interfaces';
2
+ import { ValueOf } from '../general';
3
+ export declare const GLOBAL: {
4
+ TIME: {
5
+ allYears: string;
6
+ currentYear: string;
7
+ lastYear: string;
8
+ last2Years: string;
9
+ last3Years: string;
10
+ last4Years: string;
11
+ last5Years: string;
12
+ specificYear: string;
13
+ };
14
+ SET: {
15
+ all: string;
16
+ full: string;
17
+ short: string;
18
+ };
19
+ AGE: {
20
+ all: string;
21
+ u12: string;
22
+ u14: string;
23
+ u16: string;
24
+ u18: string;
25
+ adult: string;
26
+ };
27
+ };
28
+ export type GLOBAL_TIME_UNION = ValueOf<typeof GLOBAL.TIME>;
29
+ export type GLOBAL_SET_UNION = ValueOf<typeof GLOBAL.SET>;
30
+ export type GLOBAL_AGE_UNION = ValueOf<typeof GLOBAL.AGE>;
31
+ export declare const GLOBAL_ARRAYS: {
32
+ TIME: GLOBAL_TIME_UNION[];
33
+ SET: GLOBAL_SET_UNION[];
34
+ AGE: GLOBAL_SET_UNION[];
35
+ };
36
+ export declare const createInitialPlayerConfig: (born: number) => PlayerConfig;
37
+ export declare const createInitialPlayerData: () => Omit<PlayerData, "_id">;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createInitialPlayerData = exports.createInitialPlayerConfig = exports.GLOBAL_ARRAYS = exports.GLOBAL = void 0;
4
+ const general_1 = require("../general");
5
+ const spending_1 = require("../spending");
6
+ exports.GLOBAL = {
7
+ TIME: {
8
+ allYears: 'All Years',
9
+ currentYear: 'Current Year',
10
+ lastYear: 'Last Year',
11
+ last2Years: 'Last 2 Years',
12
+ last3Years: 'Last 3 Years',
13
+ last4Years: 'Last 4 Years',
14
+ last5Years: 'Last 5 Years',
15
+ specificYear: 'Specific Year',
16
+ },
17
+ SET: {
18
+ all: 'All',
19
+ full: 'Full',
20
+ short: 'Short'
21
+ },
22
+ AGE: {
23
+ all: 'All',
24
+ u12: 'U12',
25
+ u14: 'U14',
26
+ u16: 'U16',
27
+ u18: 'U18',
28
+ adult: 'Adult',
29
+ },
30
+ };
31
+ exports.GLOBAL_ARRAYS = {
32
+ TIME: Object.values(exports.GLOBAL.TIME),
33
+ SET: Object.values(exports.GLOBAL.SET),
34
+ AGE: Object.values(exports.GLOBAL.AGE),
35
+ };
36
+ // Factory function for PlayerConfig
37
+ const createInitialPlayerConfig = (born) => ({
38
+ theme: 'theme-orange-light',
39
+ dataTableRows: 10,
40
+ budget: 10000,
41
+ calendarUseToday: general_1.COMMONS.BOOLEAN.Yes,
42
+ calendarDefaultDate: new Date(),
43
+ born: born,
44
+ spendingCosts: (0, spending_1.createInitialSpendingCosts)(),
45
+ globalFilterTimeFrame: exports.GLOBAL.TIME.allYears,
46
+ globalFilterSpecificYear: new Date().getFullYear(),
47
+ globalFilterSetFormat: exports.GLOBAL.SET.full,
48
+ globalFilterAgeGroup: exports.GLOBAL.AGE.u14,
49
+ });
50
+ exports.createInitialPlayerConfig = createInitialPlayerConfig;
51
+ // Factory function for PlayerData
52
+ const createInitialPlayerData = () => ({
53
+ firstname: '',
54
+ lastname: '',
55
+ born: new Date().getFullYear() - 18,
56
+ password: '',
57
+ email: '',
58
+ config: (0, exports.createInitialPlayerConfig)(new Date().getFullYear() - 18),
59
+ });
60
+ exports.createInitialPlayerData = createInitialPlayerData;
@@ -0,0 +1,28 @@
1
+ import { ObjectId } from 'mongodb';
2
+ import { SpendingCosts } from '../spending';
3
+ export interface PlayerData {
4
+ _id?: ObjectId;
5
+ firstname: string;
6
+ lastname: string;
7
+ born: number;
8
+ password?: string;
9
+ email: string;
10
+ config: PlayerConfig;
11
+ }
12
+ export interface PlayerConfig {
13
+ theme: string;
14
+ dataTableRows: number;
15
+ budget: number;
16
+ calendarUseToday: string;
17
+ calendarDefaultDate: Date;
18
+ born: number;
19
+ spendingCosts: SpendingCosts[];
20
+ globalFilterTimeFrame: string;
21
+ globalFilterSpecificYear: number;
22
+ globalFilterSetFormat: string;
23
+ globalFilterAgeGroup: string;
24
+ }
25
+ export interface LoginResponse {
26
+ player: PlayerData;
27
+ token: string;
28
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });