hevy-shared 1.0.722 → 1.0.724

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.
@@ -33,13 +33,14 @@ export interface ProgramGenerationParams<T extends HevyTrainerLibraryExercise> {
33
33
  focusMuscle?: SimplifiedMuscleGroup;
34
34
  excludedExerciseIds?: Set<string>;
35
35
  }
36
- export declare const frequencyMap: Record<WeeklyTrainingFrequency, string>;
36
+ export type FrequencyString = 'one_day' | 'two_days' | 'three_days' | 'four_days' | 'five_days' | 'six_days';
37
+ export declare const frequencyMap: Record<WeeklyTrainingFrequency, FrequencyString>;
37
38
  export declare const programSplits: Record<WeeklyTrainingFrequency, HevyTrainerRoutineName[]>;
38
39
  export type SetsPerGoal = {
39
40
  [key in TrainingGoal]: number;
40
41
  };
41
- export type Sets = {
42
- [key in string]: SetsPerGoal;
42
+ export type SetsPerFrequency = {
43
+ [key in FrequencyString]: SetsPerGoal;
43
44
  };
44
45
  export interface RepRange {
45
46
  rep_range_start: number;
@@ -85,7 +86,7 @@ export interface TrainerPreset {
85
86
  workout_tab_ai_insight_prompt?: string;
86
87
  }
87
88
  export interface TrainerPresetSettings {
88
- sets: Sets;
89
+ sets: SetsPerFrequency;
89
90
  rep_ranges: RepRanges;
90
91
  rest_timers: RestTimers;
91
92
  templates: Templates;
@@ -112,6 +113,9 @@ export interface TrainerProgram {
112
113
  name: WeeklyTrainingFrequency;
113
114
  routines: TrainerProgramRoutine[];
114
115
  }
116
+ export declare const getTrainerSetCount: (preset: TrainerPreset, goal: TrainingGoal, frequency: WeeklyTrainingFrequency) => number;
117
+ export declare const getTrainerRepRange: (preset: TrainerPreset, goal: TrainingGoal, exerciseCategory: HevyTrainerExerciseCategory) => RepRange;
118
+ export declare const getTrainerRestTimerSeconds: (preset: TrainerPreset, goal: TrainingGoal, exerciseCategory: HevyTrainerExerciseCategory) => number;
115
119
  /**
116
120
  * Sorts exercises by priority for each muscle group based on the provided priorities
117
121
  * and adds any remaining exercises from the store that weren't in the priorities.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateProgram = exports.pickExerciseForPrescription = exports.getPrioritySortedExercises = exports.programSplits = exports.frequencyMap = exports.routineNames = exports.hevyTrainerExerciseCategories = void 0;
3
+ exports.generateProgram = exports.pickExerciseForPrescription = exports.getPrioritySortedExercises = exports.getTrainerRestTimerSeconds = exports.getTrainerRepRange = exports.getTrainerSetCount = exports.programSplits = exports.frequencyMap = exports.routineNames = exports.hevyTrainerExerciseCategories = void 0;
4
4
  const _1 = require(".");
5
5
  const MAX_BARBELL_EXERCISES_PER_ROUTINE = 2;
6
6
  exports.hevyTrainerExerciseCategories = ['compound', 'isolation'];
@@ -49,6 +49,18 @@ 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 = (preset, goal, frequency) => {
53
+ return preset.settings.sets[exports.frequencyMap[frequency]][goal];
54
+ };
55
+ exports.getTrainerSetCount = getTrainerSetCount;
56
+ const getTrainerRepRange = (preset, goal, exerciseCategory) => {
57
+ return preset.settings.rep_ranges[goal][exerciseCategory];
58
+ };
59
+ exports.getTrainerRepRange = getTrainerRepRange;
60
+ const getTrainerRestTimerSeconds = (preset, goal, exerciseCategory) => {
61
+ return preset.settings.rest_timers[goal][exerciseCategory];
62
+ };
63
+ exports.getTrainerRestTimerSeconds = getTrainerRestTimerSeconds;
52
64
  // Utility functions for better code organization
53
65
  const isEquipmentCompatible = (exercise, allowedEquipments) => {
54
66
  return (allowedEquipments.includes(exercise.equipment_category) ||
@@ -268,15 +280,16 @@ const generateProgram = (params) => {
268
280
  routineBarbellExerciseCount++;
269
281
  if (exercisePrescription.muscle_group === 'focus_muscle')
270
282
  programFocusMuscleExerciseCount++;
283
+ const repRange = (0, exports.getTrainerRepRange)(trainerPreset, selectedGoal, exercisePrescription.category);
271
284
  routineExercises.push({
272
285
  exerciseTemplate: exercise,
273
286
  muscleGroup: exercisePrescription.muscle_group,
274
287
  category: exercisePrescription.category,
275
- sets: trainerPreset.settings.sets[exports.frequencyMap[selectedDays]][selectedGoal],
288
+ sets: (0, exports.getTrainerSetCount)(trainerPreset, selectedGoal, selectedDays),
289
+ repRangeStart: repRange.rep_range_start,
290
+ repRangeEnd: repRange.rep_range_end,
291
+ restTimerSeconds: (0, exports.getTrainerRestTimerSeconds)(trainerPreset, selectedGoal, exercisePrescription.category),
276
292
  warmupSetCount: exercisePrescription.warmup_set_count,
277
- repRangeStart: trainerPreset.settings.rep_ranges[selectedGoal][exercisePrescription.category].rep_range_start,
278
- repRangeEnd: trainerPreset.settings.rep_ranges[selectedGoal][exercisePrescription.category].rep_range_end,
279
- restTimerSeconds: trainerPreset.settings.rest_timers[selectedGoal][exercisePrescription.category],
280
293
  notes: (_a = trainerPreset.settings.exercise_notes[exercise.id]) !== null && _a !== void 0 ? _a : '',
281
294
  });
282
295
  }
package/built/index.d.ts CHANGED
@@ -1764,10 +1764,5 @@ export interface ProgressiveOverloadSettings {
1764
1764
  };
1765
1765
  }
1766
1766
  export interface HevyTrainerUserPreferences {
1767
- availablePlatesKg: number[];
1768
- availablePlatesLbs: number[];
1769
- availableBarsKg: number[];
1770
- availableBarsLbs: number[];
1771
- availableDumbbellsKg: number[];
1772
- availableDumbbellsLbs: number[];
1767
+ progressiveOverloadSettings: ProgressiveOverloadSettings;
1773
1768
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hevy-shared",
3
- "version": "1.0.722",
3
+ "version": "1.0.724",
4
4
  "description": "",
5
5
  "main": "built/index.js",
6
6
  "types": "built/index.d.ts",