hevy-shared 1.0.742 → 1.0.744
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/built/hevyTrainer.d.ts +7 -7
- package/built/hevyTrainer.js +13 -13
- package/package.json +1 -1
package/built/hevyTrainer.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export interface ExerciseSelectionParams {
|
|
|
24
24
|
context: ExerciseSelectionContext;
|
|
25
25
|
}
|
|
26
26
|
export interface ProgramGenerationParams<T extends HevyTrainerLibraryExercise> {
|
|
27
|
-
|
|
27
|
+
trainerAlgorithmSettings: TrainerAlgorithmSettings;
|
|
28
28
|
selectedDays: WeeklyTrainingFrequency;
|
|
29
29
|
selectedGoal: TrainingGoal;
|
|
30
30
|
selectedLevel: TrainingLevel;
|
|
@@ -76,16 +76,16 @@ export interface WorkoutTemplate {
|
|
|
76
76
|
export type Templates = {
|
|
77
77
|
[key in HevyTrainerRoutineName]: WorkoutTemplate;
|
|
78
78
|
};
|
|
79
|
-
export interface
|
|
79
|
+
export interface BackofficeTrainerPreset {
|
|
80
80
|
id?: number;
|
|
81
81
|
username: string;
|
|
82
82
|
title?: string;
|
|
83
83
|
is_default?: boolean;
|
|
84
84
|
updated_at?: string;
|
|
85
|
-
settings:
|
|
85
|
+
settings: TrainerAlgorithmSettings;
|
|
86
86
|
workout_tab_ai_insight_prompt?: string;
|
|
87
87
|
}
|
|
88
|
-
export interface
|
|
88
|
+
export interface TrainerAlgorithmSettings {
|
|
89
89
|
sets: SetsPerFrequency;
|
|
90
90
|
rep_ranges: RepRanges;
|
|
91
91
|
rest_timers: RestTimers;
|
|
@@ -113,9 +113,9 @@ export interface TrainerProgram {
|
|
|
113
113
|
name: WeeklyTrainingFrequency;
|
|
114
114
|
routines: TrainerProgramRoutine[];
|
|
115
115
|
}
|
|
116
|
-
export declare const getTrainerSetCount: (
|
|
117
|
-
export declare const getTrainerRepRange: (
|
|
118
|
-
export declare const getTrainerRestTimerSeconds: (
|
|
116
|
+
export declare const getTrainerSetCount: (trainerAlgorithmSettings: TrainerAlgorithmSettings, goal: TrainingGoal, frequency: WeeklyTrainingFrequency) => number;
|
|
117
|
+
export declare const getTrainerRepRange: (trainerAlgorithmSettings: TrainerAlgorithmSettings, goal: TrainingGoal, exerciseCategory: HevyTrainerExerciseCategory) => RepRange;
|
|
118
|
+
export declare const getTrainerRestTimerSeconds: (trainerAlgorithmSettings: TrainerAlgorithmSettings, goal: TrainingGoal, exerciseCategory: HevyTrainerExerciseCategory) => number;
|
|
119
119
|
/**
|
|
120
120
|
* Sorts exercises by priority for each muscle group based on the provided priorities
|
|
121
121
|
* and adds any remaining exercises from the store that weren't in the priorities.
|
package/built/hevyTrainer.js
CHANGED
|
@@ -49,16 +49,16 @@ exports.programSplits = {
|
|
|
49
49
|
5: ['push_1', 'pull_1', 'legs_1', 'upper_2', 'lower_2'],
|
|
50
50
|
6: ['push_2_a', 'pull_2_a', 'legs_2_a', 'push_2_b', 'pull_2_b', 'legs_2_b'],
|
|
51
51
|
};
|
|
52
|
-
const getTrainerSetCount = (
|
|
53
|
-
return
|
|
52
|
+
const getTrainerSetCount = (trainerAlgorithmSettings, goal, frequency) => {
|
|
53
|
+
return trainerAlgorithmSettings.sets[exports.frequencyMap[frequency]][goal];
|
|
54
54
|
};
|
|
55
55
|
exports.getTrainerSetCount = getTrainerSetCount;
|
|
56
|
-
const getTrainerRepRange = (
|
|
57
|
-
return
|
|
56
|
+
const getTrainerRepRange = (trainerAlgorithmSettings, goal, exerciseCategory) => {
|
|
57
|
+
return trainerAlgorithmSettings.rep_ranges[goal][exerciseCategory];
|
|
58
58
|
};
|
|
59
59
|
exports.getTrainerRepRange = getTrainerRepRange;
|
|
60
|
-
const getTrainerRestTimerSeconds = (
|
|
61
|
-
return
|
|
60
|
+
const getTrainerRestTimerSeconds = (trainerAlgorithmSettings, goal, exerciseCategory) => {
|
|
61
|
+
return trainerAlgorithmSettings.rest_timers[goal][exerciseCategory];
|
|
62
62
|
};
|
|
63
63
|
exports.getTrainerRestTimerSeconds = getTrainerRestTimerSeconds;
|
|
64
64
|
/**
|
|
@@ -253,18 +253,18 @@ exports.pickExerciseForPrescription = pickExerciseForPrescription;
|
|
|
253
253
|
*/
|
|
254
254
|
const generateProgram = (params) => {
|
|
255
255
|
var _a;
|
|
256
|
-
const {
|
|
256
|
+
const { trainerAlgorithmSettings, selectedDays, selectedGoal, selectedLevel, selectedEquipments, exerciseStore, focusMuscle, excludedExerciseIds, } = params;
|
|
257
257
|
const routines = exports.programSplits[selectedDays];
|
|
258
258
|
const program = {
|
|
259
259
|
name: selectedDays,
|
|
260
260
|
routines: [],
|
|
261
261
|
};
|
|
262
|
-
const sortedExercises = (0, exports.getPrioritySortedExercises)(
|
|
262
|
+
const sortedExercises = (0, exports.getPrioritySortedExercises)(trainerAlgorithmSettings.exercise_priorities, exerciseStore);
|
|
263
263
|
const programUsedExerciseIds = new Set();
|
|
264
264
|
let programFocusMuscleExerciseCount = 0;
|
|
265
265
|
const allErrors = [];
|
|
266
266
|
for (const routine of routines) {
|
|
267
|
-
const routineTemplate =
|
|
267
|
+
const routineTemplate = trainerAlgorithmSettings.templates[routine];
|
|
268
268
|
let routineBarbellExerciseCount = 0;
|
|
269
269
|
const routineUsedExerciseIds = new Set();
|
|
270
270
|
const routineExercises = [];
|
|
@@ -301,17 +301,17 @@ const generateProgram = (params) => {
|
|
|
301
301
|
routineBarbellExerciseCount++;
|
|
302
302
|
if (exercisePrescription.muscle_group === 'focus_muscle')
|
|
303
303
|
programFocusMuscleExerciseCount++;
|
|
304
|
-
const repRange = (0, exports.getTrainerRepRange)(
|
|
304
|
+
const repRange = (0, exports.getTrainerRepRange)(trainerAlgorithmSettings, selectedGoal, exercisePrescription.category);
|
|
305
305
|
routineExercises.push({
|
|
306
306
|
exerciseTemplate: exercise,
|
|
307
307
|
muscleGroup: exercisePrescription.muscle_group,
|
|
308
308
|
category: exercisePrescription.category,
|
|
309
|
-
sets: (0, exports.getTrainerSetCount)(
|
|
309
|
+
sets: (0, exports.getTrainerSetCount)(trainerAlgorithmSettings, selectedGoal, selectedDays),
|
|
310
310
|
repRangeStart: repRange.rep_range_start,
|
|
311
311
|
repRangeEnd: repRange.rep_range_end,
|
|
312
|
-
restTimerSeconds: (0, exports.getTrainerRestTimerSeconds)(
|
|
312
|
+
restTimerSeconds: (0, exports.getTrainerRestTimerSeconds)(trainerAlgorithmSettings, selectedGoal, exercisePrescription.category),
|
|
313
313
|
warmupSetCount: exercisePrescription.warmup_set_count,
|
|
314
|
-
notes: (_a =
|
|
314
|
+
notes: (_a = trainerAlgorithmSettings.exercise_notes[exercise.id]) !== null && _a !== void 0 ? _a : '',
|
|
315
315
|
});
|
|
316
316
|
}
|
|
317
317
|
else {
|