hevy-shared 1.0.939 → 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.
- package/built/hevyTrainer.d.ts +11 -5
- package/built/hevyTrainer.js +33 -26
- package/built/index.d.ts +3 -1
- package/built/index.js +1 -1
- package/package.json +1 -1
package/built/hevyTrainer.d.ts
CHANGED
|
@@ -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
|
|
7
|
-
export type
|
|
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
|
|
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,
|
|
142
|
-
|
|
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`
|
package/built/hevyTrainer.js
CHANGED
|
@@ -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.
|
|
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.
|
|
6
|
+
exports.trainingGoalRestPresets = [
|
|
7
7
|
'strength_short',
|
|
8
|
-
'
|
|
8
|
+
'strength_medium',
|
|
9
9
|
'strength_long',
|
|
10
10
|
'build_muscle_short',
|
|
11
|
-
'
|
|
11
|
+
'build_muscle_medium',
|
|
12
12
|
'build_muscle_long',
|
|
13
13
|
'fat_loss_short',
|
|
14
|
-
'
|
|
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,
|
|
218
|
-
return trainerAlgorithmSettings.rest_timers[
|
|
217
|
+
const getTrainerRestTimerSeconds = (trainerAlgorithmSettings, trainingGoalRestPreset, exerciseCategory) => {
|
|
218
|
+
return trainerAlgorithmSettings.rest_timers[trainingGoalRestPreset][exerciseCategory];
|
|
219
219
|
};
|
|
220
220
|
exports.getTrainerRestTimerSeconds = getTrainerRestTimerSeconds;
|
|
221
|
-
|
|
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
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
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
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
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
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
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
|
-
|
|
248
|
+
(0, _1.exhaustiveTypeCheck)(goal);
|
|
249
|
+
return 'strength_medium';
|
|
243
250
|
}
|
|
244
251
|
};
|
|
245
|
-
exports.
|
|
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.
|
|
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", "
|
|
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 {
|
|
@@ -1287,6 +1288,7 @@ export interface UpdateHevyTrainerProgramRequestBody {
|
|
|
1287
1288
|
focus_muscle?: SimplifiedMuscleGroup;
|
|
1288
1289
|
next_workout_index?: number;
|
|
1289
1290
|
workout_duration_minutes?: WorkoutDurationMinutes;
|
|
1291
|
+
rest_timer_length?: RestTimerLength;
|
|
1290
1292
|
routines: {
|
|
1291
1293
|
id: string;
|
|
1292
1294
|
title: string;
|
package/built/index.js
CHANGED
|
@@ -227,7 +227,7 @@ exports.exerciseCategories = [
|
|
|
227
227
|
'compound',
|
|
228
228
|
'assistance-compound',
|
|
229
229
|
];
|
|
230
|
-
exports.restTimerLengths = ['short', '
|
|
230
|
+
exports.restTimerLengths = ['short', 'medium', 'long'];
|
|
231
231
|
exports.hevyTrainerProgramEquipments = [
|
|
232
232
|
'barbell',
|
|
233
233
|
'dumbbell',
|