hevy-shared 1.0.599 → 1.0.601
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 +8 -2
- package/built/index.js +6 -2
- package/built/utils.d.ts +0 -8
- package/built/utils.js +1 -27
- package/package.json +1 -1
package/built/index.d.ts
CHANGED
|
@@ -579,6 +579,9 @@ 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 type TrainingGoal = 'strength' | 'build_muscle' | 'fat_loss';
|
|
583
|
+
export type TrainingLevel = 'beginner' | 'intermediate' | 'advanced';
|
|
584
|
+
export type ExerciseCategory = 'isolation' | 'compound' | 'compound-assistance';
|
|
582
585
|
/**
|
|
583
586
|
* Base properties that all exercise templates must have
|
|
584
587
|
*/
|
|
@@ -625,6 +628,9 @@ export interface LibraryExercise extends BaseExerciseTemplate {
|
|
|
625
628
|
localised_instructions?: {
|
|
626
629
|
[language in InstructionsLanguage]?: string;
|
|
627
630
|
};
|
|
631
|
+
goal: TrainingGoal[] | undefined;
|
|
632
|
+
level: TrainingLevel[] | undefined;
|
|
633
|
+
category: ExerciseCategory | undefined;
|
|
628
634
|
}
|
|
629
635
|
/**
|
|
630
636
|
* Custom exercises are user-created templates with minimal properties
|
|
@@ -641,9 +647,9 @@ export interface CustomExercise extends BaseExerciseTemplate {
|
|
|
641
647
|
}
|
|
642
648
|
export declare const supportedInstructionsLanguages: readonly ["en", "it", "de", "es", "fr", "pt"];
|
|
643
649
|
export type InstructionsLanguage = Lookup<typeof supportedInstructionsLanguages>;
|
|
644
|
-
|
|
645
|
-
declare const _setPersonalRecordTypes: readonly ["best_weight", "best_reps", "best_volume", "best_1rm", "best_duration", "best_distance"];
|
|
650
|
+
declare const _setPersonalRecordTypes: readonly ["best_weight", "best_reps", "best_volume", "best_1rm", "best_duration", "best_distance", "most_floors", "most_steps"];
|
|
646
651
|
export type SetPersonalRecordType = Lookup<typeof _setPersonalRecordTypes>;
|
|
652
|
+
export declare const isSetPersonalRecordType: (x: string) => x is SetPersonalRecordType;
|
|
647
653
|
export interface SetPersonalRecord {
|
|
648
654
|
exercise_template_id: string;
|
|
649
655
|
type: SetPersonalRecordType;
|
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.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;
|
|
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);
|
|
@@ -193,7 +193,7 @@ exports.supportedInstructionsLanguages = [
|
|
|
193
193
|
'fr',
|
|
194
194
|
'pt',
|
|
195
195
|
];
|
|
196
|
-
|
|
196
|
+
// Workouts
|
|
197
197
|
const _setPersonalRecordTypes = [
|
|
198
198
|
'best_weight',
|
|
199
199
|
'best_reps',
|
|
@@ -201,7 +201,11 @@ const _setPersonalRecordTypes = [
|
|
|
201
201
|
'best_1rm',
|
|
202
202
|
'best_duration',
|
|
203
203
|
'best_distance',
|
|
204
|
+
'most_floors',
|
|
205
|
+
'most_steps',
|
|
204
206
|
];
|
|
207
|
+
const isSetPersonalRecordType = (x) => (0, typeUtils_1.isInArray)(x, _setPersonalRecordTypes);
|
|
208
|
+
exports.isSetPersonalRecordType = isSetPersonalRecordType;
|
|
205
209
|
exports.validRpeValues = [6, 7, 7.5, 8, 8.5, 9, 9.5, 10];
|
|
206
210
|
const isRPE = (x) => (0, typeUtils_1.isInArray)(x, exports.validRpeValues);
|
|
207
211
|
exports.isRPE = isRPE;
|
package/built/utils.d.ts
CHANGED
|
@@ -199,14 +199,6 @@ type GenerateUserGroupError = 'invalid-number-of-groups' | 'invalid-uuid' | 'uui
|
|
|
199
199
|
* `(userId, numGroups)` pair, or an error, inside a Result<T> object
|
|
200
200
|
*/
|
|
201
201
|
export declare const generateUserGroup: (userId: string, numGroups: number) => Result<number, GenerateUserGroupError>;
|
|
202
|
-
/**
|
|
203
|
-
* Get the user group value for a given user id and number of groups.
|
|
204
|
-
* @param userId a v4 UUID; _must_ be v4 to ensure random distribution
|
|
205
|
-
* @param numGroups number of possible groups, from 2 to 2^32
|
|
206
|
-
* @returns User group value (A, B, C, etc.), or undefined if the user id is not a v4 UUID
|
|
207
|
-
* or if an error occurs.
|
|
208
|
-
*/
|
|
209
|
-
export declare const generateUserGroupValue: (userId: string, numGroups: 2 | 3) => "A" | "B" | "C" | undefined;
|
|
210
202
|
/**
|
|
211
203
|
* @example
|
|
212
204
|
* isVersionAGreaterOrEqualToVersionB('1.2.3', '1.2') // true
|
package/built/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getYoutubeVideoId = exports.validateYoutubeUrl = exports.splitAtUsernamesAndLinks = exports.isVersionAGreaterOrEqualToVersionB = exports.
|
|
3
|
+
exports.getYoutubeVideoId = exports.validateYoutubeUrl = exports.splitAtUsernamesAndLinks = exports.isVersionAGreaterOrEqualToVersionB = exports.generateUserGroup = exports.isBaseExerciseTemplate = exports.getStrengthLevelFromPercentile = exports.numberToLocaleString = exports.numberWithCommas = exports.setVolume = exports.oneRepMax = exports.oneRepMaxPercentageMap = exports.workoutSetCount = exports.userExerciseSetWeight = exports.workoutDistanceMeters = exports.workoutReps = exports.workoutDurationSeconds = exports.removeAccents = exports.getClosestDataPointAroundTargetDate = exports.getClosestDataPointBeforeTargetDate = exports.findMapped = exports.stringToNumber = exports.forceStringToNumber = exports.formatDurationInput = exports.isValidFormattedTime = exports.isWholeNumber = exports.isNumber = exports.isValidUuid = exports.isValidPhoneNumber = exports.isValidWebUrl = exports.URL_REGEX = exports.isValidEmail = exports.secondsToWordFormatMinutes = exports.secondsToWordFormat = exports.secondsToClockFormat = exports.isValidUsername = exports.roundToWholeNumber = exports.roundToOneDecimal = exports.roundToTwoDecimal = exports.divide = exports.clampNumber = exports.num = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Doesn't matter what you throw in the function it'll
|
|
6
6
|
* always return a number. Non number values will return
|
|
@@ -542,32 +542,6 @@ const generateUserGroup = (userId, numGroups) => {
|
|
|
542
542
|
};
|
|
543
543
|
};
|
|
544
544
|
exports.generateUserGroup = generateUserGroup;
|
|
545
|
-
/**
|
|
546
|
-
* Get the user group value for a given user id and number of groups.
|
|
547
|
-
* @param userId a v4 UUID; _must_ be v4 to ensure random distribution
|
|
548
|
-
* @param numGroups number of possible groups, from 2 to 2^32
|
|
549
|
-
* @returns User group value (A, B, C, etc.), or undefined if the user id is not a v4 UUID
|
|
550
|
-
* or if an error occurs.
|
|
551
|
-
*/
|
|
552
|
-
const generateUserGroupValue = (userId, numGroups) => {
|
|
553
|
-
const group = (0, exports.generateUserGroup)(userId, numGroups);
|
|
554
|
-
if (group.isSuccess) {
|
|
555
|
-
switch (group.value) {
|
|
556
|
-
case 0:
|
|
557
|
-
return 'A';
|
|
558
|
-
case 1:
|
|
559
|
-
return 'B';
|
|
560
|
-
case 2:
|
|
561
|
-
return 'C';
|
|
562
|
-
default:
|
|
563
|
-
return undefined;
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
else {
|
|
567
|
-
return undefined;
|
|
568
|
-
}
|
|
569
|
-
};
|
|
570
|
-
exports.generateUserGroupValue = generateUserGroupValue;
|
|
571
545
|
/**
|
|
572
546
|
* @example
|
|
573
547
|
* isVersionAGreaterOrEqualToVersionB('1.2.3', '1.2') // true
|