hevy-shared 1.0.604 → 1.0.606
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 +0 -9
- package/built/index.js +1 -8
- package/built/tests/utils.test.js +12 -0
- package/built/utils.d.ts +1 -1
- package/built/utils.js +14 -9
- package/package.json +1 -1
package/built/index.d.ts
CHANGED
|
@@ -579,12 +579,6 @@ export declare const isExerciseType: (x: any) => x is ExerciseType;
|
|
|
579
579
|
export type CustomExerciseType = Exclude<ExerciseType, 'floors_duration' | 'steps_duration'>;
|
|
580
580
|
export declare const customExericseTypes: CustomExerciseType[];
|
|
581
581
|
export declare const isCustomExerciseType: (x: any) => x is CustomExerciseType;
|
|
582
|
-
export declare const trainingGoals: readonly ["strength", "build_muscle", "fat_loss"];
|
|
583
|
-
export declare const trainingLevels: readonly ["beginner", "intermediate", "advanced"];
|
|
584
|
-
export declare const exerciseCategories: readonly ["isolation", "compound", "assistance-compound"];
|
|
585
|
-
export type TrainingGoal = Lookup<typeof trainingGoals>;
|
|
586
|
-
export type TrainingLevel = Lookup<typeof trainingLevels>;
|
|
587
|
-
export type ExerciseCategory = Lookup<typeof exerciseCategories>;
|
|
588
582
|
/**
|
|
589
583
|
* Base properties that all exercise templates must have
|
|
590
584
|
*/
|
|
@@ -631,9 +625,6 @@ export interface LibraryExercise extends BaseExerciseTemplate {
|
|
|
631
625
|
localised_instructions?: {
|
|
632
626
|
[language in InstructionsLanguage]?: string;
|
|
633
627
|
};
|
|
634
|
-
goal: TrainingGoal[] | undefined;
|
|
635
|
-
level: TrainingLevel[] | undefined;
|
|
636
|
-
category: ExerciseCategory | undefined;
|
|
637
628
|
}
|
|
638
629
|
/**
|
|
639
630
|
* Custom exercises are user-created templates with minimal properties
|
package/built/index.js
CHANGED
|
@@ -14,7 +14,7 @@ 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.isValidUserWorkoutMetricsType = exports.isBodyMeasurementKey = exports.measurementsList = exports.isWorkoutBiometrics = exports.isHeartRateSamples = exports.isPublicWorkout = exports.isSetType = exports.isRPE = exports.validRpeValues = exports.isSetPersonalRecordType = exports.supportedInstructionsLanguages = exports.
|
|
17
|
+
exports.isValidUserWorkoutMetricsType = exports.isBodyMeasurementKey = exports.measurementsList = exports.isWorkoutBiometrics = exports.isHeartRateSamples = exports.isPublicWorkout = exports.isSetType = exports.isRPE = exports.validRpeValues = exports.isSetPersonalRecordType = exports.supportedInstructionsLanguages = exports.isCustomExerciseType = exports.customExericseTypes = exports.isExerciseType = exports.exerciseTypes = exports.isExerciseRepType = exports.exerciseRepTypes = exports.isEquipmentFilter = exports.equipmentFilters = exports.isEquipment = exports.equipments = exports.isMuscleGroupFilter = exports.muscleGroupFilters = exports.isMuscleGroup = exports.muscleGroups = exports.DefaultClientConfiguration = exports.isCoachRole = exports.isErrorResponse = exports.isLivePRVolumeOption = exports.isTimerVolumeOption = exports.isWeekday = exports.orderedWeekdays = exports.isBodyMeasurementUnit = exports.isDistanceUnitShort = exports.isDistanceUnit = exports.isWeightUnit = exports.isLanguage = exports.supportedLanguages = void 0;
|
|
18
18
|
const typeUtils_1 = require("./typeUtils");
|
|
19
19
|
__exportStar(require("./constants"), exports);
|
|
20
20
|
__exportStar(require("./utils"), exports);
|
|
@@ -185,13 +185,6 @@ exports.isExerciseType = isExerciseType;
|
|
|
185
185
|
exports.customExericseTypes = exports.exerciseTypes.filter((type) => type !== 'floors_duration' && type !== 'steps_duration');
|
|
186
186
|
const isCustomExerciseType = (x) => (0, typeUtils_1.isInArray)(x, exports.customExericseTypes);
|
|
187
187
|
exports.isCustomExerciseType = isCustomExerciseType;
|
|
188
|
-
exports.trainingGoals = ['strength', 'build_muscle', 'fat_loss'];
|
|
189
|
-
exports.trainingLevels = ['beginner', 'intermediate', 'advanced'];
|
|
190
|
-
exports.exerciseCategories = [
|
|
191
|
-
'isolation',
|
|
192
|
-
'compound',
|
|
193
|
-
'assistance-compound',
|
|
194
|
-
];
|
|
195
188
|
exports.supportedInstructionsLanguages = [
|
|
196
189
|
'en',
|
|
197
190
|
'it',
|
|
@@ -392,6 +392,18 @@ describe('utils', () => {
|
|
|
392
392
|
{ format: 'link', text: 'https://example.com' },
|
|
393
393
|
],
|
|
394
394
|
],
|
|
395
|
+
[
|
|
396
|
+
'hey Test - https://www.tiktok.com/@tylerpath/video/7471271437467405614 @test',
|
|
397
|
+
[
|
|
398
|
+
{ format: 'none', text: 'hey Test - ' },
|
|
399
|
+
{
|
|
400
|
+
format: 'link',
|
|
401
|
+
text: 'https://www.tiktok.com/@tylerpath/video/7471271437467405614',
|
|
402
|
+
},
|
|
403
|
+
{ format: 'none', text: ' ' },
|
|
404
|
+
{ format: '@', text: '@test' },
|
|
405
|
+
],
|
|
406
|
+
],
|
|
395
407
|
];
|
|
396
408
|
inputOutputs.forEach((i) => {
|
|
397
409
|
expect((0, utils_1.splitAtUsernamesAndLinks)(i[0])).toEqual(i[1]);
|
package/built/utils.d.ts
CHANGED
|
@@ -167,7 +167,7 @@ export interface TotalSetCountWorkout {
|
|
|
167
167
|
* Calculate the set weight for a given user exercise set
|
|
168
168
|
* to be used in the exercise stats calculations on the web and coach app
|
|
169
169
|
*/
|
|
170
|
-
export declare const userExerciseSetWeight: (set: UserExerciseSet, exerciseStore: BaseExerciseTemplate[]) => number;
|
|
170
|
+
export declare const userExerciseSetWeight: (set: UserExerciseSet, exerciseStore: BaseExerciseTemplate[], hundredPercentBodyweightExercise: boolean) => number;
|
|
171
171
|
export declare const workoutSetCount: (w: TotalSetCountWorkout) => number;
|
|
172
172
|
export declare const oneRepMaxPercentageMap: {
|
|
173
173
|
[s: number]: number;
|
package/built/utils.js
CHANGED
|
@@ -404,20 +404,25 @@ exports.workoutDistanceMeters = workoutDistanceMeters;
|
|
|
404
404
|
* Calculate the set weight for a given user exercise set
|
|
405
405
|
* to be used in the exercise stats calculations on the web and coach app
|
|
406
406
|
*/
|
|
407
|
-
const userExerciseSetWeight = (set, exerciseStore) => {
|
|
407
|
+
const userExerciseSetWeight = (set, exerciseStore, hundredPercentBodyweightExercise) => {
|
|
408
408
|
if (!set)
|
|
409
409
|
return 0;
|
|
410
410
|
const exercise = exerciseStore.find((e) => e.id === set.exercise_template_id);
|
|
411
411
|
if (!exercise) {
|
|
412
412
|
return (0, exports.num)(set.weight_kg);
|
|
413
413
|
}
|
|
414
|
-
//!! This is wrong!!
|
|
415
|
-
// TODO: we should check if it's a hundred percent bodyweight exercise or not first
|
|
416
414
|
if (exercise.exercise_type === 'bodyweight_reps') {
|
|
417
|
-
return
|
|
415
|
+
return hundredPercentBodyweightExercise
|
|
416
|
+
? (0, exports.num)(set.user_bodyweight_kg) + (0, exports.num)(set.weight_kg)
|
|
417
|
+
: (0, exports.num)(set.weight_kg);
|
|
418
418
|
}
|
|
419
419
|
else if (exercise.exercise_type === 'bodyweight_assisted_reps') {
|
|
420
|
-
return
|
|
420
|
+
return hundredPercentBodyweightExercise
|
|
421
|
+
? Math.max((0, exports.num)(set.user_bodyweight_kg) - (0, exports.num)(set.weight_kg), 0)
|
|
422
|
+
: 0;
|
|
423
|
+
}
|
|
424
|
+
else if (exercise.exercise_type === 'reps_only') {
|
|
425
|
+
return hundredPercentBodyweightExercise ? (0, exports.num)(set.user_bodyweight_kg) : 0;
|
|
421
426
|
}
|
|
422
427
|
else {
|
|
423
428
|
return (0, exports.num)(set.weight_kg);
|
|
@@ -586,12 +591,12 @@ const splitAtUsernamesAndLinks = (text) => {
|
|
|
586
591
|
if (index > lastIndex) {
|
|
587
592
|
format.push({ format: 'none', text: text.substring(lastIndex, index) });
|
|
588
593
|
}
|
|
589
|
-
if (match.match(
|
|
590
|
-
format.push({ format: '@', text: match });
|
|
591
|
-
}
|
|
592
|
-
else if (match.match(linksRegex)) {
|
|
594
|
+
if (match.match(linksRegex)) {
|
|
593
595
|
format.push({ format: 'link', text: match });
|
|
594
596
|
}
|
|
597
|
+
else if (match.match(mentionsRegex)) {
|
|
598
|
+
format.push({ format: '@', text: match });
|
|
599
|
+
}
|
|
595
600
|
lastIndex = index + match.length;
|
|
596
601
|
});
|
|
597
602
|
if (lastIndex < text.length) {
|