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,204 @@
1
+ import { z } from 'zod';
2
+ export declare const playerConfigSchema: z.ZodObject<{
3
+ theme: z.ZodString;
4
+ dataTableRows: z.ZodNumber;
5
+ budget: z.ZodNumber;
6
+ calendarUseToday: z.ZodEffects<z.ZodString, {
7
+ value: boolean;
8
+ error: null;
9
+ } | {
10
+ value: null;
11
+ error: string;
12
+ }, string>;
13
+ calendarDefaultDate: z.ZodEffects<z.ZodEffects<z.ZodDate, Date, Date>, Date, unknown>;
14
+ born: z.ZodNumber;
15
+ spendingCosts: z.ZodArray<z.ZodObject<{
16
+ category: z.ZodString;
17
+ cost: z.ZodNumber;
18
+ }, "strip", z.ZodTypeAny, {
19
+ cost: number;
20
+ category: string;
21
+ }, {
22
+ cost: number;
23
+ category: string;
24
+ }>, "atleastone">;
25
+ globalFilterTimeFrame: z.ZodString;
26
+ globalFilterSpecificYear: z.ZodNumber;
27
+ globalFilterSetFormat: z.ZodString;
28
+ globalFilterAgeGroup: z.ZodString;
29
+ }, "strip", z.ZodTypeAny, {
30
+ born: number;
31
+ theme: string;
32
+ dataTableRows: number;
33
+ budget: number;
34
+ calendarUseToday: {
35
+ value: boolean;
36
+ error: null;
37
+ } | {
38
+ value: null;
39
+ error: string;
40
+ };
41
+ calendarDefaultDate: Date;
42
+ spendingCosts: [{
43
+ cost: number;
44
+ category: string;
45
+ }, ...{
46
+ cost: number;
47
+ category: string;
48
+ }[]];
49
+ globalFilterTimeFrame: string;
50
+ globalFilterSpecificYear: number;
51
+ globalFilterSetFormat: string;
52
+ globalFilterAgeGroup: string;
53
+ }, {
54
+ born: number;
55
+ theme: string;
56
+ dataTableRows: number;
57
+ budget: number;
58
+ calendarUseToday: string;
59
+ spendingCosts: [{
60
+ cost: number;
61
+ category: string;
62
+ }, ...{
63
+ cost: number;
64
+ category: string;
65
+ }[]];
66
+ globalFilterTimeFrame: string;
67
+ globalFilterSpecificYear: number;
68
+ globalFilterSetFormat: string;
69
+ globalFilterAgeGroup: string;
70
+ calendarDefaultDate?: unknown;
71
+ }>;
72
+ export declare const playerDataSchema: z.ZodObject<{
73
+ firstname: z.ZodString;
74
+ lastname: z.ZodString;
75
+ born: z.ZodNumber;
76
+ password: z.ZodOptional<z.ZodString>;
77
+ email: z.ZodString;
78
+ config: z.ZodObject<{
79
+ theme: z.ZodString;
80
+ dataTableRows: z.ZodNumber;
81
+ budget: z.ZodNumber;
82
+ calendarUseToday: z.ZodEffects<z.ZodString, {
83
+ value: boolean;
84
+ error: null;
85
+ } | {
86
+ value: null;
87
+ error: string;
88
+ }, string>;
89
+ calendarDefaultDate: z.ZodEffects<z.ZodEffects<z.ZodDate, Date, Date>, Date, unknown>;
90
+ born: z.ZodNumber;
91
+ spendingCosts: z.ZodArray<z.ZodObject<{
92
+ category: z.ZodString;
93
+ cost: z.ZodNumber;
94
+ }, "strip", z.ZodTypeAny, {
95
+ cost: number;
96
+ category: string;
97
+ }, {
98
+ cost: number;
99
+ category: string;
100
+ }>, "atleastone">;
101
+ globalFilterTimeFrame: z.ZodString;
102
+ globalFilterSpecificYear: z.ZodNumber;
103
+ globalFilterSetFormat: z.ZodString;
104
+ globalFilterAgeGroup: z.ZodString;
105
+ }, "strip", z.ZodTypeAny, {
106
+ born: number;
107
+ theme: string;
108
+ dataTableRows: number;
109
+ budget: number;
110
+ calendarUseToday: {
111
+ value: boolean;
112
+ error: null;
113
+ } | {
114
+ value: null;
115
+ error: string;
116
+ };
117
+ calendarDefaultDate: Date;
118
+ spendingCosts: [{
119
+ cost: number;
120
+ category: string;
121
+ }, ...{
122
+ cost: number;
123
+ category: string;
124
+ }[]];
125
+ globalFilterTimeFrame: string;
126
+ globalFilterSpecificYear: number;
127
+ globalFilterSetFormat: string;
128
+ globalFilterAgeGroup: string;
129
+ }, {
130
+ born: number;
131
+ theme: string;
132
+ dataTableRows: number;
133
+ budget: number;
134
+ calendarUseToday: string;
135
+ spendingCosts: [{
136
+ cost: number;
137
+ category: string;
138
+ }, ...{
139
+ cost: number;
140
+ category: string;
141
+ }[]];
142
+ globalFilterTimeFrame: string;
143
+ globalFilterSpecificYear: number;
144
+ globalFilterSetFormat: string;
145
+ globalFilterAgeGroup: string;
146
+ calendarDefaultDate?: unknown;
147
+ }>;
148
+ }, "strip", z.ZodTypeAny, {
149
+ email: string;
150
+ firstname: string;
151
+ lastname: string;
152
+ born: number;
153
+ config: {
154
+ born: number;
155
+ theme: string;
156
+ dataTableRows: number;
157
+ budget: number;
158
+ calendarUseToday: {
159
+ value: boolean;
160
+ error: null;
161
+ } | {
162
+ value: null;
163
+ error: string;
164
+ };
165
+ calendarDefaultDate: Date;
166
+ spendingCosts: [{
167
+ cost: number;
168
+ category: string;
169
+ }, ...{
170
+ cost: number;
171
+ category: string;
172
+ }[]];
173
+ globalFilterTimeFrame: string;
174
+ globalFilterSpecificYear: number;
175
+ globalFilterSetFormat: string;
176
+ globalFilterAgeGroup: string;
177
+ };
178
+ password?: string | undefined;
179
+ }, {
180
+ email: string;
181
+ firstname: string;
182
+ lastname: string;
183
+ born: number;
184
+ config: {
185
+ born: number;
186
+ theme: string;
187
+ dataTableRows: number;
188
+ budget: number;
189
+ calendarUseToday: string;
190
+ spendingCosts: [{
191
+ cost: number;
192
+ category: string;
193
+ }, ...{
194
+ cost: number;
195
+ category: string;
196
+ }[]];
197
+ globalFilterTimeFrame: string;
198
+ globalFilterSpecificYear: number;
199
+ globalFilterSetFormat: string;
200
+ globalFilterAgeGroup: string;
201
+ calendarDefaultDate?: unknown;
202
+ };
203
+ password?: string | undefined;
204
+ }>;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.playerDataSchema = exports.playerConfigSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ // Define schema for a single SpendingCost
6
+ const SpendingCostSchema = zod_1.z.object({
7
+ category: zod_1.z.string().min(1, 'Category is required.'),
8
+ cost: zod_1.z.number().nonnegative('Cost must be a non-negative number.'),
9
+ });
10
+ //Add and Update Config
11
+ exports.playerConfigSchema = zod_1.z.object({
12
+ theme: zod_1.z.string().min(1, 'Theme is required.'),
13
+ dataTableRows: zod_1.z.number().nonnegative('Data Table Rows must be a non-negative number.'),
14
+ budget: zod_1.z.number().nonnegative('Budget must be a non-negative number.'),
15
+ calendarUseToday: zod_1.z.string().transform((val) => {
16
+ if (val === 'Yes')
17
+ return { value: true, error: null };
18
+ if (val === 'No')
19
+ return { value: false, error: null };
20
+ return { value: null, error: 'Invalid value; must be "Yes" or "No"' };
21
+ }),
22
+ calendarDefaultDate: 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.')),
23
+ born: zod_1.z.number().int().gte(1950, 'Year must be greater than 1950.'),
24
+ spendingCosts: zod_1.z.array(SpendingCostSchema).nonempty('Spending Costs is required.'),
25
+ globalFilterTimeFrame: zod_1.z.string().min(1, 'Global Filter Time Frame is required.'),
26
+ globalFilterSpecificYear: zod_1.z.number().int().gte(1950, 'Year must be greater than 1950.'),
27
+ globalFilterSetFormat: zod_1.z.string().min(1, 'Global Filter Set Format is required.'),
28
+ globalFilterAgeGroup: zod_1.z.string().min(1, 'Global Filter Age Group is required.'),
29
+ });
30
+ //Add Config
31
+ exports.playerDataSchema = zod_1.z.object({
32
+ firstname: zod_1.z.string().min(1, 'First name is required.'),
33
+ lastname: zod_1.z.string().min(1, 'Last name is required.'),
34
+ born: zod_1.z.number().int().gte(1950, 'Year must be greater than 1950.'),
35
+ password: zod_1.z.string().optional(),
36
+ email: zod_1.z.string().email('Invalid email address.'),
37
+ config: exports.playerConfigSchema,
38
+ });
@@ -0,0 +1,4 @@
1
+ export * from './interfaces';
2
+ export * from './initialData';
3
+ export * from './initialStats';
4
+ export * from './validation';
@@ -0,0 +1,20 @@
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("./initialStats"), exports);
20
+ __exportStar(require("./validation"), exports);
@@ -0,0 +1,2 @@
1
+ import { SpendingItem } from './interfaces';
2
+ export declare function createInitialSpendingItem(playerId: string, date: Date): SpendingItem;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createInitialSpendingItem = createInitialSpendingItem;
4
+ const interfaces_1 = require("./interfaces");
5
+ // Factory function for creating initial SpendingItem
6
+ function createInitialSpendingItem(playerId, date) {
7
+ return {
8
+ _id: '',
9
+ playerId: playerId,
10
+ date: date,
11
+ type: interfaces_1.SPENDING.TYPE.Tournament,
12
+ cost: 0,
13
+ linkedToTraining: false,
14
+ };
15
+ }
@@ -0,0 +1,2 @@
1
+ import { SpendingTotals } from './interfaces';
2
+ export declare const createDefaultSpendingTotal: (budget?: number) => SpendingTotals;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createDefaultSpendingTotal = void 0;
4
+ const interfaces_1 = require("./interfaces");
5
+ const general_1 = require("../general");
6
+ const createDefaultSpendingTotal = (budget = 0) => {
7
+ const costPerType = {};
8
+ const costPerMonth = {};
9
+ const costPerMonthPerType = {};
10
+ interfaces_1.SPENDING_ARRAYS.TYPE.forEach(type => (costPerType[type] = 0));
11
+ general_1.COMMONS_ARRAYS.MONTH.forEach(month => {
12
+ costPerMonth[month] = 0;
13
+ costPerMonthPerType[month] = {};
14
+ interfaces_1.SPENDING_ARRAYS.TYPE.forEach(type => {
15
+ costPerMonthPerType[month][type] = 0;
16
+ });
17
+ });
18
+ return {
19
+ totalCost: 0,
20
+ budget,
21
+ budgetRemaining: budget,
22
+ costPerType,
23
+ costPerMonth,
24
+ costPerMonthPerType,
25
+ totalCostLastMonth: 0,
26
+ averageSpendingPerMonth: 0
27
+ };
28
+ };
29
+ exports.createDefaultSpendingTotal = createDefaultSpendingTotal;
@@ -0,0 +1,2 @@
1
+ import { SpendingTotals } from './interfaces';
2
+ export declare const createDefaultSpendingTotal: (budget?: number) => SpendingTotals;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createDefaultSpendingTotal = void 0;
4
+ const interfaces_1 = require("./interfaces");
5
+ const general_1 = require("../general");
6
+ const createDefaultSpendingTotal = (budget = 0) => {
7
+ const costPerType = {};
8
+ const costPerMonth = {};
9
+ const costPerMonthPerType = {};
10
+ interfaces_1.SPENDING_ARRAYS.TYPE.forEach(type => (costPerType[type] = 0));
11
+ general_1.COMMONS_ARRAYS.MONTH.forEach(month => {
12
+ costPerMonth[month] = 0;
13
+ costPerMonthPerType[month] = {};
14
+ interfaces_1.SPENDING_ARRAYS.TYPE.forEach(type => {
15
+ costPerMonthPerType[month][type] = 0;
16
+ });
17
+ });
18
+ return {
19
+ totalCost: 0,
20
+ budget,
21
+ budgetRemaining: budget,
22
+ costPerType,
23
+ costPerMonth,
24
+ costPerMonthPerType,
25
+ totalCostLastMonth: 0,
26
+ averageSpendingPerMonth: 0
27
+ };
28
+ };
29
+ exports.createDefaultSpendingTotal = createDefaultSpendingTotal;
@@ -0,0 +1,61 @@
1
+ import { ValueOf } from '../general';
2
+ export declare const SPENDING: {
3
+ readonly TYPE: {
4
+ readonly None: "None";
5
+ readonly Tournament: "Tournament";
6
+ readonly Accommodation: "Accommodation";
7
+ readonly Equipment: "Equipment";
8
+ readonly Strings: "Strings";
9
+ readonly CourtHire: "Court Hire";
10
+ readonly Hit: "Hit";
11
+ readonly Gym: "Gym";
12
+ readonly Squad: "Squad";
13
+ readonly Lesson: "Lesson";
14
+ readonly Physical: "Physical";
15
+ readonly Physio: "Physio";
16
+ readonly Membership: "Membership";
17
+ };
18
+ };
19
+ export declare const createInitialSpendingCosts: () => {
20
+ category: string;
21
+ cost: number;
22
+ }[];
23
+ export type SPENDING_TYPE_UNION = ValueOf<typeof SPENDING.TYPE>;
24
+ export declare const SPENDING_ARRAYS: {
25
+ TYPE: SPENDING_TYPE_UNION[];
26
+ };
27
+ export interface SpendingItem {
28
+ _id: string;
29
+ playerId: string;
30
+ date: Date;
31
+ type: SPENDING_TYPE_UNION;
32
+ cost: number;
33
+ linkedToTraining: boolean;
34
+ }
35
+ export interface SpendingTotals {
36
+ totalCost: number;
37
+ totalCostLastMonth: number;
38
+ averageSpendingPerMonth: number;
39
+ budget: number;
40
+ budgetRemaining: number;
41
+ costPerType: {
42
+ [type: string]: number;
43
+ };
44
+ costPerMonth: {
45
+ [month: string]: number;
46
+ };
47
+ costPerMonthPerType: {
48
+ [month: string]: {
49
+ [type: string]: number;
50
+ };
51
+ };
52
+ }
53
+ export interface MonthlyCostPerType {
54
+ [month: string]: {
55
+ [type: string]: number;
56
+ };
57
+ }
58
+ export interface SpendingCosts {
59
+ category: string;
60
+ cost: number;
61
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SPENDING_ARRAYS = exports.createInitialSpendingCosts = exports.SPENDING = void 0;
4
+ exports.SPENDING = {
5
+ TYPE: {
6
+ None: 'None',
7
+ Tournament: 'Tournament',
8
+ Accommodation: 'Accommodation',
9
+ Equipment: 'Equipment',
10
+ Strings: 'Strings',
11
+ CourtHire: 'Court Hire',
12
+ Hit: 'Hit',
13
+ Gym: 'Gym',
14
+ Squad: 'Squad',
15
+ Lesson: 'Lesson',
16
+ Physical: 'Physical',
17
+ Physio: 'Physio',
18
+ Membership: 'Membership',
19
+ },
20
+ };
21
+ const createInitialSpendingCosts = () => {
22
+ return [
23
+ { category: 'None', cost: 0 },
24
+ { category: 'Tournament', cost: 50 },
25
+ { category: 'Accommodation', cost: 175 },
26
+ { category: 'Equipment', cost: 100 },
27
+ { category: 'Strings', cost: 40 },
28
+ { category: 'Court Hire', cost: 7.5 },
29
+ { category: 'Hit', cost: 15 },
30
+ { category: 'Gym', cost: 25 },
31
+ { category: 'Squad', cost: 0 },
32
+ { category: 'Lesson', cost: 35 },
33
+ { category: 'Physical', cost: 30 },
34
+ { category: 'Physio', cost: 55 },
35
+ { category: 'Membership', cost: 120 }
36
+ ];
37
+ };
38
+ exports.createInitialSpendingCosts = createInitialSpendingCosts;
39
+ exports.SPENDING_ARRAYS = {
40
+ TYPE: Object.values(exports.SPENDING.TYPE),
41
+ };
@@ -0,0 +1,39 @@
1
+ import { z } from 'zod';
2
+ export declare const spendingItemSchema: z.ZodObject<{
3
+ playerId: z.ZodString;
4
+ date: z.ZodEffects<z.ZodEffects<z.ZodDate, Date, Date>, Date, unknown>;
5
+ type: z.ZodEffects<z.ZodString, string, string>;
6
+ cost: z.ZodNumber;
7
+ linkedToTraining: z.ZodBoolean;
8
+ }, "strip", z.ZodTypeAny, {
9
+ type: string;
10
+ date: Date;
11
+ playerId: string;
12
+ cost: number;
13
+ linkedToTraining: boolean;
14
+ }, {
15
+ type: string;
16
+ playerId: string;
17
+ cost: number;
18
+ linkedToTraining: boolean;
19
+ date?: unknown;
20
+ }>;
21
+ export declare const spendingItemSchemaFromTraining: z.ZodObject<{
22
+ playerId: z.ZodString;
23
+ date: z.ZodEffects<z.ZodEffects<z.ZodDate, Date, Date>, Date, unknown>;
24
+ type: z.ZodString;
25
+ cost: z.ZodNumber;
26
+ linkedToTraining: z.ZodBoolean;
27
+ }, "strip", z.ZodTypeAny, {
28
+ type: string;
29
+ date: Date;
30
+ playerId: string;
31
+ cost: number;
32
+ linkedToTraining: boolean;
33
+ }, {
34
+ type: string;
35
+ playerId: string;
36
+ cost: number;
37
+ linkedToTraining: boolean;
38
+ date?: unknown;
39
+ }>;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.spendingItemSchemaFromTraining = exports.spendingItemSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const interfaces_1 = require("./interfaces");
6
+ // Add spending to
7
+ exports.spendingItemSchema = zod_1.z.object({
8
+ playerId: zod_1.z.string().min(1, 'PlayerId is required.'),
9
+ 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.')),
10
+ type: zod_1.z.string().min(1, 'Type is required.').refine(value => value !== interfaces_1.SPENDING.TYPE.None, {
11
+ message: 'Type cannot be "None".',
12
+ }),
13
+ cost: zod_1.z.number().gt(0, 'Cost must be greater than zero.'),
14
+ linkedToTraining: zod_1.z.boolean(),
15
+ });
16
+ exports.spendingItemSchemaFromTraining = zod_1.z.object({
17
+ playerId: zod_1.z.string().min(1, 'PlayerId is required.'),
18
+ 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.')),
19
+ type: zod_1.z.string().min(1, 'Type is required.'),
20
+ cost: zod_1.z.number(),
21
+ linkedToTraining: zod_1.z.boolean(),
22
+ });
@@ -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 { TournamentItem, TournamentYearItem } from './interfaces';
2
+ export declare function createInitialTournamentYearItem(date: Date): TournamentYearItem;
3
+ export declare function createInitialTournamentItem(playerId: string): TournamentItem;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createInitialTournamentYearItem = createInitialTournamentYearItem;
4
+ exports.createInitialTournamentItem = createInitialTournamentItem;
5
+ const general_1 = require("../general");
6
+ const interfaces_1 = require("./interfaces");
7
+ // Factory function for creating initial TournamentYearItem
8
+ function createInitialTournamentYearItem(date) {
9
+ return {
10
+ yearId: '',
11
+ year: date.getFullYear(),
12
+ date: date,
13
+ category: interfaces_1.TOURNAMENT.CATEGORY.T500,
14
+ show: general_1.COMMONS.BOOLEAN.Yes,
15
+ comment: '',
16
+ };
17
+ }
18
+ // Factory function for creating initial TournamentItem
19
+ function createInitialTournamentItem(playerId) {
20
+ return {
21
+ _id: '',
22
+ playerId: playerId,
23
+ name: '',
24
+ type: interfaces_1.TOURNAMENT.TYPE.TennisIreland,
25
+ tournamentYears: [], // Alternatively, you can use [createInitialTournamentYearItem()] if you need to initialize with a default year item
26
+ };
27
+ }
@@ -0,0 +1,43 @@
1
+ import { BOOLEAN_UNION } from '../general';
2
+ import { ValueOf } from '../general';
3
+ export declare const TOURNAMENT: {
4
+ readonly TYPE: {
5
+ readonly TennisIreland: "Tennis Ireland";
6
+ readonly TennisEuropean: "Tennis European";
7
+ readonly BelfastAndDistrictLeague: "Belfast And District League";
8
+ };
9
+ readonly CATEGORY: {
10
+ readonly WTN: "WTN Only";
11
+ readonly T100: "T100";
12
+ readonly T200: "T200";
13
+ readonly T500: "T500";
14
+ readonly T1000: "T1000";
15
+ readonly T1250: "T1250";
16
+ readonly T1500: "T1500";
17
+ readonly T2000: "T2000";
18
+ readonly EuropeC1: "Europe C1";
19
+ readonly EuropeC2: "Europe C2";
20
+ readonly EuropeC3: "Europe C3";
21
+ };
22
+ };
23
+ export type TOURNAMENT_TYPE_UNION = ValueOf<typeof TOURNAMENT.TYPE>;
24
+ export type TOURNAMENT_CATEGORY_UNION = ValueOf<typeof TOURNAMENT.CATEGORY>;
25
+ export declare const TOURNAMENT_ARRAYS: {
26
+ TYPE: TOURNAMENT_TYPE_UNION[];
27
+ CATEGORY: TOURNAMENT_CATEGORY_UNION[];
28
+ };
29
+ export interface TournamentItem {
30
+ _id: string;
31
+ playerId: string;
32
+ name: string;
33
+ type: TOURNAMENT_TYPE_UNION;
34
+ tournamentYears: TournamentYearItem[];
35
+ }
36
+ export interface TournamentYearItem {
37
+ yearId: string;
38
+ year: number;
39
+ date: Date;
40
+ category: TOURNAMENT_CATEGORY_UNION;
41
+ show: BOOLEAN_UNION;
42
+ comment: string;
43
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TOURNAMENT_ARRAYS = exports.TOURNAMENT = void 0;
4
+ exports.TOURNAMENT = {
5
+ TYPE: {
6
+ TennisIreland: 'Tennis Ireland',
7
+ TennisEuropean: 'Tennis European',
8
+ BelfastAndDistrictLeague: 'Belfast And District League',
9
+ },
10
+ CATEGORY: {
11
+ WTN: 'WTN Only',
12
+ T100: 'T100',
13
+ T200: 'T200',
14
+ T500: 'T500',
15
+ T1000: 'T1000',
16
+ T1250: 'T1250',
17
+ T1500: 'T1500',
18
+ T2000: 'T2000',
19
+ EuropeC1: 'Europe C1',
20
+ EuropeC2: 'Europe C2',
21
+ EuropeC3: 'Europe C3',
22
+ },
23
+ };
24
+ exports.TOURNAMENT_ARRAYS = {
25
+ TYPE: Object.values(exports.TOURNAMENT.TYPE),
26
+ CATEGORY: Object.values(exports.TOURNAMENT.CATEGORY),
27
+ };