@sunsteel/contracts 0.10.0 → 0.12.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
@@ -286,6 +286,30 @@ interface FinishWorkoutRequest {
286
286
  status: FinishStatus;
287
287
  notes?: string;
288
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
+ recap: WorkoutSessionRecap | null;
312
+ }
289
313
  interface UpsertSetLogRequest {
290
314
  routineExerciseId: string;
291
315
  exerciseId: string;
@@ -311,6 +335,37 @@ interface UpsertSetLogResponse {
311
335
  setLog: SetLog;
312
336
  earnedRecords: EarnedPersonalRecord[];
313
337
  }
338
+ /** Final record frontier earned by one completed session. */
339
+ interface SessionRecapRecord extends EarnedPersonalRecord {
340
+ setNumber: number;
341
+ achievedAt: IsoDateString;
342
+ }
343
+ /** Metrics from the latest earlier execution of the same routine day. */
344
+ interface PreviousSessionRecap {
345
+ sessionId: string;
346
+ endedAt: IsoDateString;
347
+ durationSec: number;
348
+ totalVolumeKg: number;
349
+ completedSets: number;
350
+ durationDeltaSec: number;
351
+ volumeDeltaKg: number;
352
+ completedSetsDelta: number;
353
+ }
354
+ /** Stable successful response of GET /workouts/sessions/:id/recap. */
355
+ interface WorkoutSessionRecap {
356
+ sessionId: string;
357
+ routineName: string;
358
+ dayName?: string | null;
359
+ startedAt: IsoDateString;
360
+ endedAt: IsoDateString;
361
+ durationSec: number;
362
+ totalVolumeKg: number;
363
+ completedSets: number;
364
+ notes?: string | null;
365
+ records: SessionRecapRecord[];
366
+ progressionChanges: ProgressionChange[];
367
+ previousSession: PreviousSessionRecap | null;
368
+ }
314
369
  interface WorkoutSessionSummary {
315
370
  id: string;
316
371
  status: WorkoutSessionStatus;
@@ -350,6 +405,8 @@ interface WorkoutStatsResponse {
350
405
  activeDaysThisWeek: number;
351
406
  }
352
407
 
408
+ declare const TRAINING_EVENT_TYPES: readonly ["SESSION_COMPLETED", "PERSONAL_RECORD", "PROGRESSION_CHANGED"];
409
+ type TrainingEventType = (typeof TRAINING_EVENT_TYPES)[number];
353
410
  /** Stable successful response of GET /workouts/progress. */
354
411
  interface WorkoutProgressQuery {
355
412
  timeZone: string;
@@ -404,4 +461,4 @@ interface WorkoutAnalyticsStatus {
404
461
  generationId: string | null;
405
462
  }
406
463
 
407
- 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 PlatePairInventory, type PreviousPerformanceResponse, type PreviousSetPerformance, type ProgressionScheme, 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, 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 };
464
+ 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 PreviousSessionRecap, 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 SessionRecapRecord, 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 WorkoutSessionRecap, type WorkoutSessionSnapshotV1, type WorkoutSessionStatus, type WorkoutSessionSummary, type WorkoutStatsQuery, type WorkoutStatsResponse };
package/dist/index.d.ts CHANGED
@@ -286,6 +286,30 @@ interface FinishWorkoutRequest {
286
286
  status: FinishStatus;
287
287
  notes?: string;
288
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
+ recap: WorkoutSessionRecap | null;
312
+ }
289
313
  interface UpsertSetLogRequest {
290
314
  routineExerciseId: string;
291
315
  exerciseId: string;
@@ -311,6 +335,37 @@ interface UpsertSetLogResponse {
311
335
  setLog: SetLog;
312
336
  earnedRecords: EarnedPersonalRecord[];
313
337
  }
338
+ /** Final record frontier earned by one completed session. */
339
+ interface SessionRecapRecord extends EarnedPersonalRecord {
340
+ setNumber: number;
341
+ achievedAt: IsoDateString;
342
+ }
343
+ /** Metrics from the latest earlier execution of the same routine day. */
344
+ interface PreviousSessionRecap {
345
+ sessionId: string;
346
+ endedAt: IsoDateString;
347
+ durationSec: number;
348
+ totalVolumeKg: number;
349
+ completedSets: number;
350
+ durationDeltaSec: number;
351
+ volumeDeltaKg: number;
352
+ completedSetsDelta: number;
353
+ }
354
+ /** Stable successful response of GET /workouts/sessions/:id/recap. */
355
+ interface WorkoutSessionRecap {
356
+ sessionId: string;
357
+ routineName: string;
358
+ dayName?: string | null;
359
+ startedAt: IsoDateString;
360
+ endedAt: IsoDateString;
361
+ durationSec: number;
362
+ totalVolumeKg: number;
363
+ completedSets: number;
364
+ notes?: string | null;
365
+ records: SessionRecapRecord[];
366
+ progressionChanges: ProgressionChange[];
367
+ previousSession: PreviousSessionRecap | null;
368
+ }
314
369
  interface WorkoutSessionSummary {
315
370
  id: string;
316
371
  status: WorkoutSessionStatus;
@@ -350,6 +405,8 @@ interface WorkoutStatsResponse {
350
405
  activeDaysThisWeek: number;
351
406
  }
352
407
 
408
+ declare const TRAINING_EVENT_TYPES: readonly ["SESSION_COMPLETED", "PERSONAL_RECORD", "PROGRESSION_CHANGED"];
409
+ type TrainingEventType = (typeof TRAINING_EVENT_TYPES)[number];
353
410
  /** Stable successful response of GET /workouts/progress. */
354
411
  interface WorkoutProgressQuery {
355
412
  timeZone: string;
@@ -404,4 +461,4 @@ interface WorkoutAnalyticsStatus {
404
461
  generationId: string | null;
405
462
  }
406
463
 
407
- 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 PlatePairInventory, type PreviousPerformanceResponse, type PreviousSetPerformance, type ProgressionScheme, 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, 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 };
464
+ 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 PreviousSessionRecap, 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 SessionRecapRecord, 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 WorkoutSessionRecap, 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,40 +1,40 @@
1
- {
2
- "name": "@sunsteel/contracts",
3
- "version": "0.10.0",
4
- "repository": {
5
- "type": "git",
6
- "url": "git+https://github.com/ezee969/sunsteel-contracts.git"
7
- },
8
- "private": false,
9
- "engines": {
10
- "node": ">=20.11"
11
- },
12
- "type": "module",
13
- "sideEffects": false,
14
- "main": "./dist/index.cjs",
15
- "module": "./dist/index.js",
16
- "types": "./dist/index.d.ts",
17
- "exports": {
18
- ".": {
19
- "types": "./dist/index.d.ts",
20
- "import": "./dist/index.js",
21
- "require": "./dist/index.cjs"
22
- }
23
- },
24
- "files": [
25
- "dist"
26
- ],
27
- "scripts": {
28
- "build": "tsup src/index.ts --format esm,cjs --dts --clean",
29
- "dev": "tsup src/index.ts --format esm,cjs --dts --watch",
30
- "typecheck": "tsc --noEmit",
31
- "lint": "npm run typecheck",
32
- "verify": "npm run typecheck && npm run build",
33
- "verify:security": "npm audit",
34
- "prepublishOnly": "npm run build"
35
- },
36
- "devDependencies": {
37
- "tsup": "^8.3.5",
38
- "typescript": "^5.7.3"
39
- }
40
- }
1
+ {
2
+ "name": "@sunsteel/contracts",
3
+ "version": "0.12.0",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git+https://github.com/ezee969/sunsteel-contracts.git"
7
+ },
8
+ "private": false,
9
+ "engines": {
10
+ "node": ">=20.11"
11
+ },
12
+ "type": "module",
13
+ "sideEffects": false,
14
+ "main": "./dist/index.cjs",
15
+ "module": "./dist/index.js",
16
+ "types": "./dist/index.d.ts",
17
+ "exports": {
18
+ ".": {
19
+ "types": "./dist/index.d.ts",
20
+ "import": "./dist/index.js",
21
+ "require": "./dist/index.cjs"
22
+ }
23
+ },
24
+ "files": [
25
+ "dist"
26
+ ],
27
+ "scripts": {
28
+ "build": "tsup src/index.ts --format esm,cjs --dts --clean",
29
+ "dev": "tsup src/index.ts --format esm,cjs --dts --watch",
30
+ "typecheck": "tsc --noEmit",
31
+ "lint": "npm run typecheck",
32
+ "verify": "npm run typecheck && npm run build",
33
+ "verify:security": "npm audit",
34
+ "prepublishOnly": "npm run build"
35
+ },
36
+ "devDependencies": {
37
+ "tsup": "^8.3.5",
38
+ "typescript": "^5.7.3"
39
+ }
40
+ }