hevy-shared 1.0.853 → 1.0.855

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.
@@ -1,4 +1,4 @@
1
- import { WeeklyTrainingFrequency, TrainingGoal, TrainingLevel, Equipment, SimplifiedMuscleGroup, MuscleGroup, LibraryExercise } from '.';
1
+ import { WeeklyTrainingFrequency, TrainingGoal, TrainingLevel, Equipment, SimplifiedMuscleGroup, MuscleGroup, LibraryExercise, ExerciseCategory } from '.';
2
2
  export type HevyTrainerExerciseCategory = typeof hevyTrainerExerciseCategories[number];
3
3
  export type HevyTrainerRoutineName = typeof routineNames[number];
4
4
  export type HevyTrainerProgramEquipment = Extract<Equipment, 'barbell' | 'dumbbell' | 'machine'>;
@@ -125,6 +125,18 @@ export interface TrainerProgram {
125
125
  export declare const getTrainerSetCount: (trainerAlgorithmSettings: TrainerAlgorithmSettings, goal: TrainingGoal, frequency: WeeklyTrainingFrequency) => number;
126
126
  export declare const getTrainerRepRange: (trainerAlgorithmSettings: TrainerAlgorithmSettings, goal: TrainingGoal, exerciseCategory: HevyTrainerExerciseCategory) => RepRange;
127
127
  export declare const getTrainerRestTimerSeconds: (trainerAlgorithmSettings: TrainerAlgorithmSettings, goal: TrainingGoal, exerciseCategory: HevyTrainerExerciseCategory) => number;
128
+ /**
129
+ * Normalizes the exercise category to a HevyTrainerExerciseCategory
130
+ * - Treat custom exercises and exercises with no category as `compound`
131
+ * - Treat `assistance-compound` as `compound`
132
+ * - Treat `isolation` as `isolation`
133
+ * @param exercise - The exercise to normalize the category for
134
+ * @returns The normalized exercise category
135
+ */
136
+ export declare const normalizeExerciseCategory: (exercise: {
137
+ is_custom: boolean;
138
+ category?: ExerciseCategory;
139
+ }) => HevyTrainerExerciseCategory;
128
140
  /**
129
141
  * Sorts exercises by priority for each muscle group based on the provided priorities
130
142
  * 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.getTrainerRestTimerSeconds = exports.getTrainerRepRange = exports.getTrainerSetCount = exports.programSplits = exports.frequencyMap = exports.routineNames = exports.defaultDurationPerFrequency = exports.workoutDurationOptions = exports.hevyTrainerExerciseCategories = void 0;
3
+ exports.generateProgram = exports.pickExerciseForPrescription = exports.getPrioritySortedExercises = exports.normalizeExerciseCategory = exports.getTrainerRestTimerSeconds = exports.getTrainerRepRange = exports.getTrainerSetCount = exports.programSplits = exports.frequencyMap = exports.routineNames = exports.defaultDurationPerFrequency = exports.workoutDurationOptions = exports.hevyTrainerExerciseCategories = void 0;
4
4
  const _1 = require(".");
5
5
  const MAX_BARBELL_EXERCISES_PER_ROUTINE = 2;
6
6
  exports.hevyTrainerExerciseCategories = ['compound', 'isolation'];
@@ -71,6 +71,22 @@ const getTrainerRestTimerSeconds = (trainerAlgorithmSettings, goal, exerciseCate
71
71
  return trainerAlgorithmSettings.rest_timers[goal][exerciseCategory];
72
72
  };
73
73
  exports.getTrainerRestTimerSeconds = getTrainerRestTimerSeconds;
74
+ /**
75
+ * Normalizes the exercise category to a HevyTrainerExerciseCategory
76
+ * - Treat custom exercises and exercises with no category as `compound`
77
+ * - Treat `assistance-compound` as `compound`
78
+ * - Treat `isolation` as `isolation`
79
+ * @param exercise - The exercise to normalize the category for
80
+ * @returns The normalized exercise category
81
+ */
82
+ const normalizeExerciseCategory = (exercise) => {
83
+ return exercise.is_custom
84
+ ? 'compound'
85
+ : exercise.category === 'isolation'
86
+ ? 'isolation'
87
+ : 'compound';
88
+ };
89
+ exports.normalizeExerciseCategory = normalizeExerciseCategory;
74
90
  /**
75
91
  * Checks if an exercise is compatible with the user's equipments
76
92
  *
@@ -1,5 +1,5 @@
1
1
  interface SetIndicatored {
2
- indicator: 'warmup' | 'dropset' | 'failure' | 'normal' | any;
2
+ indicator: 'warmup' | 'dropset' | 'failure' | 'normal' | number;
3
3
  }
4
4
  interface Indexed {
5
5
  index: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hevy-shared",
3
- "version": "1.0.853",
3
+ "version": "1.0.855",
4
4
  "description": "",
5
5
  "main": "built/index.js",
6
6
  "types": "built/index.d.ts",