@trainheroic-unofficial/js 1.5.0 → 1.6.0
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/README.md +1 -1
- package/dist/index.d.mts +42 -1
- package/dist/index.mjs +79 -16
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @trainheroic-unofficial/js
|
|
2
2
|
|
|
3
|
-
An unofficial TypeScript SDK for the TrainHeroic
|
|
3
|
+
An unofficial TypeScript SDK for the TrainHeroic API. The client covers auth and
|
|
4
4
|
session renewal across both TrainHeroic hosts, a searchable exercise library, workout
|
|
5
5
|
encoding, and messaging. It runs in any modern JavaScript runtime, including Cloudflare
|
|
6
6
|
workerd.
|
package/dist/index.d.mts
CHANGED
|
@@ -93,6 +93,18 @@ declare function asExerciseList(body: unknown): Array<Record<string, unknown>>;
|
|
|
93
93
|
declare function isRecord(x: unknown): x is Record<string, unknown>;
|
|
94
94
|
/** A non-empty string, or null. Narrows a loosely-typed API field to a usable string. */
|
|
95
95
|
declare function str(v: unknown): string | null;
|
|
96
|
+
/**
|
|
97
|
+
* The display title of a saved-copy exercise row, preferring `exercise_title`, then `title`, then
|
|
98
|
+
* the given fallback. The saved-workout shape carries the title under either key depending on the
|
|
99
|
+
* endpoint, so this is the one place that reconciles them.
|
|
100
|
+
*/
|
|
101
|
+
declare function exerciseTitle(ex: Record<string, unknown>, fallback?: string): string;
|
|
102
|
+
/**
|
|
103
|
+
* True when a program-workout range item is a personal (athlete-created) session rather than a
|
|
104
|
+
* coach-scheduled one. The API marks these with `personal_cal === true`; this is the single
|
|
105
|
+
* definition every consumer (presenter, find-or-create, the remove guard) reads through.
|
|
106
|
+
*/
|
|
107
|
+
declare function isPersonalSession(pw: unknown): boolean;
|
|
96
108
|
/**
|
|
97
109
|
* Rank candidate rows for a free-text query (FTS5 replacement). Higher is better:
|
|
98
110
|
* exact title, then prefix, then count of matched tokens, with shorter titles and
|
|
@@ -481,6 +493,18 @@ type AddedExercise = {
|
|
|
481
493
|
* logAthleteSet.
|
|
482
494
|
*/
|
|
483
495
|
declare function addExercisesToWorkout(client: TrainHeroicClient, workoutId: number, exercises: AddedExercise[]): Promise<unknown>;
|
|
496
|
+
/**
|
|
497
|
+
* DELETE /v5/programWorkouts/{programWorkoutId} — remove a personal (athlete-created) workout
|
|
498
|
+
* session from the athlete's own calendar. Re-reads the day and removes ONLY a personal session
|
|
499
|
+
* (`personal_cal`): it throws if no workout with that id is on the date, or if the target is a
|
|
500
|
+
* coach-scheduled workout (which is not the athlete's to delete). This guard lives here, at the
|
|
501
|
+
* delete itself, so no caller can issue the DELETE against a coach workout by skipping a check.
|
|
502
|
+
* Throws on a non-ok response.
|
|
503
|
+
*/
|
|
504
|
+
declare function removePersonalWorkout(client: TrainHeroicClient, args: {
|
|
505
|
+
programWorkoutId: number;
|
|
506
|
+
date: string;
|
|
507
|
+
}): Promise<void>;
|
|
484
508
|
/** One exercise's entered sets, keyed by the exercise id rather than a saved-set id. */
|
|
485
509
|
type SessionExercise = {
|
|
486
510
|
exerciseId: number;
|
|
@@ -490,6 +514,16 @@ type SessionExercise = {
|
|
|
490
514
|
param2?: number | string;
|
|
491
515
|
}>;
|
|
492
516
|
};
|
|
517
|
+
/** A coach-scheduled prescription on the same day that matches an exercise the athlete just logged
|
|
518
|
+
* ad-hoc. Surfaced as a hint that {@link logAthleteSet} could log into the scheduled workout. */
|
|
519
|
+
type ScheduledAlternative = {
|
|
520
|
+
exerciseId: number;
|
|
521
|
+
title: string;
|
|
522
|
+
program: string | null;
|
|
523
|
+
workoutTitle: string;
|
|
524
|
+
savedWorkoutSetId: number;
|
|
525
|
+
savedWorkoutSetExerciseId: number;
|
|
526
|
+
};
|
|
493
527
|
/** Result of logging a session by exercise: which sets were written, and (athlete) whether a
|
|
494
528
|
* new personal session had to be created for the date. */
|
|
495
529
|
type LogSessionResult = {
|
|
@@ -499,6 +533,13 @@ type LogSessionResult = {
|
|
|
499
533
|
savedWorkoutSetId: number;
|
|
500
534
|
exercisesLogged: number;
|
|
501
535
|
}>;
|
|
536
|
+
/**
|
|
537
|
+
* Coach-scheduled prescriptions that day matching a logged exercise (athlete path only). Present
|
|
538
|
+
* only when non-empty — a hint that the same lift was already on the athlete's scheduled workout,
|
|
539
|
+
* so {@link logAthleteSet} (athlete_log_set) could have logged into it instead of a personal
|
|
540
|
+
* session. The ad-hoc log still happened; this does not redirect it.
|
|
541
|
+
*/
|
|
542
|
+
scheduledAlternatives?: ScheduledAlternative[];
|
|
502
543
|
};
|
|
503
544
|
/**
|
|
504
545
|
* Log a whole session for the logged-in athlete by exercise, with no pre-existing prescription
|
|
@@ -798,4 +839,4 @@ declare class ExerciseLibrary implements ExerciseIndex {
|
|
|
798
839
|
stats(): Promise<Record<string, unknown>>;
|
|
799
840
|
}
|
|
800
841
|
//#endregion
|
|
801
|
-
export { ANALYTICS_METRIC_KEYS, AddedExercise, AnalyticsMetric, AnalyticsQueryArgs, ApiBase, AthleteMainLiftPRs, BuildOptions, ClientResult, CoachRosterAthlete, DEFAULT_INVITE_MESSAGE, ExerciseIndex, ExerciseLibrary, LEADERBOARD_LABEL, LEADERBOARD_TYPE, Leaderboard, LibraryCache, LibrarySnapshot, LogSessionResult, LogSetTarget, MAIN_LIFT_FAMILIES, MAX_PARAM_SLOTS, MainLiftFamily, MainLiftFamilyKey, MainLiftPR, MainLiftResolution, MemoryLibraryCache, PARAM_NONE, PARAM_PCT_MAX, PARAM_REPS, PARAM_RPE, PARAM_UNIT, PARAM_WEIGHT, PersonalWorkoutCreated, RequestOptions, ResolvedLift, SessionExercise, SetResult, SetWriteMode, SwapExerciseResult, TrainHeroicAuthError, TrainHeroicClient, TrainHeroicSession, addExercisesToWorkout, analyticsMetricCatalog, asExerciseList, buildBlockPayload, buildCommentPayload, buildExerciseSetPayload, buildSearchText, buildSession, buildSetCompletePayload, checkResponse, chunk, classifyMainLift, coerceInt, coerceNum, collectAdvisories, copySession, createPersonalWorkout, definedProps, deleteComment, exerciseUnits, fetchAthleteMainLiftPRs, fetchAthletePrefs, fetchAthleteProfileSummary, fetchAthleteUser, fetchAthleteWorkouts, fetchCoachAthleteCalendarSummary, fetchCoachAthleteWorkouts, fetchCoachRoster, fetchExerciseHistoryDetail, fetchExerciseHistoryList, fetchExerciseStats, fetchLeaderboard, fetchPersonalRecords, fetchRosterActivity, fetchRosterMainLiftPRs, fetchStreams, fetchTeamAthleteIds, fetchWorkingMaxes, findSavedWorkoutSet, inviteAthletes, isRecord, logAdHocSession, logAthleteSet, logForAthlete, logSessionForAthlete, loginTrainHeroic, makeExercise, mapPool, prescribeForAthlete, presentAthleteWorkout, presentAthleteWorkouts, presentCoachAthleteTraining, presentExercise, presentExerciseHistory, presentLogTargets, publishSession, queryAnalytics, rankSearch, readLive, readSession, removeSession, repsList, resolveAthleteMainLifts, resolveAthleteUserId, resolveLeaderboard, searchExerciseHistory, selectWorkouts, selectWorkoutsByProgram, sendComment, setSessionInstruction, sortRosterByRecency, str, summarizeAthleteWorkouts, swapAthleteExercise, teamVolume, toSetResults, unitAdvisory, unitLabel, unwrapEnvelope, withUnits };
|
|
842
|
+
export { ANALYTICS_METRIC_KEYS, AddedExercise, AnalyticsMetric, AnalyticsQueryArgs, ApiBase, AthleteMainLiftPRs, BuildOptions, ClientResult, CoachRosterAthlete, DEFAULT_INVITE_MESSAGE, ExerciseIndex, ExerciseLibrary, LEADERBOARD_LABEL, LEADERBOARD_TYPE, Leaderboard, LibraryCache, LibrarySnapshot, LogSessionResult, LogSetTarget, MAIN_LIFT_FAMILIES, MAX_PARAM_SLOTS, MainLiftFamily, MainLiftFamilyKey, MainLiftPR, MainLiftResolution, MemoryLibraryCache, PARAM_NONE, PARAM_PCT_MAX, PARAM_REPS, PARAM_RPE, PARAM_UNIT, PARAM_WEIGHT, PersonalWorkoutCreated, RequestOptions, ResolvedLift, ScheduledAlternative, SessionExercise, SetResult, SetWriteMode, SwapExerciseResult, TrainHeroicAuthError, TrainHeroicClient, TrainHeroicSession, addExercisesToWorkout, analyticsMetricCatalog, asExerciseList, buildBlockPayload, buildCommentPayload, buildExerciseSetPayload, buildSearchText, buildSession, buildSetCompletePayload, checkResponse, chunk, classifyMainLift, coerceInt, coerceNum, collectAdvisories, copySession, createPersonalWorkout, definedProps, deleteComment, exerciseTitle, exerciseUnits, fetchAthleteMainLiftPRs, fetchAthletePrefs, fetchAthleteProfileSummary, fetchAthleteUser, fetchAthleteWorkouts, fetchCoachAthleteCalendarSummary, fetchCoachAthleteWorkouts, fetchCoachRoster, fetchExerciseHistoryDetail, fetchExerciseHistoryList, fetchExerciseStats, fetchLeaderboard, fetchPersonalRecords, fetchRosterActivity, fetchRosterMainLiftPRs, fetchStreams, fetchTeamAthleteIds, fetchWorkingMaxes, findSavedWorkoutSet, inviteAthletes, isPersonalSession, isRecord, logAdHocSession, logAthleteSet, logForAthlete, logSessionForAthlete, loginTrainHeroic, makeExercise, mapPool, prescribeForAthlete, presentAthleteWorkout, presentAthleteWorkouts, presentCoachAthleteTraining, presentExercise, presentExerciseHistory, presentLogTargets, publishSession, queryAnalytics, rankSearch, readLive, readSession, removePersonalWorkout, removeSession, repsList, resolveAthleteMainLifts, resolveAthleteUserId, resolveLeaderboard, searchExerciseHistory, selectWorkouts, selectWorkoutsByProgram, sendComment, setSessionInstruction, sortRosterByRecency, str, summarizeAthleteWorkouts, swapAthleteExercise, teamVolume, toSetResults, unitAdvisory, unitLabel, unwrapEnvelope, withUnits };
|
package/dist/index.mjs
CHANGED
|
@@ -278,6 +278,22 @@ function str(v) {
|
|
|
278
278
|
return typeof v === "string" && v !== "" ? v : null;
|
|
279
279
|
}
|
|
280
280
|
/**
|
|
281
|
+
* The display title of a saved-copy exercise row, preferring `exercise_title`, then `title`, then
|
|
282
|
+
* the given fallback. The saved-workout shape carries the title under either key depending on the
|
|
283
|
+
* endpoint, so this is the one place that reconciles them.
|
|
284
|
+
*/
|
|
285
|
+
function exerciseTitle(ex, fallback = "") {
|
|
286
|
+
return typeof ex.exercise_title === "string" && ex.exercise_title || typeof ex.title === "string" && ex.title || fallback;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* True when a program-workout range item is a personal (athlete-created) session rather than a
|
|
290
|
+
* coach-scheduled one. The API marks these with `personal_cal === true`; this is the single
|
|
291
|
+
* definition every consumer (presenter, find-or-create, the remove guard) reads through.
|
|
292
|
+
*/
|
|
293
|
+
function isPersonalSession(pw) {
|
|
294
|
+
return isRecord(pw) && pw.personal_cal === true;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
281
297
|
* Rank candidate rows for a free-text query (FTS5 replacement). Higher is better:
|
|
282
298
|
* exact title, then prefix, then count of matched tokens, with shorter titles and
|
|
283
299
|
* standard (non-custom) exercises preferred on ties.
|
|
@@ -616,6 +632,7 @@ function presentAthleteWorkout(raw) {
|
|
|
616
632
|
team: str(rec.team_title),
|
|
617
633
|
instruction: str(workout.instruction),
|
|
618
634
|
logged: blocks.some((b) => b.exercises.some((e) => e.performed.length > 0)),
|
|
635
|
+
personal: isPersonalSession(rec),
|
|
619
636
|
blocks
|
|
620
637
|
};
|
|
621
638
|
}
|
|
@@ -676,7 +693,7 @@ function presentLogTargets(list) {
|
|
|
676
693
|
if (id === null) return null;
|
|
677
694
|
return {
|
|
678
695
|
savedWorkoutSetExerciseId: id,
|
|
679
|
-
title:
|
|
696
|
+
title: exerciseTitle(ex),
|
|
680
697
|
units: exerciseUnits(ex.param_1_type, ex.param_2_type),
|
|
681
698
|
prescribed: prescribedSets(ex),
|
|
682
699
|
performed: performedSets(ex)
|
|
@@ -725,6 +742,7 @@ function summarizeAthleteWorkouts(list) {
|
|
|
725
742
|
program: w.program,
|
|
726
743
|
team: w.team,
|
|
727
744
|
logged: w.logged,
|
|
745
|
+
personal: w.personal,
|
|
728
746
|
exerciseCount,
|
|
729
747
|
performedCount
|
|
730
748
|
};
|
|
@@ -951,8 +969,7 @@ function findSavedWorkoutSet(workouts, savedWorkoutSetId) {
|
|
|
951
969
|
if (setId !== null) {
|
|
952
970
|
const exLabels = exercises.map((ex) => {
|
|
953
971
|
const exId = coerceInt(ex.id);
|
|
954
|
-
|
|
955
|
-
return exId === null ? null : `${exId} (${title})`;
|
|
972
|
+
return exId === null ? null : `${exId} (${exerciseTitle(ex, "exercise")})`;
|
|
956
973
|
}).filter((x) => x !== null);
|
|
957
974
|
available.push(`set ${setId} → exercise ids: ${exLabels.join(", ") || "none"}`);
|
|
958
975
|
}
|
|
@@ -1129,8 +1146,7 @@ async function writeSetResults(client, target, workouts, savedWorkoutSetId, resu
|
|
|
1129
1146
|
if (!ex) {
|
|
1130
1147
|
const valid = exercises.map((e) => {
|
|
1131
1148
|
const id = coerceInt(e.id);
|
|
1132
|
-
|
|
1133
|
-
return id === null ? null : `${id} (${title})`;
|
|
1149
|
+
return id === null ? null : `${id} (${exerciseTitle(e, "exercise")})`;
|
|
1134
1150
|
}).filter((x) => x !== null);
|
|
1135
1151
|
throw new Error(`savedWorkoutSetExerciseId ${result.savedWorkoutSetExerciseId} not found in saved workout set ${savedWorkoutSetId}. Exercises in this set: ${valid.join(", ") || "none"}.`);
|
|
1136
1152
|
}
|
|
@@ -1205,17 +1221,30 @@ async function addExercisesToWorkout(client, workoutId, exercises) {
|
|
|
1205
1221
|
return res.data;
|
|
1206
1222
|
}
|
|
1207
1223
|
/**
|
|
1224
|
+
* DELETE /v5/programWorkouts/{programWorkoutId} — remove a personal (athlete-created) workout
|
|
1225
|
+
* session from the athlete's own calendar. Re-reads the day and removes ONLY a personal session
|
|
1226
|
+
* (`personal_cal`): it throws if no workout with that id is on the date, or if the target is a
|
|
1227
|
+
* coach-scheduled workout (which is not the athlete's to delete). This guard lives here, at the
|
|
1228
|
+
* delete itself, so no caller can issue the DELETE against a coach workout by skipping a check.
|
|
1229
|
+
* Throws on a non-ok response.
|
|
1230
|
+
*/
|
|
1231
|
+
async function removePersonalWorkout(client, args) {
|
|
1232
|
+
const target = (await fetchAthleteWorkouts(client, args.date, args.date)).find((pw) => coerceInt(pw.id) === args.programWorkoutId);
|
|
1233
|
+
if (target === void 0) throw new Error(`No workout with id ${args.programWorkoutId} on ${args.date}. Get the id and date from athlete_workouts.`);
|
|
1234
|
+
if (!isPersonalSession(target)) throw new Error(`Workout ${args.programWorkoutId} on ${args.date} is a coach-scheduled workout, not a personal session, so it can't be removed. To change logged results on a scheduled workout, use athlete_log_set.`);
|
|
1235
|
+
const res = await client.request("DELETE", `/v5/programWorkouts/${args.programWorkoutId}`);
|
|
1236
|
+
if (!res.ok) throw new Error(`Remove personal workout failed (HTTP ${res.status}).`);
|
|
1237
|
+
}
|
|
1238
|
+
/**
|
|
1208
1239
|
* Find a personal-calendar session already on the given day. The range marks these with
|
|
1209
1240
|
* `personal_cal === true`; the addable id is the program workout's `workout_id`. Returns the
|
|
1210
1241
|
* first one's workoutId, or null when the day has no personal session.
|
|
1211
1242
|
*/
|
|
1212
1243
|
function findPersonalSessionWorkoutId(workouts) {
|
|
1213
1244
|
for (const pw of workouts) {
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
if (workoutId !== null) return workoutId;
|
|
1218
|
-
}
|
|
1245
|
+
if (!isPersonalSession(pw)) continue;
|
|
1246
|
+
const workoutId = coerceInt(pw.workout_id);
|
|
1247
|
+
if (workoutId !== null) return workoutId;
|
|
1219
1248
|
}
|
|
1220
1249
|
return null;
|
|
1221
1250
|
}
|
|
@@ -1246,7 +1275,11 @@ function indexAddedExercises(added) {
|
|
|
1246
1275
|
}
|
|
1247
1276
|
return out;
|
|
1248
1277
|
}
|
|
1249
|
-
/**
|
|
1278
|
+
/**
|
|
1279
|
+
* Flatten a day's saved sets into `{ pw, savedWorkoutSetId, ex }` rows (both saved-set keys),
|
|
1280
|
+
* carrying the parent program-workout so a caller can read its identity (`personal_cal`, program
|
|
1281
|
+
* title) without re-walking. The one saved-copy traversal the by-exercise paths share.
|
|
1282
|
+
*/
|
|
1250
1283
|
function eachPrescribedExercise(workouts) {
|
|
1251
1284
|
const rows = [];
|
|
1252
1285
|
for (const pw of workouts) {
|
|
@@ -1261,6 +1294,7 @@ function eachPrescribedExercise(workouts) {
|
|
|
1261
1294
|
if (savedWorkoutSetId === null) continue;
|
|
1262
1295
|
const exercises = Array.isArray(s.workoutSetExercises) ? s.workoutSetExercises : [];
|
|
1263
1296
|
for (const ex of exercises) if (isRecord(ex)) rows.push({
|
|
1297
|
+
pw: rec,
|
|
1264
1298
|
savedWorkoutSetId,
|
|
1265
1299
|
ex
|
|
1266
1300
|
});
|
|
@@ -1285,14 +1319,39 @@ function findPrescribedExercise(workouts, exerciseId, used) {
|
|
|
1285
1319
|
}
|
|
1286
1320
|
return null;
|
|
1287
1321
|
}
|
|
1322
|
+
/**
|
|
1323
|
+
* Find prescribed exercises on coach-scheduled (non-personal) workouts that day matching any of the
|
|
1324
|
+
* given exercise ids. Used to warn after an ad-hoc log that the same lift was already on the
|
|
1325
|
+
* athlete's scheduled workout — a caller can then point at {@link logAthleteSet}. Personal sessions
|
|
1326
|
+
* (`personal_cal === true`) are skipped: the ad-hoc log itself lands there, so they are not an
|
|
1327
|
+
* alternative. One row per matching saved-set exercise, dropping any with an unresolvable id.
|
|
1328
|
+
*/
|
|
1329
|
+
function findScheduledMatches(workouts, exerciseIds) {
|
|
1330
|
+
const out = [];
|
|
1331
|
+
for (const { pw, savedWorkoutSetId, ex } of eachPrescribedExercise(workouts)) {
|
|
1332
|
+
if (isPersonalSession(pw)) continue;
|
|
1333
|
+
const exerciseId = coerceInt(ex.exercise_id);
|
|
1334
|
+
const savedWorkoutSetExerciseId = coerceInt(ex.id);
|
|
1335
|
+
if (exerciseId === null || savedWorkoutSetExerciseId === null) continue;
|
|
1336
|
+
if (!exerciseIds.has(exerciseId)) continue;
|
|
1337
|
+
out.push({
|
|
1338
|
+
exerciseId,
|
|
1339
|
+
title: exerciseTitle(ex),
|
|
1340
|
+
program: str(pw.program_title),
|
|
1341
|
+
workoutTitle: str(pw.workout_title) ?? "",
|
|
1342
|
+
savedWorkoutSetId,
|
|
1343
|
+
savedWorkoutSetExerciseId
|
|
1344
|
+
});
|
|
1345
|
+
}
|
|
1346
|
+
return out;
|
|
1347
|
+
}
|
|
1288
1348
|
/** List the prescribed exercises on a day as `id (title)` labels, for not-found errors. */
|
|
1289
1349
|
function prescribedExerciseLabels(workouts) {
|
|
1290
1350
|
const labels = [];
|
|
1291
1351
|
for (const { ex } of eachPrescribedExercise(workouts)) {
|
|
1292
1352
|
const id = coerceInt(ex.exercise_id);
|
|
1293
1353
|
if (id === null) continue;
|
|
1294
|
-
|
|
1295
|
-
labels.push(`${id} (${title})`);
|
|
1354
|
+
labels.push(`${id} (${exerciseTitle(ex, "exercise")})`);
|
|
1296
1355
|
}
|
|
1297
1356
|
return labels;
|
|
1298
1357
|
}
|
|
@@ -1335,7 +1394,8 @@ async function logResolvedExercises(client, target, date, resolved) {
|
|
|
1335
1394
|
*/
|
|
1336
1395
|
async function logAdHocSession(client, args) {
|
|
1337
1396
|
if (args.exercises.length === 0) throw new Error("Provide at least one exercise to log.");
|
|
1338
|
-
const
|
|
1397
|
+
const day = await fetchAthleteWorkouts(client, args.date, args.date);
|
|
1398
|
+
const existing = findPersonalSessionWorkoutId(day);
|
|
1339
1399
|
const created = existing === null;
|
|
1340
1400
|
const workoutId = existing ?? (await createPersonalWorkout(client, args.date)).workoutId;
|
|
1341
1401
|
const withOrder = args.exercises.map((e, i) => ({
|
|
@@ -1359,11 +1419,14 @@ async function logAdHocSession(client, args) {
|
|
|
1359
1419
|
};
|
|
1360
1420
|
});
|
|
1361
1421
|
const sets = await logResolvedExercises(client, { role: "athlete" }, args.date, resolved);
|
|
1362
|
-
|
|
1422
|
+
const result = {
|
|
1363
1423
|
date: args.date,
|
|
1364
1424
|
created,
|
|
1365
1425
|
sets
|
|
1366
1426
|
};
|
|
1427
|
+
const scheduledAlternatives = findScheduledMatches(day, new Set(args.exercises.map((e) => e.exerciseId)));
|
|
1428
|
+
if (scheduledAlternatives.length > 0) result.scheduledAlternatives = scheduledAlternatives;
|
|
1429
|
+
return result;
|
|
1367
1430
|
}
|
|
1368
1431
|
/**
|
|
1369
1432
|
* Coach "log a session for a roster athlete" by exercise. The API offers no way to put an
|
|
@@ -2506,4 +2569,4 @@ var ExerciseLibrary = class {
|
|
|
2506
2569
|
}
|
|
2507
2570
|
};
|
|
2508
2571
|
//#endregion
|
|
2509
|
-
export { ANALYTICS_METRIC_KEYS, DEFAULT_INVITE_MESSAGE, ExerciseLibrary, LEADERBOARD_LABEL, LEADERBOARD_TYPE, MAIN_LIFT_FAMILIES, MAX_PARAM_SLOTS, MemoryLibraryCache, PARAM_NONE, PARAM_PCT_MAX, PARAM_REPS, PARAM_RPE, PARAM_UNIT, PARAM_WEIGHT, TrainHeroicAuthError, TrainHeroicClient, addExercisesToWorkout, analyticsMetricCatalog, asExerciseList, buildBlockPayload, buildCommentPayload, buildExerciseSetPayload, buildSearchText, buildSession, buildSetCompletePayload, checkResponse, chunk, classifyMainLift, coerceInt, coerceNum, collectAdvisories, copySession, createPersonalWorkout, definedProps, deleteComment, exerciseUnits, fetchAthleteMainLiftPRs, fetchAthletePrefs, fetchAthleteProfileSummary, fetchAthleteUser, fetchAthleteWorkouts, fetchCoachAthleteCalendarSummary, fetchCoachAthleteWorkouts, fetchCoachRoster, fetchExerciseHistoryDetail, fetchExerciseHistoryList, fetchExerciseStats, fetchLeaderboard, fetchPersonalRecords, fetchRosterActivity, fetchRosterMainLiftPRs, fetchStreams, fetchTeamAthleteIds, fetchWorkingMaxes, findSavedWorkoutSet, inviteAthletes, isRecord, logAdHocSession, logAthleteSet, logForAthlete, logSessionForAthlete, loginTrainHeroic, makeExercise, mapPool, prescribeForAthlete, presentAthleteWorkout, presentAthleteWorkouts, presentCoachAthleteTraining, presentExercise, presentExerciseHistory, presentLogTargets, publishSession, queryAnalytics, rankSearch, readLive, readSession, removeSession, repsList, resolveAthleteMainLifts, resolveAthleteUserId, resolveLeaderboard, searchExerciseHistory, selectWorkouts, selectWorkoutsByProgram, sendComment, setSessionInstruction, sortRosterByRecency, str, summarizeAthleteWorkouts, swapAthleteExercise, teamVolume, toSetResults, unitAdvisory, unitLabel, unwrapEnvelope, withUnits };
|
|
2572
|
+
export { ANALYTICS_METRIC_KEYS, DEFAULT_INVITE_MESSAGE, ExerciseLibrary, LEADERBOARD_LABEL, LEADERBOARD_TYPE, MAIN_LIFT_FAMILIES, MAX_PARAM_SLOTS, MemoryLibraryCache, PARAM_NONE, PARAM_PCT_MAX, PARAM_REPS, PARAM_RPE, PARAM_UNIT, PARAM_WEIGHT, TrainHeroicAuthError, TrainHeroicClient, addExercisesToWorkout, analyticsMetricCatalog, asExerciseList, buildBlockPayload, buildCommentPayload, buildExerciseSetPayload, buildSearchText, buildSession, buildSetCompletePayload, checkResponse, chunk, classifyMainLift, coerceInt, coerceNum, collectAdvisories, copySession, createPersonalWorkout, definedProps, deleteComment, exerciseTitle, exerciseUnits, fetchAthleteMainLiftPRs, fetchAthletePrefs, fetchAthleteProfileSummary, fetchAthleteUser, fetchAthleteWorkouts, fetchCoachAthleteCalendarSummary, fetchCoachAthleteWorkouts, fetchCoachRoster, fetchExerciseHistoryDetail, fetchExerciseHistoryList, fetchExerciseStats, fetchLeaderboard, fetchPersonalRecords, fetchRosterActivity, fetchRosterMainLiftPRs, fetchStreams, fetchTeamAthleteIds, fetchWorkingMaxes, findSavedWorkoutSet, inviteAthletes, isPersonalSession, isRecord, logAdHocSession, logAthleteSet, logForAthlete, logSessionForAthlete, loginTrainHeroic, makeExercise, mapPool, prescribeForAthlete, presentAthleteWorkout, presentAthleteWorkouts, presentCoachAthleteTraining, presentExercise, presentExerciseHistory, presentLogTargets, publishSession, queryAnalytics, rankSearch, readLive, readSession, removePersonalWorkout, removeSession, repsList, resolveAthleteMainLifts, resolveAthleteUserId, resolveLeaderboard, searchExerciseHistory, selectWorkouts, selectWorkoutsByProgram, sendComment, setSessionInstruction, sortRosterByRecency, str, summarizeAthleteWorkouts, swapAthleteExercise, teamVolume, toSetResults, unitAdvisory, unitLabel, unwrapEnvelope, withUnits };
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trainheroic-unofficial/js",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/alandotcom/trainheroic-unofficial.git",
|
|
8
8
|
"directory": "packages/js"
|
|
9
9
|
},
|
|
10
|
-
"description": "Unofficial TypeScript SDK for the TrainHeroic
|
|
10
|
+
"description": "Unofficial TypeScript SDK for the TrainHeroic API.",
|
|
11
11
|
"type": "module",
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"zod": "^4.4.3",
|
|
30
|
-
"@trainheroic-unofficial/dto": "1.
|
|
30
|
+
"@trainheroic-unofficial/dto": "1.6.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "^26.0.0",
|