hevy-shared 1.0.606 → 1.0.607
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 +10 -1
- package/built/index.js +8 -1
- package/built/utils.d.ts +8 -0
- package/built/utils.js +27 -1
- package/package.json +1 -1
package/built/index.d.ts
CHANGED
|
@@ -579,6 +579,12 @@ 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>;
|
|
582
588
|
/**
|
|
583
589
|
* Base properties that all exercise templates must have
|
|
584
590
|
*/
|
|
@@ -625,6 +631,9 @@ export interface LibraryExercise extends BaseExerciseTemplate {
|
|
|
625
631
|
localised_instructions?: {
|
|
626
632
|
[language in InstructionsLanguage]?: string;
|
|
627
633
|
};
|
|
634
|
+
goal: TrainingGoal[] | undefined;
|
|
635
|
+
level: TrainingLevel[] | undefined;
|
|
636
|
+
category: ExerciseCategory | undefined;
|
|
628
637
|
}
|
|
629
638
|
/**
|
|
630
639
|
* Custom exercises are user-created templates with minimal properties
|
|
@@ -1589,7 +1598,7 @@ export interface CancelSubscriptionFeedback extends BaseFeedback {
|
|
|
1589
1598
|
};
|
|
1590
1599
|
}
|
|
1591
1600
|
export type Feedback = GeneralFeedback | FeatureRequestFeedback | BugReportFeedback | GetHelpFeedback | ReportCommentFeedback | ReportWorkoutFeedback | ReportProfileFeedback | RatingPromptFeedback | CancelSubscriptionFeedback;
|
|
1592
|
-
export type SuggestedUserSource = 'popular' | 'local' | 'contact' | 'mutual_follows' | 'follows_you' | 'featured';
|
|
1601
|
+
export type SuggestedUserSource = 'popular' | 'local' | 'contact' | 'mutual_follows' | 'follows_you' | 'featured' | 'hyper_local';
|
|
1593
1602
|
export type SuggestedUserLabel = 'contact' | 'mutual_friends' | 'follows_you' | 'featured';
|
|
1594
1603
|
export interface SuggestedUser {
|
|
1595
1604
|
id: string;
|
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.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.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.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,6 +185,13 @@ 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
|
+
];
|
|
188
195
|
exports.supportedInstructionsLanguages = [
|
|
189
196
|
'en',
|
|
190
197
|
'it',
|
package/built/utils.d.ts
CHANGED
|
@@ -199,6 +199,14 @@ 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;
|
|
202
210
|
/**
|
|
203
211
|
* @example
|
|
204
212
|
* 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.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;
|
|
3
|
+
exports.getYoutubeVideoId = exports.validateYoutubeUrl = exports.splitAtUsernamesAndLinks = exports.isVersionAGreaterOrEqualToVersionB = exports.generateUserGroupValue = 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
|
|
@@ -547,6 +547,32 @@ const generateUserGroup = (userId, numGroups) => {
|
|
|
547
547
|
};
|
|
548
548
|
};
|
|
549
549
|
exports.generateUserGroup = generateUserGroup;
|
|
550
|
+
/**
|
|
551
|
+
* Get the user group value for a given user id and number of groups.
|
|
552
|
+
* @param userId a v4 UUID; _must_ be v4 to ensure random distribution
|
|
553
|
+
* @param numGroups number of possible groups, from 2 to 2^32
|
|
554
|
+
* @returns User group value (A, B, C, etc.), or undefined if the user id is not a v4 UUID
|
|
555
|
+
* or if an error occurs.
|
|
556
|
+
*/
|
|
557
|
+
const generateUserGroupValue = (userId, numGroups) => {
|
|
558
|
+
const group = (0, exports.generateUserGroup)(userId, numGroups);
|
|
559
|
+
if (group.isSuccess) {
|
|
560
|
+
switch (group.value) {
|
|
561
|
+
case 0:
|
|
562
|
+
return 'A';
|
|
563
|
+
case 1:
|
|
564
|
+
return 'B';
|
|
565
|
+
case 2:
|
|
566
|
+
return 'C';
|
|
567
|
+
default:
|
|
568
|
+
return undefined;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
else {
|
|
572
|
+
return undefined;
|
|
573
|
+
}
|
|
574
|
+
};
|
|
575
|
+
exports.generateUserGroupValue = generateUserGroupValue;
|
|
550
576
|
/**
|
|
551
577
|
* @example
|
|
552
578
|
* isVersionAGreaterOrEqualToVersionB('1.2.3', '1.2') // true
|