hevy-shared 1.0.940 → 1.0.941

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.
@@ -3,8 +3,8 @@ export type HevyTrainerExerciseCategory = typeof hevyTrainerExerciseCategories[n
3
3
  export type HevyTrainerRoutineName = typeof routineNames[number];
4
4
  export declare const workoutDurationOptions: readonly [40, 60, 80];
5
5
  export type WorkoutDurationMinutes = typeof workoutDurationOptions[number];
6
- export declare const trainingGoalLengths: readonly ["strength_short", "strength_default", "strength_long", "build_muscle_short", "build_muscle_default", "build_muscle_long", "fat_loss_short", "fat_loss_default", "fat_loss_long"];
7
- export type TrainingGoalLength = typeof trainingGoalLengths[number];
6
+ export declare const trainingGoalRestPresets: readonly ["strength_short", "strength_medium", "strength_long", "build_muscle_short", "build_muscle_medium", "build_muscle_long", "fat_loss_short", "fat_loss_medium", "fat_loss_long"];
7
+ export type TrainingGoalRestPreset = typeof trainingGoalRestPresets[number];
8
8
  export declare const trainerGymTypes: readonly ["home_gym", "garage_gym", "commercial_gym", "full_gym"];
9
9
  export type TrainerGymType = typeof trainerGymTypes[number];
10
10
  export declare const granularEquipmentDefaults: {
@@ -75,7 +75,7 @@ export type RestTimersPerCategory = {
75
75
  [key in HevyTrainerExerciseCategory]: number;
76
76
  };
77
77
  export type RestTimers = {
78
- [key in TrainingGoalLength]: RestTimersPerCategory;
78
+ [key in TrainingGoalRestPreset]: RestTimersPerCategory;
79
79
  };
80
80
  export type ExercisePriorities = {
81
81
  [key in MuscleGroup]: exerciseId[];
@@ -138,8 +138,14 @@ export interface TrainerProgram {
138
138
  }
139
139
  export declare const getTrainerSetCount: (trainerAlgorithmSettings: TrainerAlgorithmSettings, goal: TrainingGoal, frequency: WeeklyTrainingFrequency) => number;
140
140
  export declare const getTrainerRepRange: (trainerAlgorithmSettings: TrainerAlgorithmSettings, goal: TrainingGoal, exerciseCategory: HevyTrainerExerciseCategory) => RepRange;
141
- export declare const getTrainerRestTimerSeconds: (trainerAlgorithmSettings: TrainerAlgorithmSettings, restTimerLength: TrainingGoalLength, exerciseCategory: HevyTrainerExerciseCategory) => number;
142
- export declare const getRestTimerLength: (goal: TrainingGoal, length: RestTimerLength) => TrainingGoalLength;
141
+ export declare const getTrainerRestTimerSeconds: (trainerAlgorithmSettings: TrainerAlgorithmSettings, trainingGoalRestPreset: TrainingGoalRestPreset, exerciseCategory: HevyTrainerExerciseCategory) => number;
142
+ /**
143
+ * Converts a RestTimerLength to a TrainingGoalRestPreset
144
+ * @param goal - The training goal
145
+ * @param length - The rest timer length
146
+ * @returns The training goal rest preset
147
+ */
148
+ export declare const getGoalRestPreset: (goal: TrainingGoal, length: RestTimerLength) => TrainingGoalRestPreset;
143
149
  /**
144
150
  * Normalizes the exercise category to a HevyTrainerExerciseCategory
145
151
  * - Treat custom exercises and exercises with no category as `compound`
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateProgram = exports.pickExerciseForPrescription = exports.getPrioritySortedExercises = exports.isEquipmentCompatible = exports.normalizeExerciseCategory = exports.getRestTimerLength = exports.getTrainerRestTimerSeconds = exports.getTrainerRepRange = exports.getTrainerSetCount = exports.programSplits = exports.frequencyMap = exports.routineNames = exports.defaultDurationPerFrequency = exports.hevyTrainerExerciseCategories = exports.granularEquipmentsToTrainerEquipments = exports.trainerEquipmentToGranularEquipments = exports.granularEquipmentDefaults = exports.trainerGymTypes = exports.trainingGoalLengths = exports.workoutDurationOptions = void 0;
3
+ exports.generateProgram = exports.pickExerciseForPrescription = exports.getPrioritySortedExercises = exports.isEquipmentCompatible = exports.normalizeExerciseCategory = exports.getGoalRestPreset = exports.getTrainerRestTimerSeconds = exports.getTrainerRepRange = exports.getTrainerSetCount = exports.programSplits = exports.frequencyMap = exports.routineNames = exports.defaultDurationPerFrequency = exports.hevyTrainerExerciseCategories = exports.granularEquipmentsToTrainerEquipments = exports.trainerEquipmentToGranularEquipments = exports.granularEquipmentDefaults = exports.trainerGymTypes = exports.trainingGoalRestPresets = exports.workoutDurationOptions = void 0;
4
4
  const _1 = require(".");
5
5
  exports.workoutDurationOptions = [40, 60, 80];
6
- exports.trainingGoalLengths = [
6
+ exports.trainingGoalRestPresets = [
7
7
  'strength_short',
8
- 'strength_default',
8
+ 'strength_medium',
9
9
  'strength_long',
10
10
  'build_muscle_short',
11
- 'build_muscle_default',
11
+ 'build_muscle_medium',
12
12
  'build_muscle_long',
13
13
  'fat_loss_short',
14
- 'fat_loss_default',
14
+ 'fat_loss_medium',
15
15
  'fat_loss_long',
16
16
  ];
17
17
  exports.trainerGymTypes = [
@@ -214,35 +214,42 @@ const getTrainerRepRange = (trainerAlgorithmSettings, goal, exerciseCategory) =>
214
214
  return trainerAlgorithmSettings.rep_ranges[goal][exerciseCategory];
215
215
  };
216
216
  exports.getTrainerRepRange = getTrainerRepRange;
217
- const getTrainerRestTimerSeconds = (trainerAlgorithmSettings, restTimerLength, exerciseCategory) => {
218
- return trainerAlgorithmSettings.rest_timers[restTimerLength][exerciseCategory];
217
+ const getTrainerRestTimerSeconds = (trainerAlgorithmSettings, trainingGoalRestPreset, exerciseCategory) => {
218
+ return trainerAlgorithmSettings.rest_timers[trainingGoalRestPreset][exerciseCategory];
219
219
  };
220
220
  exports.getTrainerRestTimerSeconds = getTrainerRestTimerSeconds;
221
- const getRestTimerLength = (goal, length) => {
221
+ /**
222
+ * Converts a RestTimerLength to a TrainingGoalRestPreset
223
+ * @param goal - The training goal
224
+ * @param length - The rest timer length
225
+ * @returns The training goal rest preset
226
+ */
227
+ const getGoalRestPreset = (goal, length) => {
222
228
  switch (goal) {
223
229
  case 'strength':
224
- return length === 'short'
225
- ? 'strength_short'
226
- : length === 'default'
227
- ? 'strength_default'
228
- : 'strength_long';
230
+ if (length === 'short')
231
+ return 'strength_short';
232
+ if (length === 'long')
233
+ return 'strength_long';
234
+ return 'strength_medium';
229
235
  case 'build_muscle':
230
- return length === 'short'
231
- ? 'build_muscle_short'
232
- : length === 'default'
233
- ? 'build_muscle_default'
234
- : 'build_muscle_long';
236
+ if (length === 'short')
237
+ return 'build_muscle_short';
238
+ if (length === 'long')
239
+ return 'build_muscle_long';
240
+ return 'build_muscle_medium';
235
241
  case 'fat_loss':
236
- return length === 'short'
237
- ? 'fat_loss_short'
238
- : length === 'default'
239
- ? 'fat_loss_default'
240
- : 'fat_loss_long';
242
+ if (length === 'short')
243
+ return 'fat_loss_short';
244
+ if (length === 'long')
245
+ return 'fat_loss_long';
246
+ return 'fat_loss_medium';
241
247
  default:
242
- return 'strength_default';
248
+ (0, _1.exhaustiveTypeCheck)(goal);
249
+ return 'strength_medium';
243
250
  }
244
251
  };
245
- exports.getRestTimerLength = getRestTimerLength;
252
+ exports.getGoalRestPreset = getGoalRestPreset;
246
253
  /**
247
254
  * Normalizes the exercise category to a HevyTrainerExerciseCategory
248
255
  * - Treat custom exercises and exercises with no category as `compound`
@@ -601,7 +608,7 @@ const generateProgram = (params) => {
601
608
  sets: (0, exports.getTrainerSetCount)(trainerAlgorithmSettings, selectedGoal, selectedDays),
602
609
  repRangeStart: repRange.rep_range_start,
603
610
  repRangeEnd: repRange.rep_range_end,
604
- restTimerSeconds: (0, exports.getTrainerRestTimerSeconds)(trainerAlgorithmSettings, (0, exports.getRestTimerLength)(selectedGoal, selectedRestTimerLength), exercisePrescription.category),
611
+ restTimerSeconds: (0, exports.getTrainerRestTimerSeconds)(trainerAlgorithmSettings, (0, exports.getGoalRestPreset)(selectedGoal, selectedRestTimerLength), exercisePrescription.category),
605
612
  warmupSetCount: exercisePrescription.warmup_set_count,
606
613
  notes: (_a = trainerAlgorithmSettings.exercise_notes[exercise.id]) !== null && _a !== void 0 ? _a : '',
607
614
  });
package/built/index.d.ts CHANGED
@@ -640,7 +640,7 @@ export declare const isCustomExerciseType: (x: any) => x is CustomExerciseType;
640
640
  export declare const trainingGoals: readonly ["strength", "build_muscle", "fat_loss"];
641
641
  export declare const trainingLevels: readonly ["beginner", "intermediate", "advanced"];
642
642
  export declare const exerciseCategories: readonly ["isolation", "compound", "assistance-compound"];
643
- export declare const restTimerLengths: readonly ["short", "default", "long"];
643
+ export declare const restTimerLengths: readonly ["short", "medium", "long"];
644
644
  export type TrainingGoal = Lookup<typeof trainingGoals>;
645
645
  export type TrainingLevel = Lookup<typeof trainingLevels>;
646
646
  export type ExerciseCategory = Lookup<typeof exerciseCategories>;
@@ -1274,6 +1274,7 @@ export interface PostHevyTrainerProgramRequestBody {
1274
1274
  routines: RoutineUpdate[];
1275
1275
  next_workout_index?: number;
1276
1276
  workout_duration_minutes?: WorkoutDurationMinutes;
1277
+ rest_timer_length: RestTimerLength;
1277
1278
  };
1278
1279
  }
1279
1280
  export interface UpdateHevyTrainerProgramRequestBody {
package/built/index.js CHANGED
@@ -227,7 +227,7 @@ exports.exerciseCategories = [
227
227
  'compound',
228
228
  'assistance-compound',
229
229
  ];
230
- exports.restTimerLengths = ['short', 'default', 'long'];
230
+ exports.restTimerLengths = ['short', 'medium', 'long'];
231
231
  exports.hevyTrainerProgramEquipments = [
232
232
  'barbell',
233
233
  'dumbbell',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hevy-shared",
3
- "version": "1.0.940",
3
+ "version": "1.0.941",
4
4
  "description": "",
5
5
  "main": "built/index.js",
6
6
  "types": "built/index.d.ts",