@sunsteel/contracts 0.9.0 → 0.11.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
@@ -24,6 +24,7 @@ __export(index_exports, {
24
24
  PROGRESSION_SCHEMES: () => PROGRESSION_SCHEMES,
25
25
  REP_TYPES: () => REP_TYPES,
26
26
  SEXES: () => SEXES,
27
+ TRAINING_EVENT_TYPES: () => TRAINING_EVENT_TYPES,
27
28
  WEIGHT_UNITS: () => WEIGHT_UNITS,
28
29
  WORKOUT_SESSION_STATUSES: () => WORKOUT_SESSION_STATUSES
29
30
  });
@@ -62,12 +63,20 @@ var MUSCLE_GROUPS = [
62
63
  "CORE",
63
64
  "ADDUCTOR"
64
65
  ];
66
+
67
+ // src/analytics.ts
68
+ var TRAINING_EVENT_TYPES = [
69
+ "SESSION_COMPLETED",
70
+ "PERSONAL_RECORD",
71
+ "PROGRESSION_CHANGED"
72
+ ];
65
73
  // Annotate the CommonJS export names for ESM import in node:
66
74
  0 && (module.exports = {
67
75
  MUSCLE_GROUPS,
68
76
  PROGRESSION_SCHEMES,
69
77
  REP_TYPES,
70
78
  SEXES,
79
+ TRAINING_EVENT_TYPES,
71
80
  WEIGHT_UNITS,
72
81
  WORKOUT_SESSION_STATUSES
73
82
  });
package/dist/index.d.cts CHANGED
@@ -62,6 +62,31 @@ interface UpdateProfileRequest {
62
62
  height?: number | null;
63
63
  weightUnit?: WeightUnit;
64
64
  }
65
+ interface PlatePairInventory {
66
+ weightKg: number;
67
+ pairCount: number;
68
+ }
69
+ interface TrainingLocationPreference {
70
+ id: string;
71
+ name: string;
72
+ isDefault: boolean;
73
+ barWeightKg: number;
74
+ availablePlatePairs: PlatePairInventory[];
75
+ equipment: string[];
76
+ createdAt: IsoDateString;
77
+ updatedAt: IsoDateString;
78
+ }
79
+ interface TrainingLocationPreferenceInput {
80
+ id?: string;
81
+ name: string;
82
+ isDefault: boolean;
83
+ barWeightKg: number;
84
+ availablePlatePairs: PlatePairInventory[];
85
+ equipment: string[];
86
+ }
87
+ interface ReplaceTrainingLocationsRequest {
88
+ locations: TrainingLocationPreferenceInput[];
89
+ }
65
90
  interface UserSearchResponse {
66
91
  id: string;
67
92
  email: string;
@@ -261,6 +286,29 @@ interface FinishWorkoutRequest {
261
286
  status: FinishStatus;
262
287
  notes?: string;
263
288
  }
289
+ type ProgressionRule = 'ALL_SETS_REACHED_TARGET' | 'SET_REACHED_TARGET';
290
+ interface ProgressionSetChange {
291
+ setNumber: number;
292
+ targetReps: number;
293
+ performedReps: number;
294
+ previousWeightKg: number;
295
+ newWeightKg: number;
296
+ }
297
+ /** An automatic prescription update produced while completing a session. */
298
+ interface ProgressionChange {
299
+ routineExerciseId: string;
300
+ exerciseId: string;
301
+ exerciseName: string;
302
+ progressionScheme: Extract<ProgressionScheme, 'DOUBLE_PROGRESSION' | 'DYNAMIC_DOUBLE_PROGRESSION'>;
303
+ rule: ProgressionRule;
304
+ minWeightIncrementKg: number;
305
+ sets: ProgressionSetChange[];
306
+ }
307
+ /** Stable successful response of PATCH /workouts/sessions/:id/finish. */
308
+ interface FinishWorkoutResponse {
309
+ session: WorkoutSession;
310
+ progressionChanges: ProgressionChange[];
311
+ }
264
312
  interface UpsertSetLogRequest {
265
313
  routineExerciseId: string;
266
314
  exerciseId: string;
@@ -325,6 +373,8 @@ interface WorkoutStatsResponse {
325
373
  activeDaysThisWeek: number;
326
374
  }
327
375
 
376
+ declare const TRAINING_EVENT_TYPES: readonly ["SESSION_COMPLETED", "PERSONAL_RECORD", "PROGRESSION_CHANGED"];
377
+ type TrainingEventType = (typeof TRAINING_EVENT_TYPES)[number];
328
378
  /** Stable successful response of GET /workouts/progress. */
329
379
  interface WorkoutProgressQuery {
330
380
  timeZone: string;
@@ -379,4 +429,4 @@ interface WorkoutAnalyticsStatus {
379
429
  generationId: string | null;
380
430
  }
381
431
 
382
- export { type Brand, type CreateRoutineDayInput, type CreateRoutineExerciseInput, type CreateRoutineRequest, type EarnedPersonalRecord, type Exercise, type ExerciseId, type FinishStatus, type FinishWorkoutRequest, type IsoDateString, type ListSessionsParams, MUSCLE_GROUPS, type MuscleGroup, PROGRESSION_SCHEMES, type PaginatedResponse, type PersonalRecordEntry, type PersonalRecordKind, type PreviousPerformanceResponse, type PreviousSetPerformance, type ProgressionScheme, type PublicUserProfile, REP_TYPES, type RecentActivityEntry, type RepType, type Routine, type RoutineDay, type RoutineDayId, type RoutineExercise, type RoutineId, type RoutineSet, SEXES, type SetAccountTimeZoneRequest, type SetLog, type Sex, type StartWorkoutRequest, type StartWorkoutResponse, type SupabaseAuthResponse, type SupabaseAuthUser, type SupabaseMigrationResponse, type UpdateProfileRequest, type UpdateRoutineRequest, type UpsertSetLogRequest, type UpsertSetLogResponse, type UserId, type UserProfile, type UserSearchResponse, WEIGHT_UNITS, WORKOUT_SESSION_STATUSES, type WeightUnit, type WorkoutAnalyticsStatus, type WorkoutProgressQuery, type WorkoutProgressResponse, type WorkoutSession, type WorkoutSessionId, type WorkoutSessionListResponse, type WorkoutSessionSnapshotV1, type WorkoutSessionStatus, type WorkoutSessionSummary, type WorkoutStatsQuery, type WorkoutStatsResponse };
432
+ export { type Brand, type CreateRoutineDayInput, type CreateRoutineExerciseInput, type CreateRoutineRequest, type EarnedPersonalRecord, type Exercise, type ExerciseId, type FinishStatus, type FinishWorkoutRequest, type FinishWorkoutResponse, type IsoDateString, type ListSessionsParams, MUSCLE_GROUPS, type MuscleGroup, PROGRESSION_SCHEMES, type PaginatedResponse, type PersonalRecordEntry, type PersonalRecordKind, type PlatePairInventory, type PreviousPerformanceResponse, type PreviousSetPerformance, type ProgressionChange, type ProgressionRule, type ProgressionScheme, type ProgressionSetChange, type PublicUserProfile, REP_TYPES, type RecentActivityEntry, type RepType, type ReplaceTrainingLocationsRequest, type Routine, type RoutineDay, type RoutineDayId, type RoutineExercise, type RoutineId, type RoutineSet, SEXES, type SetAccountTimeZoneRequest, type SetLog, type Sex, type StartWorkoutRequest, type StartWorkoutResponse, type SupabaseAuthResponse, type SupabaseAuthUser, type SupabaseMigrationResponse, TRAINING_EVENT_TYPES, type TrainingEventType, type TrainingLocationPreference, type TrainingLocationPreferenceInput, type UpdateProfileRequest, type UpdateRoutineRequest, type UpsertSetLogRequest, type UpsertSetLogResponse, type UserId, type UserProfile, type UserSearchResponse, WEIGHT_UNITS, WORKOUT_SESSION_STATUSES, type WeightUnit, type WorkoutAnalyticsStatus, type WorkoutProgressQuery, type WorkoutProgressResponse, type WorkoutSession, type WorkoutSessionId, type WorkoutSessionListResponse, type WorkoutSessionSnapshotV1, type WorkoutSessionStatus, type WorkoutSessionSummary, type WorkoutStatsQuery, type WorkoutStatsResponse };
package/dist/index.d.ts CHANGED
@@ -62,6 +62,31 @@ interface UpdateProfileRequest {
62
62
  height?: number | null;
63
63
  weightUnit?: WeightUnit;
64
64
  }
65
+ interface PlatePairInventory {
66
+ weightKg: number;
67
+ pairCount: number;
68
+ }
69
+ interface TrainingLocationPreference {
70
+ id: string;
71
+ name: string;
72
+ isDefault: boolean;
73
+ barWeightKg: number;
74
+ availablePlatePairs: PlatePairInventory[];
75
+ equipment: string[];
76
+ createdAt: IsoDateString;
77
+ updatedAt: IsoDateString;
78
+ }
79
+ interface TrainingLocationPreferenceInput {
80
+ id?: string;
81
+ name: string;
82
+ isDefault: boolean;
83
+ barWeightKg: number;
84
+ availablePlatePairs: PlatePairInventory[];
85
+ equipment: string[];
86
+ }
87
+ interface ReplaceTrainingLocationsRequest {
88
+ locations: TrainingLocationPreferenceInput[];
89
+ }
65
90
  interface UserSearchResponse {
66
91
  id: string;
67
92
  email: string;
@@ -261,6 +286,29 @@ interface FinishWorkoutRequest {
261
286
  status: FinishStatus;
262
287
  notes?: string;
263
288
  }
289
+ type ProgressionRule = 'ALL_SETS_REACHED_TARGET' | 'SET_REACHED_TARGET';
290
+ interface ProgressionSetChange {
291
+ setNumber: number;
292
+ targetReps: number;
293
+ performedReps: number;
294
+ previousWeightKg: number;
295
+ newWeightKg: number;
296
+ }
297
+ /** An automatic prescription update produced while completing a session. */
298
+ interface ProgressionChange {
299
+ routineExerciseId: string;
300
+ exerciseId: string;
301
+ exerciseName: string;
302
+ progressionScheme: Extract<ProgressionScheme, 'DOUBLE_PROGRESSION' | 'DYNAMIC_DOUBLE_PROGRESSION'>;
303
+ rule: ProgressionRule;
304
+ minWeightIncrementKg: number;
305
+ sets: ProgressionSetChange[];
306
+ }
307
+ /** Stable successful response of PATCH /workouts/sessions/:id/finish. */
308
+ interface FinishWorkoutResponse {
309
+ session: WorkoutSession;
310
+ progressionChanges: ProgressionChange[];
311
+ }
264
312
  interface UpsertSetLogRequest {
265
313
  routineExerciseId: string;
266
314
  exerciseId: string;
@@ -325,6 +373,8 @@ interface WorkoutStatsResponse {
325
373
  activeDaysThisWeek: number;
326
374
  }
327
375
 
376
+ declare const TRAINING_EVENT_TYPES: readonly ["SESSION_COMPLETED", "PERSONAL_RECORD", "PROGRESSION_CHANGED"];
377
+ type TrainingEventType = (typeof TRAINING_EVENT_TYPES)[number];
328
378
  /** Stable successful response of GET /workouts/progress. */
329
379
  interface WorkoutProgressQuery {
330
380
  timeZone: string;
@@ -379,4 +429,4 @@ interface WorkoutAnalyticsStatus {
379
429
  generationId: string | null;
380
430
  }
381
431
 
382
- export { type Brand, type CreateRoutineDayInput, type CreateRoutineExerciseInput, type CreateRoutineRequest, type EarnedPersonalRecord, type Exercise, type ExerciseId, type FinishStatus, type FinishWorkoutRequest, type IsoDateString, type ListSessionsParams, MUSCLE_GROUPS, type MuscleGroup, PROGRESSION_SCHEMES, type PaginatedResponse, type PersonalRecordEntry, type PersonalRecordKind, type PreviousPerformanceResponse, type PreviousSetPerformance, type ProgressionScheme, type PublicUserProfile, REP_TYPES, type RecentActivityEntry, type RepType, type Routine, type RoutineDay, type RoutineDayId, type RoutineExercise, type RoutineId, type RoutineSet, SEXES, type SetAccountTimeZoneRequest, type SetLog, type Sex, type StartWorkoutRequest, type StartWorkoutResponse, type SupabaseAuthResponse, type SupabaseAuthUser, type SupabaseMigrationResponse, type UpdateProfileRequest, type UpdateRoutineRequest, type UpsertSetLogRequest, type UpsertSetLogResponse, type UserId, type UserProfile, type UserSearchResponse, WEIGHT_UNITS, WORKOUT_SESSION_STATUSES, type WeightUnit, type WorkoutAnalyticsStatus, type WorkoutProgressQuery, type WorkoutProgressResponse, type WorkoutSession, type WorkoutSessionId, type WorkoutSessionListResponse, type WorkoutSessionSnapshotV1, type WorkoutSessionStatus, type WorkoutSessionSummary, type WorkoutStatsQuery, type WorkoutStatsResponse };
432
+ export { type Brand, type CreateRoutineDayInput, type CreateRoutineExerciseInput, type CreateRoutineRequest, type EarnedPersonalRecord, type Exercise, type ExerciseId, type FinishStatus, type FinishWorkoutRequest, type FinishWorkoutResponse, type IsoDateString, type ListSessionsParams, MUSCLE_GROUPS, type MuscleGroup, PROGRESSION_SCHEMES, type PaginatedResponse, type PersonalRecordEntry, type PersonalRecordKind, type PlatePairInventory, type PreviousPerformanceResponse, type PreviousSetPerformance, type ProgressionChange, type ProgressionRule, type ProgressionScheme, type ProgressionSetChange, type PublicUserProfile, REP_TYPES, type RecentActivityEntry, type RepType, type ReplaceTrainingLocationsRequest, type Routine, type RoutineDay, type RoutineDayId, type RoutineExercise, type RoutineId, type RoutineSet, SEXES, type SetAccountTimeZoneRequest, type SetLog, type Sex, type StartWorkoutRequest, type StartWorkoutResponse, type SupabaseAuthResponse, type SupabaseAuthUser, type SupabaseMigrationResponse, TRAINING_EVENT_TYPES, type TrainingEventType, type TrainingLocationPreference, type TrainingLocationPreferenceInput, type UpdateProfileRequest, type UpdateRoutineRequest, type UpsertSetLogRequest, type UpsertSetLogResponse, type UserId, type UserProfile, type UserSearchResponse, WEIGHT_UNITS, WORKOUT_SESSION_STATUSES, type WeightUnit, type WorkoutAnalyticsStatus, type WorkoutProgressQuery, type WorkoutProgressResponse, type WorkoutSession, type WorkoutSessionId, type WorkoutSessionListResponse, type WorkoutSessionSnapshotV1, type WorkoutSessionStatus, type WorkoutSessionSummary, type WorkoutStatsQuery, type WorkoutStatsResponse };
package/dist/index.js CHANGED
@@ -31,11 +31,19 @@ var MUSCLE_GROUPS = [
31
31
  "CORE",
32
32
  "ADDUCTOR"
33
33
  ];
34
+
35
+ // src/analytics.ts
36
+ var TRAINING_EVENT_TYPES = [
37
+ "SESSION_COMPLETED",
38
+ "PERSONAL_RECORD",
39
+ "PROGRESSION_CHANGED"
40
+ ];
34
41
  export {
35
42
  MUSCLE_GROUPS,
36
43
  PROGRESSION_SCHEMES,
37
44
  REP_TYPES,
38
45
  SEXES,
46
+ TRAINING_EVENT_TYPES,
39
47
  WEIGHT_UNITS,
40
48
  WORKOUT_SESSION_STATUSES
41
49
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sunsteel/contracts",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ezee969/sunsteel-contracts.git"