hevy-shared 1.0.960 → 1.0.962
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/.eslintignore +2 -0
- package/.eslintrc +21 -0
- package/.github/workflows/ci.yml +15 -0
- package/.github/workflows/npm-publish.yml +59 -0
- package/.github/workflows/pr-auto-assign.yml +15 -0
- package/.prettierrc.js +5 -0
- package/README.md +2 -17
- package/built/chat.d.ts +23 -25
- package/built/coachPlans.d.ts +1 -2
- package/built/coachPlans.js +2 -2
- package/built/filterExercises.d.ts +3 -19
- package/built/filterExercises.js +60 -72
- package/built/index.d.ts +304 -1140
- package/built/index.js +75 -269
- package/built/setIndicatorUtils.d.ts +3 -4
- package/built/setIndicatorUtils.js +1 -15
- package/built/tests/utils.test.js +0 -748
- package/built/tests/workoutVolume.test.js +49 -165
- package/built/units.d.ts +7 -14
- package/built/units.js +14 -24
- package/built/utils.d.ts +5 -192
- package/built/utils.js +85 -598
- package/built/websocket.d.ts +2 -14
- package/built/workoutVolume.d.ts +5 -24
- package/built/workoutVolume.js +34 -25
- package/jest.config.js +4 -0
- package/package.json +10 -32
- package/src/chat.ts +130 -0
- package/src/coachPlans.ts +57 -0
- package/src/constants.ts +14 -0
- package/src/filterExercises.ts +222 -0
- package/src/index.ts +1576 -0
- package/src/setIndicatorUtils.ts +137 -0
- package/src/tests/utils.test.ts +156 -0
- package/src/tests/workoutVolume.test.ts +93 -0
- package/src/units.ts +41 -0
- package/src/utils.ts +516 -0
- package/src/websocket.ts +36 -0
- package/src/workoutVolume.ts +175 -0
- package/tsconfig.json +70 -0
- package/built/API/APIClient.d.ts +0 -157
- package/built/API/APIClient.js +0 -381
- package/built/API/index.d.ts +0 -2
- package/built/API/index.js +0 -18
- package/built/API/types.d.ts +0 -38
- package/built/API/types.js +0 -18
- package/built/adjustEventTokens.d.ts +0 -16
- package/built/adjustEventTokens.js +0 -18
- package/built/adminPermissions.d.ts +0 -4
- package/built/adminPermissions.js +0 -22
- package/built/async.d.ts +0 -50
- package/built/async.js +0 -170
- package/built/cue.d.ts +0 -12
- package/built/cue.js +0 -22
- package/built/exerciseLocaleUtils.d.ts +0 -17
- package/built/exerciseLocaleUtils.js +0 -62
- package/built/hevyTrainer.d.ts +0 -250
- package/built/hevyTrainer.js +0 -676
- package/built/muscleHeatmaps.d.ts +0 -31
- package/built/muscleHeatmaps.js +0 -68
- package/built/muscleSplits.d.ts +0 -36
- package/built/muscleSplits.js +0 -100
- package/built/normalizedWorkoutUtils.d.ts +0 -88
- package/built/normalizedWorkoutUtils.js +0 -112
- package/built/notifications.d.ts +0 -215
- package/built/notifications.js +0 -9
- package/built/routineUtils.d.ts +0 -14
- package/built/routineUtils.js +0 -186
- package/built/schemas.d.ts +0 -6
- package/built/schemas.js +0 -12
- package/built/tests/async.test.d.ts +0 -1
- package/built/tests/async.test.js +0 -49
- package/built/tests/hevyTrainer.test.d.ts +0 -1
- package/built/tests/hevyTrainer.test.js +0 -1199
- package/built/tests/muscleSplit.test.d.ts +0 -1
- package/built/tests/muscleSplit.test.js +0 -153
- package/built/tests/routineUtils.test.d.ts +0 -1
- package/built/tests/routineUtils.test.js +0 -745
- package/built/tests/testUtils.d.ts +0 -85
- package/built/tests/testUtils.js +0 -319
- package/built/translations/index.d.ts +0 -2
- package/built/translations/index.js +0 -18
- package/built/translations/translationUtils.d.ts +0 -2
- package/built/translations/translationUtils.js +0 -61
- package/built/translations/types.d.ts +0 -8
- package/built/translations/types.js +0 -20
- package/built/typeUtils.d.ts +0 -70
- package/built/typeUtils.js +0 -55
package/built/index.js
CHANGED
|
@@ -14,10 +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.
|
|
18
|
-
exports.isOAuthScope = exports.supportedScopes = exports.isSuggestedUserSource = exports.isValidUserWorkoutMetricsType = exports.isBodyMeasurementKey = exports.measurementsList = exports.isHevyTrainerRoutine = exports.isWorkoutBiometrics = void 0;
|
|
19
|
-
const typeUtils_1 = require("./typeUtils");
|
|
20
|
-
__exportStar(require("./schemas"), exports);
|
|
17
|
+
exports.isValidUserWorkoutMetricsType = exports.isPublicWorkout = exports.validRpeValues = exports.isRPE = exports.isExerciseType = exports.exerciseTypes = exports.isEquipmentFilter = exports.isEquipment = exports.equipmentFilters = exports.equipments = exports.isMuscleGroupFilter = exports.muscleGroupFilters = exports.isMuscleGroup = exports.muscleGroups = exports.DefaultClientConfiguration = exports.isErrorResponse = exports.isTimerVolumeOption = exports.isWeekday = exports.isBodyMeasurementUnit = exports.isDistanceUnitShort = exports.isDistanceUnit = exports.isWeightUnit = exports.isLanguage = void 0;
|
|
21
18
|
__exportStar(require("./constants"), exports);
|
|
22
19
|
__exportStar(require("./utils"), exports);
|
|
23
20
|
__exportStar(require("./units"), exports);
|
|
@@ -27,19 +24,23 @@ __exportStar(require("./workoutVolume"), exports);
|
|
|
27
24
|
__exportStar(require("./coachPlans"), exports);
|
|
28
25
|
__exportStar(require("./chat"), exports);
|
|
29
26
|
__exportStar(require("./websocket"), exports);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
27
|
+
const isLanguage = (x) => {
|
|
28
|
+
return [
|
|
29
|
+
'en',
|
|
30
|
+
'es',
|
|
31
|
+
'de',
|
|
32
|
+
'fr',
|
|
33
|
+
'it',
|
|
34
|
+
'pt',
|
|
35
|
+
'tr',
|
|
36
|
+
'zh_CN',
|
|
37
|
+
'zh_TW',
|
|
38
|
+
'ru',
|
|
39
|
+
'ja',
|
|
40
|
+
'ko',
|
|
41
|
+
].includes(x);
|
|
42
|
+
};
|
|
43
|
+
exports.isLanguage = isLanguage;
|
|
43
44
|
const isWeightUnit = (x) => {
|
|
44
45
|
return x === 'kg' || x === 'lbs';
|
|
45
46
|
};
|
|
@@ -56,119 +57,61 @@ const isBodyMeasurementUnit = (x) => {
|
|
|
56
57
|
return x === 'cm' || x === 'in';
|
|
57
58
|
};
|
|
58
59
|
exports.isBodyMeasurementUnit = isBodyMeasurementUnit;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
];
|
|
69
|
-
const isWeekday = (x) => (0, typeUtils_1.isInArray)(x, exports.orderedWeekdays);
|
|
60
|
+
const isWeekday = (x) => {
|
|
61
|
+
return (x === 'monday' ||
|
|
62
|
+
x === 'tuesday' ||
|
|
63
|
+
x === 'wednesday' ||
|
|
64
|
+
x === 'thursday' ||
|
|
65
|
+
x === 'friday' ||
|
|
66
|
+
x === 'saturday' ||
|
|
67
|
+
x === 'sunday');
|
|
68
|
+
};
|
|
70
69
|
exports.isWeekday = isWeekday;
|
|
71
|
-
const
|
|
72
|
-
|
|
70
|
+
const isTimerVolumeOption = (x) => {
|
|
71
|
+
return x === 'off' || x === 'low' || x === 'normal' || x === 'high';
|
|
72
|
+
};
|
|
73
73
|
exports.isTimerVolumeOption = isTimerVolumeOption;
|
|
74
|
-
const _livePRVolumeOption = ['off', 'low', 'normal', 'high'];
|
|
75
|
-
const isLivePRVolumeOption = (x) => (0, typeUtils_1.isInArray)(x, _livePRVolumeOption);
|
|
76
|
-
exports.isLivePRVolumeOption = isLivePRVolumeOption;
|
|
77
74
|
const isErrorResponse = (x) => {
|
|
78
75
|
return typeof (x === null || x === void 0 ? void 0 : x.error) === 'string';
|
|
79
76
|
};
|
|
80
77
|
exports.isErrorResponse = isErrorResponse;
|
|
81
|
-
const _coachRoles = ['member', 'admin', 'owner'];
|
|
82
|
-
const isCoachRole = (role) => (0, typeUtils_1.isInArray)(role, _coachRoles);
|
|
83
|
-
exports.isCoachRole = isCoachRole;
|
|
84
|
-
const parseClientAuthTokenResponse = (data) => typeof data === 'object' &&
|
|
85
|
-
!!data &&
|
|
86
|
-
typeof data.access_token === 'string' &&
|
|
87
|
-
data.access_token.length > 0 &&
|
|
88
|
-
typeof data.refresh_token === 'string' &&
|
|
89
|
-
data.refresh_token.length > 0 &&
|
|
90
|
-
typeof data.expires_at === 'string' &&
|
|
91
|
-
data.expires_at.length > 0 &&
|
|
92
|
-
!!new Date(data.expires_at).valueOf()
|
|
93
|
-
? {
|
|
94
|
-
access_token: data.access_token,
|
|
95
|
-
refresh_token: data.refresh_token,
|
|
96
|
-
expires_at: new Date(data.expires_at),
|
|
97
|
-
}
|
|
98
|
-
: null;
|
|
99
|
-
exports.parseClientAuthTokenResponse = parseClientAuthTokenResponse;
|
|
100
78
|
exports.DefaultClientConfiguration = {
|
|
101
79
|
is_chat_enabled: false,
|
|
102
|
-
are_notifications_enabled: true,
|
|
103
80
|
};
|
|
104
|
-
|
|
105
|
-
'
|
|
106
|
-
'play_store',
|
|
107
|
-
'stripe',
|
|
108
|
-
'hevy-gift',
|
|
109
|
-
'gympass',
|
|
110
|
-
'paddle',
|
|
111
|
-
'hevy-coach',
|
|
112
|
-
];
|
|
113
|
-
exports.coreMuscles = ['abdominals'];
|
|
114
|
-
exports.shoulderMuscles = ['shoulders'];
|
|
115
|
-
exports.armMuscles = ['biceps', 'triceps', 'forearms'];
|
|
116
|
-
exports.legMuscles = [
|
|
117
|
-
'quadriceps',
|
|
118
|
-
'hamstrings',
|
|
119
|
-
'calves',
|
|
120
|
-
'glutes',
|
|
81
|
+
exports.muscleGroups = [
|
|
82
|
+
'abdominals',
|
|
121
83
|
'abductors',
|
|
122
84
|
'adductors',
|
|
123
|
-
|
|
124
|
-
exports.backMuscles = [
|
|
125
|
-
'lats',
|
|
126
|
-
'upper_back',
|
|
127
|
-
'traps',
|
|
85
|
+
'biceps',
|
|
128
86
|
'lower_back',
|
|
129
|
-
|
|
130
|
-
exports.chestMuscles = ['chest'];
|
|
131
|
-
exports.miscellaneousMuscles = [
|
|
87
|
+
'upper_back',
|
|
132
88
|
'cardio',
|
|
89
|
+
'chest',
|
|
90
|
+
'calves',
|
|
91
|
+
'forearms',
|
|
92
|
+
'glutes',
|
|
93
|
+
'hamstrings',
|
|
94
|
+
'lats',
|
|
95
|
+
'quadriceps',
|
|
96
|
+
'shoulders',
|
|
97
|
+
'triceps',
|
|
98
|
+
'traps',
|
|
133
99
|
'neck',
|
|
134
100
|
'full_body',
|
|
135
101
|
'other',
|
|
136
102
|
];
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
'arms',
|
|
141
|
-
'legs',
|
|
142
|
-
'back',
|
|
143
|
-
'chest',
|
|
144
|
-
];
|
|
145
|
-
const isSimplifiedMuscleGroup = (x) => (0, typeUtils_1.isInArray)(x, exports.simplifiedMuscleGroups);
|
|
146
|
-
exports.isSimplifiedMuscleGroup = isSimplifiedMuscleGroup;
|
|
147
|
-
exports.muscleGroups = [
|
|
148
|
-
...exports.coreMuscles,
|
|
149
|
-
...exports.shoulderMuscles,
|
|
150
|
-
...exports.armMuscles,
|
|
151
|
-
...exports.legMuscles,
|
|
152
|
-
...exports.backMuscles,
|
|
153
|
-
...exports.chestMuscles,
|
|
154
|
-
...exports.miscellaneousMuscles,
|
|
155
|
-
];
|
|
156
|
-
const isMuscleGroup = (x) => (0, typeUtils_1.isInArray)(x, exports.muscleGroups);
|
|
103
|
+
const isMuscleGroup = (x) => {
|
|
104
|
+
return exports.muscleGroups.includes(x);
|
|
105
|
+
};
|
|
157
106
|
exports.isMuscleGroup = isMuscleGroup;
|
|
158
|
-
exports.muscleGroupFilters = [
|
|
159
|
-
|
|
160
|
-
exports.
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
back: exports.backMuscles,
|
|
165
|
-
arms: exports.armMuscles,
|
|
166
|
-
legs: exports.legMuscles,
|
|
167
|
-
core: exports.coreMuscles,
|
|
107
|
+
exports.muscleGroupFilters = [
|
|
108
|
+
'all_muscles',
|
|
109
|
+
...exports.muscleGroups,
|
|
110
|
+
];
|
|
111
|
+
const isMuscleGroupFilter = (x) => {
|
|
112
|
+
return exports.muscleGroupFilters.includes(x);
|
|
168
113
|
};
|
|
169
|
-
|
|
170
|
-
* Equipment
|
|
171
|
-
*/
|
|
114
|
+
exports.isMuscleGroupFilter = isMuscleGroupFilter;
|
|
172
115
|
exports.equipments = [
|
|
173
116
|
'none',
|
|
174
117
|
'barbell',
|
|
@@ -180,23 +123,24 @@ exports.equipments = [
|
|
|
180
123
|
'suspension',
|
|
181
124
|
'other',
|
|
182
125
|
];
|
|
183
|
-
|
|
126
|
+
exports.equipmentFilters = [
|
|
127
|
+
'all_equipment',
|
|
128
|
+
...exports.equipments,
|
|
129
|
+
];
|
|
130
|
+
const isEquipment = (x) => {
|
|
131
|
+
return exports.equipments.includes(x);
|
|
132
|
+
};
|
|
184
133
|
exports.isEquipment = isEquipment;
|
|
185
|
-
|
|
186
|
-
|
|
134
|
+
const isEquipmentFilter = (x) => {
|
|
135
|
+
return exports.equipmentFilters.includes(x);
|
|
136
|
+
};
|
|
187
137
|
exports.isEquipmentFilter = isEquipmentFilter;
|
|
188
|
-
exports.
|
|
138
|
+
exports.exerciseTypes = [
|
|
189
139
|
'weight_reps',
|
|
190
140
|
'reps_only',
|
|
191
|
-
'bodyweight_reps',
|
|
141
|
+
'bodyweight_reps',
|
|
192
142
|
'bodyweight_assisted_reps',
|
|
193
|
-
];
|
|
194
|
-
const isExerciseRepType = (x) => (0, typeUtils_1.isInArray)(x, exports.exerciseRepTypes);
|
|
195
|
-
exports.isExerciseRepType = isExerciseRepType;
|
|
196
|
-
exports.exerciseTypes = [
|
|
197
|
-
...exports.exerciseRepTypes,
|
|
198
143
|
'duration',
|
|
199
|
-
'weight_duration',
|
|
200
144
|
'distance_duration',
|
|
201
145
|
/**
|
|
202
146
|
* Note on short_distance_weight exercises. The UI makes it look like we support yards and meters
|
|
@@ -209,159 +153,21 @@ exports.exerciseTypes = [
|
|
|
209
153
|
* from yards<->meters.
|
|
210
154
|
*/
|
|
211
155
|
'short_distance_weight',
|
|
212
|
-
/**
|
|
213
|
-
* At the time of writing, the only exercise that uses these types are Stair Machine (Floors)
|
|
214
|
-
* and Stair Machine (Steps) respectively.
|
|
215
|
-
*/
|
|
216
|
-
'floors_duration',
|
|
217
|
-
'steps_duration',
|
|
218
156
|
];
|
|
219
|
-
const isExerciseType = (x) =>
|
|
157
|
+
const isExerciseType = (x) => {
|
|
158
|
+
return typeof x === 'string' && exports.exerciseTypes.includes(x);
|
|
159
|
+
};
|
|
220
160
|
exports.isExerciseType = isExerciseType;
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
// Hevy Trainer related types
|
|
225
|
-
exports.trainingGoals = ['strength', 'build_muscle', 'fat_loss'];
|
|
226
|
-
exports.trainingLevels = ['beginner', 'intermediate', 'advanced'];
|
|
227
|
-
exports.exerciseCategories = [
|
|
228
|
-
'isolation',
|
|
229
|
-
'compound',
|
|
230
|
-
'assistance-compound',
|
|
231
|
-
];
|
|
232
|
-
exports.restTimerLengths = ['short', 'medium', 'long'];
|
|
233
|
-
exports.hevyTrainerProgramEquipments = [
|
|
234
|
-
'barbell',
|
|
235
|
-
'dumbbell',
|
|
236
|
-
'machine',
|
|
237
|
-
];
|
|
238
|
-
exports.granularEquipments = [
|
|
239
|
-
'barbell',
|
|
240
|
-
'dumbbell',
|
|
241
|
-
'kettlebell',
|
|
242
|
-
'plate',
|
|
243
|
-
'medicine_ball',
|
|
244
|
-
'ez_bar',
|
|
245
|
-
'landmine',
|
|
246
|
-
'trap_bar',
|
|
247
|
-
'pullup_bar',
|
|
248
|
-
'dip_bar',
|
|
249
|
-
'squat_rack',
|
|
250
|
-
'flat_bench',
|
|
251
|
-
'adjustable_bench',
|
|
252
|
-
'dual_cable_machine',
|
|
253
|
-
'single_cable_machine',
|
|
254
|
-
'lat_pulldown_cable',
|
|
255
|
-
'leg_press_machine',
|
|
256
|
-
'smith_machine',
|
|
257
|
-
't_bar',
|
|
258
|
-
'plate_machines',
|
|
259
|
-
'stack_machines',
|
|
260
|
-
'treadmill',
|
|
261
|
-
'elliptical_trainer',
|
|
262
|
-
'rowing_machine',
|
|
263
|
-
'spinning',
|
|
264
|
-
'stair_machine',
|
|
265
|
-
'air_bike',
|
|
266
|
-
'suspension_band',
|
|
267
|
-
'resistance_band',
|
|
268
|
-
'battle_rope',
|
|
269
|
-
'rings',
|
|
270
|
-
'jump_rope',
|
|
271
|
-
];
|
|
272
|
-
const isGranularEquipment = (x) => (0, typeUtils_1.isInArray)(x, exports.granularEquipments);
|
|
273
|
-
exports.isGranularEquipment = isGranularEquipment;
|
|
274
|
-
exports.weeklyTrainingFrequencies = [1, 2, 3, 4, 5, 6];
|
|
275
|
-
// Workouts
|
|
276
|
-
const _setPersonalRecordTypes = [
|
|
277
|
-
'best_weight',
|
|
278
|
-
'best_reps',
|
|
279
|
-
'best_volume',
|
|
280
|
-
'best_1rm',
|
|
281
|
-
'best_duration',
|
|
282
|
-
'best_distance',
|
|
283
|
-
'most_floors',
|
|
284
|
-
'most_steps',
|
|
285
|
-
];
|
|
286
|
-
const isSetPersonalRecordType = (x) => (0, typeUtils_1.isInArray)(x, _setPersonalRecordTypes);
|
|
287
|
-
exports.isSetPersonalRecordType = isSetPersonalRecordType;
|
|
288
|
-
exports.validRpeValues = [6, 7, 7.5, 8, 8.5, 9, 9.5, 10];
|
|
289
|
-
const isRPE = (x) => (0, typeUtils_1.isInArray)(x, exports.validRpeValues);
|
|
161
|
+
const isRPE = (x) => {
|
|
162
|
+
return exports.validRpeValues.includes(x);
|
|
163
|
+
};
|
|
290
164
|
exports.isRPE = isRPE;
|
|
291
|
-
|
|
292
|
-
const isSetType = (x) => (0, typeUtils_1.isInArray)(x, _setTypes);
|
|
293
|
-
exports.isSetType = isSetType;
|
|
165
|
+
exports.validRpeValues = [6, 7, 7.5, 8, 8.5, 9, 9.5, 10];
|
|
294
166
|
const isPublicWorkout = (x) => {
|
|
295
167
|
return x.type === 'public';
|
|
296
168
|
};
|
|
297
169
|
exports.isPublicWorkout = isPublicWorkout;
|
|
298
|
-
const
|
|
299
|
-
|
|
300
|
-
return false;
|
|
301
|
-
for (const sample of x) {
|
|
302
|
-
if (typeof sample.timestamp_ms !== 'number' ||
|
|
303
|
-
typeof sample.bpm !== 'number') {
|
|
304
|
-
return false;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
return true;
|
|
308
|
-
};
|
|
309
|
-
exports.isHeartRateSamples = isHeartRateSamples;
|
|
310
|
-
const isWorkoutBiometrics = (x) => {
|
|
311
|
-
if (!x)
|
|
312
|
-
return false;
|
|
313
|
-
const maybeCalories = x.total_calories;
|
|
314
|
-
const maybeHeartRateSamples = x.heart_rate_samples;
|
|
315
|
-
const caloriesAreValid = maybeCalories === undefined ||
|
|
316
|
-
(typeof maybeCalories === 'number' && maybeCalories >= 0);
|
|
317
|
-
const heartSamplesAreValid = maybeHeartRateSamples === undefined ||
|
|
318
|
-
(0, exports.isHeartRateSamples)(maybeHeartRateSamples);
|
|
319
|
-
return caloriesAreValid && heartSamplesAreValid;
|
|
170
|
+
const isValidUserWorkoutMetricsType = (x) => {
|
|
171
|
+
return typeof x === 'string' && ['duration', 'reps'].includes(x);
|
|
320
172
|
};
|
|
321
|
-
exports.isWorkoutBiometrics = isWorkoutBiometrics;
|
|
322
|
-
const isHevyTrainerRoutine = (routine) => routine.hevy_trainer_program_id !== null;
|
|
323
|
-
exports.isHevyTrainerRoutine = isHevyTrainerRoutine;
|
|
324
|
-
exports.measurementsList = [
|
|
325
|
-
'weight_kg',
|
|
326
|
-
'lean_mass_kg',
|
|
327
|
-
'fat_percent',
|
|
328
|
-
'neck_cm',
|
|
329
|
-
'shoulder_cm',
|
|
330
|
-
'chest_cm',
|
|
331
|
-
'left_bicep_cm',
|
|
332
|
-
'right_bicep_cm',
|
|
333
|
-
'left_forearm_cm',
|
|
334
|
-
'right_forearm_cm',
|
|
335
|
-
'abdomen',
|
|
336
|
-
'waist',
|
|
337
|
-
'hips',
|
|
338
|
-
'left_thigh',
|
|
339
|
-
'right_thigh',
|
|
340
|
-
'left_calf',
|
|
341
|
-
'right_calf',
|
|
342
|
-
];
|
|
343
|
-
const isBodyMeasurementKey = (key) => (0, typeUtils_1.isInArray)(key, exports.measurementsList);
|
|
344
|
-
exports.isBodyMeasurementKey = isBodyMeasurementKey;
|
|
345
|
-
const _validUserWorkoutMetricsTypes = ['duration', 'reps'];
|
|
346
|
-
const isValidUserWorkoutMetricsType = (x) => (0, typeUtils_1.isInArray)(x, _validUserWorkoutMetricsTypes);
|
|
347
173
|
exports.isValidUserWorkoutMetricsType = isValidUserWorkoutMetricsType;
|
|
348
|
-
const _suggestedUserSources = [
|
|
349
|
-
'popular',
|
|
350
|
-
'local',
|
|
351
|
-
'contact',
|
|
352
|
-
'mutual_follows',
|
|
353
|
-
'follows_you',
|
|
354
|
-
'featured',
|
|
355
|
-
'hyper_local',
|
|
356
|
-
];
|
|
357
|
-
const isSuggestedUserSource = (source) => (0, typeUtils_1.isInArray)(source, _suggestedUserSources);
|
|
358
|
-
exports.isSuggestedUserSource = isSuggestedUserSource;
|
|
359
|
-
exports.supportedScopes = [
|
|
360
|
-
'read-workout',
|
|
361
|
-
'modify-workout',
|
|
362
|
-
'read-routine',
|
|
363
|
-
'modify-routine',
|
|
364
|
-
'unrestricted',
|
|
365
|
-
];
|
|
366
|
-
const isOAuthScope = (x) => (0, typeUtils_1.isInArray)(x, exports.supportedScopes);
|
|
367
|
-
exports.isOAuthScope = isOAuthScope;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
interface SetIndicatored {
|
|
2
|
-
indicator: 'warmup' | 'dropset' | 'failure' | 'normal' |
|
|
2
|
+
indicator: 'warmup' | 'dropset' | 'failure' | 'normal' | any;
|
|
3
3
|
}
|
|
4
4
|
interface Indexed {
|
|
5
5
|
index: number;
|
|
@@ -30,7 +30,7 @@ interface Indexed {
|
|
|
30
30
|
* ]
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
|
-
export declare const indexSetObjectsForUI: <T>(indexedSet: SetIndicatored[]) =>
|
|
33
|
+
export declare const indexSetObjectsForUI: <T>(indexedSet: SetIndicatored[]) => (SetIndicatored & Indexed & T)[];
|
|
34
34
|
/**
|
|
35
35
|
* This function is almost the exact same as `indexSetObjectsForUI`
|
|
36
36
|
* but this function will change failure sets to normal. Because when
|
|
@@ -63,8 +63,7 @@ export declare const indexSetObjectsForUI: <T>(indexedSet: SetIndicatored[]) =>
|
|
|
63
63
|
* ]
|
|
64
64
|
* ```
|
|
65
65
|
*/
|
|
66
|
-
export declare const indexSetObjectsForType: <T>(indexedSet: SetIndicatored[]) =>
|
|
66
|
+
export declare const indexSetObjectsForType: <T>(indexedSet: SetIndicatored[]) => (SetIndicatored & Indexed & T)[];
|
|
67
67
|
export type UserFacingSetIndicator = 'dropset' | 'warmup' | 'failure' | number;
|
|
68
68
|
export declare const setObjectToUIFacingSetIndicator: (set: SetIndicatored & Indexed) => UserFacingSetIndicator;
|
|
69
|
-
export declare const compareUserFacingSetIndicator: (indicatorA: UserFacingSetIndicator, indicatorB: UserFacingSetIndicator) => boolean;
|
|
70
69
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.setObjectToUIFacingSetIndicator = exports.indexSetObjectsForType = exports.indexSetObjectsForUI = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Accepts any data structure like this:
|
|
6
6
|
* [
|
|
@@ -110,17 +110,3 @@ const setObjectToUIFacingSetIndicator = (set) => {
|
|
|
110
110
|
return set.index + 1;
|
|
111
111
|
};
|
|
112
112
|
exports.setObjectToUIFacingSetIndicator = setObjectToUIFacingSetIndicator;
|
|
113
|
-
const compareUserFacingSetIndicator = (indicatorA, indicatorB) => {
|
|
114
|
-
const normalizedA = indicatorA === 'warmup'
|
|
115
|
-
? 'warmup'
|
|
116
|
-
: indicatorA === 'dropset'
|
|
117
|
-
? 'dropset'
|
|
118
|
-
: 'normal';
|
|
119
|
-
const normalizedB = indicatorB === 'warmup'
|
|
120
|
-
? 'warmup'
|
|
121
|
-
: indicatorB === 'dropset'
|
|
122
|
-
? 'dropset'
|
|
123
|
-
: 'normal';
|
|
124
|
-
return normalizedA === normalizedB;
|
|
125
|
-
};
|
|
126
|
-
exports.compareUserFacingSetIndicator = compareUserFacingSetIndicator;
|