hevy-shared 1.0.563 → 1.0.565
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/index.d.ts
CHANGED
|
@@ -465,8 +465,10 @@ export interface UserPreferences {
|
|
|
465
465
|
live_pr_volume?: LivePRVolumeOption;
|
|
466
466
|
inline_set_timer_enabled?: boolean;
|
|
467
467
|
default_workout_visibility_public?: boolean;
|
|
468
|
+
/** Only updateable by the backend within a special API */
|
|
469
|
+
volume_includes_warmup_sets?: boolean;
|
|
468
470
|
}
|
|
469
|
-
export type UpdateUserPreferencesRequest = Omit<UserPreferences, 'username'>;
|
|
471
|
+
export type UpdateUserPreferencesRequest = Omit<UserPreferences, 'username' | 'volume_includes_warmup_sets'>;
|
|
470
472
|
export type FollowingStatus = 'not-following' | 'following' | 'requested';
|
|
471
473
|
export type FollowingStatusMap = {
|
|
472
474
|
[id: string]: Omit<FollowingStatus, 'not-following'>;
|
|
@@ -778,6 +780,11 @@ export interface Workout {
|
|
|
778
780
|
* why we added estimated_volume_kg
|
|
779
781
|
*/
|
|
780
782
|
estimated_volume_kg: number;
|
|
783
|
+
/**
|
|
784
|
+
* Whether to include warmup sets in various calculations.
|
|
785
|
+
* https://github.com/hevyapp/hevy-shared/pull/312
|
|
786
|
+
*/
|
|
787
|
+
include_warmup_sets: boolean;
|
|
781
788
|
is_private: boolean;
|
|
782
789
|
/**
|
|
783
790
|
* If applicable, the user ID of the coach who logged this workout
|
|
@@ -1324,6 +1331,18 @@ export interface WarmupCalculatorData {
|
|
|
1324
1331
|
dumbbellRoundingSettingLbs: number;
|
|
1325
1332
|
warmupSets: WarmupSet[];
|
|
1326
1333
|
}
|
|
1334
|
+
export interface RecalculateSetPRProgress {
|
|
1335
|
+
numWorkoutsProcessed: number;
|
|
1336
|
+
numWorkoutsTotal: number;
|
|
1337
|
+
}
|
|
1338
|
+
export type RecalculateSetPRStatusResponse = {
|
|
1339
|
+
type: 'ready';
|
|
1340
|
+
} | {
|
|
1341
|
+
type: 'busy';
|
|
1342
|
+
progress: RecalculateSetPRProgress;
|
|
1343
|
+
} | {
|
|
1344
|
+
type: 'error';
|
|
1345
|
+
};
|
|
1327
1346
|
export interface ExerciseTemplateUnit {
|
|
1328
1347
|
id: number;
|
|
1329
1348
|
exercise_template_id: string;
|
package/built/notifications.d.ts
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { ClientsCoachData, Program } from '.';
|
|
9
9
|
import { HevyChatUpdateMobilePushData } from './chat';
|
|
10
|
-
export type Notification = WorkoutCompleteNotification | WorkoutMentionNotification | WorkoutCommentNotification | WorkoutCommentReplyNotification | WorkoutCommentMentionNotification | WorkoutLikeNotification | FollowNotification | FollowRequestNotification | AcceptFollowRequestNotification | CoachClientInviteNotification | ContactOnHevyNotification;
|
|
11
|
-
export type NotificationType = 'workout-complete' | 'workout-mention' | 'workout-comment' | 'workout-comment-reply' | 'workout-comment-mention' | 'workout-like' | 'follow' | 'follow-request' | 'accept-follow-request' | 'coach-client-invite' | 'contact-on-hevy';
|
|
10
|
+
export type Notification = WorkoutCompleteNotification | WorkoutMentionNotification | WorkoutCommentNotification | WorkoutCommentReplyNotification | WorkoutCommentMentionNotification | WorkoutLikeNotification | WorkoutCommentLikeNotification | FollowNotification | FollowRequestNotification | AcceptFollowRequestNotification | CoachClientInviteNotification | ContactOnHevyNotification;
|
|
11
|
+
export type NotificationType = 'workout-complete' | 'workout-mention' | 'workout-comment' | 'workout-comment-reply' | 'workout-comment-mention' | 'workout-like' | 'workout-comment-like' | 'follow' | 'follow-request' | 'accept-follow-request' | 'coach-client-invite' | 'contact-on-hevy';
|
|
12
12
|
export interface BaseNotification {
|
|
13
13
|
id: number;
|
|
14
14
|
type: NotificationType;
|
|
@@ -74,6 +74,16 @@ export interface WorkoutLikeNotification extends BaseNotification {
|
|
|
74
74
|
export interface WorkoutLikeMobilePushData extends BaseMobilePushData {
|
|
75
75
|
type: 'workout-like';
|
|
76
76
|
}
|
|
77
|
+
export interface WorkoutCommentLikeNotification extends BaseNotification {
|
|
78
|
+
type: 'workout-comment-like';
|
|
79
|
+
workout_id: string;
|
|
80
|
+
workout_title: string;
|
|
81
|
+
comment_id: number;
|
|
82
|
+
comment: string;
|
|
83
|
+
}
|
|
84
|
+
export interface WorkoutCommentLikeMobilePushData extends BaseMobilePushData {
|
|
85
|
+
type: 'workout-comment-like';
|
|
86
|
+
}
|
|
77
87
|
export interface FollowNotification extends BaseNotification {
|
|
78
88
|
type: 'follow';
|
|
79
89
|
}
|
|
@@ -173,4 +183,4 @@ export interface MonthlyReportMobilePushData extends BaseMobilePushData {
|
|
|
173
183
|
type: 'monthly-report';
|
|
174
184
|
deeplink: string;
|
|
175
185
|
}
|
|
176
|
-
export type MobilePushData = ChatUpdateMobilePushData | SyncCustomExercisesAndCoachCustomizationsMobilePushData | SyncRoutineFoldersMobilePushData | SyncRoutinesMobilePushData | ProStatusChangedPushMobilePushData | HevyProSubscriptionRenewedMobilePushData | CoachProgramChangedMobilePushData | CoachDataChangedMobilePushData | ContactOnHevyMobilePushData | CoachClientInviteMobilePushData | AcceptFollowRequestMobilePushData | FollowRequestMobilePushData | FollowMobilePushData | WorkoutLikeMobilePushData | WorkoutCommentMentionMobilePushData | WorkoutCommentReplyMobilePushData | WorkoutCommentMobilePushData | WorkoutMentionMobilePushData | WorkoutCompleteMobilePushData | CoachProgramFinishesNextWeekMobilePushData | CoachProgramStartsTodayMobilePushData | CoachLoggedYourWorkoutMobilePushData | CoachLoggedYourMeasurementsMobilePushData | MonthlyReportMobilePushData;
|
|
186
|
+
export type MobilePushData = ChatUpdateMobilePushData | SyncCustomExercisesAndCoachCustomizationsMobilePushData | SyncRoutineFoldersMobilePushData | SyncRoutinesMobilePushData | ProStatusChangedPushMobilePushData | HevyProSubscriptionRenewedMobilePushData | CoachProgramChangedMobilePushData | CoachDataChangedMobilePushData | ContactOnHevyMobilePushData | CoachClientInviteMobilePushData | AcceptFollowRequestMobilePushData | FollowRequestMobilePushData | FollowMobilePushData | WorkoutLikeMobilePushData | WorkoutCommentLikeMobilePushData | WorkoutCommentMentionMobilePushData | WorkoutCommentReplyMobilePushData | WorkoutCommentMobilePushData | WorkoutMentionMobilePushData | WorkoutCompleteMobilePushData | CoachProgramFinishesNextWeekMobilePushData | CoachProgramStartsTodayMobilePushData | CoachLoggedYourWorkoutMobilePushData | CoachLoggedYourMeasurementsMobilePushData | MonthlyReportMobilePushData;
|
|
@@ -4,7 +4,10 @@ const workoutVolume_1 = require("../workoutVolume");
|
|
|
4
4
|
describe('workoutVolume', () => {
|
|
5
5
|
describe('estimatedWorkoutVolumeKg', () => {
|
|
6
6
|
it('calculates the correct workout volume', () => {
|
|
7
|
-
const emptyWorkout = {
|
|
7
|
+
const emptyWorkout = {
|
|
8
|
+
exercises: [],
|
|
9
|
+
include_warmup_sets: true,
|
|
10
|
+
};
|
|
8
11
|
const weightRepsWorkout = {
|
|
9
12
|
exercises: [
|
|
10
13
|
{
|
|
@@ -14,6 +17,7 @@ describe('workoutVolume', () => {
|
|
|
14
17
|
hundred_percent_bodyweight_exercise: false,
|
|
15
18
|
sets: [
|
|
16
19
|
{
|
|
20
|
+
indicator: 'normal',
|
|
17
21
|
weight_kg: 100,
|
|
18
22
|
reps: 10,
|
|
19
23
|
distance_meters: 0,
|
|
@@ -21,6 +25,7 @@ describe('workoutVolume', () => {
|
|
|
21
25
|
],
|
|
22
26
|
},
|
|
23
27
|
],
|
|
28
|
+
include_warmup_sets: true,
|
|
24
29
|
};
|
|
25
30
|
const pullUpWorkout = {
|
|
26
31
|
exercises: [
|
|
@@ -31,6 +36,7 @@ describe('workoutVolume', () => {
|
|
|
31
36
|
hundred_percent_bodyweight_exercise: true,
|
|
32
37
|
sets: [
|
|
33
38
|
{
|
|
39
|
+
indicator: 'normal',
|
|
34
40
|
weight_kg: 0,
|
|
35
41
|
reps: 10,
|
|
36
42
|
distance_meters: 0,
|
|
@@ -38,6 +44,7 @@ describe('workoutVolume', () => {
|
|
|
38
44
|
],
|
|
39
45
|
},
|
|
40
46
|
],
|
|
47
|
+
include_warmup_sets: true,
|
|
41
48
|
};
|
|
42
49
|
const assistedPullUpWorkout = {
|
|
43
50
|
exercises: [
|
|
@@ -48,6 +55,7 @@ describe('workoutVolume', () => {
|
|
|
48
55
|
hundred_percent_bodyweight_exercise: true,
|
|
49
56
|
sets: [
|
|
50
57
|
{
|
|
58
|
+
indicator: 'normal',
|
|
51
59
|
weight_kg: 10,
|
|
52
60
|
reps: 10,
|
|
53
61
|
distance_meters: 0,
|
|
@@ -55,6 +63,7 @@ describe('workoutVolume', () => {
|
|
|
55
63
|
],
|
|
56
64
|
},
|
|
57
65
|
],
|
|
66
|
+
include_warmup_sets: true,
|
|
58
67
|
};
|
|
59
68
|
const weightedPullUpWorkout = {
|
|
60
69
|
exercises: [
|
|
@@ -65,6 +74,7 @@ describe('workoutVolume', () => {
|
|
|
65
74
|
hundred_percent_bodyweight_exercise: true,
|
|
66
75
|
sets: [
|
|
67
76
|
{
|
|
77
|
+
indicator: 'normal',
|
|
68
78
|
weight_kg: 10,
|
|
69
79
|
reps: 10,
|
|
70
80
|
distance_meters: 0,
|
|
@@ -72,6 +82,7 @@ describe('workoutVolume', () => {
|
|
|
72
82
|
],
|
|
73
83
|
},
|
|
74
84
|
],
|
|
85
|
+
include_warmup_sets: true,
|
|
75
86
|
};
|
|
76
87
|
const shortDistanceWeightWorkout = {
|
|
77
88
|
exercises: [
|
|
@@ -82,6 +93,7 @@ describe('workoutVolume', () => {
|
|
|
82
93
|
hundred_percent_bodyweight_exercise: false,
|
|
83
94
|
sets: [
|
|
84
95
|
{
|
|
96
|
+
indicator: 'normal',
|
|
85
97
|
weight_kg: 100,
|
|
86
98
|
reps: 0,
|
|
87
99
|
distance_meters: 10,
|
|
@@ -89,6 +101,7 @@ describe('workoutVolume', () => {
|
|
|
89
101
|
],
|
|
90
102
|
},
|
|
91
103
|
],
|
|
104
|
+
include_warmup_sets: true,
|
|
92
105
|
};
|
|
93
106
|
expect((0, workoutVolume_1.estimatedWorkoutVolumeKg)({
|
|
94
107
|
bodyweightKg: 100,
|
|
@@ -124,8 +137,49 @@ describe('workoutVolume', () => {
|
|
|
124
137
|
...weightedPullUpWorkout.exercises,
|
|
125
138
|
...shortDistanceWeightWorkout.exercises,
|
|
126
139
|
],
|
|
140
|
+
include_warmup_sets: true,
|
|
127
141
|
},
|
|
128
142
|
})).toBe(5000);
|
|
129
143
|
});
|
|
144
|
+
it('takes warmup sets into account only if `include_warmup_sets` === `true`', () => {
|
|
145
|
+
const workoutWithWarmupSets = {
|
|
146
|
+
exercises: [
|
|
147
|
+
{
|
|
148
|
+
exercise_type: 'weight_reps',
|
|
149
|
+
exercise_template_id: 'asd',
|
|
150
|
+
volume_doubling_enabled: false,
|
|
151
|
+
hundred_percent_bodyweight_exercise: false,
|
|
152
|
+
sets: [
|
|
153
|
+
{
|
|
154
|
+
indicator: 'warmup',
|
|
155
|
+
weight_kg: 100,
|
|
156
|
+
reps: 10,
|
|
157
|
+
distance_meters: 0,
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
indicator: 'normal',
|
|
161
|
+
weight_kg: 100,
|
|
162
|
+
reps: 10,
|
|
163
|
+
distance_meters: 0,
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
indicator: 'normal',
|
|
167
|
+
weight_kg: 100,
|
|
168
|
+
reps: 10,
|
|
169
|
+
distance_meters: 0,
|
|
170
|
+
},
|
|
171
|
+
],
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
};
|
|
175
|
+
expect((0, workoutVolume_1.estimatedWorkoutVolumeKg)({
|
|
176
|
+
bodyweightKg: 100,
|
|
177
|
+
workout: Object.assign(Object.assign({}, workoutWithWarmupSets), { include_warmup_sets: false }),
|
|
178
|
+
})).toBe(2000);
|
|
179
|
+
expect((0, workoutVolume_1.estimatedWorkoutVolumeKg)({
|
|
180
|
+
bodyweightKg: 100,
|
|
181
|
+
workout: Object.assign(Object.assign({}, workoutWithWarmupSets), { include_warmup_sets: true }),
|
|
182
|
+
})).toBe(3000);
|
|
183
|
+
});
|
|
130
184
|
});
|
|
131
185
|
});
|
package/built/workoutVolume.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BodyMeasurement, ExerciseType, BaseExerciseTemplate } from '.';
|
|
1
|
+
import { BodyMeasurement, ExerciseType, BaseExerciseTemplate, WorkoutExerciseSet } from '.';
|
|
2
2
|
export declare const isVolumeDoublingSupportableForExerciseTemplate: (exerciseTemplate: Pick<BaseExerciseTemplate, "equipment_category" | "exercise_type">) => boolean;
|
|
3
3
|
export interface VolumeCalculableWorkout {
|
|
4
4
|
exercises: {
|
|
@@ -6,13 +6,9 @@ export interface VolumeCalculableWorkout {
|
|
|
6
6
|
exercise_template_id: string;
|
|
7
7
|
volume_doubling_enabled: boolean;
|
|
8
8
|
hundred_percent_bodyweight_exercise: boolean;
|
|
9
|
-
sets:
|
|
10
|
-
weight_kg?: number | null;
|
|
11
|
-
reps?: number | null;
|
|
12
|
-
distance_meters?: number | null;
|
|
13
|
-
duration_seconds?: number | null;
|
|
14
|
-
}[];
|
|
9
|
+
sets: Pick<WorkoutExerciseSet, 'indicator' | 'weight_kg' | 'reps' | 'distance_meters' | 'duration_seconds'>[];
|
|
15
10
|
}[];
|
|
11
|
+
include_warmup_sets: boolean;
|
|
16
12
|
}
|
|
17
13
|
export interface TimestampedVolumeCalculableWorkout extends VolumeCalculableWorkout {
|
|
18
14
|
start_time: number;
|
package/built/workoutVolume.js
CHANGED
|
@@ -98,7 +98,9 @@ const setVolumeKg = (set, bodyweightKg) => {
|
|
|
98
98
|
exports.setVolumeKg = setVolumeKg;
|
|
99
99
|
const workoutToWorkoutVolumeSets = (workout) => {
|
|
100
100
|
const unflatSets = workout.exercises.map((e) => {
|
|
101
|
-
return e.sets
|
|
101
|
+
return e.sets
|
|
102
|
+
.filter((s) => workout.include_warmup_sets || s.indicator !== 'warmup')
|
|
103
|
+
.map((s) => {
|
|
102
104
|
var _a, _b, _c;
|
|
103
105
|
return {
|
|
104
106
|
type: e.exercise_type || 'weight_reps',
|