@trainheroic-unofficial/dto 1.1.0 → 1.2.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 CHANGED
@@ -1,8 +1,8 @@
1
1
  # @trainheroic-unofficial/dto
2
2
 
3
3
  Domain DTOs and zod schemas for the TrainHeroic API. This package is the single source of
4
- truth for request and response shapes; the SDK, the MCP tool layer, and the CLI all import
5
- their types from here instead of redefining them.
4
+ truth for request and response shapes. The SDK, the MCP tool layer, and the CLI all import
5
+ their types from here.
6
6
 
7
7
  Part of the [trainheroic-unofficial](../../README.md) workspace.
8
8
 
@@ -32,7 +32,7 @@ import { workoutSpecSchema, type WorkoutSpec } from "@trainheroic-unofficial/dto
32
32
  const spec: WorkoutSpec = workoutSpecSchema.parse(input);
33
33
  ```
34
34
 
35
- It imports no `node:*` and touches no filesystem, so it runs anywhere — Node, browsers, and
35
+ It imports no `node:*` and touches no filesystem, so it runs in Node, browsers, and
36
36
  Cloudflare workerd.
37
37
 
38
38
  ## What's inside
@@ -57,7 +57,7 @@ re-exported through `index.ts`. The central pieces:
57
57
  warnings the encoder emits (for example, a prescription whose unit does not match the
58
58
  exercise's parameter type).
59
59
  - The `responses` module holds the tolerant schemas the SDK uses to sanity-check an API
60
- response before trusting it, without rejecting unknown fields.
60
+ response before trusting it; these schemas accept unknown fields.
61
61
 
62
62
  ## Develop
63
63
 
package/dist/index.d.mts CHANGED
@@ -262,6 +262,39 @@ declare const coachLogSetArgsSchema: z.ZodObject<{
262
262
  athleteId: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
263
263
  }, z.core.$strip>;
264
264
  type CoachLogSetArgs = z.infer<typeof coachLogSetArgsSchema>;
265
+ /**
266
+ * Args for the coach prescription-override write. Structurally the same as
267
+ * {@link coachLogSetArgsSchema} (athleteId + date + savedWorkoutSetId + per-exercise `sets`), but
268
+ * the values are prescribed targets (param1 = reps, param2 = weight) written to the athlete's
269
+ * plan without marking the set performed. It is a separate schema (not an alias) so a future
270
+ * prescribe-only constraint can be added here without changing the log args, and the write
271
+ * replaces the slot's prescribed values for this athlete only.
272
+ */
273
+ declare const coachPrescribeSetArgsSchema: z.ZodObject<{
274
+ date: z.ZodString;
275
+ savedWorkoutSetId: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
276
+ results: z.ZodArray<z.ZodObject<{
277
+ savedWorkoutSetExerciseId: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
278
+ sets: z.ZodArray<z.ZodObject<{
279
+ param1: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
280
+ param2: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
281
+ }, z.core.$strip>>;
282
+ }, z.core.$strip>>;
283
+ athleteId: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
284
+ }, z.core.$strip>;
285
+ type CoachPrescribeSetArgs = z.infer<typeof coachPrescribeSetArgsSchema>;
286
+ /**
287
+ * Args for the coach per-athlete exercise swap: replace the exercise prescribed in one of a
288
+ * roster athlete's saved-workout slots with a different exercise, the API equivalent of the
289
+ * app's per-athlete "swap exercise". `savedWorkoutSetExerciseId` is that athlete's own slot id
290
+ * (the same id `coachLogSetArgsSchema` uses, read off athlete_saved_workouts raw);
291
+ * `exerciseId` is the replacement exercise. The team/program prescription is left untouched.
292
+ */
293
+ declare const swapAthleteExerciseArgsSchema: z.ZodObject<{
294
+ savedWorkoutSetExerciseId: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
295
+ exerciseId: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
296
+ }, z.core.$strip>;
297
+ type SwapAthleteExerciseArgs = z.infer<typeof swapAthleteExerciseArgsSchema>;
265
298
  /**
266
299
  * Args for logging a whole session by exercise (rather than by saved-workout-set id). Each
267
300
  * exercise carries its entered sets and an optional 1-based `order`. The athlete path creates
@@ -652,4 +685,4 @@ type ReadResult = {
652
685
  blocks: ReadBlock[];
653
686
  };
654
687
  //#endregion
655
- export { Advisory, AthletePrefs, AthleteProfileSummary, AthleteUser, AthleteWorkingMax, AthleteWorkoutBlock, AthleteWorkoutExercise, AthleteWorkoutRangeArgs, AthleteWorkoutSummary, AthleteWorkoutView, BlockSpec, CoachAthleteExercise, CoachAthleteSession, CoachAthleteTraining, CoachLogSessionArgs, CoachLogSetArgs, CommentDraft, ExerciseCreate, ExerciseHistoryDetail, ExerciseHistoryListItem, ExerciseRow, ExerciseSpec, ExerciseStats, ExerciseView, Id, LeaderboardSpec, LogSessionArgs, LogSetArgs, PersonalRecord, PresentedExerciseHistory, PresentedExerciseSession, ProgramWorkout, ReadBlock, ReadExercise, ReadResult, ResolveResult, RosterActivityRow, TeamVolumeAthlete, TeamVolumeReport, UserSimple, WorkoutDate, WorkoutSpec, athletePrefsSchema, athleteProfileSummarySchema, athleteUserSchema, athleteWorkingMaxListSchema, athleteWorkingMaxSchema, athleteWorkoutRangeArgsSchema, blockSpecSchema, coachLogSessionArgsSchema, coachLogSetArgsSchema, commentDraftSchema, dateString, exerciseCreateSchema, exerciseHistoryDetailSchema, exerciseHistoryListItemSchema, exerciseHistoryListSchema, exerciseLibraryResponseSchema, exerciseResponseSchema, exerciseSpecSchema, exerciseStatsSchema, historyEntrySchema, historySetSchema, idArgSchema, idSchema, leaderboardSpecSchema, liftPRSchema, logSessionArgsSchema, logSetArgsSchema, loggedSetSchema, parseWorkoutDate, personalRecordListSchema, personalRecordSchema, programWorkoutListSchema, programWorkoutResponseSchema, programWorkoutSchema, programsEditResponseSchema, repMaxSchema, sessionCreateResponseSchema, userSimpleSchema, workoutSpecSchema };
688
+ export { Advisory, AthletePrefs, AthleteProfileSummary, AthleteUser, AthleteWorkingMax, AthleteWorkoutBlock, AthleteWorkoutExercise, AthleteWorkoutRangeArgs, AthleteWorkoutSummary, AthleteWorkoutView, BlockSpec, CoachAthleteExercise, CoachAthleteSession, CoachAthleteTraining, CoachLogSessionArgs, CoachLogSetArgs, CoachPrescribeSetArgs, CommentDraft, ExerciseCreate, ExerciseHistoryDetail, ExerciseHistoryListItem, ExerciseRow, ExerciseSpec, ExerciseStats, ExerciseView, Id, LeaderboardSpec, LogSessionArgs, LogSetArgs, PersonalRecord, PresentedExerciseHistory, PresentedExerciseSession, ProgramWorkout, ReadBlock, ReadExercise, ReadResult, ResolveResult, RosterActivityRow, SwapAthleteExerciseArgs, TeamVolumeAthlete, TeamVolumeReport, UserSimple, WorkoutDate, WorkoutSpec, athletePrefsSchema, athleteProfileSummarySchema, athleteUserSchema, athleteWorkingMaxListSchema, athleteWorkingMaxSchema, athleteWorkoutRangeArgsSchema, blockSpecSchema, coachLogSessionArgsSchema, coachLogSetArgsSchema, coachPrescribeSetArgsSchema, commentDraftSchema, dateString, exerciseCreateSchema, exerciseHistoryDetailSchema, exerciseHistoryListItemSchema, exerciseHistoryListSchema, exerciseLibraryResponseSchema, exerciseResponseSchema, exerciseSpecSchema, exerciseStatsSchema, historyEntrySchema, historySetSchema, idArgSchema, idSchema, leaderboardSpecSchema, liftPRSchema, logSessionArgsSchema, logSetArgsSchema, loggedSetSchema, parseWorkoutDate, personalRecordListSchema, personalRecordSchema, programWorkoutListSchema, programWorkoutResponseSchema, programWorkoutSchema, programsEditResponseSchema, repMaxSchema, sessionCreateResponseSchema, swapAthleteExerciseArgsSchema, userSimpleSchema, workoutSpecSchema };
package/dist/index.mjs CHANGED
@@ -182,6 +182,26 @@ const logSetArgsSchema = z.object({
182
182
  */
183
183
  const coachLogSetArgsSchema = logSetArgsSchema.extend({ athleteId: idArgSchema });
184
184
  /**
185
+ * Args for the coach prescription-override write. Structurally the same as
186
+ * {@link coachLogSetArgsSchema} (athleteId + date + savedWorkoutSetId + per-exercise `sets`), but
187
+ * the values are prescribed targets (param1 = reps, param2 = weight) written to the athlete's
188
+ * plan without marking the set performed. It is a separate schema (not an alias) so a future
189
+ * prescribe-only constraint can be added here without changing the log args, and the write
190
+ * replaces the slot's prescribed values for this athlete only.
191
+ */
192
+ const coachPrescribeSetArgsSchema = logSetArgsSchema.extend({ athleteId: idArgSchema });
193
+ /**
194
+ * Args for the coach per-athlete exercise swap: replace the exercise prescribed in one of a
195
+ * roster athlete's saved-workout slots with a different exercise, the API equivalent of the
196
+ * app's per-athlete "swap exercise". `savedWorkoutSetExerciseId` is that athlete's own slot id
197
+ * (the same id `coachLogSetArgsSchema` uses, read off athlete_saved_workouts raw);
198
+ * `exerciseId` is the replacement exercise. The team/program prescription is left untouched.
199
+ */
200
+ const swapAthleteExerciseArgsSchema = z.object({
201
+ savedWorkoutSetExerciseId: idArgSchema,
202
+ exerciseId: idArgSchema
203
+ });
204
+ /**
185
205
  * Args for logging a whole session by exercise (rather than by saved-workout-set id). Each
186
206
  * exercise carries its entered sets and an optional 1-based `order`. The athlete path creates
187
207
  * or reuses a personal session for the date and logs against it; the coach path resolves each
@@ -302,4 +322,4 @@ function parseWorkoutDate(s) {
302
322
  ];
303
323
  }
304
324
  //#endregion
305
- export { athletePrefsSchema, athleteProfileSummarySchema, athleteUserSchema, athleteWorkingMaxListSchema, athleteWorkingMaxSchema, athleteWorkoutRangeArgsSchema, blockSpecSchema, coachLogSessionArgsSchema, coachLogSetArgsSchema, commentDraftSchema, dateString, exerciseCreateSchema, exerciseHistoryDetailSchema, exerciseHistoryListItemSchema, exerciseHistoryListSchema, exerciseLibraryResponseSchema, exerciseResponseSchema, exerciseSpecSchema, exerciseStatsSchema, historyEntrySchema, historySetSchema, idArgSchema, idSchema, leaderboardSpecSchema, liftPRSchema, logSessionArgsSchema, logSetArgsSchema, loggedSetSchema, parseWorkoutDate, personalRecordListSchema, personalRecordSchema, programWorkoutListSchema, programWorkoutResponseSchema, programWorkoutSchema, programsEditResponseSchema, repMaxSchema, sessionCreateResponseSchema, userSimpleSchema, workoutSpecSchema };
325
+ export { athletePrefsSchema, athleteProfileSummarySchema, athleteUserSchema, athleteWorkingMaxListSchema, athleteWorkingMaxSchema, athleteWorkoutRangeArgsSchema, blockSpecSchema, coachLogSessionArgsSchema, coachLogSetArgsSchema, coachPrescribeSetArgsSchema, commentDraftSchema, dateString, exerciseCreateSchema, exerciseHistoryDetailSchema, exerciseHistoryListItemSchema, exerciseHistoryListSchema, exerciseLibraryResponseSchema, exerciseResponseSchema, exerciseSpecSchema, exerciseStatsSchema, historyEntrySchema, historySetSchema, idArgSchema, idSchema, leaderboardSpecSchema, liftPRSchema, logSessionArgsSchema, logSetArgsSchema, loggedSetSchema, parseWorkoutDate, personalRecordListSchema, personalRecordSchema, programWorkoutListSchema, programWorkoutResponseSchema, programWorkoutSchema, programsEditResponseSchema, repMaxSchema, sessionCreateResponseSchema, swapAthleteExerciseArgsSchema, userSimpleSchema, workoutSpecSchema };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trainheroic-unofficial/dto",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",