@sunsteel/contracts 0.11.0 → 0.13.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
@@ -23,8 +23,12 @@ __export(index_exports, {
23
23
  MUSCLE_GROUPS: () => MUSCLE_GROUPS,
24
24
  PROGRESSION_SCHEMES: () => PROGRESSION_SCHEMES,
25
25
  REP_TYPES: () => REP_TYPES,
26
+ RESERVED_USERNAMES: () => RESERVED_USERNAMES,
26
27
  SEXES: () => SEXES,
27
28
  TRAINING_EVENT_TYPES: () => TRAINING_EVENT_TYPES,
29
+ USERNAME_MAX_LENGTH: () => USERNAME_MAX_LENGTH,
30
+ USERNAME_MIN_LENGTH: () => USERNAME_MIN_LENGTH,
31
+ USERNAME_PATTERN_SOURCE: () => USERNAME_PATTERN_SOURCE,
28
32
  WEIGHT_UNITS: () => WEIGHT_UNITS,
29
33
  WORKOUT_SESSION_STATUSES: () => WORKOUT_SESSION_STATUSES
30
34
  });
@@ -64,6 +68,43 @@ var MUSCLE_GROUPS = [
64
68
  "ADDUCTOR"
65
69
  ];
66
70
 
71
+ // src/user.ts
72
+ var USERNAME_MIN_LENGTH = 3;
73
+ var USERNAME_MAX_LENGTH = 30;
74
+ var USERNAME_PATTERN_SOURCE = "^[a-z0-9][a-z0-9_-]{1,28}[a-z0-9]$";
75
+ var RESERVED_USERNAMES = [
76
+ "achievements",
77
+ "admin",
78
+ "api",
79
+ "auth",
80
+ "dashboard",
81
+ "edit",
82
+ "exercises",
83
+ "help",
84
+ "login",
85
+ "logout",
86
+ "me",
87
+ "new",
88
+ "notifications",
89
+ "privacy",
90
+ "profile",
91
+ "profiles",
92
+ "progress",
93
+ "register",
94
+ "routines",
95
+ "schedule",
96
+ "search",
97
+ "settings",
98
+ "signup",
99
+ "sunnsteel",
100
+ "sunsteel",
101
+ "support",
102
+ "system",
103
+ "terms",
104
+ "users",
105
+ "workouts"
106
+ ];
107
+
67
108
  // src/analytics.ts
68
109
  var TRAINING_EVENT_TYPES = [
69
110
  "SESSION_COMPLETED",
@@ -75,8 +116,12 @@ var TRAINING_EVENT_TYPES = [
75
116
  MUSCLE_GROUPS,
76
117
  PROGRESSION_SCHEMES,
77
118
  REP_TYPES,
119
+ RESERVED_USERNAMES,
78
120
  SEXES,
79
121
  TRAINING_EVENT_TYPES,
122
+ USERNAME_MAX_LENGTH,
123
+ USERNAME_MIN_LENGTH,
124
+ USERNAME_PATTERN_SOURCE,
80
125
  WEIGHT_UNITS,
81
126
  WORKOUT_SESSION_STATUSES
82
127
  });
package/dist/index.d.cts CHANGED
@@ -24,10 +24,15 @@ interface PaginatedResponse<T> {
24
24
  nextCursor?: string;
25
25
  }
26
26
 
27
+ declare const USERNAME_MIN_LENGTH = 3;
28
+ declare const USERNAME_MAX_LENGTH = 30;
29
+ declare const USERNAME_PATTERN_SOURCE = "^[a-z0-9][a-z0-9_-]{1,28}[a-z0-9]$";
30
+ declare const RESERVED_USERNAMES: readonly ["achievements", "admin", "api", "auth", "dashboard", "edit", "exercises", "help", "login", "logout", "me", "new", "notifications", "privacy", "profile", "profiles", "progress", "register", "routines", "schedule", "search", "settings", "signup", "sunnsteel", "sunsteel", "support", "system", "terms", "users", "workouts"];
27
31
  interface UserProfile {
28
32
  timeZone?: string | null;
29
33
  id: string;
30
34
  email: string;
35
+ username: string;
31
36
  name: string;
32
37
  lastName?: string | null;
33
38
  avatarUrl?: string | null;
@@ -43,6 +48,7 @@ interface UserProfile {
43
48
  }
44
49
  interface PublicUserProfile {
45
50
  id: string;
51
+ username: string;
46
52
  name: string;
47
53
  lastName?: string | null;
48
54
  avatarUrl?: string | null;
@@ -53,6 +59,7 @@ interface PublicUserProfile {
53
59
  isFollowedByMe: boolean;
54
60
  }
55
61
  interface UpdateProfileRequest {
62
+ username?: string;
56
63
  name?: string;
57
64
  lastName?: string | null;
58
65
  avatarUrl?: string | null;
@@ -89,7 +96,7 @@ interface ReplaceTrainingLocationsRequest {
89
96
  }
90
97
  interface UserSearchResponse {
91
98
  id: string;
92
- email: string;
99
+ username: string;
93
100
  name: string;
94
101
  lastName?: string | null;
95
102
  avatarUrl?: string | null;
@@ -308,6 +315,7 @@ interface ProgressionChange {
308
315
  interface FinishWorkoutResponse {
309
316
  session: WorkoutSession;
310
317
  progressionChanges: ProgressionChange[];
318
+ recap: WorkoutSessionRecap | null;
311
319
  }
312
320
  interface UpsertSetLogRequest {
313
321
  routineExerciseId: string;
@@ -334,6 +342,37 @@ interface UpsertSetLogResponse {
334
342
  setLog: SetLog;
335
343
  earnedRecords: EarnedPersonalRecord[];
336
344
  }
345
+ /** Final record frontier earned by one completed session. */
346
+ interface SessionRecapRecord extends EarnedPersonalRecord {
347
+ setNumber: number;
348
+ achievedAt: IsoDateString;
349
+ }
350
+ /** Metrics from the latest earlier execution of the same routine day. */
351
+ interface PreviousSessionRecap {
352
+ sessionId: string;
353
+ endedAt: IsoDateString;
354
+ durationSec: number;
355
+ totalVolumeKg: number;
356
+ completedSets: number;
357
+ durationDeltaSec: number;
358
+ volumeDeltaKg: number;
359
+ completedSetsDelta: number;
360
+ }
361
+ /** Stable successful response of GET /workouts/sessions/:id/recap. */
362
+ interface WorkoutSessionRecap {
363
+ sessionId: string;
364
+ routineName: string;
365
+ dayName?: string | null;
366
+ startedAt: IsoDateString;
367
+ endedAt: IsoDateString;
368
+ durationSec: number;
369
+ totalVolumeKg: number;
370
+ completedSets: number;
371
+ notes?: string | null;
372
+ records: SessionRecapRecord[];
373
+ progressionChanges: ProgressionChange[];
374
+ previousSession: PreviousSessionRecap | null;
375
+ }
337
376
  interface WorkoutSessionSummary {
338
377
  id: string;
339
378
  status: WorkoutSessionStatus;
@@ -429,4 +468,4 @@ interface WorkoutAnalyticsStatus {
429
468
  generationId: string | null;
430
469
  }
431
470
 
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 };
471
+ 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, RESERVED_USERNAMES, 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, USERNAME_MAX_LENGTH, USERNAME_MIN_LENGTH, USERNAME_PATTERN_SOURCE, 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
@@ -24,10 +24,15 @@ interface PaginatedResponse<T> {
24
24
  nextCursor?: string;
25
25
  }
26
26
 
27
+ declare const USERNAME_MIN_LENGTH = 3;
28
+ declare const USERNAME_MAX_LENGTH = 30;
29
+ declare const USERNAME_PATTERN_SOURCE = "^[a-z0-9][a-z0-9_-]{1,28}[a-z0-9]$";
30
+ declare const RESERVED_USERNAMES: readonly ["achievements", "admin", "api", "auth", "dashboard", "edit", "exercises", "help", "login", "logout", "me", "new", "notifications", "privacy", "profile", "profiles", "progress", "register", "routines", "schedule", "search", "settings", "signup", "sunnsteel", "sunsteel", "support", "system", "terms", "users", "workouts"];
27
31
  interface UserProfile {
28
32
  timeZone?: string | null;
29
33
  id: string;
30
34
  email: string;
35
+ username: string;
31
36
  name: string;
32
37
  lastName?: string | null;
33
38
  avatarUrl?: string | null;
@@ -43,6 +48,7 @@ interface UserProfile {
43
48
  }
44
49
  interface PublicUserProfile {
45
50
  id: string;
51
+ username: string;
46
52
  name: string;
47
53
  lastName?: string | null;
48
54
  avatarUrl?: string | null;
@@ -53,6 +59,7 @@ interface PublicUserProfile {
53
59
  isFollowedByMe: boolean;
54
60
  }
55
61
  interface UpdateProfileRequest {
62
+ username?: string;
56
63
  name?: string;
57
64
  lastName?: string | null;
58
65
  avatarUrl?: string | null;
@@ -89,7 +96,7 @@ interface ReplaceTrainingLocationsRequest {
89
96
  }
90
97
  interface UserSearchResponse {
91
98
  id: string;
92
- email: string;
99
+ username: string;
93
100
  name: string;
94
101
  lastName?: string | null;
95
102
  avatarUrl?: string | null;
@@ -308,6 +315,7 @@ interface ProgressionChange {
308
315
  interface FinishWorkoutResponse {
309
316
  session: WorkoutSession;
310
317
  progressionChanges: ProgressionChange[];
318
+ recap: WorkoutSessionRecap | null;
311
319
  }
312
320
  interface UpsertSetLogRequest {
313
321
  routineExerciseId: string;
@@ -334,6 +342,37 @@ interface UpsertSetLogResponse {
334
342
  setLog: SetLog;
335
343
  earnedRecords: EarnedPersonalRecord[];
336
344
  }
345
+ /** Final record frontier earned by one completed session. */
346
+ interface SessionRecapRecord extends EarnedPersonalRecord {
347
+ setNumber: number;
348
+ achievedAt: IsoDateString;
349
+ }
350
+ /** Metrics from the latest earlier execution of the same routine day. */
351
+ interface PreviousSessionRecap {
352
+ sessionId: string;
353
+ endedAt: IsoDateString;
354
+ durationSec: number;
355
+ totalVolumeKg: number;
356
+ completedSets: number;
357
+ durationDeltaSec: number;
358
+ volumeDeltaKg: number;
359
+ completedSetsDelta: number;
360
+ }
361
+ /** Stable successful response of GET /workouts/sessions/:id/recap. */
362
+ interface WorkoutSessionRecap {
363
+ sessionId: string;
364
+ routineName: string;
365
+ dayName?: string | null;
366
+ startedAt: IsoDateString;
367
+ endedAt: IsoDateString;
368
+ durationSec: number;
369
+ totalVolumeKg: number;
370
+ completedSets: number;
371
+ notes?: string | null;
372
+ records: SessionRecapRecord[];
373
+ progressionChanges: ProgressionChange[];
374
+ previousSession: PreviousSessionRecap | null;
375
+ }
337
376
  interface WorkoutSessionSummary {
338
377
  id: string;
339
378
  status: WorkoutSessionStatus;
@@ -429,4 +468,4 @@ interface WorkoutAnalyticsStatus {
429
468
  generationId: string | null;
430
469
  }
431
470
 
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 };
471
+ 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, RESERVED_USERNAMES, 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, USERNAME_MAX_LENGTH, USERNAME_MIN_LENGTH, USERNAME_PATTERN_SOURCE, 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
@@ -32,6 +32,43 @@ var MUSCLE_GROUPS = [
32
32
  "ADDUCTOR"
33
33
  ];
34
34
 
35
+ // src/user.ts
36
+ var USERNAME_MIN_LENGTH = 3;
37
+ var USERNAME_MAX_LENGTH = 30;
38
+ var USERNAME_PATTERN_SOURCE = "^[a-z0-9][a-z0-9_-]{1,28}[a-z0-9]$";
39
+ var RESERVED_USERNAMES = [
40
+ "achievements",
41
+ "admin",
42
+ "api",
43
+ "auth",
44
+ "dashboard",
45
+ "edit",
46
+ "exercises",
47
+ "help",
48
+ "login",
49
+ "logout",
50
+ "me",
51
+ "new",
52
+ "notifications",
53
+ "privacy",
54
+ "profile",
55
+ "profiles",
56
+ "progress",
57
+ "register",
58
+ "routines",
59
+ "schedule",
60
+ "search",
61
+ "settings",
62
+ "signup",
63
+ "sunnsteel",
64
+ "sunsteel",
65
+ "support",
66
+ "system",
67
+ "terms",
68
+ "users",
69
+ "workouts"
70
+ ];
71
+
35
72
  // src/analytics.ts
36
73
  var TRAINING_EVENT_TYPES = [
37
74
  "SESSION_COMPLETED",
@@ -42,8 +79,12 @@ export {
42
79
  MUSCLE_GROUPS,
43
80
  PROGRESSION_SCHEMES,
44
81
  REP_TYPES,
82
+ RESERVED_USERNAMES,
45
83
  SEXES,
46
84
  TRAINING_EVENT_TYPES,
85
+ USERNAME_MAX_LENGTH,
86
+ USERNAME_MIN_LENGTH,
87
+ USERNAME_PATTERN_SOURCE,
47
88
  WEIGHT_UNITS,
48
89
  WORKOUT_SESSION_STATUSES
49
90
  };
package/package.json CHANGED
@@ -1,40 +1,40 @@
1
- {
2
- "name": "@sunsteel/contracts",
3
- "version": "0.11.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.13.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
+ }