@trainheroic-unofficial/js 3.7.2 → 4.1.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 +25 -10
- package/dist/index.d.mts +12 -5
- package/dist/index.mjs +83 -10
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -221,19 +221,31 @@ import { buildSession, type BlockSpec } from "@trainheroic-unofficial/js";
|
|
|
221
221
|
|
|
222
222
|
const { match } = await library.resolve("Back Squat");
|
|
223
223
|
if (!match) throw new Error("Resolve to a single exercise before building.");
|
|
224
|
+
if (match.units[0] !== "reps" || match.units[1] !== "lb") {
|
|
225
|
+
throw new Error("Choose an exercise with reps and pounds as its fixed units.");
|
|
226
|
+
}
|
|
224
227
|
|
|
225
228
|
const blocks: BlockSpec[] = [
|
|
226
229
|
{
|
|
227
230
|
title: "Strength",
|
|
228
231
|
exercises: [
|
|
229
232
|
// sets/reps/weight scalars; rpe is routed into the instruction text (see the encoder).
|
|
230
|
-
{
|
|
233
|
+
{
|
|
234
|
+
id: match.id,
|
|
235
|
+
sets: 5,
|
|
236
|
+
reps: 5,
|
|
237
|
+
primaryUnit: "reps",
|
|
238
|
+
weight: 225,
|
|
239
|
+
secondaryUnit: "lb",
|
|
240
|
+
rpe: 8,
|
|
241
|
+
},
|
|
231
242
|
],
|
|
232
243
|
},
|
|
233
244
|
];
|
|
234
245
|
|
|
235
246
|
const { pwId, workoutId } = await buildSession(client, {
|
|
236
247
|
programId: 12345,
|
|
248
|
+
index: library,
|
|
237
249
|
date: [2026, 6, 22], // [year, month, day]; month is 1-based, so 6 = June
|
|
238
250
|
blocks,
|
|
239
251
|
instruction: "Warm up first.",
|
|
@@ -243,11 +255,12 @@ const { pwId, workoutId } = await buildSession(client, {
|
|
|
243
255
|
|
|
244
256
|
Each exercise needs an `id`; `sets`, `reps`, `weight`, `rpe`, and a per-exercise `instr` are
|
|
245
257
|
optional. `reps` and `weight` take a scalar (broadcast across every set) or a per-set array
|
|
246
|
-
like `reps: [5, 5, 3]`.
|
|
247
|
-
|
|
248
|
-
|
|
258
|
+
like `reps: [5, 5, 3]`. State `primaryUnit` for `reps` and `secondaryUnit` for `weight`.
|
|
259
|
+
The full field list is `ExerciseSpec` / `BlockSpec` in
|
|
260
|
+
[`@trainheroic-unofficial/dto`](../dto). `buildSession` checks those units against the
|
|
261
|
+
exercise library and rejects a mismatch before writing.
|
|
249
262
|
|
|
250
|
-
`buildSession` returns `{ pwId, workoutId }`: `pwId` is the program-workout id (the
|
|
263
|
+
`buildSession` returns `{ pwId, workoutId, advisories }`: `pwId` is the program-workout id (the
|
|
251
264
|
placement of the session in the program, which is the handle subsequent calls take), and
|
|
252
265
|
`workoutId` is the underlying workout id. Use `pwId` with `readSession(client, programId, date, pwId)`
|
|
253
266
|
to read the session back. `publishSession(client, pwId)` publishes it later;
|
|
@@ -298,15 +311,17 @@ console.log(analyticsMetricCatalog());
|
|
|
298
311
|
|
|
299
312
|
## The workout encoder
|
|
300
313
|
|
|
301
|
-
`buildSession` calls the encoder for you; you only deal with it directly to preview
|
|
314
|
+
`buildSession` calls the encoder for you; you only deal with it directly to preview values.
|
|
302
315
|
TrainHeroic's exercise payload expects every parameter slot present, so the encoder fills all
|
|
303
316
|
of them (empty slots included) to avoid an HTTP 500. A scalar prescription is broadcast across
|
|
304
317
|
the set count. RPE goes into the instruction text because the API coerces a numeric slot to
|
|
305
|
-
load.
|
|
306
|
-
|
|
318
|
+
load. Each populated slot in a spec states its intended unit. `collectAdvisories` rejects a
|
|
319
|
+
unit that differs from the exercise's fixed parameter type before a workout is written.
|
|
307
320
|
|
|
308
|
-
|
|
309
|
-
|
|
321
|
+
`buildSession` calls `collectAdvisories(blocks, index)` before its first write and returns
|
|
322
|
+
its non-blocking notes and warnings in `advisories`. Call `collectAdvisories` directly to
|
|
323
|
+
preview validation without writing a workout. Validation fetches current units from
|
|
324
|
+
TrainHeroic; an unavailable library response stops the build.
|
|
310
325
|
|
|
311
326
|
## Develop
|
|
312
327
|
|
package/dist/index.d.mts
CHANGED
|
@@ -222,6 +222,8 @@ export interface ExerciseIndex {
|
|
|
222
222
|
search(query: string, limit?: number): Promise<ExerciseView[]>;
|
|
223
223
|
get(id: number): Promise<Record<string, unknown> | null>;
|
|
224
224
|
defaultsMany(ids: readonly number[]): Promise<Map<number, ExerciseDefaults>>;
|
|
225
|
+
/** Fetch current units from TrainHeroic for a write, bypassing the search mirror's TTL. */
|
|
226
|
+
currentDefaultsMany(ids: readonly number[]): Promise<Map<number, ExerciseDefaults>>;
|
|
225
227
|
create(body: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
226
228
|
/** POST an update to a custom exercise on TrainHeroic, then refresh the mirror row. */
|
|
227
229
|
update(id: number, body: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
@@ -1069,7 +1071,7 @@ export declare const SESSION_TEMPLATES_LIST_PATH = "/1.0/coach/workouts?page=1&p
|
|
|
1069
1071
|
export declare function definedProps<T extends object>(obj: T): { [K in keyof T]: Exclude<T[K], undefined>; };
|
|
1070
1072
|
//#endregion
|
|
1071
1073
|
//#region src/workout-encode.d.ts
|
|
1072
|
-
type AdvisoryIndex = Pick<ExerciseIndex, "
|
|
1074
|
+
type AdvisoryIndex = Pick<ExerciseIndex, "currentDefaultsMany">;
|
|
1073
1075
|
export type SetSplit = {
|
|
1074
1076
|
blockTitle: string;
|
|
1075
1077
|
exerciseTitle: string;
|
|
@@ -1113,10 +1115,9 @@ export declare function unitAdvisory(blockTitle: string, ex: ExerciseSpec, defau
|
|
|
1113
1115
|
param2: number | null;
|
|
1114
1116
|
}): Advisory;
|
|
1115
1117
|
/**
|
|
1116
|
-
*
|
|
1117
|
-
*
|
|
1118
|
-
*
|
|
1119
|
-
* advisory is silently dropped.
|
|
1118
|
+
* Validate every populated value's stated unit against current TrainHeroic exercise data,
|
|
1119
|
+
* then collect non-blocking advisories. The write path calls this before creating a workout;
|
|
1120
|
+
* TrainHeroic silently replaces mismatched types.
|
|
1120
1121
|
*/
|
|
1121
1122
|
export declare function collectAdvisories(blocks: readonly BlockSpec[], index: AdvisoryIndex): Promise<Advisory>;
|
|
1122
1123
|
//#endregion
|
|
@@ -1124,6 +1125,8 @@ export declare function collectAdvisories(blocks: readonly BlockSpec[], index: A
|
|
|
1124
1125
|
export type BuildOptions = {
|
|
1125
1126
|
programId: number;
|
|
1126
1127
|
blocks: BlockSpec[];
|
|
1128
|
+
/** Exercise library used to validate every populated slot before the first write. */
|
|
1129
|
+
index: Pick<ExerciseIndex, "currentDefaultsMany">;
|
|
1127
1130
|
date?: WorkoutDate;
|
|
1128
1131
|
timelineDay?: number;
|
|
1129
1132
|
publish?: boolean;
|
|
@@ -1141,6 +1144,7 @@ export declare function calendarWriteError(method: string, path: string, status:
|
|
|
1141
1144
|
export declare function buildSession(client: TrainHeroicClient, opts: BuildOptions): Promise<{
|
|
1142
1145
|
pwId: number;
|
|
1143
1146
|
workoutId: number;
|
|
1147
|
+
advisories: Advisory;
|
|
1144
1148
|
}>;
|
|
1145
1149
|
/**
|
|
1146
1150
|
* Set a session's Coach Instructions (the day-note at the top of a session). `pw` is the
|
|
@@ -1169,6 +1173,8 @@ export declare function deleteComment(client: TrainHeroicClient, streamId: numbe
|
|
|
1169
1173
|
export declare function readLive(client: TrainHeroicClient, streamId: number, limit?: number, afterCommentId?: number): Promise<unknown[]>;
|
|
1170
1174
|
//#endregion
|
|
1171
1175
|
//#region src/exercise-index.d.ts
|
|
1176
|
+
/** Read current parameter types without refreshing or trusting the search mirror. */
|
|
1177
|
+
export declare function fetchCurrentExerciseDefaults(client: TrainHeroicClient, ids: readonly number[]): Promise<Map<number, ExerciseDefaults>>;
|
|
1172
1178
|
/**
|
|
1173
1179
|
* The exercise library held in memory for fast queries and persisted through a
|
|
1174
1180
|
* LibraryCache (JSON file for a CLI/local server, in-memory by default). Same
|
|
@@ -1181,6 +1187,7 @@ export declare class ExerciseLibrary implements ExerciseIndex {
|
|
|
1181
1187
|
refresh(): Promise<Record<string, unknown>>;
|
|
1182
1188
|
get(id: number): Promise<Record<string, unknown> | null>;
|
|
1183
1189
|
defaultsMany(ids: readonly number[]): Promise<Map<number, ExerciseDefaults>>;
|
|
1190
|
+
currentDefaultsMany(ids: readonly number[]): Promise<Map<number, ExerciseDefaults>>;
|
|
1184
1191
|
search(query: string, limit?: number): Promise<ExerciseView[]>;
|
|
1185
1192
|
resolve(name: string): Promise<ResolveResult>;
|
|
1186
1193
|
create(body: Record<string, unknown>): Promise<Record<string, unknown>>;
|
package/dist/index.mjs
CHANGED
|
@@ -2649,6 +2649,56 @@ function buildBlockPayload(blocks, workoutId) {
|
|
|
2649
2649
|
function unitOr(t) {
|
|
2650
2650
|
return unitLabel(t) ?? "?";
|
|
2651
2651
|
}
|
|
2652
|
+
const UNIT_ALIASES = {
|
|
2653
|
+
rep: "reps",
|
|
2654
|
+
reps: "reps",
|
|
2655
|
+
lb: "lb",
|
|
2656
|
+
lbs: "lb",
|
|
2657
|
+
pound: "lb",
|
|
2658
|
+
pounds: "lb",
|
|
2659
|
+
sec: "sec",
|
|
2660
|
+
second: "sec",
|
|
2661
|
+
seconds: "sec",
|
|
2662
|
+
s: "sec",
|
|
2663
|
+
yd: "yd",
|
|
2664
|
+
yard: "yd",
|
|
2665
|
+
yards: "yd",
|
|
2666
|
+
m: "m",
|
|
2667
|
+
meter: "m",
|
|
2668
|
+
meters: "m",
|
|
2669
|
+
metre: "m",
|
|
2670
|
+
metres: "m",
|
|
2671
|
+
mi: "mi",
|
|
2672
|
+
mile: "mi",
|
|
2673
|
+
miles: "mi",
|
|
2674
|
+
ft: "ft",
|
|
2675
|
+
foot: "ft",
|
|
2676
|
+
feet: "ft",
|
|
2677
|
+
in: "in",
|
|
2678
|
+
inch: "in",
|
|
2679
|
+
inches: "in",
|
|
2680
|
+
bpm: "bpm",
|
|
2681
|
+
rpe: "RPE",
|
|
2682
|
+
"%max": "%max"
|
|
2683
|
+
};
|
|
2684
|
+
function statedUnit(value, label) {
|
|
2685
|
+
const normalized = UNIT_ALIASES[value.trim().toLowerCase()];
|
|
2686
|
+
if (normalized === void 0) throw new Error(`${label}: unknown unit '${value}'. Use a concrete exercise unit such as reps, lb, sec, m, or mi.`);
|
|
2687
|
+
return normalized;
|
|
2688
|
+
}
|
|
2689
|
+
function validateSlotUnit(label, field, stated, paramType, fixedType, allowAddedWeight = false) {
|
|
2690
|
+
if (stated === void 0) throw new Error(`${label}: ${field} is required for this value.`);
|
|
2691
|
+
const intended = statedUnit(stated, `${label} / ${field}`);
|
|
2692
|
+
const fixed = unitLabel(fixedType);
|
|
2693
|
+
if (intended !== fixed && !(allowAddedWeight && (fixedType === 0 || fixedType === null) && intended === "lb")) throw new Error(`${label}: ${field} ${intended} does not match the exercise's fixed ${fixed ?? "unset"} unit. Choose an exercise with the requested unit before building.`);
|
|
2694
|
+
if (paramType !== void 0 && unitLabel(paramType) !== intended) throw new Error(`${label}: ${field} ${intended} conflicts with param type ${paramType} (${unitLabel(paramType) ?? "unset"}).`);
|
|
2695
|
+
}
|
|
2696
|
+
/** Validate both populated slots against the library before any workout write. */
|
|
2697
|
+
function validateExerciseUnits(blockTitle, ex, defaults) {
|
|
2698
|
+
const label = `${blockTitle} / ${ex.title ?? ex.id}`;
|
|
2699
|
+
if (ex.reps !== void 0) validateSlotUnit(label, "primaryUnit", ex.primaryUnit, ex.param_1_type, defaults.param1);
|
|
2700
|
+
if (ex.weight !== void 0) validateSlotUnit(label, "secondaryUnit", ex.secondaryUnit, ex.param_2_type, defaults.param2, true);
|
|
2701
|
+
}
|
|
2652
2702
|
/** Flag spec params the API will silently override to the exercise's fixed units. */
|
|
2653
2703
|
function unitAdvisory(blockTitle, ex, defaults) {
|
|
2654
2704
|
const notes = [];
|
|
@@ -2662,8 +2712,8 @@ function unitAdvisory(blockTitle, ex, defaults) {
|
|
|
2662
2712
|
warnings.push(`${label}: param_1_type ${sentP1} (${u(sp1)}) is ignored — this exercise is fixed to ${u(defaults.param1)}; values render as ${u(defaults.param1)}.`);
|
|
2663
2713
|
} else if (defaults.param1 !== 3 && defaults.param1 !== null) notes.push(`${label}: values are in ${u(defaults.param1)} (the exercise's fixed primary unit).`);
|
|
2664
2714
|
if (ex.weight !== void 0 && ex.weight !== null) {
|
|
2665
|
-
const sentP2 = Math.trunc(Number(ex.param_2_type ?? 1));
|
|
2666
2715
|
const effP2 = defaults.param2 === 0 || defaults.param2 === null ? 1 : defaults.param2;
|
|
2716
|
+
const sentP2 = Math.trunc(Number(ex.param_2_type ?? effP2));
|
|
2667
2717
|
if (sentP2 !== effP2) {
|
|
2668
2718
|
if (sentP2 === 2 || sentP2 === 14) warnings.push(`${label}: ${u(sentP2)} does not stick on this exercise — it renders as ${u(effP2)}. Put it in the exercise 'instr' text and leave load blank.`);
|
|
2669
2719
|
else warnings.push(`${label}: load renders as ${u(effP2)}, not ${u(sentP2)} (this exercise's secondary unit is fixed).`);
|
|
@@ -2675,24 +2725,23 @@ function unitAdvisory(blockTitle, ex, defaults) {
|
|
|
2675
2725
|
};
|
|
2676
2726
|
}
|
|
2677
2727
|
/**
|
|
2678
|
-
*
|
|
2679
|
-
*
|
|
2680
|
-
*
|
|
2681
|
-
* advisory is silently dropped.
|
|
2728
|
+
* Validate every populated value's stated unit against current TrainHeroic exercise data,
|
|
2729
|
+
* then collect non-blocking advisories. The write path calls this before creating a workout;
|
|
2730
|
+
* TrainHeroic silently replaces mismatched types.
|
|
2682
2731
|
*/
|
|
2683
2732
|
async function collectAdvisories(blocks, index) {
|
|
2684
|
-
await index.ensureFresh();
|
|
2685
2733
|
const pairs = blocks.flatMap((b) => b.exercises.map((ex) => ({
|
|
2686
2734
|
block: b,
|
|
2687
2735
|
ex
|
|
2688
2736
|
})));
|
|
2689
2737
|
const ids = [...new Set(pairs.map((p) => Number(p.ex.id)).filter((id) => Number.isFinite(id)))];
|
|
2690
|
-
const defaultsById = await index.
|
|
2738
|
+
const defaultsById = await index.currentDefaultsMany(ids);
|
|
2691
2739
|
const notes = [];
|
|
2692
2740
|
const warnings = [];
|
|
2693
2741
|
pairs.forEach((p) => {
|
|
2694
2742
|
const def = defaultsById.get(Number(p.ex.id));
|
|
2695
|
-
if (!def)
|
|
2743
|
+
if (!def) throw new Error(`${p.block.title} / ${p.ex.title ?? p.ex.id}: exercise id ${p.ex.id} was not found in the library.`);
|
|
2744
|
+
validateExerciseUnits(p.block.title, p.ex, def);
|
|
2696
2745
|
const advisory = unitAdvisory(p.block.title, p.ex, def);
|
|
2697
2746
|
notes.push(...advisory.notes);
|
|
2698
2747
|
warnings.push(...advisory.warnings);
|
|
@@ -2733,6 +2782,7 @@ async function buildSession(client, opts) {
|
|
|
2733
2782
|
const validatedBlocks = z.array(blockSpecSchema).parse(opts.blocks);
|
|
2734
2783
|
const splitSummary = setSplitSummary(validatedBlocks);
|
|
2735
2784
|
if (splitSummary !== null && opts.confirmSetSplit !== true) throw new Error(`${splitSummary} Set confirmSetSplit:true to allow this change.`);
|
|
2785
|
+
const advisories = await collectAdvisories(validatedBlocks, opts.index);
|
|
2736
2786
|
const blocks = splitSummary === null ? validatedBlocks : splitOversizedBlocks(validatedBlocks);
|
|
2737
2787
|
const sess = await req(client, "POST", createPath(opts), {});
|
|
2738
2788
|
checkResponse(sessionCreateResponseSchema, sess, "session create");
|
|
@@ -2756,7 +2806,8 @@ async function buildSession(client, opts) {
|
|
|
2756
2806
|
if (opts.publish ?? false) await req(client, "POST", "/2.0/coach/calendar/programWorkout/publish", [pwId]);
|
|
2757
2807
|
return {
|
|
2758
2808
|
pwId,
|
|
2759
|
-
workoutId
|
|
2809
|
+
workoutId,
|
|
2810
|
+
advisories
|
|
2760
2811
|
};
|
|
2761
2812
|
}
|
|
2762
2813
|
/**
|
|
@@ -3652,6 +3703,25 @@ const CREATE_PATH = "/2.0/coach/exercise/create";
|
|
|
3652
3703
|
const UPDATE_PATH = (id) => `/2.0/coach/exercise/update/${id}`;
|
|
3653
3704
|
const DELETE_PATH = (id) => `/v5/exercises/${id}`;
|
|
3654
3705
|
const TTL_MS = 6048e5;
|
|
3706
|
+
/** Read current parameter types without refreshing or trusting the search mirror. */
|
|
3707
|
+
async function fetchCurrentExerciseDefaults(client, ids) {
|
|
3708
|
+
if (ids.length === 0) return /* @__PURE__ */ new Map();
|
|
3709
|
+
const res = await client.request("GET", LIBRARY_PATH);
|
|
3710
|
+
if (!res.ok) throw new Error(`Exercise library fetch failed (HTTP ${res.status}).`);
|
|
3711
|
+
const list = asExerciseList(res.data);
|
|
3712
|
+
if (list.length === 0) throw new Error("Exercise library returned no rows.");
|
|
3713
|
+
checkResponse(exerciseLibraryResponseSchema, list, "exercise library");
|
|
3714
|
+
const requested = new Set(ids);
|
|
3715
|
+
const defaults = /* @__PURE__ */ new Map();
|
|
3716
|
+
for (const exercise of list) {
|
|
3717
|
+
const id = coerceInt(exercise.id);
|
|
3718
|
+
if (id !== null && requested.has(id)) defaults.set(id, {
|
|
3719
|
+
param1: coerceInt(exercise.param_1_type),
|
|
3720
|
+
param2: coerceInt(exercise.param_2_type)
|
|
3721
|
+
});
|
|
3722
|
+
}
|
|
3723
|
+
return defaults;
|
|
3724
|
+
}
|
|
3655
3725
|
function toStored(ex) {
|
|
3656
3726
|
const id = coerceInt(ex.id);
|
|
3657
3727
|
if (id === null) return null;
|
|
@@ -3752,6 +3822,9 @@ var ExerciseLibrary = class {
|
|
|
3752
3822
|
}
|
|
3753
3823
|
return result;
|
|
3754
3824
|
}
|
|
3825
|
+
async currentDefaultsMany(ids) {
|
|
3826
|
+
return fetchCurrentExerciseDefaults(this.#client, ids);
|
|
3827
|
+
}
|
|
3755
3828
|
async search(query, limit = 20) {
|
|
3756
3829
|
await this.ensureFresh();
|
|
3757
3830
|
return this.#searchOnly(query, limit);
|
|
@@ -3831,4 +3904,4 @@ var ExerciseLibrary = class {
|
|
|
3831
3904
|
}
|
|
3832
3905
|
};
|
|
3833
3906
|
//#endregion
|
|
3834
|
-
export { ANALYTICS_METRIC_KEYS, BLOCK_TYPE_CONDITIONING, BLOCK_TYPE_HYPERTROPHY, 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, PROGRAM_KINDS, SESSION_TEMPLATES_LIST_PATH, TrainHeroicAuthError, TrainHeroicClient, TrainHeroicHttpError, addExercisesToWorkout, analyticsMetricCatalog, asExerciseList, buildBlockPayload, buildCommentPayload, buildExerciseSetPayload, buildSearchText, buildSession, buildSetCompletePayload, calendarWriteError, checkResponse, chunk, classifyMainLift, coerceInt, coerceNum, collectAdvisories, copySession, createLimiter, createPersonalWorkout, createProgram, createSessionTemplate, dateWindows, defaultBlockType, definedProps, deleteComment, deleteProgram, exerciseSetCount, exerciseTitle, exerciseUnits, fetchAthleteCircuits, fetchAthleteMainLiftPRs, fetchAthletePrefs, fetchAthleteProfileSummary, fetchAthleteProgrammingPrograms, fetchAthleteUser, fetchAthleteWorkouts, fetchAthleteWorkoutsChunked, fetchCoachAthleteCalendar, fetchCoachAthleteCalendarSummary, fetchCoachAthleteWorkouts, fetchCoachRoster, fetchExerciseHistoryDetail, fetchExerciseHistoryList, fetchExerciseStats, fetchLeaderboard, fetchPersonalRecords, fetchRecentExercises, fetchRosterActivity, fetchRosterMainLiftPRs, fetchStreams, fetchTeamAthleteIds, fetchWorkingMaxes, findSavedWorkoutSet, findSetSplits, historyInRange, inviteAthletes, isPersonalSession, isRecord, logAdHocSession, logAthleteSet, logForAthlete, logSessionForAthlete, loginTrainHeroic, makeExercise, mapPool, mergeWorkoutsById, performedExercises, prescribeAthleteSet, prescribeForAthlete, presentAthleteWorkout, presentAthleteWorkoutExport, presentAthleteWorkouts, presentAthleteWorkoutsExport, presentCoachAthleteTraining, presentExercise, presentExerciseHistory, presentLogTargets, programWorkoutOnDate, publishSession, queryAnalytics, rankSearch, readLive, readSession, removePersonalWorkout, removeSession, repsList, resolveAthleteMainLifts, resolveAthleteUserId, resolveBuildProgramId, resolveLeaderboard, savedWorkoutOf, searchExerciseHistory, selectWorkouts, selectWorkoutsByProgram, sendComment, serializeWorkoutHistory, setAthleteExerciseNote, setAthleteWorkoutNote, setSessionInstruction, setSplitSummary, sortRosterByRecency, splitOversizedBlocks, str, summarizeAthleteWorkouts, swapAthleteExercise, teamPublishTarget, teamVolume, toSetResults, trainHeroicApiErrorMessage, unitAdvisory, unitLabel, unwrapEnvelope, updateTeam, updateTeamPublishSettings, withUnits, workoutsToCsv, workoutsToJson, workoutsToText };
|
|
3907
|
+
export { ANALYTICS_METRIC_KEYS, BLOCK_TYPE_CONDITIONING, BLOCK_TYPE_HYPERTROPHY, 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, PROGRAM_KINDS, SESSION_TEMPLATES_LIST_PATH, TrainHeroicAuthError, TrainHeroicClient, TrainHeroicHttpError, addExercisesToWorkout, analyticsMetricCatalog, asExerciseList, buildBlockPayload, buildCommentPayload, buildExerciseSetPayload, buildSearchText, buildSession, buildSetCompletePayload, calendarWriteError, checkResponse, chunk, classifyMainLift, coerceInt, coerceNum, collectAdvisories, copySession, createLimiter, createPersonalWorkout, createProgram, createSessionTemplate, dateWindows, defaultBlockType, definedProps, deleteComment, deleteProgram, exerciseSetCount, exerciseTitle, exerciseUnits, fetchAthleteCircuits, fetchAthleteMainLiftPRs, fetchAthletePrefs, fetchAthleteProfileSummary, fetchAthleteProgrammingPrograms, fetchAthleteUser, fetchAthleteWorkouts, fetchAthleteWorkoutsChunked, fetchCoachAthleteCalendar, fetchCoachAthleteCalendarSummary, fetchCoachAthleteWorkouts, fetchCoachRoster, fetchCurrentExerciseDefaults, fetchExerciseHistoryDetail, fetchExerciseHistoryList, fetchExerciseStats, fetchLeaderboard, fetchPersonalRecords, fetchRecentExercises, fetchRosterActivity, fetchRosterMainLiftPRs, fetchStreams, fetchTeamAthleteIds, fetchWorkingMaxes, findSavedWorkoutSet, findSetSplits, historyInRange, inviteAthletes, isPersonalSession, isRecord, logAdHocSession, logAthleteSet, logForAthlete, logSessionForAthlete, loginTrainHeroic, makeExercise, mapPool, mergeWorkoutsById, performedExercises, prescribeAthleteSet, prescribeForAthlete, presentAthleteWorkout, presentAthleteWorkoutExport, presentAthleteWorkouts, presentAthleteWorkoutsExport, presentCoachAthleteTraining, presentExercise, presentExerciseHistory, presentLogTargets, programWorkoutOnDate, publishSession, queryAnalytics, rankSearch, readLive, readSession, removePersonalWorkout, removeSession, repsList, resolveAthleteMainLifts, resolveAthleteUserId, resolveBuildProgramId, resolveLeaderboard, savedWorkoutOf, searchExerciseHistory, selectWorkouts, selectWorkoutsByProgram, sendComment, serializeWorkoutHistory, setAthleteExerciseNote, setAthleteWorkoutNote, setSessionInstruction, setSplitSummary, sortRosterByRecency, splitOversizedBlocks, str, summarizeAthleteWorkouts, swapAthleteExercise, teamPublishTarget, teamVolume, toSetResults, trainHeroicApiErrorMessage, unitAdvisory, unitLabel, unwrapEnvelope, updateTeam, updateTeamPublishSettings, withUnits, workoutsToCsv, workoutsToJson, workoutsToText };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trainheroic-unofficial/js",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"es-toolkit": "^1.52.0",
|
|
30
|
-
"zod": "^4.6.
|
|
31
|
-
"@trainheroic-unofficial/dto": "
|
|
30
|
+
"zod": "^4.6.5",
|
|
31
|
+
"@trainheroic-unofficial/dto": "4.1.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@types/node": "^26.
|
|
34
|
+
"@types/node": "^26.6.4",
|
|
35
35
|
"tsdown": "^0.23.0",
|
|
36
|
-
"vitest": "^
|
|
36
|
+
"vitest": "^5.0.3"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "tsdown",
|