@aneuhold/core-ts-db-lib 4.1.12 → 4.1.14

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 (58) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/lib/browser.d.ts +11 -8
  3. package/lib/browser.d.ts.map +1 -1
  4. package/lib/browser.js +6 -4
  5. package/lib/browser.js.map +1 -1
  6. package/lib/browser.ts +23 -9
  7. package/lib/ctos/workout/WorkoutMuscleGroupVolumeCTO.d.ts +14 -0
  8. package/lib/ctos/workout/WorkoutMuscleGroupVolumeCTO.d.ts.map +1 -1
  9. package/lib/ctos/workout/WorkoutMuscleGroupVolumeCTO.ts +18 -0
  10. package/lib/documents/workout/README.md +43 -9
  11. package/lib/documents/workout/WorkoutSet.d.ts +8 -0
  12. package/lib/documents/workout/WorkoutSet.d.ts.map +1 -1
  13. package/lib/documents/workout/WorkoutSet.ts +9 -0
  14. package/lib/services/workout/Exercise/WorkoutExerciseService.d.ts +40 -0
  15. package/lib/services/workout/Exercise/WorkoutExerciseService.d.ts.map +1 -1
  16. package/lib/services/workout/Exercise/WorkoutExerciseService.js +134 -1
  17. package/lib/services/workout/Exercise/WorkoutExerciseService.js.map +1 -1
  18. package/lib/services/workout/Exercise/WorkoutExerciseService.ts +204 -1
  19. package/lib/services/workout/ExerciseCalibration/WorkoutExerciseCalibrationService.d.ts +15 -0
  20. package/lib/services/workout/ExerciseCalibration/WorkoutExerciseCalibrationService.d.ts.map +1 -1
  21. package/lib/services/workout/ExerciseCalibration/WorkoutExerciseCalibrationService.js +18 -1
  22. package/lib/services/workout/ExerciseCalibration/WorkoutExerciseCalibrationService.js.map +1 -1
  23. package/lib/services/workout/ExerciseCalibration/WorkoutExerciseCalibrationService.ts +19 -1
  24. package/lib/services/workout/Mesocycle/WorkoutMesocyclePlanContext.d.ts +30 -4
  25. package/lib/services/workout/Mesocycle/WorkoutMesocyclePlanContext.d.ts.map +1 -1
  26. package/lib/services/workout/Mesocycle/WorkoutMesocyclePlanContext.js +58 -4
  27. package/lib/services/workout/Mesocycle/WorkoutMesocyclePlanContext.js.map +1 -1
  28. package/lib/services/workout/Mesocycle/WorkoutMesocyclePlanContext.ts +69 -3
  29. package/lib/services/workout/Mesocycle/WorkoutMesocycleService.d.ts +45 -1
  30. package/lib/services/workout/Mesocycle/WorkoutMesocycleService.d.ts.map +1 -1
  31. package/lib/services/workout/Mesocycle/WorkoutMesocycleService.js +201 -11
  32. package/lib/services/workout/Mesocycle/WorkoutMesocycleService.js.map +1 -1
  33. package/lib/services/workout/Mesocycle/WorkoutMesocycleService.ts +285 -9
  34. package/lib/services/workout/Mesocycle/WorkoutMesocycleService.types.d.ts +33 -0
  35. package/lib/services/workout/Mesocycle/WorkoutMesocycleService.types.d.ts.map +1 -0
  36. package/lib/services/workout/Mesocycle/WorkoutMesocycleService.types.js +24 -0
  37. package/lib/services/workout/Mesocycle/WorkoutMesocycleService.types.js.map +1 -0
  38. package/lib/services/workout/Mesocycle/WorkoutMesocycleService.types.ts +36 -0
  39. package/lib/services/workout/Session/WorkoutSessionService.d.ts.map +1 -1
  40. package/lib/services/workout/Session/WorkoutSessionService.js +1 -11
  41. package/lib/services/workout/Session/WorkoutSessionService.js.map +1 -1
  42. package/lib/services/workout/Session/WorkoutSessionService.ts +1 -17
  43. package/lib/services/workout/SessionExercise/WorkoutSessionExerciseService.d.ts +14 -2
  44. package/lib/services/workout/SessionExercise/WorkoutSessionExerciseService.d.ts.map +1 -1
  45. package/lib/services/workout/SessionExercise/WorkoutSessionExerciseService.js +17 -3
  46. package/lib/services/workout/SessionExercise/WorkoutSessionExerciseService.js.map +1 -1
  47. package/lib/services/workout/SessionExercise/WorkoutSessionExerciseService.ts +28 -3
  48. package/lib/services/workout/Set/WorkoutSetService.d.ts +17 -5
  49. package/lib/services/workout/Set/WorkoutSetService.d.ts.map +1 -1
  50. package/lib/services/workout/Set/WorkoutSetService.js +83 -16
  51. package/lib/services/workout/Set/WorkoutSetService.js.map +1 -1
  52. package/lib/services/workout/Set/WorkoutSetService.ts +107 -24
  53. package/lib/services/workout/util/VolumePlanning/WorkoutVolumePlanningService.d.ts +161 -11
  54. package/lib/services/workout/util/VolumePlanning/WorkoutVolumePlanningService.d.ts.map +1 -1
  55. package/lib/services/workout/util/VolumePlanning/WorkoutVolumePlanningService.js +364 -127
  56. package/lib/services/workout/util/VolumePlanning/WorkoutVolumePlanningService.js.map +1 -1
  57. package/lib/services/workout/util/VolumePlanning/WorkoutVolumePlanningService.ts +551 -160
  58. package/package.json +1 -1
@@ -1,6 +1,7 @@
1
1
  import { ExerciseProgressionType, ExerciseRepRange } from '../../../documents/workout/WorkoutExercise.js';
2
2
  import WorkoutEquipmentTypeService from '../EquipmentType/WorkoutEquipmentTypeService.js';
3
3
  import WorkoutExerciseCalibrationService from '../ExerciseCalibration/WorkoutExerciseCalibrationService.js';
4
+ import WorkoutSessionExerciseService from '../SessionExercise/WorkoutSessionExerciseService.js';
4
5
  import WorkoutSFRService from '../util/SFR/WorkoutSFRService.js';
5
6
  /**
6
7
  * A service for handling operations related to {@link WorkoutExercise}s.
@@ -41,6 +42,10 @@ export default class WorkoutExerciseService {
41
42
  * This method applies either rep-based or load-based progression depending on the exercise's
42
43
  * preferred progression type, then rounds the weight to available equipment options.
43
44
  *
45
+ * When a `previousFirstSet` is provided, autoregulation adjusts progression based on the
46
+ * surplus between planned and actual performance. Without it, the calibration-based formula
47
+ * is used as a baseline.
48
+ *
44
49
  * Rep progression: The weight is calculated based on reps at microcycle 0, and reps increase
45
50
  * by 2 per microcycle to reach max reps at the final accumulation microcycle (ideally),
46
51
  * or drop back down and increase weight by 2%.
@@ -49,7 +54,7 @@ export default class WorkoutExerciseService {
49
54
  * If weight can't be increased, adds 2 reps instead.
50
55
  */
51
56
  static calculateTargetRepsAndWeightForFirstSet(params) {
52
- const { exercise, calibration, equipment, microcycleIndex, firstMicrocycleRir } = params;
57
+ const { exercise, calibration, equipment, microcycleIndex, firstMicrocycleRir, previousFirstSet } = params;
53
58
  // Validate equipment has weight options
54
59
  if (!equipment.weightOptions || equipment.weightOptions.length === 0) {
55
60
  throw new Error(`No weight options defined for equipment type ${equipment._id}, ${equipment.title}`);
@@ -57,6 +62,134 @@ export default class WorkoutExerciseService {
57
62
  // Get rep range for this exercise
58
63
  const repRange = this.getRepRangeValues(exercise.repRange);
59
64
  const repRangeMidpoint = Math.floor((repRange.min + repRange.max) / 2);
65
+ // If we have a previous set with complete data, use autoregulation
66
+ if (previousFirstSet && this.hasCompleteAutoRegulationData(previousFirstSet)) {
67
+ return this.calculateAutoRegulatedTargets({
68
+ exercise,
69
+ equipment,
70
+ previousFirstSet,
71
+ repRange
72
+ });
73
+ }
74
+ // Calibration-based formula (no previous set available)
75
+ return this.calculateCalibrationBasedTargets({
76
+ exercise,
77
+ calibration,
78
+ equipment,
79
+ microcycleIndex,
80
+ firstMicrocycleRir,
81
+ repRange,
82
+ repRangeMidpoint
83
+ });
84
+ }
85
+ /**
86
+ * Calculates targets using auto-regulation based on actual performance from a previous set.
87
+ */
88
+ static calculateAutoRegulatedTargets(params) {
89
+ const { exercise, equipment, previousFirstSet, repRange } = params;
90
+ const surplus = WorkoutSessionExerciseService.calculateSetSurplus(previousFirstSet.actualReps, previousFirstSet.plannedReps, previousFirstSet.rir, previousFirstSet.plannedRir);
91
+ if (exercise.preferredProgressionType === ExerciseProgressionType.Rep) {
92
+ return this.calculateAutoRegulatedRepTargets(previousFirstSet, surplus, repRange, equipment);
93
+ }
94
+ return this.calculateAutoRegulatedLoadTargets(previousFirstSet, surplus, repRange, equipment);
95
+ }
96
+ /**
97
+ * Auto-regulated rep progression. Weight stays the same, reps adjust based on surplus.
98
+ *
99
+ * | Surplus | Action |
100
+ * |---:|---|
101
+ * | >= 3 | Accelerate: actualReps + 2 (progress from actual, not planned) |
102
+ * | 0 to 2 | Normal: plannedReps + 2 |
103
+ * | -1 to -2 | Hold: plannedReps (don't add reps) |
104
+ * | <= -3 | Regress: actualReps (use actual as new baseline) |
105
+ */
106
+ static calculateAutoRegulatedRepTargets(previousSet, surplus, repRange, equipment) {
107
+ let targetReps;
108
+ let targetWeight = previousSet.plannedWeight;
109
+ if (surplus >= 3) {
110
+ targetReps = previousSet.actualReps + 2;
111
+ }
112
+ else if (surplus >= 0) {
113
+ targetReps = previousSet.plannedReps + 2;
114
+ }
115
+ else if (surplus >= -2) {
116
+ targetReps = previousSet.plannedReps;
117
+ }
118
+ else {
119
+ targetReps = previousSet.actualReps;
120
+ }
121
+ // Clamp to rep range floor (never target below min, even if actual was 0)
122
+ targetReps = Math.max(targetReps, repRange.min);
123
+ // Handle rep range ceiling: if target exceeds max, reset and bump weight
124
+ if (targetReps > repRange.max) {
125
+ targetReps = repRange.max;
126
+ const nextWeight = this.findNextTwoPercentWeight(targetWeight, equipment);
127
+ if (nextWeight !== null) {
128
+ targetWeight = nextWeight;
129
+ }
130
+ }
131
+ // Round weight to equipment
132
+ const roundedWeight = WorkoutEquipmentTypeService.findNearestWeight(equipment, targetWeight, 'prefer-down');
133
+ if (roundedWeight !== null) {
134
+ targetWeight = roundedWeight;
135
+ }
136
+ return { targetWeight, targetReps };
137
+ }
138
+ /**
139
+ * Auto-regulated load progression. Reps stay at rep range max, weight adjusts based on surplus.
140
+ *
141
+ * | Surplus | Action |
142
+ * |---:|---|
143
+ * | >= 2 | Accelerate: increase weight by ~4% |
144
+ * | 0 to 1 | Normal: increase weight by 2% |
145
+ * | -1 to -2 | Hold weight (no increase) |
146
+ * | <= -3 | Reduce weight by minimum equipment increment |
147
+ */
148
+ static calculateAutoRegulatedLoadTargets(previousSet, surplus, repRange, equipment) {
149
+ const targetReps = repRange.max;
150
+ let targetWeight = previousSet.plannedWeight;
151
+ if (surplus >= 2) {
152
+ // Accelerate: increase by ~4%
153
+ const fourPercentIncrease = targetWeight * 1.04;
154
+ const nextWeight = WorkoutEquipmentTypeService.findNearestWeight(equipment, fourPercentIncrease, 'up');
155
+ if (nextWeight !== null) {
156
+ targetWeight = nextWeight;
157
+ }
158
+ }
159
+ else if (surplus >= 0) {
160
+ // Normal: increase by 2%
161
+ const nextWeight = this.findNextTwoPercentWeight(targetWeight, equipment);
162
+ if (nextWeight !== null) {
163
+ targetWeight = nextWeight;
164
+ }
165
+ }
166
+ else if (surplus >= -2) {
167
+ // Hold weight - no change
168
+ }
169
+ else {
170
+ // Reduce by minimum equipment increment
171
+ const reducedWeight = WorkoutEquipmentTypeService.findNearestWeight(equipment, targetWeight - 0.01, 'down');
172
+ if (reducedWeight !== null) {
173
+ targetWeight = reducedWeight;
174
+ }
175
+ }
176
+ return { targetWeight, targetReps };
177
+ }
178
+ /**
179
+ * Checks whether a set has all the data needed for autoregulation calculations.
180
+ */
181
+ static hasCompleteAutoRegulationData(set) {
182
+ return (set.actualReps != null &&
183
+ set.plannedReps != null &&
184
+ set.rir != null &&
185
+ set.plannedRir != null &&
186
+ set.plannedWeight != null);
187
+ }
188
+ /**
189
+ * Calculates targets using the calibration-based formula (original behavior).
190
+ */
191
+ static calculateCalibrationBasedTargets(params) {
192
+ const { exercise, calibration, equipment, microcycleIndex, firstMicrocycleRir, repRange, repRangeMidpoint } = params;
60
193
  // For rep progression, calculate weight based on reps at microcycle 0
61
194
  // For load progression, use max reps
62
195
  let baseRepsForWeight;
@@ -1 +1 @@
1
- {"version":3,"file":"WorkoutExerciseService.js","sourceRoot":"","sources":["../../../../src/services/workout/Exercise/WorkoutExerciseService.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EACjB,MAAM,+CAA+C,CAAC;AAEvD,OAAO,2BAA2B,MAAM,iDAAiD,CAAC;AAC1F,OAAO,iCAAiC,MAAM,6DAA6D,CAAC;AAC5G,OAAO,iBAAiB,MAAM,kCAAkC,CAAC;AAEjE;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,sBAAsB;IACzC;;;;;;;;OAQG;IACH,MAAM,CAAC,iBAAiB,CAAC,QAA0B;QACjD,QAAQ,QAAQ,EAAE,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AAM,UAAU,GAAG,IAAI,CAAC,wBAAwB,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;oBAC1E,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;wBACxB,YAAY,GAAG,UAAU,CAAC;oBAC5B,CAAC;gBACH,CAAC;gBACD,sBAAsB,EAAE,CAAC;YAC3B,CAAC;QACH,CAAC;aAAM,CAAC;YACN,sCAAsC;YACtC,UAAU,GAAG,QAAQ,CAAC,GAAG,CAAC;QAC5B,CAAC;QAED,sDAAsD;QACtD,IAAI,QAAQ,CAAC,wBAAwB,KAAK,uBAAuB,CAAC,IAAI,IAAI,eAAe,GAAG,CAAC,EAAE,CAAC;YAC9F,MAAM,UAAU,GAAG,IAAI,CAAC,wBAAwB,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;YAC1E,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;gBACxB,YAAY,GAAG,UAAU,CAAC;YAC5B,CAAC;iBAAM,CAAC;gBACN,4CAA4C;gBAC5C,UAAU,GAAG,UAAU,GAAG,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC;QAED,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC;IACtC,CAAC;IAEO,MAAM,CAAC,wBAAwB,CACrC,aAAqB,EACrB,SAA+B;QAE/B,iCAAiC;QACjC,MAAM,kBAAkB,GAAG,aAAa,GAAG,IAAI,CAAC;QAEhD,6FAA6F;QAC7F,0FAA0F;QAC1F,MAAM,UAAU,GAAG,2BAA2B,CAAC,iBAAiB,CAC9D,SAAS,EACT,kBAAkB,EAClB,IAAI,CACL,CAAC;QACF,OAAO,UAAU,CAAC;IACpB,CAAC;CACF"}
1
+ {"version":3,"file":"WorkoutExerciseService.js","sourceRoot":"","sources":["../../../../src/services/workout/Exercise/WorkoutExerciseService.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EACjB,MAAM,+CAA+C,CAAC;AAGvD,OAAO,2BAA2B,MAAM,iDAAiD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B,CAAC,iBAAiB,CAC9D,SAAS,EACT,kBAAkB,EAClB,IAAI,CACL,CAAC;QACF,OAAO,UAAU,CAAC;IACpB,CAAC;CACF"}
@@ -5,8 +5,10 @@ import {
5
5
  ExerciseRepRange
6
6
  } from '../../../documents/workout/WorkoutExercise.js';
7
7
  import type { WorkoutExerciseCalibration } from '../../../documents/workout/WorkoutExerciseCalibration.js';
8
+ import type { CompletedWorkoutSet, WorkoutSet } from '../../../documents/workout/WorkoutSet.js';
8
9
  import WorkoutEquipmentTypeService from '../EquipmentType/WorkoutEquipmentTypeService.js';
9
10
  import WorkoutExerciseCalibrationService from '../ExerciseCalibration/WorkoutExerciseCalibrationService.js';
11
+ import WorkoutSessionExerciseService from '../SessionExercise/WorkoutSessionExerciseService.js';
10
12
  import WorkoutSFRService from '../util/SFR/WorkoutSFRService.js';
11
13
 
12
14
  /**
@@ -50,6 +52,10 @@ export default class WorkoutExerciseService {
50
52
  * This method applies either rep-based or load-based progression depending on the exercise's
51
53
  * preferred progression type, then rounds the weight to available equipment options.
52
54
  *
55
+ * When a `previousFirstSet` is provided, autoregulation adjusts progression based on the
56
+ * surplus between planned and actual performance. Without it, the calibration-based formula
57
+ * is used as a baseline.
58
+ *
53
59
  * Rep progression: The weight is calculated based on reps at microcycle 0, and reps increase
54
60
  * by 2 per microcycle to reach max reps at the final accumulation microcycle (ideally),
55
61
  * or drop back down and increase weight by 2%.
@@ -63,8 +69,16 @@ export default class WorkoutExerciseService {
63
69
  equipment: WorkoutEquipmentType;
64
70
  microcycleIndex: number;
65
71
  firstMicrocycleRir: number;
72
+ previousFirstSet?: WorkoutSet;
66
73
  }): { targetWeight: number; targetReps: number } {
67
- const { exercise, calibration, equipment, microcycleIndex, firstMicrocycleRir } = params;
74
+ const {
75
+ exercise,
76
+ calibration,
77
+ equipment,
78
+ microcycleIndex,
79
+ firstMicrocycleRir,
80
+ previousFirstSet
81
+ } = params;
68
82
 
69
83
  // Validate equipment has weight options
70
84
  if (!equipment.weightOptions || equipment.weightOptions.length === 0) {
@@ -77,6 +91,195 @@ export default class WorkoutExerciseService {
77
91
  const repRange = this.getRepRangeValues(exercise.repRange);
78
92
  const repRangeMidpoint = Math.floor((repRange.min + repRange.max) / 2);
79
93
 
94
+ // If we have a previous set with complete data, use autoregulation
95
+ if (previousFirstSet && this.hasCompleteAutoRegulationData(previousFirstSet)) {
96
+ return this.calculateAutoRegulatedTargets({
97
+ exercise,
98
+ equipment,
99
+ previousFirstSet,
100
+ repRange
101
+ });
102
+ }
103
+
104
+ // Calibration-based formula (no previous set available)
105
+ return this.calculateCalibrationBasedTargets({
106
+ exercise,
107
+ calibration,
108
+ equipment,
109
+ microcycleIndex,
110
+ firstMicrocycleRir,
111
+ repRange,
112
+ repRangeMidpoint
113
+ });
114
+ }
115
+
116
+ /**
117
+ * Calculates targets using auto-regulation based on actual performance from a previous set.
118
+ */
119
+ private static calculateAutoRegulatedTargets(params: {
120
+ exercise: WorkoutExercise;
121
+ equipment: WorkoutEquipmentType;
122
+ previousFirstSet: CompletedWorkoutSet;
123
+ repRange: { min: number; max: number };
124
+ }): { targetWeight: number; targetReps: number } {
125
+ const { exercise, equipment, previousFirstSet, repRange } = params;
126
+
127
+ const surplus = WorkoutSessionExerciseService.calculateSetSurplus(
128
+ previousFirstSet.actualReps,
129
+ previousFirstSet.plannedReps,
130
+ previousFirstSet.rir,
131
+ previousFirstSet.plannedRir
132
+ );
133
+
134
+ if (exercise.preferredProgressionType === ExerciseProgressionType.Rep) {
135
+ return this.calculateAutoRegulatedRepTargets(previousFirstSet, surplus, repRange, equipment);
136
+ }
137
+
138
+ return this.calculateAutoRegulatedLoadTargets(previousFirstSet, surplus, repRange, equipment);
139
+ }
140
+
141
+ /**
142
+ * Auto-regulated rep progression. Weight stays the same, reps adjust based on surplus.
143
+ *
144
+ * | Surplus | Action |
145
+ * |---:|---|
146
+ * | >= 3 | Accelerate: actualReps + 2 (progress from actual, not planned) |
147
+ * | 0 to 2 | Normal: plannedReps + 2 |
148
+ * | -1 to -2 | Hold: plannedReps (don't add reps) |
149
+ * | <= -3 | Regress: actualReps (use actual as new baseline) |
150
+ */
151
+ private static calculateAutoRegulatedRepTargets(
152
+ previousSet: CompletedWorkoutSet,
153
+ surplus: number,
154
+ repRange: { min: number; max: number },
155
+ equipment: WorkoutEquipmentType
156
+ ): { targetWeight: number; targetReps: number } {
157
+ let targetReps: number;
158
+ let targetWeight = previousSet.plannedWeight;
159
+
160
+ if (surplus >= 3) {
161
+ targetReps = previousSet.actualReps + 2;
162
+ } else if (surplus >= 0) {
163
+ targetReps = previousSet.plannedReps + 2;
164
+ } else if (surplus >= -2) {
165
+ targetReps = previousSet.plannedReps;
166
+ } else {
167
+ targetReps = previousSet.actualReps;
168
+ }
169
+
170
+ // Clamp to rep range floor (never target below min, even if actual was 0)
171
+ targetReps = Math.max(targetReps, repRange.min);
172
+
173
+ // Handle rep range ceiling: if target exceeds max, reset and bump weight
174
+ if (targetReps > repRange.max) {
175
+ targetReps = repRange.max;
176
+ const nextWeight = this.findNextTwoPercentWeight(targetWeight, equipment);
177
+ if (nextWeight !== null) {
178
+ targetWeight = nextWeight;
179
+ }
180
+ }
181
+
182
+ // Round weight to equipment
183
+ const roundedWeight = WorkoutEquipmentTypeService.findNearestWeight(
184
+ equipment,
185
+ targetWeight,
186
+ 'prefer-down'
187
+ );
188
+ if (roundedWeight !== null) {
189
+ targetWeight = roundedWeight;
190
+ }
191
+
192
+ return { targetWeight, targetReps };
193
+ }
194
+
195
+ /**
196
+ * Auto-regulated load progression. Reps stay at rep range max, weight adjusts based on surplus.
197
+ *
198
+ * | Surplus | Action |
199
+ * |---:|---|
200
+ * | >= 2 | Accelerate: increase weight by ~4% |
201
+ * | 0 to 1 | Normal: increase weight by 2% |
202
+ * | -1 to -2 | Hold weight (no increase) |
203
+ * | <= -3 | Reduce weight by minimum equipment increment |
204
+ */
205
+ private static calculateAutoRegulatedLoadTargets(
206
+ previousSet: CompletedWorkoutSet,
207
+ surplus: number,
208
+ repRange: { min: number; max: number },
209
+ equipment: WorkoutEquipmentType
210
+ ): { targetWeight: number; targetReps: number } {
211
+ const targetReps = repRange.max;
212
+ let targetWeight = previousSet.plannedWeight;
213
+
214
+ if (surplus >= 2) {
215
+ // Accelerate: increase by ~4%
216
+ const fourPercentIncrease = targetWeight * 1.04;
217
+ const nextWeight = WorkoutEquipmentTypeService.findNearestWeight(
218
+ equipment,
219
+ fourPercentIncrease,
220
+ 'up'
221
+ );
222
+ if (nextWeight !== null) {
223
+ targetWeight = nextWeight;
224
+ }
225
+ } else if (surplus >= 0) {
226
+ // Normal: increase by 2%
227
+ const nextWeight = this.findNextTwoPercentWeight(targetWeight, equipment);
228
+ if (nextWeight !== null) {
229
+ targetWeight = nextWeight;
230
+ }
231
+ } else if (surplus >= -2) {
232
+ // Hold weight - no change
233
+ } else {
234
+ // Reduce by minimum equipment increment
235
+ const reducedWeight = WorkoutEquipmentTypeService.findNearestWeight(
236
+ equipment,
237
+ targetWeight - 0.01,
238
+ 'down'
239
+ );
240
+ if (reducedWeight !== null) {
241
+ targetWeight = reducedWeight;
242
+ }
243
+ }
244
+
245
+ return { targetWeight, targetReps };
246
+ }
247
+
248
+ /**
249
+ * Checks whether a set has all the data needed for autoregulation calculations.
250
+ */
251
+ private static hasCompleteAutoRegulationData(set: WorkoutSet): set is CompletedWorkoutSet {
252
+ return (
253
+ set.actualReps != null &&
254
+ set.plannedReps != null &&
255
+ set.rir != null &&
256
+ set.plannedRir != null &&
257
+ set.plannedWeight != null
258
+ );
259
+ }
260
+
261
+ /**
262
+ * Calculates targets using the calibration-based formula (original behavior).
263
+ */
264
+ private static calculateCalibrationBasedTargets(params: {
265
+ exercise: WorkoutExercise;
266
+ calibration: WorkoutExerciseCalibration;
267
+ equipment: WorkoutEquipmentType;
268
+ microcycleIndex: number;
269
+ firstMicrocycleRir: number;
270
+ repRange: { min: number; max: number };
271
+ repRangeMidpoint: number;
272
+ }): { targetWeight: number; targetReps: number } {
273
+ const {
274
+ exercise,
275
+ calibration,
276
+ equipment,
277
+ microcycleIndex,
278
+ firstMicrocycleRir,
279
+ repRange,
280
+ repRangeMidpoint
281
+ } = params;
282
+
80
283
  // For rep progression, calculate weight based on reps at microcycle 0
81
284
  // For load progression, use max reps
82
285
  let baseRepsForWeight: number;
@@ -45,6 +45,21 @@ export default class WorkoutExerciseCalibrationService {
45
45
  * @param targetReps The target number of reps.
46
46
  */
47
47
  static getTargetWeight(calibration: WorkoutExerciseCalibration, targetReps: number): number;
48
+ /**
49
+ * Calculates the target weight from a raw 1RM value and a target rep count.
50
+ *
51
+ * This applies the same targetPercentage formula as {@link getTargetWeight}
52
+ * but accepts a pre-computed 1RM instead of a calibration document. Useful
53
+ * when the effective 1RM is derived from multiple sources (calibrations and
54
+ * actual sets).
55
+ *
56
+ * Returns the calculated weight without rounding. Consumer can use
57
+ * WorkoutEquipmentTypeService.findNearestWeight() to round if needed.
58
+ *
59
+ * @param effective1RM The effective 1 Rep Max value.
60
+ * @param targetReps The target number of reps.
61
+ */
62
+ static getTargetWeightFrom1RM(effective1RM: number, targetReps: number): number;
48
63
  /**
49
64
  * Generates auto-calibrations from exercise CTOs whose best set 1RM exceeds
50
65
  * their best calibration 1RM.
@@ -1 +1 @@
1
- {"version":3,"file":"WorkoutExerciseCalibrationService.d.ts","sourceRoot":"","sources":["../../../../src/services/workout/ExerciseCalibration/WorkoutExerciseCalibrationService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0DAA0D,CAAC;AAM3G;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,iCAAiC;IACpD;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,0BAA0B,GAAG,MAAM;IAI9D;;;;;OAKG;IACH,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAItD;;;;;;;OAOG;IACH,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;;;;;;;IAM7D;;;;;;;;OAQG;IACH,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,0BAA0B,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM;IAM3F;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,wBAAwB,CAC7B,YAAY,EAAE,kBAAkB,EAAE,EAClC,MAAM,EAAE,IAAI,EACZ,YAAY,EAAE,IAAI,GACjB,0BAA0B,EAAE;IA4B/B;;;;;;;;;OASG;IACH,OAAO,CAAC,MAAM,CAAC,mBAAmB;CAGnC"}
1
+ {"version":3,"file":"WorkoutExerciseCalibrationService.d.ts","sourceRoot":"","sources":["../../../../src/services/workout/ExerciseCalibration/WorkoutExerciseCalibrationService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0DAA0D,CAAC;AAM3G;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,iCAAiC;IACpD;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,0BAA0B,GAAG,MAAM;IAI9D;;;;;OAKG;IACH,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAItD;;;;;;;OAOG;IACH,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;;;;;;;IAM7D;;;;;;;;OAQG;IACH,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,0BAA0B,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM;IAK3F;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,sBAAsB,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM;IAK/E;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,wBAAwB,CAC7B,YAAY,EAAE,kBAAkB,EAAE,EAClC,MAAM,EAAE,IAAI,EACZ,YAAY,EAAE,IAAI,GACjB,0BAA0B,EAAE;IA4B/B;;;;;;;;;OASG;IACH,OAAO,CAAC,MAAM,CAAC,mBAAmB;CAGnC"}
@@ -48,8 +48,25 @@ export default class WorkoutExerciseCalibrationService {
48
48
  */
49
49
  static getTargetWeight(calibration, targetReps) {
50
50
  const oneRepMax = this.get1RM(calibration);
51
+ return this.getTargetWeightFrom1RM(oneRepMax, targetReps);
52
+ }
53
+ /**
54
+ * Calculates the target weight from a raw 1RM value and a target rep count.
55
+ *
56
+ * This applies the same targetPercentage formula as {@link getTargetWeight}
57
+ * but accepts a pre-computed 1RM instead of a calibration document. Useful
58
+ * when the effective 1RM is derived from multiple sources (calibrations and
59
+ * actual sets).
60
+ *
61
+ * Returns the calculated weight without rounding. Consumer can use
62
+ * WorkoutEquipmentTypeService.findNearestWeight() to round if needed.
63
+ *
64
+ * @param effective1RM The effective 1 Rep Max value.
65
+ * @param targetReps The target number of reps.
66
+ */
67
+ static getTargetWeightFrom1RM(effective1RM, targetReps) {
51
68
  const targetPercentage = this.getTargetPercentage(targetReps);
52
- return (targetPercentage / 100) * oneRepMax;
69
+ return (targetPercentage / 100) * effective1RM;
53
70
  }
54
71
  /**
55
72
  * Generates auto-calibrations from exercise CTOs whose best set 1RM exceeds
@@ -1 +1 @@
1
- {"version":3,"file":"WorkoutExerciseCalibrationService.js","sourceRoot":"","sources":["../../../../src/services/workout/ExerciseCalibration/WorkoutExerciseCalibrationService.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gCAAgC,EAAE,MAAM,0DAA0D,CAAC;AAE5G,mFAAmF;AACnF,MAAM,gBAAgB,GAAG,KAAK,C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CAAC;gBAAE,SAAS;YAEvF,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;YACxE,MAAM,MAAM,GAAG,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAElE,IAAI,MAAM,GAAG,MAAM,EAAE,CAAC;gBACpB,eAAe,CAAC,IAAI,CAClB,gCAAgC,CAAC,KAAK,CAAC;oBACrC,MAAM;oBACN,iBAAiB,EAAE,GAAG,CAAC,GAAG;oBAC1B,MAAM,EAAE,OAAO,CAAC,YAAY;oBAC5B,IAAI,EAAE,OAAO,CAAC,UAAU;oBACxB,kBAAkB,EAAE,OAAO,CAAC,kBAAkB;oBAC9C,YAAY;oBACZ,sBAAsB,EAAE,OAAO,CAAC,GAAG;iBACpC,CAAC,CACH,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,eAAe,CAAC;IACzB,CAAC;IAED;;;;;;;;;OASG;IACK,MAAM,CAAC,mBAAmB,CAAC,UAAkB;QACnD,OAAO,EAAE,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;IACrC,CAAC;CACF"}
1
+ {"version":3,"file":"WorkoutExerciseCalibrationService.js","sourceRoot":"","sources":["../../../../src/services/workout/ExerciseCalibration/WorkoutExerciseCalibrationService.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gCAAgC,EAAE,MAAM,0DAA0D,CAAC;AAE5G,mFAAmF;AACnF,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAE/B;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,iCAAiC;IACpD;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,CAAC,WAAuC;QACnD,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;IAC9D,CAAC;IAED;;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CAAC,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;YACxE,MAAM,MAAM,GAAG,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAElE,IAAI,MAAM,GAAG,MAAM,EAAE,CAAC;gBACpB,eAAe,CAAC,IAAI,CAClB,gCAAgC,CAAC,KAAK,CAAC;oBACrC,MAAM;oBACN,iBAAiB,EAAE,GAAG,CAAC,GAAG;oBAC1B,MAAM,EAAE,OAAO,CAAC,YAAY;oBAC5B,IAAI,EAAE,OAAO,CAAC,UAAU;oBACxB,kBAAkB,EAAE,OAAO,CAAC,kBAAkB;oBAC9C,YAAY;oBACZ,sBAAsB,EAAE,OAAO,CAAC,GAAG;iBACpC,CAAC,CACH,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,eAAe,CAAC;IACzB,CAAC;IAED;;;;;;;;;OASG;IACK,MAAM,CAAC,mBAAmB,CAAC,UAAkB;QACnD,OAAO,EAAE,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;IACrC,CAAC;CACF"}
@@ -56,8 +56,26 @@ export default class WorkoutExerciseCalibrationService {
56
56
  */
57
57
  static getTargetWeight(calibration: WorkoutExerciseCalibration, targetReps: number): number {
58
58
  const oneRepMax = this.get1RM(calibration);
59
+ return this.getTargetWeightFrom1RM(oneRepMax, targetReps);
60
+ }
61
+
62
+ /**
63
+ * Calculates the target weight from a raw 1RM value and a target rep count.
64
+ *
65
+ * This applies the same targetPercentage formula as {@link getTargetWeight}
66
+ * but accepts a pre-computed 1RM instead of a calibration document. Useful
67
+ * when the effective 1RM is derived from multiple sources (calibrations and
68
+ * actual sets).
69
+ *
70
+ * Returns the calculated weight without rounding. Consumer can use
71
+ * WorkoutEquipmentTypeService.findNearestWeight() to round if needed.
72
+ *
73
+ * @param effective1RM The effective 1 Rep Max value.
74
+ * @param targetReps The target number of reps.
75
+ */
76
+ static getTargetWeightFrom1RM(effective1RM: number, targetReps: number): number {
59
77
  const targetPercentage = this.getTargetPercentage(targetReps);
60
- return (targetPercentage / 100) * oneRepMax;
78
+ return (targetPercentage / 100) * effective1RM;
61
79
  }
62
80
 
63
81
  /**
@@ -1,5 +1,6 @@
1
1
  import type { UUID } from 'crypto';
2
2
  import type { WorkoutExerciseCTO } from '../../../ctos/workout/WorkoutExerciseCTO.js';
3
+ import type { WorkoutMuscleGroupVolumeCTO, WorkoutVolumeLandmarkEstimate } from '../../../ctos/workout/WorkoutMuscleGroupVolumeCTO.js';
3
4
  import type { WorkoutEquipmentType } from '../../../documents/workout/WorkoutEquipmentType.js';
4
5
  import type { WorkoutExercise } from '../../../documents/workout/WorkoutExercise.js';
5
6
  import type { WorkoutMesocycle } from '../../../documents/workout/WorkoutMesocycle.js';
@@ -21,14 +22,30 @@ export default class WorkoutMesocyclePlanContext {
21
22
  existingSessionExercises: WorkoutSessionExercise[];
22
23
  existingSets: WorkoutSet[];
23
24
  /**
24
- * A constant for now that defines what the target RIR is for the first microcycle of every mesocycle,
25
- * regardless of anything else.
25
+ * The target RIR for the first microcycle of the mesocycle. Varies by cycle
26
+ * type: MuscleGain starts at 4, Cut starts at 3, Resensitization stays at 3.
26
27
  */
27
- readonly FIRST_MICROCYCLE_RIR = 4;
28
+ readonly firstMicrocycleRir: number;
29
+ /**
30
+ * Number of microcycles between each baseline set addition.
31
+ * MuscleGain = 1 (every microcycle), Cut = 2 (every other), Resensitization = 0 (never).
32
+ */
33
+ readonly progressionInterval: number;
34
+ /**
35
+ * Whether this mesocycle type skips the deload microcycle. True for
36
+ * Resensitization cycles.
37
+ */
38
+ readonly skipDeload: boolean;
39
+ /**
40
+ * Number of accumulation (non-deload) microcycles in this mesocycle.
41
+ * Equal to the total planned count when deload is skipped, or total minus one otherwise.
42
+ */
43
+ readonly accumulationMicrocycleCount: number;
28
44
  readonly exerciseMap: Map<UUID, WorkoutExercise>;
29
45
  readonly equipmentMap: Map<UUID, WorkoutEquipmentType>;
30
46
  readonly sessionMap: Map<UUID, WorkoutSession>;
31
47
  readonly sessionExerciseMap: Map<UUID, WorkoutSessionExercise>;
48
+ readonly setMap: Map<UUID, WorkoutSet>;
32
49
  readonly microcyclesToCreate: WorkoutMicrocycle[];
33
50
  /**
34
51
  * All microcycles for this mesocycle in chronological order.
@@ -53,11 +70,16 @@ export default class WorkoutMesocyclePlanContext {
53
70
  * ended up in.
54
71
  */
55
72
  muscleGroupToExerciseCTOsMap: Map<UUID, WorkoutExerciseCTO[]> | undefined;
73
+ /**
74
+ * Maps muscle group ID to its estimated volume landmarks (MEV, MRV, MAV).
75
+ * Populated from WorkoutMuscleGroupVolumeCTOs when provided.
76
+ */
77
+ muscleGroupToVolumeLandmarkMap: Map<UUID, WorkoutVolumeLandmarkEstimate>;
56
78
  exerciseIdToSessionIndex: Map<UUID, number> | undefined;
57
79
  /**
58
80
  * Creates a new workout mesocycle planning context.
59
81
  */
60
- constructor(mesocycle: WorkoutMesocycle, exerciseCTOs: WorkoutExerciseCTO[], existingMicrocycles?: WorkoutMicrocycle[], existingSessions?: WorkoutSession[], existingSessionExercises?: WorkoutSessionExercise[], existingSets?: WorkoutSet[]);
82
+ constructor(mesocycle: WorkoutMesocycle, exerciseCTOs: WorkoutExerciseCTO[], volumeCTOs?: WorkoutMuscleGroupVolumeCTO[], existingMicrocycles?: WorkoutMicrocycle[], existingSessions?: WorkoutSession[], existingSessionExercises?: WorkoutSessionExercise[], existingSets?: WorkoutSet[]);
61
83
  /**
62
84
  * Adds a microcycle to the list of microcycles to create and the overall chronological list.
63
85
  */
@@ -70,6 +92,10 @@ export default class WorkoutMesocyclePlanContext {
70
92
  * Adds a session exercise to the context and updates internal maps.
71
93
  */
72
94
  addSessionExercise(sessionExercise: WorkoutSessionExercise): void;
95
+ /**
96
+ * Adds sets to the context and updates the set map for O(1) lookup.
97
+ */
98
+ addSets(sets: WorkoutSet[]): void;
73
99
  /**
74
100
  * Stores the planned session -> exercises structure for the mesocycle and derives
75
101
  * the muscle-group-wide ordering used for set progression.
@@ -1 +1 @@
1
- {"version":3,"file":"WorkoutMesocyclePlanContext.d.ts","sourceRoot":"","sources":["../../../../src/services/workout/Mesocycle/WorkoutMesocyclePlanContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oDAAoD,CAAC;AAC/F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+CAA+C,CAAC;AACrF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AACvF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;AACzF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AACnF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sDAAsD,CAAC;AACnG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAE3E;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,2BAA2B;IA2CrC,SAAS,EAAE,gBAAgB;IAE3B,mBAAmB,EAAE,iBAAiB,EAAE;IACxC,gBAAgB,EAAE,cAAc,EAAE;IAClC,wBAAwB,EAAE,sBAAsB,EAAE;IAClD,YAAY,EAAE,UAAU,EAAE;IA/CnC;;;OAGG;IACH,SAAgB,oBAAoB,KAAK;IAEzC,SAAgB,WAAW,EAAE,GAAG,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;IACxD,SAAgB,YAAY,EAAE,GAAG,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;IAC9D,SAAgB,UAAU,EAAE,GAAG,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IACtD,SAAgB,kBAAkB,EAAE,GAAG,CAAC,IAAI,EAAE,sBAAs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