@sunsteel/contracts 0.61.0 → 0.63.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.cjs CHANGED
@@ -120,6 +120,11 @@ __export(index_exports, {
120
120
  SCHEDULE_OVERRIDES_MAX_RANGE_DAYS: () => SCHEDULE_OVERRIDES_MAX_RANGE_DAYS,
121
121
  SCHEDULE_OVERRIDE_KINDS: () => SCHEDULE_OVERRIDE_KINDS,
122
122
  SCHEDULE_SKIP_PAST_DAYS: () => SCHEDULE_SKIP_PAST_DAYS,
123
+ SESSION_CORRECTIONS_MAX: () => SESSION_CORRECTIONS_MAX,
124
+ SESSION_CORRECTION_LIMITS: () => SESSION_CORRECTION_LIMITS,
125
+ SESSION_CORRECTION_WINDOW_HOURS: () => SESSION_CORRECTION_WINDOW_HOURS,
126
+ SESSION_EXERCISE_NOTE_MAX_LENGTH: () => SESSION_EXERCISE_NOTE_MAX_LENGTH,
127
+ SESSION_NOTE_MAX_LENGTH: () => SESSION_NOTE_MAX_LENGTH,
123
128
  SESSION_SHARE_DEFAULT_FIELDS: () => SESSION_SHARE_DEFAULT_FIELDS,
124
129
  SESSION_SHARE_FIELDS: () => SESSION_SHARE_FIELDS,
125
130
  SESSION_SHARE_MAX_ACTIVE_LINKS: () => SESSION_SHARE_MAX_ACTIVE_LINKS,
@@ -145,7 +150,9 @@ __export(index_exports, {
145
150
  accountExportFileName: () => accountExportFileName,
146
151
  isWithinQuietHours: () => isWithinQuietHours,
147
152
  matchesDeletionConfirmation: () => matchesDeletionConfirmation,
148
- routineDayLabel: () => routineDayLabel
153
+ routineDayLabel: () => routineDayLabel,
154
+ sessionCorrectionWindow: () => sessionCorrectionWindow,
155
+ setLogValuesDiffer: () => setLogValuesDiffer
149
156
  });
150
157
  module.exports = __toCommonJS(index_exports);
151
158
 
@@ -580,6 +587,8 @@ var SCHEDULE_SKIP_PAST_DAYS = 6;
580
587
  var SCHEDULE_OVERRIDES_MAX_RANGE_DAYS = 62;
581
588
 
582
589
  // src/workout.ts
590
+ var SESSION_NOTE_MAX_LENGTH = 2e3;
591
+ var SESSION_EXERCISE_NOTE_MAX_LENGTH = 500;
583
592
  var SESSION_SHARE_FIELDS = [
584
593
  "duration",
585
594
  "volume",
@@ -596,6 +605,33 @@ var SESSION_SHARE_DEFAULT_FIELDS = [
596
605
  ];
597
606
  var SESSION_SHARE_MAX_ACTIVE_LINKS = 10;
598
607
 
608
+ // src/session-corrections.ts
609
+ var SESSION_CORRECTION_WINDOW_HOURS = 48;
610
+ var SESSION_CORRECTIONS_MAX = 10;
611
+ var SESSION_CORRECTION_LIMITS = {
612
+ weightKgMax: 1500,
613
+ repsMax: 1e3,
614
+ rpeMin: 0,
615
+ rpeMax: 10
616
+ };
617
+ function sessionCorrectionWindow(input, now = /* @__PURE__ */ new Date()) {
618
+ const closed = (closedReason) => ({ correctableUntil: null, closedReason });
619
+ if (input.status !== "COMPLETED" || !input.endedAt)
620
+ return closed("NOT_COMPLETED");
621
+ if (!input.isLatest) return closed("NOT_LATEST");
622
+ if (input.laterSessionStarted) return closed("LATER_SESSION");
623
+ const until = new Date(
624
+ new Date(input.endedAt).getTime() + SESSION_CORRECTION_WINDOW_HOURS * 3600 * 1e3
625
+ );
626
+ if (now.getTime() >= until.getTime()) return closed("WINDOW_PASSED");
627
+ if (input.correctionCount >= SESSION_CORRECTIONS_MAX)
628
+ return closed("LIMIT_REACHED");
629
+ return { correctableUntil: until.toISOString(), closedReason: null };
630
+ }
631
+ function setLogValuesDiffer(a, b) {
632
+ return a.weight !== b.weight || a.reps !== b.reps || a.rpe !== b.rpe || a.isCompleted !== b.isCompleted;
633
+ }
634
+
599
635
  // src/analytics.ts
600
636
  var TRAINING_EVENT_TYPES = [
601
637
  "SESSION_COMPLETED",
@@ -801,6 +837,11 @@ function accountExportFileName(username, exportedAt) {
801
837
  SCHEDULE_OVERRIDES_MAX_RANGE_DAYS,
802
838
  SCHEDULE_OVERRIDE_KINDS,
803
839
  SCHEDULE_SKIP_PAST_DAYS,
840
+ SESSION_CORRECTIONS_MAX,
841
+ SESSION_CORRECTION_LIMITS,
842
+ SESSION_CORRECTION_WINDOW_HOURS,
843
+ SESSION_EXERCISE_NOTE_MAX_LENGTH,
844
+ SESSION_NOTE_MAX_LENGTH,
804
845
  SESSION_SHARE_DEFAULT_FIELDS,
805
846
  SESSION_SHARE_FIELDS,
806
847
  SESSION_SHARE_MAX_ACTIVE_LINKS,
@@ -826,5 +867,7 @@ function accountExportFileName(username, exportedAt) {
826
867
  accountExportFileName,
827
868
  isWithinQuietHours,
828
869
  matchesDeletionConfirmation,
829
- routineDayLabel
870
+ routineDayLabel,
871
+ sessionCorrectionWindow,
872
+ setLogValuesDiffer
830
873
  });
package/dist/index.d.cts CHANGED
@@ -56,6 +56,12 @@ interface WorkoutSession {
56
56
  * substituted slot carry the substitute's `exerciseId`.
57
57
  */
58
58
  exerciseSubstitutions?: SessionExerciseSubstitution[];
59
+ /**
60
+ * LIVE-16: what the owner noted about one exercise in this workout. The
61
+ * routine's own note (`routineDay.exercises[].note`) is the standing
62
+ * instruction and is never written from a session.
63
+ */
64
+ exerciseNotes?: SessionExerciseNote[];
59
65
  reused?: boolean;
60
66
  routine?: {
61
67
  id: string;
@@ -177,6 +183,30 @@ interface SessionExerciseSubstitution {
177
183
  };
178
184
  substitutedAt: IsoDateString;
179
185
  }
186
+ declare const SESSION_NOTE_MAX_LENGTH = 2000;
187
+ declare const SESSION_EXERCISE_NOTE_MAX_LENGTH = 500;
188
+ /** One exercise's note for one workout, keyed by its routine slot. */
189
+ interface SessionExerciseNote {
190
+ /** The slot, as in `routineDay.exercises[].id`. */
191
+ routineExerciseId: string;
192
+ note: string;
193
+ }
194
+ /**
195
+ * Body of PUT /workouts/sessions/:id/notes. Partial: an omitted field keeps
196
+ * what is stored, `null` or an empty string clears it. Exercise notes merge
197
+ * by slot, so two notes saved moments apart cannot overwrite each other.
198
+ */
199
+ interface UpdateSessionNotesRequest {
200
+ notes?: string | null;
201
+ exerciseNotes?: Array<{
202
+ routineExerciseId: string;
203
+ note: string | null;
204
+ }>;
205
+ }
206
+ interface UpdateSessionNotesResponse {
207
+ notes: string | null;
208
+ exerciseNotes: SessionExerciseNote[];
209
+ }
180
210
  /** Body of PUT /workouts/sessions/:id/exercises/:routineExerciseId/substitution. */
181
211
  interface SubstituteSessionExerciseRequest {
182
212
  exerciseId: string;
@@ -236,10 +266,17 @@ interface WorkoutSessionRecap {
236
266
  totalVolumeKg: number;
237
267
  completedSets: number;
238
268
  notes?: string | null;
269
+ /** LIVE-16: exercise notes of this workout, named, in the day's order. */
270
+ exerciseNotes?: SessionRecapExerciseNote[];
239
271
  records: SessionRecapRecord[];
240
272
  progressionChanges: ProgressionChange[];
241
273
  previousSession: PreviousSessionRecap | null;
242
274
  }
275
+ interface SessionRecapExerciseNote {
276
+ routineExerciseId: string;
277
+ exerciseName: string;
278
+ note: string;
279
+ }
243
280
  /** Parts of a completed session's recap the owner may choose to share. */
244
281
  declare const SESSION_SHARE_FIELDS: readonly ["duration", "volume", "completedSets", "records", "progression", "notes"];
245
282
  type SessionShareField = (typeof SESSION_SHARE_FIELDS)[number];
@@ -294,6 +331,8 @@ interface SharedSessionRecap {
294
331
  records?: SessionRecapRecord[];
295
332
  progressionChanges?: ProgressionChange[];
296
333
  notes?: string | null;
334
+ /** LIVE-16: shared with the `notes` field. */
335
+ exerciseNotes?: SessionRecapExerciseNote[];
297
336
  }
298
337
  interface WorkoutSessionSummary {
299
338
  id: string;
@@ -2226,6 +2265,109 @@ interface DeleteActivityCommentResponse {
2226
2265
  summary: ActivityCommentSummary;
2227
2266
  }
2228
2267
 
2268
+ /**
2269
+ * LIVE-17. Correcting a finished workout: the owner fixes a mistyped weight,
2270
+ * reps or RPE, or a set left unticked, and everything the workout fed --
2271
+ * records, totals, achievements, its own load changes and the activity built
2272
+ * from them -- is re-derived from the corrected sets.
2273
+ *
2274
+ * Only the most recent completed workout can be corrected, for a bounded time
2275
+ * and until another workout starts, because the next workout is built on this
2276
+ * one: its "last time", the loads it prescribes and the records it is measured
2277
+ * against. Every saved correction is kept, with the values before and after.
2278
+ */
2279
+ /** How long after finishing a workout it can still be corrected. */
2280
+ declare const SESSION_CORRECTION_WINDOW_HOURS = 48;
2281
+ /** Saved corrections per workout, so the trail stays readable. */
2282
+ declare const SESSION_CORRECTIONS_MAX = 10;
2283
+ /**
2284
+ * Bounds a corrected value must respect. Weight is kilograms. The live logging
2285
+ * path is looser; a correction exists to replace an implausible value, so it
2286
+ * does not accept one.
2287
+ */
2288
+ declare const SESSION_CORRECTION_LIMITS: {
2289
+ readonly weightKgMax: 1500;
2290
+ readonly repsMax: 1000;
2291
+ readonly rpeMin: 0;
2292
+ readonly rpeMax: 10;
2293
+ };
2294
+ /** The four things a correction can change on one logged set. */
2295
+ interface SetLogValues {
2296
+ weight: number | null;
2297
+ reps: number | null;
2298
+ rpe: number | null;
2299
+ isCompleted: boolean;
2300
+ }
2301
+ /** One changed set, as it was and as it became. */
2302
+ interface SessionSetCorrection {
2303
+ setLogId: string;
2304
+ exerciseId: string;
2305
+ /** As named when the correction was saved. */
2306
+ exerciseName: string;
2307
+ setNumber: number;
2308
+ before: SetLogValues;
2309
+ after: SetLogValues;
2310
+ }
2311
+ /** One saved correction. Never edited or deleted once written. */
2312
+ interface SessionCorrection {
2313
+ id: string;
2314
+ createdAt: IsoDateString;
2315
+ changes: SessionSetCorrection[];
2316
+ }
2317
+ type SessionCorrectionClosedReason = "NOT_COMPLETED" | "NOT_LATEST" | "LATER_SESSION" | "WINDOW_PASSED" | "LIMIT_REACHED";
2318
+ /**
2319
+ * Whether the workout can be corrected now. `correctableUntil` is set only
2320
+ * while it can; `closedReason` says why it cannot.
2321
+ */
2322
+ interface SessionCorrectionWindow {
2323
+ correctableUntil: IsoDateString | null;
2324
+ closedReason: SessionCorrectionClosedReason | null;
2325
+ }
2326
+ /** GET /workouts/sessions/:id/corrections */
2327
+ interface SessionCorrectionsResponse {
2328
+ window: SessionCorrectionWindow;
2329
+ /** Oldest first. */
2330
+ corrections: SessionCorrection[];
2331
+ }
2332
+ interface CorrectSessionSetRequest extends SetLogValues {
2333
+ setLogId: string;
2334
+ }
2335
+ /**
2336
+ * POST /workouts/sessions/:id/corrections. Each set carries all four values
2337
+ * as they should now read; sets that end up unchanged are ignored, and a
2338
+ * request that changes nothing is refused.
2339
+ */
2340
+ interface CorrectSessionRequest {
2341
+ sets: CorrectSessionSetRequest[];
2342
+ }
2343
+ interface CorrectSessionResponse {
2344
+ correction: SessionCorrection;
2345
+ window: SessionCorrectionWindow;
2346
+ /**
2347
+ * Exercises whose load change from this workout was left as it is, because
2348
+ * the routine was edited after the workout and re-deriving it would undo
2349
+ * that edit.
2350
+ */
2351
+ progressionKept: Array<{
2352
+ exerciseId: string;
2353
+ exerciseName: string;
2354
+ }>;
2355
+ }
2356
+ /**
2357
+ * The window rule, shared so the server and the page state it the same way.
2358
+ * `isLatest` means no other completed workout ended later; `laterSessionStarted`
2359
+ * means any workout started after this one ended.
2360
+ */
2361
+ declare function sessionCorrectionWindow(input: {
2362
+ status: string;
2363
+ endedAt: IsoDateString | Date | null | undefined;
2364
+ isLatest: boolean;
2365
+ laterSessionStarted: boolean;
2366
+ correctionCount: number;
2367
+ }, now?: Date): SessionCorrectionWindow;
2368
+ /** Whether two sets of values differ in anything a correction records. */
2369
+ declare function setLogValuesDiffer(a: SetLogValues, b: SetLogValues): boolean;
2370
+
2229
2371
  /** SOC-08: one explicit grant from a member to their active training partner. */
2230
2372
  interface TrainingPartnerPermissions {
2231
2373
  schedule: boolean;
@@ -2710,6 +2852,10 @@ interface AccountExportV1 {
2710
2852
  };
2711
2853
  routines: AccountExportRoutine[];
2712
2854
  workouts: WorkoutSession[];
2855
+ /** LIVE-17: every saved correction of a workout, with its before and after values. */
2856
+ workoutCorrections: Array<SessionCorrection & {
2857
+ sessionId: string;
2858
+ }>;
2713
2859
  personalRecords: AccountExportPersonalRecord[];
2714
2860
  trainingEvents: AccountExportTrainingEvent[];
2715
2861
  goals: AccountExportGoal[];
@@ -2764,4 +2910,4 @@ interface AccountExportV1 {
2764
2910
  /** The file name a download of the export is saved under. */
2765
2911
  declare function accountExportFileName(username: string, exportedAt: string): string;
2766
2912
 
2767
- export { ACCOUNT_EXPORT_FORMAT, ACCOUNT_EXPORT_VERSION, ACHIEVEMENT_CATEGORIES, ACHIEVEMENT_DEFINITIONS, ACTIVITY_CAPS, ACTIVITY_COMMENTS_PAGE_SIZE, ACTIVITY_COMMENTS_PER_DAY_MAX, ACTIVITY_COMMENT_MAX_LENGTH, ACTIVITY_DEFAULT_AUDIENCE, ACTIVITY_ENTRY_ID_MAX_LENGTH, ACTIVITY_FEED_FOLLOWED_MAX, ACTIVITY_PAGE_DEFAULT_LIMIT, ACTIVITY_PAGE_MAX_LIMIT, ACTIVITY_PREVIEW_AUDIENCES, ACTIVITY_REACTIONS, ACTIVITY_TYPES, ACTIVITY_TYPE_SECTIONS, type AccountExportGoal, type AccountExportMember, type AccountExportPersonalRecord, type AccountExportRoutine, type AccountExportScheduleOverride, type AccountExportTrainingEvent, type AccountExportTrainingLocation, type AccountExportV1, type AchievementActivity, type AchievementCategory, type AchievementCategoryProgress, type AchievementDefinition, type AchievementNotification, type AchievementUnlockedEventPayload, type AchievementsResponse, type ActivityAudience, type ActivityCap, type ActivityComment, type ActivityCommentNotification, type ActivityCommentSummary, type ActivityCommentsQuery, type ActivityCommentsResponse, type ActivityEntry, type ActivityEntrySharing, type ActivityFeedResponse, type ActivityLink, type ActivityPage, type ActivityPageQuery, type ActivityPreviewAudience, type ActivityPreviewQuery, type ActivityReaction, type ActivityReactionSummary, type ActivitySection, type ActivitySharingSettings, type ActivityType, type AppNotification, BLOCKED_MEMBERS_MAX, type BlockedMember, type BlockedMembersResponse, type Brand, CLONE_ROUTINE_REFUSALS, COMEBACK_MIN_INACTIVE_DAYS, COMEBACK_RECOGNITION_LIMIT, COMEBACK_REQUIRED_ACTIVE_DAYS, COMEBACK_SESSION_LOOKBACK, COMEBACK_WINDOW_DAYS, type CalendarDate, type CloneRoutineRefusal, type CloneRoutineRequest, type ComebackActivity, type ComebackRecognition, type ComebackRecognitionSummary, type CreateActivityCommentRequest, type CreateActivityCommentResponse, type CreateReportRequest, type CreateReportResponse, type CreateRoutineDayInput, type CreateRoutineExerciseInput, type CreateRoutineRequest, type CreateRoutineVersionRequest, type CreateSessionShareRequest, type DeleteAccountRequest, type DeleteAccountResponse, type DeleteActivityCommentResponse, type DeletePushSubscriptionRequest, type DiscoverableRoutine, EXERCISE_EQUIPMENT, EXERCISE_MECHANICS, type EarnedAchievement, type EarnedPersonalRecord, type Exercise, type ExerciseEquipment, type ExerciseId, type ExerciseMechanic, type ExercisePerformanceHistoryQuery, type ExercisePerformanceHistoryResponse, type ExercisePerformancePrescription, type ExercisePerformancePrescriptionSet, type ExercisePerformanceSession, type ExercisePerformanceSet, type ExercisePerformanceSummary, type ExercisePlateau, type ExerciseStrengthSummary, type ExerciseStrengthTrendPoint, type ExerciseStrengthTrendQuery, type ExerciseStrengthTrendResponse, FEATURED_PROFILE_ITEMS_MAX, FEATURED_PROFILE_ITEM_KINDS, FEATURED_PROFILE_REFERENCE_MAX_LENGTH, FOLLOW_SUGGESTIONS_DEFAULT_LIMIT, FOLLOW_SUGGESTIONS_MAX_LIMIT, FOLLOW_SUGGESTION_REASONS, type FeaturedProfileAchievementItem, type FeaturedProfileItem, type FeaturedProfileItemKind, type FeaturedProfileRankItem, type FeaturedProfileRecordItem, type FeaturedProfileRoutineItem, type FeaturedProfileSelection, type FeaturedProfileSelectionInput, type FeaturedProfileSelectionsResponse, type FinishStatus, type FinishWorkoutRequest, type FinishWorkoutResponse, type FollowSuggestion, type FollowSuggestionReason, type FollowSuggestionsResponse, type IsoDateString, type ListSessionsParams, MEASURABLE_GOALS_MAX, MEASURABLE_GOAL_DIRECTIONS, MEASURABLE_GOAL_TYPES, MINUTES_IN_DAY, MODERATION_ACTION_KINDS, MODERATION_HISTORY_PAGE_SIZE, MODERATION_NOTE_MAX_LENGTH, MODERATION_QUEUE_PAGE_SIZE, MOVEMENT_PATTERNS, MUSCLE_GROUPS, type MarkNotificationsReadRequest, type MarkNotificationsReadResponse, type MeasurableGoal, type MeasurableGoalDirection, type MeasurableGoalExercise, type MeasurableGoalInput, type MeasurableGoalType, type MemberActivityResponse, type MemberModerationState, type MemberRoutinesResponse, type ModerationActionKind, type ModerationActionRecord, type ModerationHistoryQuery, type ModerationHistoryResponse, type ModerationQueueQuery, type ModerationQueueResponse, type ModerationReport, type ModeratorState, type MoveOccurrenceRequest, type MovementPattern, type MuscleGroup, type MuscleGroupHeatmapQuery, type MuscleGroupHeatmapResponse, type MuscleGroupHeatmapValue, type MuscleGroupHeatmapWeek, type MuscleVolumeTrendSeries, NOTIFICATIONS_LIST_LIMIT, NOTIFICATIONS_LOOKBACK_DAYS, NOTIFICATIONS_RETENTION_DAYS, NOTIFICATION_CATEGORIES, NOTIFICATION_KINDS, type NewFollowerNotification, type NotificationCategory, type NotificationKind, type NotificationPreferences, type NotificationPreferencesResponse, type NotificationsResponse, type OwnActivityEntry, type OwnActivityResponse, PLATEAU_MIN_DAYS_SINCE_BEST, PLATEAU_MIN_SESSIONS, PLATEAU_MIN_SESSIONS_MAX, PLATEAU_MIN_SESSIONS_MIN, PLATEAU_RECENT_DAYS, PLATEAU_WINDOW_DAYS, PREFERRED_TRAINING_STYLE_VALUES, PROFILE_BIO_MAX_LENGTH, PROFILE_FAVORITE_EXERCISES_MAX, PROFILE_LOCATION_MAX_LENGTH, PROFILE_TRAINING_DISCIPLINES_MAX, PROFILE_TRAINING_GOALS_MAX, PROFILE_VISIBILITY_VALUES, PROGRESSION_SCHEMES, PROGRESS_TIMELINE_EVENT_TYPES, PUSH_PAYLOAD_KINDS, PUSH_SUBSCRIPTIONS_MAX, type PaginatedResponse, type PersonalGoalProgress, type PersonalGoalsResponse, type PersonalRecordActivity, type PersonalRecordEntry, type PersonalRecordKind, type PlannedReminder, type PlatePairInventory, type PlateauPreferences, type PlateauSet, type PlateausResponse, type PreferredTrainingStyle, type PreviousPerformanceResponse, type PreviousSessionRecap, type PreviousSetPerformance, type ProfileDiscoverySettings, type ProfileFavoriteExercise, type ProfilePrivacySettings, type ProfileViewerAccess, type ProfileVisibility, type ProgressTimelineEventType, type ProgressTimelineItem, type ProgressTimelinePersonalRecordItem, type ProgressTimelineProgressionItem, type ProgressTimelineQuery, type ProgressTimelineRecordPerformance, type ProgressTimelineRecordReason, type ProgressTimelineResponse, type ProgressTimelineSessionContext, type ProgressionActivity, type ProgressionChange, type ProgressionRule, type ProgressionScheme, type ProgressionSetChange, type PublicBodyMetrics, type PublicProfileAchievements, type PublicTrainingSummary, type PublicUserProfile, type PushPayload, type PushPayloadKind, type PushSubscriptionKeys, type PushSubscriptionSummary, type PushSubscriptionsResponse, type QuietHours, RELATIONSHIP_LIST_DEFAULT_LIMIT, RELATIONSHIP_LIST_KINDS, RELATIONSHIP_LIST_MAX_LIMIT, RENAISSANCE_RANK_DEFINITIONS, REPORTS_PER_DAY_MAX, REPORT_DETAILS_MAX_LENGTH, REPORT_REASONS, REPORT_STATUSES, REPORT_SUBJECT_KINDS, REP_TYPES, RESERVED_USERNAMES, REST_ALERT_MAX_LEAD_SECONDS, REST_ALERT_MIN_LEAD_SECONDS, REST_ALERT_REFUSALS, ROUTINE_DAYS_MAX, ROUTINE_DAY_NAME_MAX, ROUTINE_DISCOVERY_DEFAULT_LIMIT, ROUTINE_DISCOVERY_MAX_LIMIT, ROUTINE_DISCOVERY_SCAN_LIMIT, ROUTINE_DURATION_BANDS, ROUTINE_DURATION_BAND_MAX_MINUTES, ROUTINE_SCHEDULE_MODES, ROUTINE_SHARE_MAX_ACTIVE_LINKS, ROUTINE_TRAINING_BLOCKS_MAX, ROUTINE_TRAINING_BLOCK_NAME_MAX, ROUTINE_TRAINING_BLOCK_REVISIONS_MAX, ROUTINE_TRAINING_BLOCK_SOURCE_KINDS, ROUTINE_TRAINING_BLOCK_STATES, ROUTINE_VERSIONS_MAX, ROUTINE_VERSION_KINDS, ROUTINE_VERSION_NAME_MAX, ROUTINE_VISIBILITY_VALUES, type RecentActivityEntry, type RegisterPushSubscriptionRequest, type RelationshipListKind, type RelationshipListQuery, type RelationshipListResponse, type RelationshipMember, type RenaissanceRankDefinition, type RenaissanceRankProgress, type RepType, type ReplaceFeaturedProfileItemsRequest, type ReplaceMeasurableGoalsRequest, type ReplaceTrainingLocationsRequest, type ReportReason, type ReportStatus, type ReportSubjectKind, type ReportSubjectPreview, type RestAlertPushPayload, type RestAlertRefusal, type RestoreRoutineVersionResponse, type ReviewReportRequest, type ReviewReportResponse, type Routine, type RoutineClassification, type RoutineDay, type RoutineDayId, type RoutineDiscoveryQuery, type RoutineDiscoveryResponse, type RoutineDurationBand, type RoutineExercise, type RoutineFacets, type RoutineId, type RoutineLineage, type RoutineScheduleMode, type RoutineSet, type RoutineShare, type RoutineShareListResponse, type RoutineSharedActivity, type RoutineTrainingBlock, type RoutineTrainingBlockRevision, type RoutineTrainingBlockRevisionsResponse, type RoutineTrainingBlockSource, type RoutineTrainingBlockSourceKind, type RoutineTrainingBlockState, type RoutineTrainingBlocksResponse, type RoutineVersion, type RoutineVersionDay, type RoutineVersionExercise, type RoutineVersionKind, type RoutineVersionSetup, type RoutineVersionsResponse, type RoutineVisibility, SCHEDULE_MOVE_MAX_DAYS, SCHEDULE_OVERRIDES_MAX_RANGE_DAYS, SCHEDULE_OVERRIDE_KINDS, SCHEDULE_SKIP_PAST_DAYS, SESSION_SHARE_DEFAULT_FIELDS, SESSION_SHARE_FIELDS, SESSION_SHARE_MAX_ACTIVE_LINKS, SEXES, SHARED_ROUTINE_SOURCES, STARRED_EXERCISES_MAX, STREAK_MAX_GAP_DAYS, type ScheduleOverride, type ScheduleOverrideKind, type ScheduleOverridesQuery, type ScheduleOverridesResponse, type ScheduleRestAlertRequest, type ScheduleRestAlertResponse, type SendTrainingPartnerEncouragementRequest, type SendTrainingPartnerEncouragementResponse, type SessionComparisonExercise, type SessionComparisonQuery, type SessionComparisonResponse, type SessionComparisonRoutineDay, type SessionComparisonSession, type SessionComparisonSet, type SessionCompletedActivity, type SessionExerciseSubstitution, type SessionProgressNotification, type SessionRecapRecord, type SessionShare, type SessionShareField, type SessionShareListResponse, type SetAccountTimeZoneRequest, type SetActivityEntryAudienceRequest, type SetActivityEntryAudienceResponse, type SetActivityReactionRequest, type SetActivityReactionResponse, type SetLog, type Sex, type SharedRoutine, type SharedRoutineOwner, type SharedRoutineSource, type SharedRoutineSummary, type SharedSessionOwner, type SharedSessionRecap, type SkipOccurrenceRequest, type StarredExercise, type StarredExercisesResponse, type StartWorkoutRequest, type StartWorkoutResponse, type StreakAtRiskPushPayload, type StreakMilestoneActivity, type StreakMilestoneEventPayload, type SubstituteSessionExerciseRequest, type SubstituteSessionExerciseResponse, type SupabaseAuthResponse, type SupabaseAuthUser, type SupabaseMigrationResponse, TRAINING_DISCIPLINE_VALUES, TRAINING_EVENT_TYPES, TRAINING_EXPERIENCE_LEVEL_VALUES, TRAINING_GOAL_VALUES, TRAINING_PARTNERSHIP_STATUSES, TRAINING_PARTNERS_MAX, TRAINING_PARTNER_ENCOURAGEMENTS_PER_24_HOURS_MAX, TRAINING_PARTNER_ENCOURAGEMENT_KINDS, TRAINING_PARTNER_PERMISSION_KEYS, TRAINING_PARTNER_REQUESTS_PER_DAY_MAX, type TrainingDiscipline, type TrainingEventType, type TrainingExperienceLevel, type TrainingGoal, type TrainingIdentity, type TrainingLocationPreference, type TrainingLocationPreferenceInput, type TrainingPartnerEncouragementKind, type TrainingPartnerEncouragementNotification, type TrainingPartnerPermissions, type TrainingPartnerScheduleDay, type TrainingPartnerScheduleResponse, type TrainingPartnership, type TrainingPartnershipStatus, type TrainingPartnershipsResponse, type TrainingReminderPreference, type TrainingReminderPushPayload, USERNAME_MAX_LENGTH, USERNAME_MIN_LENGTH, USERNAME_PATTERN_SOURCE, type UpdateActivitySharingRequest, type UpdateNotificationPreferencesRequest, type UpdateProfileDiscoveryRequest, type UpdateProfilePrivacyRequest, type UpdateProfileRequest, type UpdateRoutineRequest, type UpdateRoutineVisibilityRequest, type UpdateTrainingPartnerPermissionsRequest, type UpsertRoutineTrainingBlockRequest, type UpsertSetLogRequest, type UpsertSetLogResponse, type UserId, type UserProfile, type UserSearchResponse, type VolumeTrendPoint, type VolumeTrendQuery, type VolumeTrendResponse, type VolumeTrendSeries, WEIGHT_UNITS, WORKOUT_SESSION_STATUSES, type WeightUnit, type WorkoutAnalyticsStatus, type WorkoutProgressQuery, type WorkoutProgressResponse, type WorkoutSession, type WorkoutSessionId, type WorkoutSessionListResponse, type WorkoutSessionRecap, type WorkoutSessionSnapshotV1, type WorkoutSessionStatus, type WorkoutSessionSummary, type WorkoutStatsQuery, type WorkoutStatsResponse, accountExportFileName, isWithinQuietHours, matchesDeletionConfirmation, routineDayLabel };
2913
+ export { ACCOUNT_EXPORT_FORMAT, ACCOUNT_EXPORT_VERSION, ACHIEVEMENT_CATEGORIES, ACHIEVEMENT_DEFINITIONS, ACTIVITY_CAPS, ACTIVITY_COMMENTS_PAGE_SIZE, ACTIVITY_COMMENTS_PER_DAY_MAX, ACTIVITY_COMMENT_MAX_LENGTH, ACTIVITY_DEFAULT_AUDIENCE, ACTIVITY_ENTRY_ID_MAX_LENGTH, ACTIVITY_FEED_FOLLOWED_MAX, ACTIVITY_PAGE_DEFAULT_LIMIT, ACTIVITY_PAGE_MAX_LIMIT, ACTIVITY_PREVIEW_AUDIENCES, ACTIVITY_REACTIONS, ACTIVITY_TYPES, ACTIVITY_TYPE_SECTIONS, type AccountExportGoal, type AccountExportMember, type AccountExportPersonalRecord, type AccountExportRoutine, type AccountExportScheduleOverride, type AccountExportTrainingEvent, type AccountExportTrainingLocation, type AccountExportV1, type AchievementActivity, type AchievementCategory, type AchievementCategoryProgress, type AchievementDefinition, type AchievementNotification, type AchievementUnlockedEventPayload, type AchievementsResponse, type ActivityAudience, type ActivityCap, type ActivityComment, type ActivityCommentNotification, type ActivityCommentSummary, type ActivityCommentsQuery, type ActivityCommentsResponse, type ActivityEntry, type ActivityEntrySharing, type ActivityFeedResponse, type ActivityLink, type ActivityPage, type ActivityPageQuery, type ActivityPreviewAudience, type ActivityPreviewQuery, type ActivityReaction, type ActivityReactionSummary, type ActivitySection, type ActivitySharingSettings, type ActivityType, type AppNotification, BLOCKED_MEMBERS_MAX, type BlockedMember, type BlockedMembersResponse, type Brand, CLONE_ROUTINE_REFUSALS, COMEBACK_MIN_INACTIVE_DAYS, COMEBACK_RECOGNITION_LIMIT, COMEBACK_REQUIRED_ACTIVE_DAYS, COMEBACK_SESSION_LOOKBACK, COMEBACK_WINDOW_DAYS, type CalendarDate, type CloneRoutineRefusal, type CloneRoutineRequest, type ComebackActivity, type ComebackRecognition, type ComebackRecognitionSummary, type CorrectSessionRequest, type CorrectSessionResponse, type CorrectSessionSetRequest, type CreateActivityCommentRequest, type CreateActivityCommentResponse, type CreateReportRequest, type CreateReportResponse, type CreateRoutineDayInput, type CreateRoutineExerciseInput, type CreateRoutineRequest, type CreateRoutineVersionRequest, type CreateSessionShareRequest, type DeleteAccountRequest, type DeleteAccountResponse, type DeleteActivityCommentResponse, type DeletePushSubscriptionRequest, type DiscoverableRoutine, EXERCISE_EQUIPMENT, EXERCISE_MECHANICS, type EarnedAchievement, type EarnedPersonalRecord, type Exercise, type ExerciseEquipment, type ExerciseId, type ExerciseMechanic, type ExercisePerformanceHistoryQuery, type ExercisePerformanceHistoryResponse, type ExercisePerformancePrescription, type ExercisePerformancePrescriptionSet, type ExercisePerformanceSession, type ExercisePerformanceSet, type ExercisePerformanceSummary, type ExercisePlateau, type ExerciseStrengthSummary, type ExerciseStrengthTrendPoint, type ExerciseStrengthTrendQuery, type ExerciseStrengthTrendResponse, FEATURED_PROFILE_ITEMS_MAX, FEATURED_PROFILE_ITEM_KINDS, FEATURED_PROFILE_REFERENCE_MAX_LENGTH, FOLLOW_SUGGESTIONS_DEFAULT_LIMIT, FOLLOW_SUGGESTIONS_MAX_LIMIT, FOLLOW_SUGGESTION_REASONS, type FeaturedProfileAchievementItem, type FeaturedProfileItem, type FeaturedProfileItemKind, type FeaturedProfileRankItem, type FeaturedProfileRecordItem, type FeaturedProfileRoutineItem, type FeaturedProfileSelection, type FeaturedProfileSelectionInput, type FeaturedProfileSelectionsResponse, type FinishStatus, type FinishWorkoutRequest, type FinishWorkoutResponse, type FollowSuggestion, type FollowSuggestionReason, type FollowSuggestionsResponse, type IsoDateString, type ListSessionsParams, MEASURABLE_GOALS_MAX, MEASURABLE_GOAL_DIRECTIONS, MEASURABLE_GOAL_TYPES, MINUTES_IN_DAY, MODERATION_ACTION_KINDS, MODERATION_HISTORY_PAGE_SIZE, MODERATION_NOTE_MAX_LENGTH, MODERATION_QUEUE_PAGE_SIZE, MOVEMENT_PATTERNS, MUSCLE_GROUPS, type MarkNotificationsReadRequest, type MarkNotificationsReadResponse, type MeasurableGoal, type MeasurableGoalDirection, type MeasurableGoalExercise, type MeasurableGoalInput, type MeasurableGoalType, type MemberActivityResponse, type MemberModerationState, type MemberRoutinesResponse, type ModerationActionKind, type ModerationActionRecord, type ModerationHistoryQuery, type ModerationHistoryResponse, type ModerationQueueQuery, type ModerationQueueResponse, type ModerationReport, type ModeratorState, type MoveOccurrenceRequest, type MovementPattern, type MuscleGroup, type MuscleGroupHeatmapQuery, type MuscleGroupHeatmapResponse, type MuscleGroupHeatmapValue, type MuscleGroupHeatmapWeek, type MuscleVolumeTrendSeries, NOTIFICATIONS_LIST_LIMIT, NOTIFICATIONS_LOOKBACK_DAYS, NOTIFICATIONS_RETENTION_DAYS, NOTIFICATION_CATEGORIES, NOTIFICATION_KINDS, type NewFollowerNotification, type NotificationCategory, type NotificationKind, type NotificationPreferences, type NotificationPreferencesResponse, type NotificationsResponse, type OwnActivityEntry, type OwnActivityResponse, PLATEAU_MIN_DAYS_SINCE_BEST, PLATEAU_MIN_SESSIONS, PLATEAU_MIN_SESSIONS_MAX, PLATEAU_MIN_SESSIONS_MIN, PLATEAU_RECENT_DAYS, PLATEAU_WINDOW_DAYS, PREFERRED_TRAINING_STYLE_VALUES, PROFILE_BIO_MAX_LENGTH, PROFILE_FAVORITE_EXERCISES_MAX, PROFILE_LOCATION_MAX_LENGTH, PROFILE_TRAINING_DISCIPLINES_MAX, PROFILE_TRAINING_GOALS_MAX, PROFILE_VISIBILITY_VALUES, PROGRESSION_SCHEMES, PROGRESS_TIMELINE_EVENT_TYPES, PUSH_PAYLOAD_KINDS, PUSH_SUBSCRIPTIONS_MAX, type PaginatedResponse, type PersonalGoalProgress, type PersonalGoalsResponse, type PersonalRecordActivity, type PersonalRecordEntry, type PersonalRecordKind, type PlannedReminder, type PlatePairInventory, type PlateauPreferences, type PlateauSet, type PlateausResponse, type PreferredTrainingStyle, type PreviousPerformanceResponse, type PreviousSessionRecap, type PreviousSetPerformance, type ProfileDiscoverySettings, type ProfileFavoriteExercise, type ProfilePrivacySettings, type ProfileViewerAccess, type ProfileVisibility, type ProgressTimelineEventType, type ProgressTimelineItem, type ProgressTimelinePersonalRecordItem, type ProgressTimelineProgressionItem, type ProgressTimelineQuery, type ProgressTimelineRecordPerformance, type ProgressTimelineRecordReason, type ProgressTimelineResponse, type ProgressTimelineSessionContext, type ProgressionActivity, type ProgressionChange, type ProgressionRule, type ProgressionScheme, type ProgressionSetChange, type PublicBodyMetrics, type PublicProfileAchievements, type PublicTrainingSummary, type PublicUserProfile, type PushPayload, type PushPayloadKind, type PushSubscriptionKeys, type PushSubscriptionSummary, type PushSubscriptionsResponse, type QuietHours, RELATIONSHIP_LIST_DEFAULT_LIMIT, RELATIONSHIP_LIST_KINDS, RELATIONSHIP_LIST_MAX_LIMIT, RENAISSANCE_RANK_DEFINITIONS, REPORTS_PER_DAY_MAX, REPORT_DETAILS_MAX_LENGTH, REPORT_REASONS, REPORT_STATUSES, REPORT_SUBJECT_KINDS, REP_TYPES, RESERVED_USERNAMES, REST_ALERT_MAX_LEAD_SECONDS, REST_ALERT_MIN_LEAD_SECONDS, REST_ALERT_REFUSALS, ROUTINE_DAYS_MAX, ROUTINE_DAY_NAME_MAX, ROUTINE_DISCOVERY_DEFAULT_LIMIT, ROUTINE_DISCOVERY_MAX_LIMIT, ROUTINE_DISCOVERY_SCAN_LIMIT, ROUTINE_DURATION_BANDS, ROUTINE_DURATION_BAND_MAX_MINUTES, ROUTINE_SCHEDULE_MODES, ROUTINE_SHARE_MAX_ACTIVE_LINKS, ROUTINE_TRAINING_BLOCKS_MAX, ROUTINE_TRAINING_BLOCK_NAME_MAX, ROUTINE_TRAINING_BLOCK_REVISIONS_MAX, ROUTINE_TRAINING_BLOCK_SOURCE_KINDS, ROUTINE_TRAINING_BLOCK_STATES, ROUTINE_VERSIONS_MAX, ROUTINE_VERSION_KINDS, ROUTINE_VERSION_NAME_MAX, ROUTINE_VISIBILITY_VALUES, type RecentActivityEntry, type RegisterPushSubscriptionRequest, type RelationshipListKind, type RelationshipListQuery, type RelationshipListResponse, type RelationshipMember, type RenaissanceRankDefinition, type RenaissanceRankProgress, type RepType, type ReplaceFeaturedProfileItemsRequest, type ReplaceMeasurableGoalsRequest, type ReplaceTrainingLocationsRequest, type ReportReason, type ReportStatus, type ReportSubjectKind, type ReportSubjectPreview, type RestAlertPushPayload, type RestAlertRefusal, type RestoreRoutineVersionResponse, type ReviewReportRequest, type ReviewReportResponse, type Routine, type RoutineClassification, type RoutineDay, type RoutineDayId, type RoutineDiscoveryQuery, type RoutineDiscoveryResponse, type RoutineDurationBand, type RoutineExercise, type RoutineFacets, type RoutineId, type RoutineLineage, type RoutineScheduleMode, type RoutineSet, type RoutineShare, type RoutineShareListResponse, type RoutineSharedActivity, type RoutineTrainingBlock, type RoutineTrainingBlockRevision, type RoutineTrainingBlockRevisionsResponse, type RoutineTrainingBlockSource, type RoutineTrainingBlockSourceKind, type RoutineTrainingBlockState, type RoutineTrainingBlocksResponse, type RoutineVersion, type RoutineVersionDay, type RoutineVersionExercise, type RoutineVersionKind, type RoutineVersionSetup, type RoutineVersionsResponse, type RoutineVisibility, SCHEDULE_MOVE_MAX_DAYS, SCHEDULE_OVERRIDES_MAX_RANGE_DAYS, SCHEDULE_OVERRIDE_KINDS, SCHEDULE_SKIP_PAST_DAYS, SESSION_CORRECTIONS_MAX, SESSION_CORRECTION_LIMITS, SESSION_CORRECTION_WINDOW_HOURS, SESSION_EXERCISE_NOTE_MAX_LENGTH, SESSION_NOTE_MAX_LENGTH, SESSION_SHARE_DEFAULT_FIELDS, SESSION_SHARE_FIELDS, SESSION_SHARE_MAX_ACTIVE_LINKS, SEXES, SHARED_ROUTINE_SOURCES, STARRED_EXERCISES_MAX, STREAK_MAX_GAP_DAYS, type ScheduleOverride, type ScheduleOverrideKind, type ScheduleOverridesQuery, type ScheduleOverridesResponse, type ScheduleRestAlertRequest, type ScheduleRestAlertResponse, type SendTrainingPartnerEncouragementRequest, type SendTrainingPartnerEncouragementResponse, type SessionComparisonExercise, type SessionComparisonQuery, type SessionComparisonResponse, type SessionComparisonRoutineDay, type SessionComparisonSession, type SessionComparisonSet, type SessionCompletedActivity, type SessionCorrection, type SessionCorrectionClosedReason, type SessionCorrectionWindow, type SessionCorrectionsResponse, type SessionExerciseNote, type SessionExerciseSubstitution, type SessionProgressNotification, type SessionRecapExerciseNote, type SessionRecapRecord, type SessionSetCorrection, type SessionShare, type SessionShareField, type SessionShareListResponse, type SetAccountTimeZoneRequest, type SetActivityEntryAudienceRequest, type SetActivityEntryAudienceResponse, type SetActivityReactionRequest, type SetActivityReactionResponse, type SetLog, type SetLogValues, type Sex, type SharedRoutine, type SharedRoutineOwner, type SharedRoutineSource, type SharedRoutineSummary, type SharedSessionOwner, type SharedSessionRecap, type SkipOccurrenceRequest, type StarredExercise, type StarredExercisesResponse, type StartWorkoutRequest, type StartWorkoutResponse, type StreakAtRiskPushPayload, type StreakMilestoneActivity, type StreakMilestoneEventPayload, type SubstituteSessionExerciseRequest, type SubstituteSessionExerciseResponse, type SupabaseAuthResponse, type SupabaseAuthUser, type SupabaseMigrationResponse, TRAINING_DISCIPLINE_VALUES, TRAINING_EVENT_TYPES, TRAINING_EXPERIENCE_LEVEL_VALUES, TRAINING_GOAL_VALUES, TRAINING_PARTNERSHIP_STATUSES, TRAINING_PARTNERS_MAX, TRAINING_PARTNER_ENCOURAGEMENTS_PER_24_HOURS_MAX, TRAINING_PARTNER_ENCOURAGEMENT_KINDS, TRAINING_PARTNER_PERMISSION_KEYS, TRAINING_PARTNER_REQUESTS_PER_DAY_MAX, type TrainingDiscipline, type TrainingEventType, type TrainingExperienceLevel, type TrainingGoal, type TrainingIdentity, type TrainingLocationPreference, type TrainingLocationPreferenceInput, type TrainingPartnerEncouragementKind, type TrainingPartnerEncouragementNotification, type TrainingPartnerPermissions, type TrainingPartnerScheduleDay, type TrainingPartnerScheduleResponse, type TrainingPartnership, type TrainingPartnershipStatus, type TrainingPartnershipsResponse, type TrainingReminderPreference, type TrainingReminderPushPayload, USERNAME_MAX_LENGTH, USERNAME_MIN_LENGTH, USERNAME_PATTERN_SOURCE, type UpdateActivitySharingRequest, type UpdateNotificationPreferencesRequest, type UpdateProfileDiscoveryRequest, type UpdateProfilePrivacyRequest, type UpdateProfileRequest, type UpdateRoutineRequest, type UpdateRoutineVisibilityRequest, type UpdateSessionNotesRequest, type UpdateSessionNotesResponse, type UpdateTrainingPartnerPermissionsRequest, type UpsertRoutineTrainingBlockRequest, type UpsertSetLogRequest, type UpsertSetLogResponse, type UserId, type UserProfile, type UserSearchResponse, type VolumeTrendPoint, type VolumeTrendQuery, type VolumeTrendResponse, type VolumeTrendSeries, WEIGHT_UNITS, WORKOUT_SESSION_STATUSES, type WeightUnit, type WorkoutAnalyticsStatus, type WorkoutProgressQuery, type WorkoutProgressResponse, type WorkoutSession, type WorkoutSessionId, type WorkoutSessionListResponse, type WorkoutSessionRecap, type WorkoutSessionSnapshotV1, type WorkoutSessionStatus, type WorkoutSessionSummary, type WorkoutStatsQuery, type WorkoutStatsResponse, accountExportFileName, isWithinQuietHours, matchesDeletionConfirmation, routineDayLabel, sessionCorrectionWindow, setLogValuesDiffer };
package/dist/index.d.ts CHANGED
@@ -56,6 +56,12 @@ interface WorkoutSession {
56
56
  * substituted slot carry the substitute's `exerciseId`.
57
57
  */
58
58
  exerciseSubstitutions?: SessionExerciseSubstitution[];
59
+ /**
60
+ * LIVE-16: what the owner noted about one exercise in this workout. The
61
+ * routine's own note (`routineDay.exercises[].note`) is the standing
62
+ * instruction and is never written from a session.
63
+ */
64
+ exerciseNotes?: SessionExerciseNote[];
59
65
  reused?: boolean;
60
66
  routine?: {
61
67
  id: string;
@@ -177,6 +183,30 @@ interface SessionExerciseSubstitution {
177
183
  };
178
184
  substitutedAt: IsoDateString;
179
185
  }
186
+ declare const SESSION_NOTE_MAX_LENGTH = 2000;
187
+ declare const SESSION_EXERCISE_NOTE_MAX_LENGTH = 500;
188
+ /** One exercise's note for one workout, keyed by its routine slot. */
189
+ interface SessionExerciseNote {
190
+ /** The slot, as in `routineDay.exercises[].id`. */
191
+ routineExerciseId: string;
192
+ note: string;
193
+ }
194
+ /**
195
+ * Body of PUT /workouts/sessions/:id/notes. Partial: an omitted field keeps
196
+ * what is stored, `null` or an empty string clears it. Exercise notes merge
197
+ * by slot, so two notes saved moments apart cannot overwrite each other.
198
+ */
199
+ interface UpdateSessionNotesRequest {
200
+ notes?: string | null;
201
+ exerciseNotes?: Array<{
202
+ routineExerciseId: string;
203
+ note: string | null;
204
+ }>;
205
+ }
206
+ interface UpdateSessionNotesResponse {
207
+ notes: string | null;
208
+ exerciseNotes: SessionExerciseNote[];
209
+ }
180
210
  /** Body of PUT /workouts/sessions/:id/exercises/:routineExerciseId/substitution. */
181
211
  interface SubstituteSessionExerciseRequest {
182
212
  exerciseId: string;
@@ -236,10 +266,17 @@ interface WorkoutSessionRecap {
236
266
  totalVolumeKg: number;
237
267
  completedSets: number;
238
268
  notes?: string | null;
269
+ /** LIVE-16: exercise notes of this workout, named, in the day's order. */
270
+ exerciseNotes?: SessionRecapExerciseNote[];
239
271
  records: SessionRecapRecord[];
240
272
  progressionChanges: ProgressionChange[];
241
273
  previousSession: PreviousSessionRecap | null;
242
274
  }
275
+ interface SessionRecapExerciseNote {
276
+ routineExerciseId: string;
277
+ exerciseName: string;
278
+ note: string;
279
+ }
243
280
  /** Parts of a completed session's recap the owner may choose to share. */
244
281
  declare const SESSION_SHARE_FIELDS: readonly ["duration", "volume", "completedSets", "records", "progression", "notes"];
245
282
  type SessionShareField = (typeof SESSION_SHARE_FIELDS)[number];
@@ -294,6 +331,8 @@ interface SharedSessionRecap {
294
331
  records?: SessionRecapRecord[];
295
332
  progressionChanges?: ProgressionChange[];
296
333
  notes?: string | null;
334
+ /** LIVE-16: shared with the `notes` field. */
335
+ exerciseNotes?: SessionRecapExerciseNote[];
297
336
  }
298
337
  interface WorkoutSessionSummary {
299
338
  id: string;
@@ -2226,6 +2265,109 @@ interface DeleteActivityCommentResponse {
2226
2265
  summary: ActivityCommentSummary;
2227
2266
  }
2228
2267
 
2268
+ /**
2269
+ * LIVE-17. Correcting a finished workout: the owner fixes a mistyped weight,
2270
+ * reps or RPE, or a set left unticked, and everything the workout fed --
2271
+ * records, totals, achievements, its own load changes and the activity built
2272
+ * from them -- is re-derived from the corrected sets.
2273
+ *
2274
+ * Only the most recent completed workout can be corrected, for a bounded time
2275
+ * and until another workout starts, because the next workout is built on this
2276
+ * one: its "last time", the loads it prescribes and the records it is measured
2277
+ * against. Every saved correction is kept, with the values before and after.
2278
+ */
2279
+ /** How long after finishing a workout it can still be corrected. */
2280
+ declare const SESSION_CORRECTION_WINDOW_HOURS = 48;
2281
+ /** Saved corrections per workout, so the trail stays readable. */
2282
+ declare const SESSION_CORRECTIONS_MAX = 10;
2283
+ /**
2284
+ * Bounds a corrected value must respect. Weight is kilograms. The live logging
2285
+ * path is looser; a correction exists to replace an implausible value, so it
2286
+ * does not accept one.
2287
+ */
2288
+ declare const SESSION_CORRECTION_LIMITS: {
2289
+ readonly weightKgMax: 1500;
2290
+ readonly repsMax: 1000;
2291
+ readonly rpeMin: 0;
2292
+ readonly rpeMax: 10;
2293
+ };
2294
+ /** The four things a correction can change on one logged set. */
2295
+ interface SetLogValues {
2296
+ weight: number | null;
2297
+ reps: number | null;
2298
+ rpe: number | null;
2299
+ isCompleted: boolean;
2300
+ }
2301
+ /** One changed set, as it was and as it became. */
2302
+ interface SessionSetCorrection {
2303
+ setLogId: string;
2304
+ exerciseId: string;
2305
+ /** As named when the correction was saved. */
2306
+ exerciseName: string;
2307
+ setNumber: number;
2308
+ before: SetLogValues;
2309
+ after: SetLogValues;
2310
+ }
2311
+ /** One saved correction. Never edited or deleted once written. */
2312
+ interface SessionCorrection {
2313
+ id: string;
2314
+ createdAt: IsoDateString;
2315
+ changes: SessionSetCorrection[];
2316
+ }
2317
+ type SessionCorrectionClosedReason = "NOT_COMPLETED" | "NOT_LATEST" | "LATER_SESSION" | "WINDOW_PASSED" | "LIMIT_REACHED";
2318
+ /**
2319
+ * Whether the workout can be corrected now. `correctableUntil` is set only
2320
+ * while it can; `closedReason` says why it cannot.
2321
+ */
2322
+ interface SessionCorrectionWindow {
2323
+ correctableUntil: IsoDateString | null;
2324
+ closedReason: SessionCorrectionClosedReason | null;
2325
+ }
2326
+ /** GET /workouts/sessions/:id/corrections */
2327
+ interface SessionCorrectionsResponse {
2328
+ window: SessionCorrectionWindow;
2329
+ /** Oldest first. */
2330
+ corrections: SessionCorrection[];
2331
+ }
2332
+ interface CorrectSessionSetRequest extends SetLogValues {
2333
+ setLogId: string;
2334
+ }
2335
+ /**
2336
+ * POST /workouts/sessions/:id/corrections. Each set carries all four values
2337
+ * as they should now read; sets that end up unchanged are ignored, and a
2338
+ * request that changes nothing is refused.
2339
+ */
2340
+ interface CorrectSessionRequest {
2341
+ sets: CorrectSessionSetRequest[];
2342
+ }
2343
+ interface CorrectSessionResponse {
2344
+ correction: SessionCorrection;
2345
+ window: SessionCorrectionWindow;
2346
+ /**
2347
+ * Exercises whose load change from this workout was left as it is, because
2348
+ * the routine was edited after the workout and re-deriving it would undo
2349
+ * that edit.
2350
+ */
2351
+ progressionKept: Array<{
2352
+ exerciseId: string;
2353
+ exerciseName: string;
2354
+ }>;
2355
+ }
2356
+ /**
2357
+ * The window rule, shared so the server and the page state it the same way.
2358
+ * `isLatest` means no other completed workout ended later; `laterSessionStarted`
2359
+ * means any workout started after this one ended.
2360
+ */
2361
+ declare function sessionCorrectionWindow(input: {
2362
+ status: string;
2363
+ endedAt: IsoDateString | Date | null | undefined;
2364
+ isLatest: boolean;
2365
+ laterSessionStarted: boolean;
2366
+ correctionCount: number;
2367
+ }, now?: Date): SessionCorrectionWindow;
2368
+ /** Whether two sets of values differ in anything a correction records. */
2369
+ declare function setLogValuesDiffer(a: SetLogValues, b: SetLogValues): boolean;
2370
+
2229
2371
  /** SOC-08: one explicit grant from a member to their active training partner. */
2230
2372
  interface TrainingPartnerPermissions {
2231
2373
  schedule: boolean;
@@ -2710,6 +2852,10 @@ interface AccountExportV1 {
2710
2852
  };
2711
2853
  routines: AccountExportRoutine[];
2712
2854
  workouts: WorkoutSession[];
2855
+ /** LIVE-17: every saved correction of a workout, with its before and after values. */
2856
+ workoutCorrections: Array<SessionCorrection & {
2857
+ sessionId: string;
2858
+ }>;
2713
2859
  personalRecords: AccountExportPersonalRecord[];
2714
2860
  trainingEvents: AccountExportTrainingEvent[];
2715
2861
  goals: AccountExportGoal[];
@@ -2764,4 +2910,4 @@ interface AccountExportV1 {
2764
2910
  /** The file name a download of the export is saved under. */
2765
2911
  declare function accountExportFileName(username: string, exportedAt: string): string;
2766
2912
 
2767
- export { ACCOUNT_EXPORT_FORMAT, ACCOUNT_EXPORT_VERSION, ACHIEVEMENT_CATEGORIES, ACHIEVEMENT_DEFINITIONS, ACTIVITY_CAPS, ACTIVITY_COMMENTS_PAGE_SIZE, ACTIVITY_COMMENTS_PER_DAY_MAX, ACTIVITY_COMMENT_MAX_LENGTH, ACTIVITY_DEFAULT_AUDIENCE, ACTIVITY_ENTRY_ID_MAX_LENGTH, ACTIVITY_FEED_FOLLOWED_MAX, ACTIVITY_PAGE_DEFAULT_LIMIT, ACTIVITY_PAGE_MAX_LIMIT, ACTIVITY_PREVIEW_AUDIENCES, ACTIVITY_REACTIONS, ACTIVITY_TYPES, ACTIVITY_TYPE_SECTIONS, type AccountExportGoal, type AccountExportMember, type AccountExportPersonalRecord, type AccountExportRoutine, type AccountExportScheduleOverride, type AccountExportTrainingEvent, type AccountExportTrainingLocation, type AccountExportV1, type AchievementActivity, type AchievementCategory, type AchievementCategoryProgress, type AchievementDefinition, type AchievementNotification, type AchievementUnlockedEventPayload, type AchievementsResponse, type ActivityAudience, type ActivityCap, type ActivityComment, type ActivityCommentNotification, type ActivityCommentSummary, type ActivityCommentsQuery, type ActivityCommentsResponse, type ActivityEntry, type ActivityEntrySharing, type ActivityFeedResponse, type ActivityLink, type ActivityPage, type ActivityPageQuery, type ActivityPreviewAudience, type ActivityPreviewQuery, type ActivityReaction, type ActivityReactionSummary, type ActivitySection, type ActivitySharingSettings, type ActivityType, type AppNotification, BLOCKED_MEMBERS_MAX, type BlockedMember, type BlockedMembersResponse, type Brand, CLONE_ROUTINE_REFUSALS, COMEBACK_MIN_INACTIVE_DAYS, COMEBACK_RECOGNITION_LIMIT, COMEBACK_REQUIRED_ACTIVE_DAYS, COMEBACK_SESSION_LOOKBACK, COMEBACK_WINDOW_DAYS, type CalendarDate, type CloneRoutineRefusal, type CloneRoutineRequest, type ComebackActivity, type ComebackRecognition, type ComebackRecognitionSummary, type CreateActivityCommentRequest, type CreateActivityCommentResponse, type CreateReportRequest, type CreateReportResponse, type CreateRoutineDayInput, type CreateRoutineExerciseInput, type CreateRoutineRequest, type CreateRoutineVersionRequest, type CreateSessionShareRequest, type DeleteAccountRequest, type DeleteAccountResponse, type DeleteActivityCommentResponse, type DeletePushSubscriptionRequest, type DiscoverableRoutine, EXERCISE_EQUIPMENT, EXERCISE_MECHANICS, type EarnedAchievement, type EarnedPersonalRecord, type Exercise, type ExerciseEquipment, type ExerciseId, type ExerciseMechanic, type ExercisePerformanceHistoryQuery, type ExercisePerformanceHistoryResponse, type ExercisePerformancePrescription, type ExercisePerformancePrescriptionSet, type ExercisePerformanceSession, type ExercisePerformanceSet, type ExercisePerformanceSummary, type ExercisePlateau, type ExerciseStrengthSummary, type ExerciseStrengthTrendPoint, type ExerciseStrengthTrendQuery, type ExerciseStrengthTrendResponse, FEATURED_PROFILE_ITEMS_MAX, FEATURED_PROFILE_ITEM_KINDS, FEATURED_PROFILE_REFERENCE_MAX_LENGTH, FOLLOW_SUGGESTIONS_DEFAULT_LIMIT, FOLLOW_SUGGESTIONS_MAX_LIMIT, FOLLOW_SUGGESTION_REASONS, type FeaturedProfileAchievementItem, type FeaturedProfileItem, type FeaturedProfileItemKind, type FeaturedProfileRankItem, type FeaturedProfileRecordItem, type FeaturedProfileRoutineItem, type FeaturedProfileSelection, type FeaturedProfileSelectionInput, type FeaturedProfileSelectionsResponse, type FinishStatus, type FinishWorkoutRequest, type FinishWorkoutResponse, type FollowSuggestion, type FollowSuggestionReason, type FollowSuggestionsResponse, type IsoDateString, type ListSessionsParams, MEASURABLE_GOALS_MAX, MEASURABLE_GOAL_DIRECTIONS, MEASURABLE_GOAL_TYPES, MINUTES_IN_DAY, MODERATION_ACTION_KINDS, MODERATION_HISTORY_PAGE_SIZE, MODERATION_NOTE_MAX_LENGTH, MODERATION_QUEUE_PAGE_SIZE, MOVEMENT_PATTERNS, MUSCLE_GROUPS, type MarkNotificationsReadRequest, type MarkNotificationsReadResponse, type MeasurableGoal, type MeasurableGoalDirection, type MeasurableGoalExercise, type MeasurableGoalInput, type MeasurableGoalType, type MemberActivityResponse, type MemberModerationState, type MemberRoutinesResponse, type ModerationActionKind, type ModerationActionRecord, type ModerationHistoryQuery, type ModerationHistoryResponse, type ModerationQueueQuery, type ModerationQueueResponse, type ModerationReport, type ModeratorState, type MoveOccurrenceRequest, type MovementPattern, type MuscleGroup, type MuscleGroupHeatmapQuery, type MuscleGroupHeatmapResponse, type MuscleGroupHeatmapValue, type MuscleGroupHeatmapWeek, type MuscleVolumeTrendSeries, NOTIFICATIONS_LIST_LIMIT, NOTIFICATIONS_LOOKBACK_DAYS, NOTIFICATIONS_RETENTION_DAYS, NOTIFICATION_CATEGORIES, NOTIFICATION_KINDS, type NewFollowerNotification, type NotificationCategory, type NotificationKind, type NotificationPreferences, type NotificationPreferencesResponse, type NotificationsResponse, type OwnActivityEntry, type OwnActivityResponse, PLATEAU_MIN_DAYS_SINCE_BEST, PLATEAU_MIN_SESSIONS, PLATEAU_MIN_SESSIONS_MAX, PLATEAU_MIN_SESSIONS_MIN, PLATEAU_RECENT_DAYS, PLATEAU_WINDOW_DAYS, PREFERRED_TRAINING_STYLE_VALUES, PROFILE_BIO_MAX_LENGTH, PROFILE_FAVORITE_EXERCISES_MAX, PROFILE_LOCATION_MAX_LENGTH, PROFILE_TRAINING_DISCIPLINES_MAX, PROFILE_TRAINING_GOALS_MAX, PROFILE_VISIBILITY_VALUES, PROGRESSION_SCHEMES, PROGRESS_TIMELINE_EVENT_TYPES, PUSH_PAYLOAD_KINDS, PUSH_SUBSCRIPTIONS_MAX, type PaginatedResponse, type PersonalGoalProgress, type PersonalGoalsResponse, type PersonalRecordActivity, type PersonalRecordEntry, type PersonalRecordKind, type PlannedReminder, type PlatePairInventory, type PlateauPreferences, type PlateauSet, type PlateausResponse, type PreferredTrainingStyle, type PreviousPerformanceResponse, type PreviousSessionRecap, type PreviousSetPerformance, type ProfileDiscoverySettings, type ProfileFavoriteExercise, type ProfilePrivacySettings, type ProfileViewerAccess, type ProfileVisibility, type ProgressTimelineEventType, type ProgressTimelineItem, type ProgressTimelinePersonalRecordItem, type ProgressTimelineProgressionItem, type ProgressTimelineQuery, type ProgressTimelineRecordPerformance, type ProgressTimelineRecordReason, type ProgressTimelineResponse, type ProgressTimelineSessionContext, type ProgressionActivity, type ProgressionChange, type ProgressionRule, type ProgressionScheme, type ProgressionSetChange, type PublicBodyMetrics, type PublicProfileAchievements, type PublicTrainingSummary, type PublicUserProfile, type PushPayload, type PushPayloadKind, type PushSubscriptionKeys, type PushSubscriptionSummary, type PushSubscriptionsResponse, type QuietHours, RELATIONSHIP_LIST_DEFAULT_LIMIT, RELATIONSHIP_LIST_KINDS, RELATIONSHIP_LIST_MAX_LIMIT, RENAISSANCE_RANK_DEFINITIONS, REPORTS_PER_DAY_MAX, REPORT_DETAILS_MAX_LENGTH, REPORT_REASONS, REPORT_STATUSES, REPORT_SUBJECT_KINDS, REP_TYPES, RESERVED_USERNAMES, REST_ALERT_MAX_LEAD_SECONDS, REST_ALERT_MIN_LEAD_SECONDS, REST_ALERT_REFUSALS, ROUTINE_DAYS_MAX, ROUTINE_DAY_NAME_MAX, ROUTINE_DISCOVERY_DEFAULT_LIMIT, ROUTINE_DISCOVERY_MAX_LIMIT, ROUTINE_DISCOVERY_SCAN_LIMIT, ROUTINE_DURATION_BANDS, ROUTINE_DURATION_BAND_MAX_MINUTES, ROUTINE_SCHEDULE_MODES, ROUTINE_SHARE_MAX_ACTIVE_LINKS, ROUTINE_TRAINING_BLOCKS_MAX, ROUTINE_TRAINING_BLOCK_NAME_MAX, ROUTINE_TRAINING_BLOCK_REVISIONS_MAX, ROUTINE_TRAINING_BLOCK_SOURCE_KINDS, ROUTINE_TRAINING_BLOCK_STATES, ROUTINE_VERSIONS_MAX, ROUTINE_VERSION_KINDS, ROUTINE_VERSION_NAME_MAX, ROUTINE_VISIBILITY_VALUES, type RecentActivityEntry, type RegisterPushSubscriptionRequest, type RelationshipListKind, type RelationshipListQuery, type RelationshipListResponse, type RelationshipMember, type RenaissanceRankDefinition, type RenaissanceRankProgress, type RepType, type ReplaceFeaturedProfileItemsRequest, type ReplaceMeasurableGoalsRequest, type ReplaceTrainingLocationsRequest, type ReportReason, type ReportStatus, type ReportSubjectKind, type ReportSubjectPreview, type RestAlertPushPayload, type RestAlertRefusal, type RestoreRoutineVersionResponse, type ReviewReportRequest, type ReviewReportResponse, type Routine, type RoutineClassification, type RoutineDay, type RoutineDayId, type RoutineDiscoveryQuery, type RoutineDiscoveryResponse, type RoutineDurationBand, type RoutineExercise, type RoutineFacets, type RoutineId, type RoutineLineage, type RoutineScheduleMode, type RoutineSet, type RoutineShare, type RoutineShareListResponse, type RoutineSharedActivity, type RoutineTrainingBlock, type RoutineTrainingBlockRevision, type RoutineTrainingBlockRevisionsResponse, type RoutineTrainingBlockSource, type RoutineTrainingBlockSourceKind, type RoutineTrainingBlockState, type RoutineTrainingBlocksResponse, type RoutineVersion, type RoutineVersionDay, type RoutineVersionExercise, type RoutineVersionKind, type RoutineVersionSetup, type RoutineVersionsResponse, type RoutineVisibility, SCHEDULE_MOVE_MAX_DAYS, SCHEDULE_OVERRIDES_MAX_RANGE_DAYS, SCHEDULE_OVERRIDE_KINDS, SCHEDULE_SKIP_PAST_DAYS, SESSION_SHARE_DEFAULT_FIELDS, SESSION_SHARE_FIELDS, SESSION_SHARE_MAX_ACTIVE_LINKS, SEXES, SHARED_ROUTINE_SOURCES, STARRED_EXERCISES_MAX, STREAK_MAX_GAP_DAYS, type ScheduleOverride, type ScheduleOverrideKind, type ScheduleOverridesQuery, type ScheduleOverridesResponse, type ScheduleRestAlertRequest, type ScheduleRestAlertResponse, type SendTrainingPartnerEncouragementRequest, type SendTrainingPartnerEncouragementResponse, type SessionComparisonExercise, type SessionComparisonQuery, type SessionComparisonResponse, type SessionComparisonRoutineDay, type SessionComparisonSession, type SessionComparisonSet, type SessionCompletedActivity, type SessionExerciseSubstitution, type SessionProgressNotification, type SessionRecapRecord, type SessionShare, type SessionShareField, type SessionShareListResponse, type SetAccountTimeZoneRequest, type SetActivityEntryAudienceRequest, type SetActivityEntryAudienceResponse, type SetActivityReactionRequest, type SetActivityReactionResponse, type SetLog, type Sex, type SharedRoutine, type SharedRoutineOwner, type SharedRoutineSource, type SharedRoutineSummary, type SharedSessionOwner, type SharedSessionRecap, type SkipOccurrenceRequest, type StarredExercise, type StarredExercisesResponse, type StartWorkoutRequest, type StartWorkoutResponse, type StreakAtRiskPushPayload, type StreakMilestoneActivity, type StreakMilestoneEventPayload, type SubstituteSessionExerciseRequest, type SubstituteSessionExerciseResponse, type SupabaseAuthResponse, type SupabaseAuthUser, type SupabaseMigrationResponse, TRAINING_DISCIPLINE_VALUES, TRAINING_EVENT_TYPES, TRAINING_EXPERIENCE_LEVEL_VALUES, TRAINING_GOAL_VALUES, TRAINING_PARTNERSHIP_STATUSES, TRAINING_PARTNERS_MAX, TRAINING_PARTNER_ENCOURAGEMENTS_PER_24_HOURS_MAX, TRAINING_PARTNER_ENCOURAGEMENT_KINDS, TRAINING_PARTNER_PERMISSION_KEYS, TRAINING_PARTNER_REQUESTS_PER_DAY_MAX, type TrainingDiscipline, type TrainingEventType, type TrainingExperienceLevel, type TrainingGoal, type TrainingIdentity, type TrainingLocationPreference, type TrainingLocationPreferenceInput, type TrainingPartnerEncouragementKind, type TrainingPartnerEncouragementNotification, type TrainingPartnerPermissions, type TrainingPartnerScheduleDay, type TrainingPartnerScheduleResponse, type TrainingPartnership, type TrainingPartnershipStatus, type TrainingPartnershipsResponse, type TrainingReminderPreference, type TrainingReminderPushPayload, USERNAME_MAX_LENGTH, USERNAME_MIN_LENGTH, USERNAME_PATTERN_SOURCE, type UpdateActivitySharingRequest, type UpdateNotificationPreferencesRequest, type UpdateProfileDiscoveryRequest, type UpdateProfilePrivacyRequest, type UpdateProfileRequest, type UpdateRoutineRequest, type UpdateRoutineVisibilityRequest, type UpdateTrainingPartnerPermissionsRequest, type UpsertRoutineTrainingBlockRequest, type UpsertSetLogRequest, type UpsertSetLogResponse, type UserId, type UserProfile, type UserSearchResponse, type VolumeTrendPoint, type VolumeTrendQuery, type VolumeTrendResponse, type VolumeTrendSeries, WEIGHT_UNITS, WORKOUT_SESSION_STATUSES, type WeightUnit, type WorkoutAnalyticsStatus, type WorkoutProgressQuery, type WorkoutProgressResponse, type WorkoutSession, type WorkoutSessionId, type WorkoutSessionListResponse, type WorkoutSessionRecap, type WorkoutSessionSnapshotV1, type WorkoutSessionStatus, type WorkoutSessionSummary, type WorkoutStatsQuery, type WorkoutStatsResponse, accountExportFileName, isWithinQuietHours, matchesDeletionConfirmation, routineDayLabel };
2913
+ export { ACCOUNT_EXPORT_FORMAT, ACCOUNT_EXPORT_VERSION, ACHIEVEMENT_CATEGORIES, ACHIEVEMENT_DEFINITIONS, ACTIVITY_CAPS, ACTIVITY_COMMENTS_PAGE_SIZE, ACTIVITY_COMMENTS_PER_DAY_MAX, ACTIVITY_COMMENT_MAX_LENGTH, ACTIVITY_DEFAULT_AUDIENCE, ACTIVITY_ENTRY_ID_MAX_LENGTH, ACTIVITY_FEED_FOLLOWED_MAX, ACTIVITY_PAGE_DEFAULT_LIMIT, ACTIVITY_PAGE_MAX_LIMIT, ACTIVITY_PREVIEW_AUDIENCES, ACTIVITY_REACTIONS, ACTIVITY_TYPES, ACTIVITY_TYPE_SECTIONS, type AccountExportGoal, type AccountExportMember, type AccountExportPersonalRecord, type AccountExportRoutine, type AccountExportScheduleOverride, type AccountExportTrainingEvent, type AccountExportTrainingLocation, type AccountExportV1, type AchievementActivity, type AchievementCategory, type AchievementCategoryProgress, type AchievementDefinition, type AchievementNotification, type AchievementUnlockedEventPayload, type AchievementsResponse, type ActivityAudience, type ActivityCap, type ActivityComment, type ActivityCommentNotification, type ActivityCommentSummary, type ActivityCommentsQuery, type ActivityCommentsResponse, type ActivityEntry, type ActivityEntrySharing, type ActivityFeedResponse, type ActivityLink, type ActivityPage, type ActivityPageQuery, type ActivityPreviewAudience, type ActivityPreviewQuery, type ActivityReaction, type ActivityReactionSummary, type ActivitySection, type ActivitySharingSettings, type ActivityType, type AppNotification, BLOCKED_MEMBERS_MAX, type BlockedMember, type BlockedMembersResponse, type Brand, CLONE_ROUTINE_REFUSALS, COMEBACK_MIN_INACTIVE_DAYS, COMEBACK_RECOGNITION_LIMIT, COMEBACK_REQUIRED_ACTIVE_DAYS, COMEBACK_SESSION_LOOKBACK, COMEBACK_WINDOW_DAYS, type CalendarDate, type CloneRoutineRefusal, type CloneRoutineRequest, type ComebackActivity, type ComebackRecognition, type ComebackRecognitionSummary, type CorrectSessionRequest, type CorrectSessionResponse, type CorrectSessionSetRequest, type CreateActivityCommentRequest, type CreateActivityCommentResponse, type CreateReportRequest, type CreateReportResponse, type CreateRoutineDayInput, type CreateRoutineExerciseInput, type CreateRoutineRequest, type CreateRoutineVersionRequest, type CreateSessionShareRequest, type DeleteAccountRequest, type DeleteAccountResponse, type DeleteActivityCommentResponse, type DeletePushSubscriptionRequest, type DiscoverableRoutine, EXERCISE_EQUIPMENT, EXERCISE_MECHANICS, type EarnedAchievement, type EarnedPersonalRecord, type Exercise, type ExerciseEquipment, type ExerciseId, type ExerciseMechanic, type ExercisePerformanceHistoryQuery, type ExercisePerformanceHistoryResponse, type ExercisePerformancePrescription, type ExercisePerformancePrescriptionSet, type ExercisePerformanceSession, type ExercisePerformanceSet, type ExercisePerformanceSummary, type ExercisePlateau, type ExerciseStrengthSummary, type ExerciseStrengthTrendPoint, type ExerciseStrengthTrendQuery, type ExerciseStrengthTrendResponse, FEATURED_PROFILE_ITEMS_MAX, FEATURED_PROFILE_ITEM_KINDS, FEATURED_PROFILE_REFERENCE_MAX_LENGTH, FOLLOW_SUGGESTIONS_DEFAULT_LIMIT, FOLLOW_SUGGESTIONS_MAX_LIMIT, FOLLOW_SUGGESTION_REASONS, type FeaturedProfileAchievementItem, type FeaturedProfileItem, type FeaturedProfileItemKind, type FeaturedProfileRankItem, type FeaturedProfileRecordItem, type FeaturedProfileRoutineItem, type FeaturedProfileSelection, type FeaturedProfileSelectionInput, type FeaturedProfileSelectionsResponse, type FinishStatus, type FinishWorkoutRequest, type FinishWorkoutResponse, type FollowSuggestion, type FollowSuggestionReason, type FollowSuggestionsResponse, type IsoDateString, type ListSessionsParams, MEASURABLE_GOALS_MAX, MEASURABLE_GOAL_DIRECTIONS, MEASURABLE_GOAL_TYPES, MINUTES_IN_DAY, MODERATION_ACTION_KINDS, MODERATION_HISTORY_PAGE_SIZE, MODERATION_NOTE_MAX_LENGTH, MODERATION_QUEUE_PAGE_SIZE, MOVEMENT_PATTERNS, MUSCLE_GROUPS, type MarkNotificationsReadRequest, type MarkNotificationsReadResponse, type MeasurableGoal, type MeasurableGoalDirection, type MeasurableGoalExercise, type MeasurableGoalInput, type MeasurableGoalType, type MemberActivityResponse, type MemberModerationState, type MemberRoutinesResponse, type ModerationActionKind, type ModerationActionRecord, type ModerationHistoryQuery, type ModerationHistoryResponse, type ModerationQueueQuery, type ModerationQueueResponse, type ModerationReport, type ModeratorState, type MoveOccurrenceRequest, type MovementPattern, type MuscleGroup, type MuscleGroupHeatmapQuery, type MuscleGroupHeatmapResponse, type MuscleGroupHeatmapValue, type MuscleGroupHeatmapWeek, type MuscleVolumeTrendSeries, NOTIFICATIONS_LIST_LIMIT, NOTIFICATIONS_LOOKBACK_DAYS, NOTIFICATIONS_RETENTION_DAYS, NOTIFICATION_CATEGORIES, NOTIFICATION_KINDS, type NewFollowerNotification, type NotificationCategory, type NotificationKind, type NotificationPreferences, type NotificationPreferencesResponse, type NotificationsResponse, type OwnActivityEntry, type OwnActivityResponse, PLATEAU_MIN_DAYS_SINCE_BEST, PLATEAU_MIN_SESSIONS, PLATEAU_MIN_SESSIONS_MAX, PLATEAU_MIN_SESSIONS_MIN, PLATEAU_RECENT_DAYS, PLATEAU_WINDOW_DAYS, PREFERRED_TRAINING_STYLE_VALUES, PROFILE_BIO_MAX_LENGTH, PROFILE_FAVORITE_EXERCISES_MAX, PROFILE_LOCATION_MAX_LENGTH, PROFILE_TRAINING_DISCIPLINES_MAX, PROFILE_TRAINING_GOALS_MAX, PROFILE_VISIBILITY_VALUES, PROGRESSION_SCHEMES, PROGRESS_TIMELINE_EVENT_TYPES, PUSH_PAYLOAD_KINDS, PUSH_SUBSCRIPTIONS_MAX, type PaginatedResponse, type PersonalGoalProgress, type PersonalGoalsResponse, type PersonalRecordActivity, type PersonalRecordEntry, type PersonalRecordKind, type PlannedReminder, type PlatePairInventory, type PlateauPreferences, type PlateauSet, type PlateausResponse, type PreferredTrainingStyle, type PreviousPerformanceResponse, type PreviousSessionRecap, type PreviousSetPerformance, type ProfileDiscoverySettings, type ProfileFavoriteExercise, type ProfilePrivacySettings, type ProfileViewerAccess, type ProfileVisibility, type ProgressTimelineEventType, type ProgressTimelineItem, type ProgressTimelinePersonalRecordItem, type ProgressTimelineProgressionItem, type ProgressTimelineQuery, type ProgressTimelineRecordPerformance, type ProgressTimelineRecordReason, type ProgressTimelineResponse, type ProgressTimelineSessionContext, type ProgressionActivity, type ProgressionChange, type ProgressionRule, type ProgressionScheme, type ProgressionSetChange, type PublicBodyMetrics, type PublicProfileAchievements, type PublicTrainingSummary, type PublicUserProfile, type PushPayload, type PushPayloadKind, type PushSubscriptionKeys, type PushSubscriptionSummary, type PushSubscriptionsResponse, type QuietHours, RELATIONSHIP_LIST_DEFAULT_LIMIT, RELATIONSHIP_LIST_KINDS, RELATIONSHIP_LIST_MAX_LIMIT, RENAISSANCE_RANK_DEFINITIONS, REPORTS_PER_DAY_MAX, REPORT_DETAILS_MAX_LENGTH, REPORT_REASONS, REPORT_STATUSES, REPORT_SUBJECT_KINDS, REP_TYPES, RESERVED_USERNAMES, REST_ALERT_MAX_LEAD_SECONDS, REST_ALERT_MIN_LEAD_SECONDS, REST_ALERT_REFUSALS, ROUTINE_DAYS_MAX, ROUTINE_DAY_NAME_MAX, ROUTINE_DISCOVERY_DEFAULT_LIMIT, ROUTINE_DISCOVERY_MAX_LIMIT, ROUTINE_DISCOVERY_SCAN_LIMIT, ROUTINE_DURATION_BANDS, ROUTINE_DURATION_BAND_MAX_MINUTES, ROUTINE_SCHEDULE_MODES, ROUTINE_SHARE_MAX_ACTIVE_LINKS, ROUTINE_TRAINING_BLOCKS_MAX, ROUTINE_TRAINING_BLOCK_NAME_MAX, ROUTINE_TRAINING_BLOCK_REVISIONS_MAX, ROUTINE_TRAINING_BLOCK_SOURCE_KINDS, ROUTINE_TRAINING_BLOCK_STATES, ROUTINE_VERSIONS_MAX, ROUTINE_VERSION_KINDS, ROUTINE_VERSION_NAME_MAX, ROUTINE_VISIBILITY_VALUES, type RecentActivityEntry, type RegisterPushSubscriptionRequest, type RelationshipListKind, type RelationshipListQuery, type RelationshipListResponse, type RelationshipMember, type RenaissanceRankDefinition, type RenaissanceRankProgress, type RepType, type ReplaceFeaturedProfileItemsRequest, type ReplaceMeasurableGoalsRequest, type ReplaceTrainingLocationsRequest, type ReportReason, type ReportStatus, type ReportSubjectKind, type ReportSubjectPreview, type RestAlertPushPayload, type RestAlertRefusal, type RestoreRoutineVersionResponse, type ReviewReportRequest, type ReviewReportResponse, type Routine, type RoutineClassification, type RoutineDay, type RoutineDayId, type RoutineDiscoveryQuery, type RoutineDiscoveryResponse, type RoutineDurationBand, type RoutineExercise, type RoutineFacets, type RoutineId, type RoutineLineage, type RoutineScheduleMode, type RoutineSet, type RoutineShare, type RoutineShareListResponse, type RoutineSharedActivity, type RoutineTrainingBlock, type RoutineTrainingBlockRevision, type RoutineTrainingBlockRevisionsResponse, type RoutineTrainingBlockSource, type RoutineTrainingBlockSourceKind, type RoutineTrainingBlockState, type RoutineTrainingBlocksResponse, type RoutineVersion, type RoutineVersionDay, type RoutineVersionExercise, type RoutineVersionKind, type RoutineVersionSetup, type RoutineVersionsResponse, type RoutineVisibility, SCHEDULE_MOVE_MAX_DAYS, SCHEDULE_OVERRIDES_MAX_RANGE_DAYS, SCHEDULE_OVERRIDE_KINDS, SCHEDULE_SKIP_PAST_DAYS, SESSION_CORRECTIONS_MAX, SESSION_CORRECTION_LIMITS, SESSION_CORRECTION_WINDOW_HOURS, SESSION_EXERCISE_NOTE_MAX_LENGTH, SESSION_NOTE_MAX_LENGTH, SESSION_SHARE_DEFAULT_FIELDS, SESSION_SHARE_FIELDS, SESSION_SHARE_MAX_ACTIVE_LINKS, SEXES, SHARED_ROUTINE_SOURCES, STARRED_EXERCISES_MAX, STREAK_MAX_GAP_DAYS, type ScheduleOverride, type ScheduleOverrideKind, type ScheduleOverridesQuery, type ScheduleOverridesResponse, type ScheduleRestAlertRequest, type ScheduleRestAlertResponse, type SendTrainingPartnerEncouragementRequest, type SendTrainingPartnerEncouragementResponse, type SessionComparisonExercise, type SessionComparisonQuery, type SessionComparisonResponse, type SessionComparisonRoutineDay, type SessionComparisonSession, type SessionComparisonSet, type SessionCompletedActivity, type SessionCorrection, type SessionCorrectionClosedReason, type SessionCorrectionWindow, type SessionCorrectionsResponse, type SessionExerciseNote, type SessionExerciseSubstitution, type SessionProgressNotification, type SessionRecapExerciseNote, type SessionRecapRecord, type SessionSetCorrection, type SessionShare, type SessionShareField, type SessionShareListResponse, type SetAccountTimeZoneRequest, type SetActivityEntryAudienceRequest, type SetActivityEntryAudienceResponse, type SetActivityReactionRequest, type SetActivityReactionResponse, type SetLog, type SetLogValues, type Sex, type SharedRoutine, type SharedRoutineOwner, type SharedRoutineSource, type SharedRoutineSummary, type SharedSessionOwner, type SharedSessionRecap, type SkipOccurrenceRequest, type StarredExercise, type StarredExercisesResponse, type StartWorkoutRequest, type StartWorkoutResponse, type StreakAtRiskPushPayload, type StreakMilestoneActivity, type StreakMilestoneEventPayload, type SubstituteSessionExerciseRequest, type SubstituteSessionExerciseResponse, type SupabaseAuthResponse, type SupabaseAuthUser, type SupabaseMigrationResponse, TRAINING_DISCIPLINE_VALUES, TRAINING_EVENT_TYPES, TRAINING_EXPERIENCE_LEVEL_VALUES, TRAINING_GOAL_VALUES, TRAINING_PARTNERSHIP_STATUSES, TRAINING_PARTNERS_MAX, TRAINING_PARTNER_ENCOURAGEMENTS_PER_24_HOURS_MAX, TRAINING_PARTNER_ENCOURAGEMENT_KINDS, TRAINING_PARTNER_PERMISSION_KEYS, TRAINING_PARTNER_REQUESTS_PER_DAY_MAX, type TrainingDiscipline, type TrainingEventType, type TrainingExperienceLevel, type TrainingGoal, type TrainingIdentity, type TrainingLocationPreference, type TrainingLocationPreferenceInput, type TrainingPartnerEncouragementKind, type TrainingPartnerEncouragementNotification, type TrainingPartnerPermissions, type TrainingPartnerScheduleDay, type TrainingPartnerScheduleResponse, type TrainingPartnership, type TrainingPartnershipStatus, type TrainingPartnershipsResponse, type TrainingReminderPreference, type TrainingReminderPushPayload, USERNAME_MAX_LENGTH, USERNAME_MIN_LENGTH, USERNAME_PATTERN_SOURCE, type UpdateActivitySharingRequest, type UpdateNotificationPreferencesRequest, type UpdateProfileDiscoveryRequest, type UpdateProfilePrivacyRequest, type UpdateProfileRequest, type UpdateRoutineRequest, type UpdateRoutineVisibilityRequest, type UpdateSessionNotesRequest, type UpdateSessionNotesResponse, type UpdateTrainingPartnerPermissionsRequest, type UpsertRoutineTrainingBlockRequest, type UpsertSetLogRequest, type UpsertSetLogResponse, type UserId, type UserProfile, type UserSearchResponse, type VolumeTrendPoint, type VolumeTrendQuery, type VolumeTrendResponse, type VolumeTrendSeries, WEIGHT_UNITS, WORKOUT_SESSION_STATUSES, type WeightUnit, type WorkoutAnalyticsStatus, type WorkoutProgressQuery, type WorkoutProgressResponse, type WorkoutSession, type WorkoutSessionId, type WorkoutSessionListResponse, type WorkoutSessionRecap, type WorkoutSessionSnapshotV1, type WorkoutSessionStatus, type WorkoutSessionSummary, type WorkoutStatsQuery, type WorkoutStatsResponse, accountExportFileName, isWithinQuietHours, matchesDeletionConfirmation, routineDayLabel, sessionCorrectionWindow, setLogValuesDiffer };
package/dist/index.js CHANGED
@@ -429,6 +429,8 @@ var SCHEDULE_SKIP_PAST_DAYS = 6;
429
429
  var SCHEDULE_OVERRIDES_MAX_RANGE_DAYS = 62;
430
430
 
431
431
  // src/workout.ts
432
+ var SESSION_NOTE_MAX_LENGTH = 2e3;
433
+ var SESSION_EXERCISE_NOTE_MAX_LENGTH = 500;
432
434
  var SESSION_SHARE_FIELDS = [
433
435
  "duration",
434
436
  "volume",
@@ -445,6 +447,33 @@ var SESSION_SHARE_DEFAULT_FIELDS = [
445
447
  ];
446
448
  var SESSION_SHARE_MAX_ACTIVE_LINKS = 10;
447
449
 
450
+ // src/session-corrections.ts
451
+ var SESSION_CORRECTION_WINDOW_HOURS = 48;
452
+ var SESSION_CORRECTIONS_MAX = 10;
453
+ var SESSION_CORRECTION_LIMITS = {
454
+ weightKgMax: 1500,
455
+ repsMax: 1e3,
456
+ rpeMin: 0,
457
+ rpeMax: 10
458
+ };
459
+ function sessionCorrectionWindow(input, now = /* @__PURE__ */ new Date()) {
460
+ const closed = (closedReason) => ({ correctableUntil: null, closedReason });
461
+ if (input.status !== "COMPLETED" || !input.endedAt)
462
+ return closed("NOT_COMPLETED");
463
+ if (!input.isLatest) return closed("NOT_LATEST");
464
+ if (input.laterSessionStarted) return closed("LATER_SESSION");
465
+ const until = new Date(
466
+ new Date(input.endedAt).getTime() + SESSION_CORRECTION_WINDOW_HOURS * 3600 * 1e3
467
+ );
468
+ if (now.getTime() >= until.getTime()) return closed("WINDOW_PASSED");
469
+ if (input.correctionCount >= SESSION_CORRECTIONS_MAX)
470
+ return closed("LIMIT_REACHED");
471
+ return { correctableUntil: until.toISOString(), closedReason: null };
472
+ }
473
+ function setLogValuesDiffer(a, b) {
474
+ return a.weight !== b.weight || a.reps !== b.reps || a.rpe !== b.rpe || a.isCompleted !== b.isCompleted;
475
+ }
476
+
448
477
  // src/analytics.ts
449
478
  var TRAINING_EVENT_TYPES = [
450
479
  "SESSION_COMPLETED",
@@ -649,6 +678,11 @@ export {
649
678
  SCHEDULE_OVERRIDES_MAX_RANGE_DAYS,
650
679
  SCHEDULE_OVERRIDE_KINDS,
651
680
  SCHEDULE_SKIP_PAST_DAYS,
681
+ SESSION_CORRECTIONS_MAX,
682
+ SESSION_CORRECTION_LIMITS,
683
+ SESSION_CORRECTION_WINDOW_HOURS,
684
+ SESSION_EXERCISE_NOTE_MAX_LENGTH,
685
+ SESSION_NOTE_MAX_LENGTH,
652
686
  SESSION_SHARE_DEFAULT_FIELDS,
653
687
  SESSION_SHARE_FIELDS,
654
688
  SESSION_SHARE_MAX_ACTIVE_LINKS,
@@ -674,5 +708,7 @@ export {
674
708
  accountExportFileName,
675
709
  isWithinQuietHours,
676
710
  matchesDeletionConfirmation,
677
- routineDayLabel
711
+ routineDayLabel,
712
+ sessionCorrectionWindow,
713
+ setLogValuesDiffer
678
714
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sunsteel/contracts",
3
- "version": "0.61.0",
3
+ "version": "0.63.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ezee969/sunsteel-contracts.git"