hevy-shared 1.0.935 → 1.0.937
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 -3
- package/built/hevyTrainer.js +41 -5
- package/built/index.d.ts +2 -0
- package/built/index.js +3 -2
- package/package.json +1 -1
package/built/hevyTrainer.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { WeeklyTrainingFrequency, TrainingGoal, TrainingLevel, SimplifiedMuscleGroup, MuscleGroup, LibraryExercise, ExerciseCategory, GranularEquipment, HevyTrainerProgramEquipment } from '.';
|
|
1
|
+
import { WeeklyTrainingFrequency, TrainingGoal, TrainingLevel, SimplifiedMuscleGroup, MuscleGroup, LibraryExercise, ExerciseCategory, GranularEquipment, HevyTrainerProgramEquipment, RestTimerLength } from '.';
|
|
2
2
|
export type HevyTrainerExerciseCategory = typeof hevyTrainerExerciseCategories[number];
|
|
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
8
|
export declare const trainerGymTypes: readonly ["home_gym", "garage_gym", "commercial_gym", "full_gym"];
|
|
7
9
|
export type TrainerGymType = typeof trainerGymTypes[number];
|
|
8
10
|
export declare const granularEquipmentDefaults: {
|
|
@@ -45,6 +47,7 @@ export interface ProgramGenerationParams<T extends HevyTrainerLibraryExercise> {
|
|
|
45
47
|
selectedLevel: TrainingLevel;
|
|
46
48
|
selectedEquipments: GranularEquipment[];
|
|
47
49
|
selectedWorkoutDurationMinutes?: WorkoutDurationMinutes;
|
|
50
|
+
selectedRestTimerLength: RestTimerLength;
|
|
48
51
|
exerciseStore: T[];
|
|
49
52
|
focusMuscle?: SimplifiedMuscleGroup;
|
|
50
53
|
excludedExerciseIds?: Set<string>;
|
|
@@ -72,7 +75,7 @@ export type RestTimersPerCategory = {
|
|
|
72
75
|
[key in HevyTrainerExerciseCategory]: number;
|
|
73
76
|
};
|
|
74
77
|
export type RestTimers = {
|
|
75
|
-
[key in
|
|
78
|
+
[key in TrainingGoalLength]: RestTimersPerCategory;
|
|
76
79
|
};
|
|
77
80
|
export type ExercisePriorities = {
|
|
78
81
|
[key in MuscleGroup]: exerciseId[];
|
|
@@ -135,7 +138,8 @@ export interface TrainerProgram {
|
|
|
135
138
|
}
|
|
136
139
|
export declare const getTrainerSetCount: (trainerAlgorithmSettings: TrainerAlgorithmSettings, goal: TrainingGoal, frequency: WeeklyTrainingFrequency) => number;
|
|
137
140
|
export declare const getTrainerRepRange: (trainerAlgorithmSettings: TrainerAlgorithmSettings, goal: TrainingGoal, exerciseCategory: HevyTrainerExerciseCategory) => RepRange;
|
|
138
|
-
export declare const getTrainerRestTimerSeconds: (trainerAlgorithmSettings: TrainerAlgorithmSettings,
|
|
141
|
+
export declare const getTrainerRestTimerSeconds: (trainerAlgorithmSettings: TrainerAlgorithmSettings, restTimerLength: TrainingGoalLength, exerciseCategory: HevyTrainerExerciseCategory) => number;
|
|
142
|
+
export declare const getRestTimerLength: (goal: TrainingGoal, length: RestTimerLength) => TrainingGoalLength;
|
|
139
143
|
/**
|
|
140
144
|
* Normalizes the exercise category to a HevyTrainerExerciseCategory
|
|
141
145
|
* - Treat custom exercises and exercises with no category as `compound`
|
package/built/hevyTrainer.js
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateProgram = exports.pickExerciseForPrescription = exports.getPrioritySortedExercises = exports.isEquipmentCompatible = exports.normalizeExerciseCategory = 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.workoutDurationOptions = void 0;
|
|
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;
|
|
4
4
|
const _1 = require(".");
|
|
5
5
|
exports.workoutDurationOptions = [40, 60, 80];
|
|
6
|
+
exports.trainingGoalLengths = [
|
|
7
|
+
'strength_short',
|
|
8
|
+
'strength_default',
|
|
9
|
+
'strength_long',
|
|
10
|
+
'build_muscle_short',
|
|
11
|
+
'build_muscle_default',
|
|
12
|
+
'build_muscle_long',
|
|
13
|
+
'fat_loss_short',
|
|
14
|
+
'fat_loss_default',
|
|
15
|
+
'fat_loss_long',
|
|
16
|
+
];
|
|
6
17
|
exports.trainerGymTypes = [
|
|
7
18
|
'home_gym',
|
|
8
19
|
'garage_gym',
|
|
@@ -203,10 +214,35 @@ const getTrainerRepRange = (trainerAlgorithmSettings, goal, exerciseCategory) =>
|
|
|
203
214
|
return trainerAlgorithmSettings.rep_ranges[goal][exerciseCategory];
|
|
204
215
|
};
|
|
205
216
|
exports.getTrainerRepRange = getTrainerRepRange;
|
|
206
|
-
const getTrainerRestTimerSeconds = (trainerAlgorithmSettings,
|
|
207
|
-
return trainerAlgorithmSettings.rest_timers[
|
|
217
|
+
const getTrainerRestTimerSeconds = (trainerAlgorithmSettings, restTimerLength, exerciseCategory) => {
|
|
218
|
+
return trainerAlgorithmSettings.rest_timers[restTimerLength][exerciseCategory];
|
|
208
219
|
};
|
|
209
220
|
exports.getTrainerRestTimerSeconds = getTrainerRestTimerSeconds;
|
|
221
|
+
const getRestTimerLength = (goal, length) => {
|
|
222
|
+
switch (goal) {
|
|
223
|
+
case 'strength':
|
|
224
|
+
return length === 'short'
|
|
225
|
+
? 'strength_short'
|
|
226
|
+
: length === 'default'
|
|
227
|
+
? 'strength_default'
|
|
228
|
+
: 'strength_long';
|
|
229
|
+
case 'build_muscle':
|
|
230
|
+
return length === 'short'
|
|
231
|
+
? 'build_muscle_short'
|
|
232
|
+
: length === 'default'
|
|
233
|
+
? 'build_muscle_default'
|
|
234
|
+
: 'build_muscle_long';
|
|
235
|
+
case 'fat_loss':
|
|
236
|
+
return length === 'short'
|
|
237
|
+
? 'fat_loss_short'
|
|
238
|
+
: length === 'default'
|
|
239
|
+
? 'fat_loss_default'
|
|
240
|
+
: 'fat_loss_long';
|
|
241
|
+
default:
|
|
242
|
+
return 'strength_default';
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
exports.getRestTimerLength = getRestTimerLength;
|
|
210
246
|
/**
|
|
211
247
|
* Normalizes the exercise category to a HevyTrainerExerciseCategory
|
|
212
248
|
* - Treat custom exercises and exercises with no category as `compound`
|
|
@@ -498,7 +534,7 @@ exports.pickExerciseForPrescription = pickExerciseForPrescription;
|
|
|
498
534
|
*/
|
|
499
535
|
const generateProgram = (params) => {
|
|
500
536
|
var _a;
|
|
501
|
-
const { trainerAlgorithmSettings, selectedDays, selectedGoal, selectedLevel, selectedEquipments, selectedWorkoutDurationMinutes, exerciseStore, focusMuscle, excludedExerciseIds, } = params;
|
|
537
|
+
const { trainerAlgorithmSettings, selectedDays, selectedGoal, selectedLevel, selectedEquipments, selectedWorkoutDurationMinutes, selectedRestTimerLength, exerciseStore, focusMuscle, excludedExerciseIds, } = params;
|
|
502
538
|
const routines = exports.programSplits[selectedDays];
|
|
503
539
|
const program = {
|
|
504
540
|
name: selectedDays,
|
|
@@ -565,7 +601,7 @@ const generateProgram = (params) => {
|
|
|
565
601
|
sets: (0, exports.getTrainerSetCount)(trainerAlgorithmSettings, selectedGoal, selectedDays),
|
|
566
602
|
repRangeStart: repRange.rep_range_start,
|
|
567
603
|
repRangeEnd: repRange.rep_range_end,
|
|
568
|
-
restTimerSeconds: (0, exports.getTrainerRestTimerSeconds)(trainerAlgorithmSettings, selectedGoal, exercisePrescription.category),
|
|
604
|
+
restTimerSeconds: (0, exports.getTrainerRestTimerSeconds)(trainerAlgorithmSettings, (0, exports.getRestTimerLength)(selectedGoal, selectedRestTimerLength), exercisePrescription.category),
|
|
569
605
|
warmupSetCount: exercisePrescription.warmup_set_count,
|
|
570
606
|
notes: (_a = trainerAlgorithmSettings.exercise_notes[exercise.id]) !== null && _a !== void 0 ? _a : '',
|
|
571
607
|
});
|
package/built/index.d.ts
CHANGED
|
@@ -640,9 +640,11 @@ 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
644
|
export type TrainingGoal = Lookup<typeof trainingGoals>;
|
|
644
645
|
export type TrainingLevel = Lookup<typeof trainingLevels>;
|
|
645
646
|
export type ExerciseCategory = Lookup<typeof exerciseCategories>;
|
|
647
|
+
export type RestTimerLength = typeof restTimerLengths[number];
|
|
646
648
|
export type HevyTrainerProgramEquipment = Extract<Equipment, 'barbell' | 'dumbbell' | 'machine'>;
|
|
647
649
|
export declare const hevyTrainerProgramEquipments: readonly ["barbell", "dumbbell", "machine"];
|
|
648
650
|
export declare const granularEquipments: readonly ["barbell", "dumbbell", "kettlebell", "plate", "medicine_ball", "ez_bar", "landmine", "trap_bar", "pullup_bar", "dip_bar", "squat_rack", "flat_bench", "adjustable_bench", "dual_cable_machine", "single_cable_machine", "lat_pulldown_cable", "leg_press_machine", "smith_machine", "t_bar", "plate_machines", "stack_machines", "treadmill", "elliptical_trainer", "rowing_machine", "spinning", "stair_machine", "air_bike", "suspension_band", "resistance_band", "battle_rope", "rings", "jump_rope"];
|
package/built/index.js
CHANGED
|
@@ -14,8 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
18
|
-
exports.isOAuthScope = exports.supportedScopes = exports.isSuggestedUserSource = exports.isValidUserWorkoutMetricsType = exports.isBodyMeasurementKey = exports.measurementsList = exports.isHevyTrainerRoutine = exports.isWorkoutBiometrics = void 0;
|
|
17
|
+
exports.isPublicWorkout = exports.isSetType = exports.isRPE = exports.validRpeValues = exports.isSetPersonalRecordType = exports.supportedInstructionsLanguages = exports.weeklyTrainingFrequencies = exports.isGranularEquipment = exports.granularEquipments = exports.hevyTrainerProgramEquipments = exports.restTimerLengths = exports.exerciseCategories = exports.trainingLevels = exports.trainingGoals = exports.isCustomExerciseType = exports.customExericseTypes = exports.isExerciseType = exports.exerciseTypes = exports.isExerciseRepType = exports.exerciseRepTypes = exports.isEquipmentFilter = exports.equipmentFilters = exports.isEquipment = exports.equipments = exports.simplifiedMuscleGroupToMuscleGroups = exports.isMuscleGroupFilter = exports.muscleGroupFilters = exports.isMuscleGroup = exports.muscleGroups = exports.isSimplifiedMuscleGroup = exports.simplifiedMuscleGroups = exports.miscellaneousMuscles = exports.chestMuscles = exports.backMuscles = exports.legMuscles = exports.armMuscles = exports.shoulderMuscles = exports.coreMuscles = exports.DefaultClientConfiguration = exports.parseClientAuthTokenResponse = exports.isCoachRole = exports.isErrorResponse = exports.isLivePRVolumeOption = exports.isTimerVolumeOption = exports.isWeekday = exports.orderedWeekdays = exports.isBodyMeasurementUnit = exports.isDistanceUnitShort = exports.isDistanceUnit = exports.isWeightUnit = void 0;
|
|
18
|
+
exports.isOAuthScope = exports.supportedScopes = exports.isSuggestedUserSource = exports.isValidUserWorkoutMetricsType = exports.isBodyMeasurementKey = exports.measurementsList = exports.isHevyTrainerRoutine = exports.isWorkoutBiometrics = exports.isHeartRateSamples = void 0;
|
|
19
19
|
const typeUtils_1 = require("./typeUtils");
|
|
20
20
|
__exportStar(require("./constants"), exports);
|
|
21
21
|
__exportStar(require("./utils"), exports);
|
|
@@ -227,6 +227,7 @@ exports.exerciseCategories = [
|
|
|
227
227
|
'compound',
|
|
228
228
|
'assistance-compound',
|
|
229
229
|
];
|
|
230
|
+
exports.restTimerLengths = ['short', 'default', 'long'];
|
|
230
231
|
exports.hevyTrainerProgramEquipments = [
|
|
231
232
|
'barbell',
|
|
232
233
|
'dumbbell',
|