hevy-shared 1.0.567 → 1.0.569

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
@@ -1,4 +1,4 @@
1
- import { Lookup } from './typeUtils';
1
+ import { Lookup as _Lookup } from './typeUtils';
2
2
  export * from './constants';
3
3
  export * from './utils';
4
4
  export * from './units';
@@ -16,8 +16,12 @@ export * from './normalizedWorkoutUtils';
16
16
  export * from './routineUtils';
17
17
  export * from './typeUtils';
18
18
  export * from './async';
19
+ export * from './index.zod';
19
20
  export declare const supportedLanguages: readonly ["en", "es", "de", "fr", "it", "pt", "tr", "zh_CN", "zh_TW", "ru", "ja", "ko"];
20
- export type Language = Lookup<typeof supportedLanguages>;
21
+ /**
22
+ * @schema enum(['en', 'es', 'de', 'fr', 'it', 'pt', 'tr', 'zh_CN', 'zh_TW', 'ru', 'ja', 'ko'])
23
+ */
24
+ export type Language = _Lookup<typeof supportedLanguages>;
21
25
  export declare const isLanguage: (x: string) => x is Language;
22
26
  export type WeightUnit = 'kg' | 'lbs';
23
27
  export declare const isWeightUnit: (x: string) => x is WeightUnit;
@@ -29,13 +33,22 @@ export type BodyMeasurementUnit = 'cm' | 'in';
29
33
  export declare const isBodyMeasurementUnit: (x: string) => x is BodyMeasurementUnit;
30
34
  /** Monday is first */
31
35
  export declare const orderedWeekdays: readonly ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"];
32
- export type Weekday = Lookup<typeof orderedWeekdays>;
36
+ /**
37
+ * @schema enum(['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'])
38
+ */
39
+ export type Weekday = _Lookup<typeof orderedWeekdays>;
33
40
  export declare const isWeekday: (x: string) => x is Weekday;
34
41
  declare const _timerVolumeOptions: readonly ["off", "low", "normal", "high"];
35
- export type TimerVolumeOption = Lookup<typeof _timerVolumeOptions>;
42
+ /**
43
+ * @schema enum(['off', 'low', 'normal', 'high'])
44
+ */
45
+ export type TimerVolumeOption = _Lookup<typeof _timerVolumeOptions>;
36
46
  export declare const isTimerVolumeOption: (x: string) => x is TimerVolumeOption;
37
47
  declare const _livePRVolumeOption: readonly ["off", "low", "normal", "high"];
38
- export type LivePRVolumeOption = Lookup<typeof _livePRVolumeOption>;
48
+ /**
49
+ * @schema enum(['off', 'low', 'normal', 'high'])
50
+ */
51
+ export type LivePRVolumeOption = _Lookup<typeof _livePRVolumeOption>;
39
52
  export declare const isLivePRVolumeOption: (x: string) => x is LivePRVolumeOption;
40
53
  export interface ErrorResponse {
41
54
  error: string;
@@ -109,7 +122,10 @@ export interface CoachAppPushTarget {
109
122
  token: string;
110
123
  }
111
124
  declare const _coachRoles: readonly ["member", "admin", "owner"];
112
- export type CoachRole = Lookup<typeof _coachRoles>;
125
+ /**
126
+ * @schema enum(['member', 'admin', 'owner'])
127
+ */
128
+ export type CoachRole = _Lookup<typeof _coachRoles>;
113
129
  export declare const isCoachRole: (role: any) => role is CoachRole;
114
130
  export interface CoachAccount {
115
131
  id: string;
@@ -434,7 +450,10 @@ export interface UserShadowBanMetadata {
434
450
  recaptcha_score?: number | null;
435
451
  }
436
452
  declare const _supportedProStores: readonly ["app_store", "play_store", "stripe", "hevy-gift", "gympass", "paddle", "hevy-coach"];
437
- type UserHevyProSubcriptionStore = Lookup<typeof _supportedProStores>;
453
+ /**
454
+ * @schema enum(['app_store', 'play_store', 'stripe', 'hevy-gift', 'gympass', 'paddle', 'hevy-coach'])
455
+ */
456
+ type UserHevyProSubcriptionStore = _Lookup<typeof _supportedProStores>;
438
457
  export interface UserHevyProSubcription {
439
458
  is_pro: boolean;
440
459
  active_subscription?: {
@@ -470,10 +489,19 @@ export interface UserPreferences {
470
489
  volume_includes_warmup_sets?: boolean;
471
490
  }
472
491
  export type UpdateUserPreferencesRequest = Omit<UserPreferences, 'username' | 'volume_includes_warmup_sets'>;
492
+ /**
493
+ * @schema enum(['not-following', 'following', 'requested'])
494
+ */
473
495
  export type FollowingStatus = 'not-following' | 'following' | 'requested';
496
+ /**
497
+ * @schema record(FollowingStatus.exclude(['not-following']))
498
+ */
474
499
  export type FollowingStatusMap = {
475
- [id: string]: Omit<FollowingStatus, 'not-following'>;
500
+ [id: string]: Exclude<FollowingStatus, 'not-following'>;
476
501
  };
502
+ /**
503
+ * @schema record(z.enum(['following', 'requested']))
504
+ */
477
505
  export type FollowingStatusesResponse = {
478
506
  [id: string]: 'following' | 'requested';
479
507
  };
@@ -547,19 +575,31 @@ export interface PublicUserProfile {
547
575
  last_workout?: Workout;
548
576
  }
549
577
  export declare const muscleGroups: readonly ["abdominals", "abductors", "adductors", "biceps", "lower_back", "upper_back", "cardio", "chest", "calves", "forearms", "glutes", "hamstrings", "lats", "quadriceps", "shoulders", "triceps", "traps", "neck", "full_body", "other"];
550
- export type MuscleGroup = Lookup<typeof muscleGroups>;
578
+ /**
579
+ * @schema enum(['abdominals', 'abductors', 'adductors', 'biceps', 'lower_back', 'upper_back', 'cardio', 'chest', 'calves', 'forearms', 'glutes', 'hamstrings', 'lats', 'quadriceps', 'shoulders', 'triceps', 'traps', 'neck', 'full_body', 'other'])
580
+ */
581
+ export type MuscleGroup = _Lookup<typeof muscleGroups>;
551
582
  export declare const isMuscleGroup: (x: string) => x is MuscleGroup;
552
583
  export declare const muscleGroupFilters: readonly ["all_muscles", "abdominals", "abductors", "adductors", "biceps", "lower_back", "upper_back", "cardio", "chest", "calves", "forearms", "glutes", "hamstrings", "lats", "quadriceps", "shoulders", "triceps", "traps", "neck", "full_body", "other"];
553
- export type MuscleGroupFilter = Lookup<typeof muscleGroupFilters>;
584
+ /**
585
+ * @schema enum(['all_muscles', 'abdominals', 'abductors', 'adductors', 'biceps', 'lower_back', 'upper_back', 'cardio', 'chest', 'calves', 'forearms', 'glutes', 'hamstrings', 'lats', 'quadriceps', 'shoulders', 'triceps', 'traps', 'neck', 'full_body', 'other'])
586
+ */
587
+ export type MuscleGroupFilter = _Lookup<typeof muscleGroupFilters>;
554
588
  export declare const isMuscleGroupFilter: (x: string) => x is MuscleGroupFilter;
555
589
  /**
556
590
  * Equipment
557
591
  */
558
592
  export declare const equipments: readonly ["none", "barbell", "dumbbell", "kettlebell", "machine", "plate", "resistance_band", "suspension", "other"];
559
- export type Equipment = Lookup<typeof equipments>;
593
+ /**
594
+ * @schema enum(['none', 'barbell', 'dumbbell', 'kettlebell', 'machine', 'plate', 'resistance_band', 'suspension', 'other'])
595
+ */
596
+ export type Equipment = _Lookup<typeof equipments>;
560
597
  export declare const isEquipment: (x: string) => x is Equipment;
561
598
  export declare const equipmentFilters: readonly ["all_equipment", "none", "barbell", "dumbbell", "kettlebell", "machine", "plate", "resistance_band", "suspension", "other"];
562
- export type EquipmentFilter = Lookup<typeof equipmentFilters>;
599
+ /**
600
+ * @schema enum(['all_equipment', 'none', 'barbell', 'dumbbell', 'kettlebell', 'machine', 'plate', 'resistance_band', 'suspension', 'other'])
601
+ */
602
+ export type EquipmentFilter = _Lookup<typeof equipmentFilters>;
563
603
  export declare const isEquipmentFilter: (x: string) => x is EquipmentFilter;
564
604
  export declare const exerciseRepTypes: readonly ["weight_reps", "reps_only", "bodyweight_reps", "bodyweight_assisted_reps"];
565
605
  /**
@@ -570,11 +610,20 @@ export declare const exerciseRepTypes: readonly ["weight_reps", "reps_only", "bo
570
610
  * bodyweight_assisted_reps = Pull Ups (Assisted)
571
611
  * reps_only = Pull ups
572
612
  */
573
- export type ExerciseRepType = Lookup<typeof exerciseRepTypes>;
613
+ /**
614
+ * @schema enum(['weight_reps', 'reps_only', 'bodyweight_reps', 'bodyweight_assisted_reps'])
615
+ */
616
+ export type ExerciseRepType = _Lookup<typeof exerciseRepTypes>;
574
617
  export declare const isExerciseRepType: (x: any) => x is ExerciseRepType;
575
618
  export declare const exerciseTypes: readonly ["weight_reps", "reps_only", "bodyweight_reps", "bodyweight_assisted_reps", "duration", "weight_duration", "distance_duration", "short_distance_weight", "floors_duration", "steps_duration"];
576
- export type ExerciseType = Lookup<typeof exerciseTypes>;
619
+ /**
620
+ * @schema enum(['weight_reps', 'reps_only', 'bodyweight_reps', 'bodyweight_assisted_reps', 'duration', 'weight_duration', 'distance_duration', 'short_distance_weight', 'floors_duration', 'steps_duration'])
621
+ */
622
+ export type ExerciseType = _Lookup<typeof exerciseTypes>;
577
623
  export declare const isExerciseType: (x: any) => x is ExerciseType;
624
+ /**
625
+ * @schema enum(['weight_reps', 'reps_only', 'bodyweight_reps', 'bodyweight_assisted_reps', 'duration', 'weight_duration', 'distance_duration', 'short_distance_weight'])
626
+ */
578
627
  export type CustomExerciseType = Exclude<ExerciseType, 'floors_duration' | 'steps_duration'>;
579
628
  export declare const customExericseTypes: CustomExerciseType[];
580
629
  export declare const isCustomExerciseType: (x: any) => x is CustomExerciseType;
@@ -622,7 +671,12 @@ export interface LibraryExercise extends BaseExerciseTemplate {
622
671
  zh_cn_title?: string;
623
672
  zh_tw_title?: string;
624
673
  localised_instructions?: {
625
- [language in InstructionsLanguage]?: string;
674
+ en?: string;
675
+ it?: string;
676
+ de?: string;
677
+ es?: string;
678
+ fr?: string;
679
+ pt?: string;
626
680
  };
627
681
  }
628
682
  /**
@@ -639,20 +693,29 @@ export interface CustomExercise extends BaseExerciseTemplate {
639
693
  parent_exercise_template_id?: string;
640
694
  }
641
695
  export declare const supportedInstructionsLanguages: readonly ["en", "it", "de", "es", "fr", "pt"];
642
- export type InstructionsLanguage = Lookup<typeof supportedInstructionsLanguages>;
696
+ /**
697
+ * @schema enum(['en', 'it', 'de', 'es', 'fr', 'pt'])
698
+ */
699
+ export type InstructionsLanguage = _Lookup<typeof supportedInstructionsLanguages>;
643
700
  /** Workouts */
644
701
  declare const _setPersonalRecordTypes: readonly ["best_weight", "best_reps", "best_volume", "best_1rm", "best_duration", "best_distance"];
645
- export type SetPersonalRecordType = Lookup<typeof _setPersonalRecordTypes>;
702
+ /**
703
+ * @schema enum(['best_weight', 'best_reps', 'best_volume', 'best_1rm', 'best_duration', 'best_distance'])
704
+ */
705
+ export type SetPersonalRecordType = _Lookup<typeof _setPersonalRecordTypes>;
646
706
  export interface SetPersonalRecord {
647
707
  exercise_template_id: string;
648
708
  type: SetPersonalRecordType;
649
709
  record: number;
650
710
  }
651
711
  export declare const validRpeValues: readonly [6, 7, 7.5, 8, 8.5, 9, 9.5, 10];
652
- export type RPE = Lookup<typeof validRpeValues>;
712
+ export type RPE = 6 | 7 | 7.5 | 8 | 8.5 | 9 | 9.5 | 10;
653
713
  export declare const isRPE: (x: number) => x is RPE;
654
714
  declare const _setTypes: readonly ["warmup", "normal", "failure", "dropset"];
655
- export type SetType = Lookup<typeof _setTypes>;
715
+ /**
716
+ * @schema enum(['warmup', 'normal', 'failure', 'dropset'])
717
+ */
718
+ export type SetType = _Lookup<typeof _setTypes>;
656
719
  export declare const isSetType: (x: string) => x is SetType;
657
720
  export interface RepRange {
658
721
  start: number | null;
@@ -738,7 +801,6 @@ export interface WorkoutComment {
738
801
  like_count: number;
739
802
  is_liked_by_user: boolean;
740
803
  parent_comment_id?: number;
741
- replying_to_comment_id?: number;
742
804
  }
743
805
  export interface WorkoutImage {
744
806
  type: 'image';
@@ -908,13 +970,15 @@ export interface PostWorkoutRequestSet {
908
970
  custom_metric?: number;
909
971
  rpe?: RPE;
910
972
  }
973
+ type UpdateWorkoutRequestWorkoutOptionalFields = Pick<PostWorkoutRequestWorkout, 'title' | 'description' | 'media' | 'exercises' | 'is_private' | 'is_biometrics_public'>;
974
+ type UpdateWorkoutRequestWorkoutRequiredFields = Required<Pick<PostWorkoutRequestWorkout, 'start_time' | 'end_time'>>;
911
975
  /**
912
976
  * Used to update an existing workout. Props that are defined will be used to
913
977
  * update the corresponding values of the workout in the database, and those
914
978
  * that are undefined will not be changed.
915
979
  */
916
- export type UpdateWorkoutRequestWorkout = Partial<Pick<PostWorkoutRequestWorkout, 'title' | 'description' | 'media' | 'exercises' | 'is_private' | 'is_biometrics_public'>> & {
917
- start_and_end_time?: Required<Pick<PostWorkoutRequestWorkout, 'start_time' | 'end_time'>>;
980
+ export type UpdateWorkoutRequestWorkout = Partial<UpdateWorkoutRequestWorkoutOptionalFields> & {
981
+ start_and_end_time?: UpdateWorkoutRequestWorkoutRequiredFields;
918
982
  };
919
983
  /** Routines */
920
984
  export interface RoutineSet {
@@ -1147,10 +1211,28 @@ export interface OutstandingInvitesForCoachTeamResponse {
1147
1211
  invites: CoachTeamInvite[];
1148
1212
  }
1149
1213
  export declare const measurementsList: readonly ["weight_kg", "fat_percent", "neck_cm", "shoulder_cm", "chest_cm", "left_bicep_cm", "right_bicep_cm", "left_forearm_cm", "right_forearm_cm", "abdomen", "waist", "hips", "left_thigh", "right_thigh", "left_calf", "right_calf"];
1150
- type MeasurementProperties = {
1151
- [key in typeof measurementsList[number]]?: number;
1152
- };
1153
- export type BodyMeasurementKey = Lookup<typeof measurementsList>;
1214
+ interface MeasurementProperties {
1215
+ weight_kg?: number;
1216
+ fat_percent?: number;
1217
+ neck_cm?: number;
1218
+ shoulder_cm?: number;
1219
+ chest_cm?: number;
1220
+ left_bicep_cm?: number;
1221
+ right_bicep_cm?: number;
1222
+ left_forearm_cm?: number;
1223
+ right_forearm_cm?: number;
1224
+ abdomen?: number;
1225
+ waist?: number;
1226
+ hips?: number;
1227
+ left_thigh?: number;
1228
+ right_thigh?: number;
1229
+ left_calf?: number;
1230
+ right_calf?: number;
1231
+ }
1232
+ /**
1233
+ * @schema enum(['weight_kg', 'fat_percent', 'neck_cm', 'shoulder_cm', 'chest_cm', 'left_bicep_cm', 'right_bicep_cm', 'left_forearm_cm', 'right_forearm_cm', 'abdomen', 'waist', 'hips', 'left_thigh', 'right_thigh', 'left_calf', 'right_calf'])
1234
+ */
1235
+ export type BodyMeasurementKey = _Lookup<typeof measurementsList>;
1154
1236
  export declare const isBodyMeasurementKey: (key: string) => key is BodyMeasurementKey;
1155
1237
  export interface BodyMeasurement extends MeasurementProperties {
1156
1238
  id: number;
@@ -1276,9 +1358,28 @@ export interface UserExerciseSet {
1276
1358
  user_bodyweight_kg: number | null;
1277
1359
  custom_metric: number | null;
1278
1360
  }
1279
- export type SetCountMuscleSplitResponse = {
1280
- [key in MuscleGroup]: number;
1281
- };
1361
+ export interface SetCountMuscleSplitResponse {
1362
+ abdominals: number;
1363
+ abductors: number;
1364
+ adductors: number;
1365
+ biceps: number;
1366
+ lower_back: number;
1367
+ upper_back: number;
1368
+ cardio: number;
1369
+ chest: number;
1370
+ calves: number;
1371
+ forearms: number;
1372
+ glutes: number;
1373
+ hamstrings: number;
1374
+ lats: number;
1375
+ quadriceps: number;
1376
+ shoulders: number;
1377
+ triceps: number;
1378
+ traps: number;
1379
+ neck: number;
1380
+ full_body: number;
1381
+ other: number;
1382
+ }
1282
1383
  export type ComparableExerciseTemplatesResponse = Array<{
1283
1384
  exercise_template_id: string;
1284
1385
  }>;
@@ -1308,7 +1409,7 @@ export interface ExerciseLeaderboardResponse {
1308
1409
  }
1309
1410
  export type StrengthLevel = 'beginner' | 'intermediate' | 'advanced' | 'elite';
1310
1411
  export interface GetStrengthLevelParams {
1311
- sex: Omit<Sex, 'other'>;
1412
+ sex: 'male' | 'female';
1312
1413
  best_1rm_kg: number;
1313
1414
  exercise_template_id: string;
1314
1415
  age: number;
@@ -1429,10 +1530,14 @@ export interface StripeCustomerPortalSessionRequest {
1429
1530
  export interface StripeCustomerPortalSessionResponse {
1430
1531
  url: string;
1431
1532
  }
1533
+ /**
1534
+ * @schema union([z.string(), z.number(), z.boolean(), z.array(z.any())]).nullable()
1535
+ */
1432
1536
  export type UserValue = string | number | boolean | null | UserValue[];
1433
- export type UserKeyValues = {
1434
- [key: string]: UserValue;
1435
- };
1537
+ export type UserKeyValues = Record<string, UserValue>;
1538
+ /**
1539
+ * @schema enum(['male', 'female', 'other'])
1540
+ */
1436
1541
  export type Sex = 'male' | 'female' | 'other';
1437
1542
  /**
1438
1543
  * Used for the chat backend to validate authentication details
@@ -1441,8 +1546,9 @@ export type UserAuthenticationValidationResponse = 'unauthorized' | 'authorized_
1441
1546
  declare const _validUserWorkoutMetricsTypes: readonly ["duration", "reps"];
1442
1547
  /**
1443
1548
  * Used for hevy-web for fetching profile metrics and calendar data
1549
+ * @schema enum(['duration', 'reps'])
1444
1550
  */
1445
- export type UserWorkoutMetricsType = Lookup<typeof _validUserWorkoutMetricsTypes>;
1551
+ export type UserWorkoutMetricsType = _Lookup<typeof _validUserWorkoutMetricsTypes>;
1446
1552
  export declare const isValidUserWorkoutMetricsType: (x: any) => x is UserWorkoutMetricsType;
1447
1553
  interface WorkoutMetricBase {
1448
1554
  workout_id: string;
@@ -1535,8 +1641,8 @@ interface BaseFeedback {
1535
1641
  type: FeedbackType;
1536
1642
  userId: string;
1537
1643
  message?: string;
1538
- data?: any;
1539
- debugInfo?: any;
1644
+ data?: object | null;
1645
+ debugInfo?: object | null;
1540
1646
  }
1541
1647
  export interface GeneralFeedback extends BaseFeedback {
1542
1648
  type: 'general';
@@ -1604,8 +1710,8 @@ export type BackofficeFeedback = {
1604
1710
  type: string;
1605
1711
  username?: string;
1606
1712
  message?: string;
1607
- data?: any;
1608
- debug_info?: any;
1713
+ data?: object | null;
1714
+ debug_info?: object | null;
1609
1715
  created_at: Date;
1610
1716
  };
1611
1717
  export interface BackofficeFeedbacksResponse {
package/built/index.js CHANGED
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
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;
18
- const typeUtils_1 = require("./typeUtils");
18
+ const typeUtils_1 = require("./typeUtils"); // import as _Lookup to avoid a lint error as ts-to-zod emits an unused dummy value
19
19
  __exportStar(require("./constants"), exports);
20
20
  __exportStar(require("./utils"), exports);
21
21
  __exportStar(require("./units"), exports);
@@ -33,6 +33,7 @@ __exportStar(require("./normalizedWorkoutUtils"), exports);
33
33
  __exportStar(require("./routineUtils"), exports);
34
34
  __exportStar(require("./typeUtils"), exports);
35
35
  __exportStar(require("./async"), exports);
36
+ __exportStar(require("./index.zod"), exports);
36
37
  exports.supportedLanguages = [
37
38
  'en',
38
39
  'es',