@trainheroic-unofficial/dto 1.4.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/dist/index.d.mts CHANGED
@@ -228,10 +228,27 @@ declare const loggedSetSchema: z.ZodObject<{
228
228
  param1: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
229
229
  param2: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
230
230
  }, z.core.$strip>;
231
+ /**
232
+ * A logged set that can name the prescribed position it fills. `slot` is the 1-based set
233
+ * index in the prescription (10 max) the result should land in; omit it to fill the next
234
+ * sequential position (the first entry is set 1, the second set 2, and so on). Targeting a
235
+ * slot lets a partial log land in the right positions of a multi-set prescription — e.g.
236
+ * three top singles into the 4th/5th/6th positions of an `8,5,3,1,1,1` ramp. Used by the
237
+ * by-set logging write (not the by-exercise session log, where each exercise's sets are
238
+ * always sequential).
239
+ */
240
+ declare const loggedSetWithSlotSchema: z.ZodObject<{
241
+ param1: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
242
+ param2: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
243
+ slot: z.ZodOptional<z.ZodNumber>;
244
+ }, z.core.$strip>;
231
245
  /**
232
246
  * Args for the set-logging write. `date` (the workout's day) locates the saved
233
247
  * workout via the range endpoint; `savedWorkoutSetId` picks the set to complete; `results`
234
- * gives, per exercise in it, the entered value of each set (param 1 / param 2 by entry slot).
248
+ * gives, per exercise in it, the entered value of each set. Each set fills the next position by
249
+ * default, or names its `slot` (1-based) to place a partial log at specific positions. A partial
250
+ * log keeps positions already logged in an earlier call and leaves the positions it does not
251
+ * write empty.
235
252
  */
236
253
  declare const logSetArgsSchema: z.ZodObject<{
237
254
  date: z.ZodString;
@@ -241,6 +258,7 @@ declare const logSetArgsSchema: z.ZodObject<{
241
258
  sets: z.ZodArray<z.ZodObject<{
242
259
  param1: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
243
260
  param2: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
261
+ slot: z.ZodOptional<z.ZodNumber>;
244
262
  }, z.core.$strip>>;
245
263
  }, z.core.$strip>>;
246
264
  }, z.core.$strip>;
@@ -257,22 +275,25 @@ declare const coachLogSetArgsSchema: z.ZodObject<{
257
275
  sets: z.ZodArray<z.ZodObject<{
258
276
  param1: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
259
277
  param2: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
278
+ slot: z.ZodOptional<z.ZodNumber>;
260
279
  }, z.core.$strip>>;
261
280
  }, z.core.$strip>>;
262
281
  athleteId: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
263
282
  }, z.core.$strip>;
264
283
  type CoachLogSetArgs = z.infer<typeof coachLogSetArgsSchema>;
265
284
  /**
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.
285
+ * Args for the coach prescription-override write. Like {@link coachLogSetArgsSchema}
286
+ * (athleteId + date + savedWorkoutSetId + per-exercise `sets`), but the values are prescribed
287
+ * targets (param1 = reps, param2 = weight) written to the athlete's plan without marking the set
288
+ * performed. The write replaces this athlete's whole prescription for the set, so its sets are
289
+ * positional and sequential by definition: it deliberately omits the log path's `slot` field (a
290
+ * sparse, slot-targeted prescription has no meaning here) by building its results off
291
+ * {@link loggedSetSchema} rather than {@link loggedSetWithSlotSchema}.
272
292
  */
273
293
  declare const coachPrescribeSetArgsSchema: z.ZodObject<{
274
294
  date: z.ZodString;
275
295
  savedWorkoutSetId: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
296
+ athleteId: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
276
297
  results: z.ZodArray<z.ZodObject<{
277
298
  savedWorkoutSetExerciseId: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
278
299
  sets: z.ZodArray<z.ZodObject<{
@@ -280,7 +301,6 @@ declare const coachPrescribeSetArgsSchema: z.ZodObject<{
280
301
  param2: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
281
302
  }, z.core.$strip>>;
282
303
  }, z.core.$strip>>;
283
- athleteId: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
284
304
  }, z.core.$strip>;
285
305
  type CoachPrescribeSetArgs = z.infer<typeof coachPrescribeSetArgsSchema>;
286
306
  /**
@@ -330,6 +350,17 @@ declare const coachLogSessionArgsSchema: z.ZodObject<{
330
350
  athleteId: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
331
351
  }, z.core.$strip>;
332
352
  type CoachLogSessionArgs = z.infer<typeof coachLogSessionArgsSchema>;
353
+ /**
354
+ * Args for removing a personal (athlete-created) workout session. `programWorkoutId` is the
355
+ * range item's top-level `id`; `date` is that session's day, used to look the item back up so the
356
+ * write can confirm it is a personal session (`personal_cal === true`) before deleting. A
357
+ * coach-scheduled workout is never removed this way.
358
+ */
359
+ declare const athleteSessionRemoveArgsSchema: z.ZodObject<{
360
+ programWorkoutId: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
361
+ date: z.ZodString;
362
+ }, z.core.$strip>;
363
+ type AthleteSessionRemoveArgs = z.infer<typeof athleteSessionRemoveArgsSchema>;
333
364
  /** A flattened exercise within a presented workout: prescriptions, logged results, units. */
334
365
  type AthleteWorkoutExercise = {
335
366
  exerciseId: number | null;
@@ -367,6 +398,12 @@ type AthleteWorkoutView = {
367
398
  * the API's own completion flags are unreliable.
368
399
  */
369
400
  logged: boolean;
401
+ /**
402
+ * True when this is a personal session the athlete created (the API's `personal_cal` flag),
403
+ * rather than a coach-scheduled workout. Only a personal session can be removed with
404
+ * `athlete_session_remove`; its `id` is the `programWorkoutId` that tool takes.
405
+ */
406
+ personal: boolean;
370
407
  blocks: AthleteWorkoutBlock[];
371
408
  };
372
409
  /**
@@ -382,7 +419,8 @@ type AthleteWorkoutSummary = {
382
419
  title: string;
383
420
  program: string | null;
384
421
  team: string | null; /** True when the athlete logged at least one set on this workout. */
385
- logged: boolean; /** Total prescribed exercises across all blocks. */
422
+ logged: boolean; /** True when this is a personal session the athlete created, not a coach-scheduled workout. */
423
+ personal: boolean; /** Total prescribed exercises across all blocks. */
386
424
  exerciseCount: number;
387
425
  /**
388
426
  * How many of those exercises have at least one logged set. Read it against exerciseCount
@@ -686,4 +724,4 @@ type ReadResult = {
686
724
  blocks: ReadBlock[];
687
725
  };
688
726
  //#endregion
689
- 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 };
727
+ export { Advisory, AthletePrefs, AthleteProfileSummary, AthleteSessionRemoveArgs, 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, athleteSessionRemoveArgsSchema, 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, loggedSetWithSlotSchema, parseWorkoutDate, personalRecordListSchema, personalRecordSchema, programWorkoutListSchema, programWorkoutResponseSchema, programWorkoutSchema, programsEditResponseSchema, repMaxSchema, sessionCreateResponseSchema, swapAthleteExerciseArgsSchema, userSimpleSchema, workoutSpecSchema };
package/dist/index.mjs CHANGED
@@ -164,16 +164,29 @@ const loggedSetSchema = z.object({
164
164
  param2: z.union([z.number(), z.string()]).optional()
165
165
  });
166
166
  /**
167
+ * A logged set that can name the prescribed position it fills. `slot` is the 1-based set
168
+ * index in the prescription (10 max) the result should land in; omit it to fill the next
169
+ * sequential position (the first entry is set 1, the second set 2, and so on). Targeting a
170
+ * slot lets a partial log land in the right positions of a multi-set prescription — e.g.
171
+ * three top singles into the 4th/5th/6th positions of an `8,5,3,1,1,1` ramp. Used by the
172
+ * by-set logging write (not the by-exercise session log, where each exercise's sets are
173
+ * always sequential).
174
+ */
175
+ const loggedSetWithSlotSchema = loggedSetSchema.extend({ slot: z.number().int().min(1).max(10).optional() });
176
+ /**
167
177
  * Args for the set-logging write. `date` (the workout's day) locates the saved
168
178
  * workout via the range endpoint; `savedWorkoutSetId` picks the set to complete; `results`
169
- * gives, per exercise in it, the entered value of each set (param 1 / param 2 by entry slot).
179
+ * gives, per exercise in it, the entered value of each set. Each set fills the next position by
180
+ * default, or names its `slot` (1-based) to place a partial log at specific positions. A partial
181
+ * log keeps positions already logged in an earlier call and leaves the positions it does not
182
+ * write empty.
170
183
  */
171
184
  const logSetArgsSchema = z.object({
172
185
  date: dateString,
173
186
  savedWorkoutSetId: idArgSchema,
174
187
  results: z.array(z.object({
175
188
  savedWorkoutSetExerciseId: idArgSchema,
176
- sets: z.array(loggedSetSchema).min(1)
189
+ sets: z.array(loggedSetWithSlotSchema).min(1)
177
190
  })).min(1)
178
191
  });
179
192
  /**
@@ -182,14 +195,23 @@ const logSetArgsSchema = z.object({
182
195
  */
183
196
  const coachLogSetArgsSchema = logSetArgsSchema.extend({ athleteId: idArgSchema });
184
197
  /**
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.
198
+ * Args for the coach prescription-override write. Like {@link coachLogSetArgsSchema}
199
+ * (athleteId + date + savedWorkoutSetId + per-exercise `sets`), but the values are prescribed
200
+ * targets (param1 = reps, param2 = weight) written to the athlete's plan without marking the set
201
+ * performed. The write replaces this athlete's whole prescription for the set, so its sets are
202
+ * positional and sequential by definition: it deliberately omits the log path's `slot` field (a
203
+ * sparse, slot-targeted prescription has no meaning here) by building its results off
204
+ * {@link loggedSetSchema} rather than {@link loggedSetWithSlotSchema}.
191
205
  */
192
- const coachPrescribeSetArgsSchema = logSetArgsSchema.extend({ athleteId: idArgSchema });
206
+ const coachPrescribeSetArgsSchema = z.object({
207
+ date: dateString,
208
+ savedWorkoutSetId: idArgSchema,
209
+ athleteId: idArgSchema,
210
+ results: z.array(z.object({
211
+ savedWorkoutSetExerciseId: idArgSchema,
212
+ sets: z.array(loggedSetSchema).min(1)
213
+ })).min(1)
214
+ });
193
215
  /**
194
216
  * Args for the coach per-athlete exercise swap: replace the exercise prescribed in one of a
195
217
  * roster athlete's saved-workout slots with a different exercise, the API equivalent of the
@@ -220,6 +242,16 @@ const logSessionArgsSchema = z.object({
220
242
  * `athleteId` whose session is being logged on their behalf.
221
243
  */
222
244
  const coachLogSessionArgsSchema = logSessionArgsSchema.extend({ athleteId: idArgSchema });
245
+ /**
246
+ * Args for removing a personal (athlete-created) workout session. `programWorkoutId` is the
247
+ * range item's top-level `id`; `date` is that session's day, used to look the item back up so the
248
+ * write can confirm it is a personal session (`personal_cal === true`) before deleting. A
249
+ * coach-scheduled workout is never removed this way.
250
+ */
251
+ const athleteSessionRemoveArgsSchema = z.object({
252
+ programWorkoutId: idArgSchema,
253
+ date: dateString
254
+ });
223
255
  //#endregion
224
256
  //#region src/exercise.ts
225
257
  /** Body for creating a custom exercise; extra fields the API accepts are preserved. */
@@ -322,4 +354,4 @@ function parseWorkoutDate(s) {
322
354
  ];
323
355
  }
324
356
  //#endregion
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 };
357
+ export { athletePrefsSchema, athleteProfileSummarySchema, athleteSessionRemoveArgsSchema, 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, loggedSetWithSlotSchema, 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.4.0",
3
+ "version": "1.6.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",