hevy-shared 1.0.867 → 1.0.869

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
@@ -1589,7 +1589,7 @@ export type Sex = 'male' | 'female' | 'other';
1589
1589
  * Used for the chat backend to validate authentication details
1590
1590
  */
1591
1591
  export type UserAuthenticationValidationResponse = 'unauthorized' | 'authorized_user' | 'admin' | 'banned' | 'shadow_banned';
1592
- declare const _validUserWorkoutMetricsTypes: readonly ["duration", "volume_kg", "reps"];
1592
+ declare const _validUserWorkoutMetricsTypes: readonly ["duration", "reps"];
1593
1593
  /**
1594
1594
  * Used for hevy-web for fetching profile metrics and calendar data
1595
1595
  */
@@ -1600,19 +1600,15 @@ interface WorkoutMetricBase {
1600
1600
  start_time: number;
1601
1601
  type: UserWorkoutMetricsType;
1602
1602
  }
1603
- export interface DurationWorkoutMetric extends WorkoutMetricBase {
1604
- type: 'duration';
1605
- duration_seconds: number;
1606
- }
1607
- export interface VolumeKgWorkoutMetric extends WorkoutMetricBase {
1608
- type: 'volume_kg';
1609
- volume_kg: number;
1610
- }
1611
1603
  export interface RepsWorkoutMetric extends WorkoutMetricBase {
1612
1604
  type: 'reps';
1613
1605
  reps: number;
1614
1606
  }
1615
- export type WorkoutMetric = DurationWorkoutMetric | VolumeKgWorkoutMetric | RepsWorkoutMetric;
1607
+ export interface DurationWorkoutMetric extends WorkoutMetricBase {
1608
+ type: 'duration';
1609
+ duration_seconds: number;
1610
+ }
1611
+ export type WorkoutMetric = RepsWorkoutMetric | DurationWorkoutMetric;
1616
1612
  export interface UserCalendarWorkout {
1617
1613
  workout_short_id: string;
1618
1614
  title: string;
@@ -1891,3 +1887,26 @@ export interface FolderLinkPreviewMetadataResponse extends LinkPreviewMetadataRe
1891
1887
  username: string;
1892
1888
  routine_count: number;
1893
1889
  }
1890
+ export interface ExerciseHistorySet {
1891
+ weight_kg: number | null;
1892
+ reps: number | null;
1893
+ indicator: string | null;
1894
+ duration_seconds: number | null;
1895
+ distance_meters: number | null;
1896
+ rpe: number | null;
1897
+ custom_metric: number | null;
1898
+ set_index: number;
1899
+ prs: SetPersonalRecordType[];
1900
+ }
1901
+ export interface ExerciseInstructionsStep {
1902
+ index?: number;
1903
+ description: string;
1904
+ }
1905
+ export interface ExerciseHistoryWorkout {
1906
+ id: string;
1907
+ name: string;
1908
+ start_time: number;
1909
+ exercises: {
1910
+ sets: ExerciseHistorySet[];
1911
+ }[];
1912
+ }
package/built/index.js CHANGED
@@ -326,11 +326,7 @@ exports.measurementsList = [
326
326
  ];
327
327
  const isBodyMeasurementKey = (key) => (0, typeUtils_1.isInArray)(key, exports.measurementsList);
328
328
  exports.isBodyMeasurementKey = isBodyMeasurementKey;
329
- const _validUserWorkoutMetricsTypes = [
330
- 'duration',
331
- 'volume_kg',
332
- 'reps',
333
- ];
329
+ const _validUserWorkoutMetricsTypes = ['duration', 'reps'];
334
330
  const isValidUserWorkoutMetricsType = (x) => (0, typeUtils_1.isInArray)(x, _validUserWorkoutMetricsTypes);
335
331
  exports.isValidUserWorkoutMetricsType = isValidUserWorkoutMetricsType;
336
332
  const _suggestedUserSources = [
package/built/utils.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Dayjs } from 'dayjs';
2
- import { BaseExerciseTemplate, ExerciseType, FormatAtText, Result, SetType, StrengthLevel, UserExerciseSet, UserFacingSetIndicator, Weekday } from '.';
2
+ import { BaseExerciseTemplate, ExerciseInstructionsStep, ExerciseType, FormatAtText, Result, SetType, StrengthLevel, UserExerciseSet, UserFacingSetIndicator, Weekday } from '.';
3
3
  /**
4
4
  * Doesn't matter what you throw in the function it'll
5
5
  * always return a number. Non number values will return
@@ -249,4 +249,5 @@ export declare const startOfWeek: (d: Dayjs, firstDayOfWeek: Weekday) => Dayjs;
249
249
  export declare const weekdayNumberMap: {
250
250
  [key in Weekday]: number;
251
251
  };
252
+ export declare const rawInstructionsToIndexedSteps: (rawInstructions: string) => ExerciseInstructionsStep[];
252
253
  export {};
package/built/utils.js CHANGED
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.startOfWeek = exports.calculateCurrentWeekStreak = 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.getEstimatedExercisesDurationSeconds = exports.ESTIMATED_REST_TIMER_DURATION = exports.ESTIMATED_SET_DURATION = exports.UserFacingIndicatorToSetIndicator = 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.secondsToClockParts = exports.isValidUsername = exports.roundToWholeNumber = exports.roundToOneDecimal = exports.roundToTwoDecimal = exports.divide = exports.clampNumber = exports.num = void 0;
7
- exports.weekdayNumberMap = void 0;
7
+ exports.rawInstructionsToIndexedSteps = exports.weekdayNumberMap = void 0;
8
8
  const dayjs_1 = __importDefault(require("dayjs"));
9
9
  /**
10
10
  * Doesn't matter what you throw in the function it'll
@@ -775,3 +775,22 @@ exports.weekdayNumberMap = {
775
775
  friday: 5,
776
776
  saturday: 6,
777
777
  };
778
+ const rawInstructionsToIndexedSteps = (rawInstructions) => {
779
+ const instructionsByLine = rawInstructions
780
+ .split('\n')
781
+ .map((l) => l.trim())
782
+ .filter((l) => l.length > 0);
783
+ const instructionsByStep = instructionsByLine.map((s) => {
784
+ var _a, _b;
785
+ const parsedStep = s.match(/^([0-9]*)\\?\.(.*)$/);
786
+ if (!parsedStep) {
787
+ // this line doesn't contain a number, so just return it unchanged
788
+ return { description: s };
789
+ }
790
+ const index = Number(parsedStep[1]) || undefined; // if it's NaN or 0, convert it to undefined
791
+ const description = (_b = (_a = parsedStep[2]) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : s;
792
+ return { index, description };
793
+ });
794
+ return instructionsByStep;
795
+ };
796
+ exports.rawInstructionsToIndexedSteps = rawInstructionsToIndexedSteps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hevy-shared",
3
- "version": "1.0.867",
3
+ "version": "1.0.869",
4
4
  "description": "",
5
5
  "main": "built/index.js",
6
6
  "types": "built/index.d.ts",