@sunsteel/contracts 0.12.0 → 0.14.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
@@ -21,10 +21,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  MUSCLE_GROUPS: () => MUSCLE_GROUPS,
24
+ PROFILE_VISIBILITY_VALUES: () => PROFILE_VISIBILITY_VALUES,
24
25
  PROGRESSION_SCHEMES: () => PROGRESSION_SCHEMES,
25
26
  REP_TYPES: () => REP_TYPES,
27
+ RESERVED_USERNAMES: () => RESERVED_USERNAMES,
26
28
  SEXES: () => SEXES,
27
29
  TRAINING_EVENT_TYPES: () => TRAINING_EVENT_TYPES,
30
+ USERNAME_MAX_LENGTH: () => USERNAME_MAX_LENGTH,
31
+ USERNAME_MIN_LENGTH: () => USERNAME_MIN_LENGTH,
32
+ USERNAME_PATTERN_SOURCE: () => USERNAME_PATTERN_SOURCE,
28
33
  WEIGHT_UNITS: () => WEIGHT_UNITS,
29
34
  WORKOUT_SESSION_STATUSES: () => WORKOUT_SESSION_STATUSES
30
35
  });
@@ -64,6 +69,48 @@ var MUSCLE_GROUPS = [
64
69
  "ADDUCTOR"
65
70
  ];
66
71
 
72
+ // src/user.ts
73
+ var USERNAME_MIN_LENGTH = 3;
74
+ var USERNAME_MAX_LENGTH = 30;
75
+ var USERNAME_PATTERN_SOURCE = "^[a-z0-9][a-z0-9_-]{1,28}[a-z0-9]$";
76
+ var RESERVED_USERNAMES = [
77
+ "achievements",
78
+ "admin",
79
+ "api",
80
+ "auth",
81
+ "dashboard",
82
+ "edit",
83
+ "exercises",
84
+ "help",
85
+ "login",
86
+ "logout",
87
+ "me",
88
+ "new",
89
+ "notifications",
90
+ "privacy",
91
+ "profile",
92
+ "profiles",
93
+ "progress",
94
+ "register",
95
+ "routines",
96
+ "schedule",
97
+ "search",
98
+ "settings",
99
+ "signup",
100
+ "sunnsteel",
101
+ "sunsteel",
102
+ "support",
103
+ "system",
104
+ "terms",
105
+ "users",
106
+ "workouts"
107
+ ];
108
+ var PROFILE_VISIBILITY_VALUES = [
109
+ "PUBLIC",
110
+ "FOLLOWERS",
111
+ "PRIVATE"
112
+ ];
113
+
67
114
  // src/analytics.ts
68
115
  var TRAINING_EVENT_TYPES = [
69
116
  "SESSION_COMPLETED",
@@ -73,10 +120,15 @@ var TRAINING_EVENT_TYPES = [
73
120
  // Annotate the CommonJS export names for ESM import in node:
74
121
  0 && (module.exports = {
75
122
  MUSCLE_GROUPS,
123
+ PROFILE_VISIBILITY_VALUES,
76
124
  PROGRESSION_SCHEMES,
77
125
  REP_TYPES,
126
+ RESERVED_USERNAMES,
78
127
  SEXES,
79
128
  TRAINING_EVENT_TYPES,
129
+ USERNAME_MAX_LENGTH,
130
+ USERNAME_MIN_LENGTH,
131
+ USERNAME_PATTERN_SOURCE,
80
132
  WEIGHT_UNITS,
81
133
  WORKOUT_SESSION_STATUSES
82
134
  });
package/dist/index.d.cts CHANGED
@@ -24,171 +24,6 @@ interface PaginatedResponse<T> {
24
24
  nextCursor?: string;
25
25
  }
26
26
 
27
- interface UserProfile {
28
- timeZone?: string | null;
29
- id: string;
30
- email: string;
31
- name: string;
32
- lastName?: string | null;
33
- avatarUrl?: string | null;
34
- age?: number | null;
35
- sex?: Sex | null;
36
- weight?: number | null;
37
- height?: number | null;
38
- weightUnit: WeightUnit;
39
- followerCount: number;
40
- followingCount: number;
41
- createdAt: IsoDateString;
42
- updatedAt: IsoDateString;
43
- }
44
- interface PublicUserProfile {
45
- id: string;
46
- name: string;
47
- lastName?: string | null;
48
- avatarUrl?: string | null;
49
- createdAt: IsoDateString;
50
- updatedAt: IsoDateString;
51
- followerCount: number;
52
- followingCount: number;
53
- isFollowedByMe: boolean;
54
- }
55
- interface UpdateProfileRequest {
56
- name?: string;
57
- lastName?: string | null;
58
- avatarUrl?: string | null;
59
- age?: number | null;
60
- sex?: Sex | null;
61
- weight?: number | null;
62
- height?: number | null;
63
- weightUnit?: WeightUnit;
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
- }
90
- interface UserSearchResponse {
91
- id: string;
92
- email: string;
93
- name: string;
94
- lastName?: string | null;
95
- avatarUrl?: string | null;
96
- }
97
-
98
- interface SupabaseAuthUser {
99
- id: string;
100
- email: string;
101
- name: string;
102
- supabaseUserId?: string | null;
103
- weightUnit: WeightUnit;
104
- createdAt?: IsoDateString;
105
- updatedAt?: IsoDateString;
106
- }
107
- interface SupabaseAuthResponse {
108
- user: SupabaseAuthUser;
109
- message?: string;
110
- requiresEmailVerification?: boolean;
111
- }
112
- interface SupabaseMigrationResponse {
113
- message: string;
114
- userId: string;
115
- email: string;
116
- }
117
-
118
- interface Exercise {
119
- id: string;
120
- name: string;
121
- primaryMuscles: MuscleGroup[];
122
- secondaryMuscles: MuscleGroup[];
123
- equipment: string;
124
- createdAt: IsoDateString;
125
- updatedAt: IsoDateString;
126
- }
127
-
128
- interface RoutineSet {
129
- setNumber: number;
130
- repType: RepType;
131
- reps?: number | null;
132
- minReps?: number | null;
133
- maxReps?: number | null;
134
- weight?: number | null;
135
- rir?: number | null;
136
- }
137
- interface RoutineExercise {
138
- id: string;
139
- order: number;
140
- restSeconds: number;
141
- note?: string | null;
142
- progressionScheme: ProgressionScheme;
143
- minWeightIncrement: number;
144
- exercise: {
145
- id: string;
146
- name: string;
147
- primaryMuscles?: MuscleGroup[];
148
- secondaryMuscles?: MuscleGroup[];
149
- };
150
- sets: RoutineSet[];
151
- }
152
- interface CreateRoutineExerciseInput {
153
- exerciseId: string;
154
- order?: number;
155
- restSeconds: number;
156
- note?: string;
157
- progressionScheme: ProgressionScheme;
158
- minWeightIncrement: number;
159
- sets: RoutineSet[];
160
- }
161
- interface RoutineDay {
162
- id: string;
163
- dayOfWeek: number;
164
- order: number;
165
- exercises: RoutineExercise[];
166
- }
167
- interface CreateRoutineDayInput {
168
- dayOfWeek: number;
169
- order?: number;
170
- exercises: CreateRoutineExerciseInput[];
171
- }
172
- interface Routine {
173
- id: string;
174
- userId: string;
175
- name: string;
176
- description?: string | null;
177
- isPeriodized: boolean;
178
- isFavorite: boolean;
179
- isCompleted: boolean;
180
- days: RoutineDay[];
181
- createdAt: IsoDateString;
182
- updatedAt: IsoDateString;
183
- }
184
- interface CreateRoutineRequest {
185
- name: string;
186
- description?: string;
187
- isPeriodized: boolean;
188
- days: CreateRoutineDayInput[];
189
- }
190
- type UpdateRoutineRequest = Partial<CreateRoutineRequest>;
191
-
192
27
  interface SetLog {
193
28
  id: string;
194
29
  sessionId: string;
@@ -461,4 +296,210 @@ interface WorkoutAnalyticsStatus {
461
296
  generationId: string | null;
462
297
  }
463
298
 
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 };
299
+ declare const USERNAME_MIN_LENGTH = 3;
300
+ declare const USERNAME_MAX_LENGTH = 30;
301
+ declare const USERNAME_PATTERN_SOURCE = "^[a-z0-9][a-z0-9_-]{1,28}[a-z0-9]$";
302
+ 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"];
303
+ declare const PROFILE_VISIBILITY_VALUES: readonly ["PUBLIC", "FOLLOWERS", "PRIVATE"];
304
+ type ProfileVisibility = (typeof PROFILE_VISIBILITY_VALUES)[number];
305
+ interface ProfilePrivacySettings {
306
+ workoutHistory: ProfileVisibility;
307
+ records: ProfileVisibility;
308
+ routines: ProfileVisibility;
309
+ achievements: ProfileVisibility;
310
+ bodyMetrics: ProfileVisibility;
311
+ }
312
+ interface ProfileViewerAccess {
313
+ workoutHistory: boolean;
314
+ records: boolean;
315
+ routines: boolean;
316
+ achievements: boolean;
317
+ bodyMetrics: boolean;
318
+ }
319
+ interface PublicTrainingSummary {
320
+ completedWorkouts: number;
321
+ totalVolumeKg: number;
322
+ currentStreakDays: number;
323
+ bestStreakDays: number;
324
+ }
325
+ interface PublicBodyMetrics {
326
+ age?: number | null;
327
+ sex?: Sex | null;
328
+ weightKg?: number | null;
329
+ heightCm?: number | null;
330
+ }
331
+ interface UserProfile {
332
+ timeZone?: string | null;
333
+ id: string;
334
+ email: string;
335
+ username: string;
336
+ name: string;
337
+ lastName?: string | null;
338
+ avatarUrl?: string | null;
339
+ age?: number | null;
340
+ sex?: Sex | null;
341
+ weight?: number | null;
342
+ height?: number | null;
343
+ weightUnit: WeightUnit;
344
+ privacySettings: ProfilePrivacySettings;
345
+ followerCount: number;
346
+ followingCount: number;
347
+ createdAt: IsoDateString;
348
+ updatedAt: IsoDateString;
349
+ }
350
+ interface PublicUserProfile {
351
+ id: string;
352
+ username: string;
353
+ name: string;
354
+ lastName?: string | null;
355
+ avatarUrl?: string | null;
356
+ createdAt: IsoDateString;
357
+ updatedAt: IsoDateString;
358
+ followerCount: number;
359
+ followingCount: number;
360
+ isFollowedByMe: boolean;
361
+ viewerAccess: ProfileViewerAccess;
362
+ trainingSummary?: PublicTrainingSummary;
363
+ personalRecords?: PersonalRecordEntry[];
364
+ bodyMetrics?: PublicBodyMetrics;
365
+ }
366
+ interface UpdateProfileRequest {
367
+ username?: string;
368
+ name?: string;
369
+ lastName?: string | null;
370
+ avatarUrl?: string | null;
371
+ age?: number | null;
372
+ sex?: Sex | null;
373
+ weight?: number | null;
374
+ height?: number | null;
375
+ weightUnit?: WeightUnit;
376
+ }
377
+ type UpdateProfilePrivacyRequest = ProfilePrivacySettings;
378
+ interface PlatePairInventory {
379
+ weightKg: number;
380
+ pairCount: number;
381
+ }
382
+ interface TrainingLocationPreference {
383
+ id: string;
384
+ name: string;
385
+ isDefault: boolean;
386
+ barWeightKg: number;
387
+ availablePlatePairs: PlatePairInventory[];
388
+ equipment: string[];
389
+ createdAt: IsoDateString;
390
+ updatedAt: IsoDateString;
391
+ }
392
+ interface TrainingLocationPreferenceInput {
393
+ id?: string;
394
+ name: string;
395
+ isDefault: boolean;
396
+ barWeightKg: number;
397
+ availablePlatePairs: PlatePairInventory[];
398
+ equipment: string[];
399
+ }
400
+ interface ReplaceTrainingLocationsRequest {
401
+ locations: TrainingLocationPreferenceInput[];
402
+ }
403
+ interface UserSearchResponse {
404
+ id: string;
405
+ username: string;
406
+ name: string;
407
+ lastName?: string | null;
408
+ avatarUrl?: string | null;
409
+ }
410
+
411
+ interface SupabaseAuthUser {
412
+ id: string;
413
+ email: string;
414
+ name: string;
415
+ supabaseUserId?: string | null;
416
+ weightUnit: WeightUnit;
417
+ createdAt?: IsoDateString;
418
+ updatedAt?: IsoDateString;
419
+ }
420
+ interface SupabaseAuthResponse {
421
+ user: SupabaseAuthUser;
422
+ message?: string;
423
+ requiresEmailVerification?: boolean;
424
+ }
425
+ interface SupabaseMigrationResponse {
426
+ message: string;
427
+ userId: string;
428
+ email: string;
429
+ }
430
+
431
+ interface Exercise {
432
+ id: string;
433
+ name: string;
434
+ primaryMuscles: MuscleGroup[];
435
+ secondaryMuscles: MuscleGroup[];
436
+ equipment: string;
437
+ createdAt: IsoDateString;
438
+ updatedAt: IsoDateString;
439
+ }
440
+
441
+ interface RoutineSet {
442
+ setNumber: number;
443
+ repType: RepType;
444
+ reps?: number | null;
445
+ minReps?: number | null;
446
+ maxReps?: number | null;
447
+ weight?: number | null;
448
+ rir?: number | null;
449
+ }
450
+ interface RoutineExercise {
451
+ id: string;
452
+ order: number;
453
+ restSeconds: number;
454
+ note?: string | null;
455
+ progressionScheme: ProgressionScheme;
456
+ minWeightIncrement: number;
457
+ exercise: {
458
+ id: string;
459
+ name: string;
460
+ primaryMuscles?: MuscleGroup[];
461
+ secondaryMuscles?: MuscleGroup[];
462
+ };
463
+ sets: RoutineSet[];
464
+ }
465
+ interface CreateRoutineExerciseInput {
466
+ exerciseId: string;
467
+ order?: number;
468
+ restSeconds: number;
469
+ note?: string;
470
+ progressionScheme: ProgressionScheme;
471
+ minWeightIncrement: number;
472
+ sets: RoutineSet[];
473
+ }
474
+ interface RoutineDay {
475
+ id: string;
476
+ dayOfWeek: number;
477
+ order: number;
478
+ exercises: RoutineExercise[];
479
+ }
480
+ interface CreateRoutineDayInput {
481
+ dayOfWeek: number;
482
+ order?: number;
483
+ exercises: CreateRoutineExerciseInput[];
484
+ }
485
+ interface Routine {
486
+ id: string;
487
+ userId: string;
488
+ name: string;
489
+ description?: string | null;
490
+ isPeriodized: boolean;
491
+ isFavorite: boolean;
492
+ isCompleted: boolean;
493
+ days: RoutineDay[];
494
+ createdAt: IsoDateString;
495
+ updatedAt: IsoDateString;
496
+ }
497
+ interface CreateRoutineRequest {
498
+ name: string;
499
+ description?: string;
500
+ isPeriodized: boolean;
501
+ days: CreateRoutineDayInput[];
502
+ }
503
+ type UpdateRoutineRequest = Partial<CreateRoutineRequest>;
504
+
505
+ 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, PROFILE_VISIBILITY_VALUES, PROGRESSION_SCHEMES, type PaginatedResponse, type PersonalRecordEntry, type PersonalRecordKind, type PlatePairInventory, type PreviousPerformanceResponse, type PreviousSessionRecap, type PreviousSetPerformance, type ProfilePrivacySettings, type ProfileViewerAccess, type ProfileVisibility, type ProgressionChange, type ProgressionRule, type ProgressionScheme, type ProgressionSetChange, type PublicBodyMetrics, type PublicTrainingSummary, 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 UpdateProfilePrivacyRequest, 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,171 +24,6 @@ interface PaginatedResponse<T> {
24
24
  nextCursor?: string;
25
25
  }
26
26
 
27
- interface UserProfile {
28
- timeZone?: string | null;
29
- id: string;
30
- email: string;
31
- name: string;
32
- lastName?: string | null;
33
- avatarUrl?: string | null;
34
- age?: number | null;
35
- sex?: Sex | null;
36
- weight?: number | null;
37
- height?: number | null;
38
- weightUnit: WeightUnit;
39
- followerCount: number;
40
- followingCount: number;
41
- createdAt: IsoDateString;
42
- updatedAt: IsoDateString;
43
- }
44
- interface PublicUserProfile {
45
- id: string;
46
- name: string;
47
- lastName?: string | null;
48
- avatarUrl?: string | null;
49
- createdAt: IsoDateString;
50
- updatedAt: IsoDateString;
51
- followerCount: number;
52
- followingCount: number;
53
- isFollowedByMe: boolean;
54
- }
55
- interface UpdateProfileRequest {
56
- name?: string;
57
- lastName?: string | null;
58
- avatarUrl?: string | null;
59
- age?: number | null;
60
- sex?: Sex | null;
61
- weight?: number | null;
62
- height?: number | null;
63
- weightUnit?: WeightUnit;
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
- }
90
- interface UserSearchResponse {
91
- id: string;
92
- email: string;
93
- name: string;
94
- lastName?: string | null;
95
- avatarUrl?: string | null;
96
- }
97
-
98
- interface SupabaseAuthUser {
99
- id: string;
100
- email: string;
101
- name: string;
102
- supabaseUserId?: string | null;
103
- weightUnit: WeightUnit;
104
- createdAt?: IsoDateString;
105
- updatedAt?: IsoDateString;
106
- }
107
- interface SupabaseAuthResponse {
108
- user: SupabaseAuthUser;
109
- message?: string;
110
- requiresEmailVerification?: boolean;
111
- }
112
- interface SupabaseMigrationResponse {
113
- message: string;
114
- userId: string;
115
- email: string;
116
- }
117
-
118
- interface Exercise {
119
- id: string;
120
- name: string;
121
- primaryMuscles: MuscleGroup[];
122
- secondaryMuscles: MuscleGroup[];
123
- equipment: string;
124
- createdAt: IsoDateString;
125
- updatedAt: IsoDateString;
126
- }
127
-
128
- interface RoutineSet {
129
- setNumber: number;
130
- repType: RepType;
131
- reps?: number | null;
132
- minReps?: number | null;
133
- maxReps?: number | null;
134
- weight?: number | null;
135
- rir?: number | null;
136
- }
137
- interface RoutineExercise {
138
- id: string;
139
- order: number;
140
- restSeconds: number;
141
- note?: string | null;
142
- progressionScheme: ProgressionScheme;
143
- minWeightIncrement: number;
144
- exercise: {
145
- id: string;
146
- name: string;
147
- primaryMuscles?: MuscleGroup[];
148
- secondaryMuscles?: MuscleGroup[];
149
- };
150
- sets: RoutineSet[];
151
- }
152
- interface CreateRoutineExerciseInput {
153
- exerciseId: string;
154
- order?: number;
155
- restSeconds: number;
156
- note?: string;
157
- progressionScheme: ProgressionScheme;
158
- minWeightIncrement: number;
159
- sets: RoutineSet[];
160
- }
161
- interface RoutineDay {
162
- id: string;
163
- dayOfWeek: number;
164
- order: number;
165
- exercises: RoutineExercise[];
166
- }
167
- interface CreateRoutineDayInput {
168
- dayOfWeek: number;
169
- order?: number;
170
- exercises: CreateRoutineExerciseInput[];
171
- }
172
- interface Routine {
173
- id: string;
174
- userId: string;
175
- name: string;
176
- description?: string | null;
177
- isPeriodized: boolean;
178
- isFavorite: boolean;
179
- isCompleted: boolean;
180
- days: RoutineDay[];
181
- createdAt: IsoDateString;
182
- updatedAt: IsoDateString;
183
- }
184
- interface CreateRoutineRequest {
185
- name: string;
186
- description?: string;
187
- isPeriodized: boolean;
188
- days: CreateRoutineDayInput[];
189
- }
190
- type UpdateRoutineRequest = Partial<CreateRoutineRequest>;
191
-
192
27
  interface SetLog {
193
28
  id: string;
194
29
  sessionId: string;
@@ -461,4 +296,210 @@ interface WorkoutAnalyticsStatus {
461
296
  generationId: string | null;
462
297
  }
463
298
 
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 };
299
+ declare const USERNAME_MIN_LENGTH = 3;
300
+ declare const USERNAME_MAX_LENGTH = 30;
301
+ declare const USERNAME_PATTERN_SOURCE = "^[a-z0-9][a-z0-9_-]{1,28}[a-z0-9]$";
302
+ 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"];
303
+ declare const PROFILE_VISIBILITY_VALUES: readonly ["PUBLIC", "FOLLOWERS", "PRIVATE"];
304
+ type ProfileVisibility = (typeof PROFILE_VISIBILITY_VALUES)[number];
305
+ interface ProfilePrivacySettings {
306
+ workoutHistory: ProfileVisibility;
307
+ records: ProfileVisibility;
308
+ routines: ProfileVisibility;
309
+ achievements: ProfileVisibility;
310
+ bodyMetrics: ProfileVisibility;
311
+ }
312
+ interface ProfileViewerAccess {
313
+ workoutHistory: boolean;
314
+ records: boolean;
315
+ routines: boolean;
316
+ achievements: boolean;
317
+ bodyMetrics: boolean;
318
+ }
319
+ interface PublicTrainingSummary {
320
+ completedWorkouts: number;
321
+ totalVolumeKg: number;
322
+ currentStreakDays: number;
323
+ bestStreakDays: number;
324
+ }
325
+ interface PublicBodyMetrics {
326
+ age?: number | null;
327
+ sex?: Sex | null;
328
+ weightKg?: number | null;
329
+ heightCm?: number | null;
330
+ }
331
+ interface UserProfile {
332
+ timeZone?: string | null;
333
+ id: string;
334
+ email: string;
335
+ username: string;
336
+ name: string;
337
+ lastName?: string | null;
338
+ avatarUrl?: string | null;
339
+ age?: number | null;
340
+ sex?: Sex | null;
341
+ weight?: number | null;
342
+ height?: number | null;
343
+ weightUnit: WeightUnit;
344
+ privacySettings: ProfilePrivacySettings;
345
+ followerCount: number;
346
+ followingCount: number;
347
+ createdAt: IsoDateString;
348
+ updatedAt: IsoDateString;
349
+ }
350
+ interface PublicUserProfile {
351
+ id: string;
352
+ username: string;
353
+ name: string;
354
+ lastName?: string | null;
355
+ avatarUrl?: string | null;
356
+ createdAt: IsoDateString;
357
+ updatedAt: IsoDateString;
358
+ followerCount: number;
359
+ followingCount: number;
360
+ isFollowedByMe: boolean;
361
+ viewerAccess: ProfileViewerAccess;
362
+ trainingSummary?: PublicTrainingSummary;
363
+ personalRecords?: PersonalRecordEntry[];
364
+ bodyMetrics?: PublicBodyMetrics;
365
+ }
366
+ interface UpdateProfileRequest {
367
+ username?: string;
368
+ name?: string;
369
+ lastName?: string | null;
370
+ avatarUrl?: string | null;
371
+ age?: number | null;
372
+ sex?: Sex | null;
373
+ weight?: number | null;
374
+ height?: number | null;
375
+ weightUnit?: WeightUnit;
376
+ }
377
+ type UpdateProfilePrivacyRequest = ProfilePrivacySettings;
378
+ interface PlatePairInventory {
379
+ weightKg: number;
380
+ pairCount: number;
381
+ }
382
+ interface TrainingLocationPreference {
383
+ id: string;
384
+ name: string;
385
+ isDefault: boolean;
386
+ barWeightKg: number;
387
+ availablePlatePairs: PlatePairInventory[];
388
+ equipment: string[];
389
+ createdAt: IsoDateString;
390
+ updatedAt: IsoDateString;
391
+ }
392
+ interface TrainingLocationPreferenceInput {
393
+ id?: string;
394
+ name: string;
395
+ isDefault: boolean;
396
+ barWeightKg: number;
397
+ availablePlatePairs: PlatePairInventory[];
398
+ equipment: string[];
399
+ }
400
+ interface ReplaceTrainingLocationsRequest {
401
+ locations: TrainingLocationPreferenceInput[];
402
+ }
403
+ interface UserSearchResponse {
404
+ id: string;
405
+ username: string;
406
+ name: string;
407
+ lastName?: string | null;
408
+ avatarUrl?: string | null;
409
+ }
410
+
411
+ interface SupabaseAuthUser {
412
+ id: string;
413
+ email: string;
414
+ name: string;
415
+ supabaseUserId?: string | null;
416
+ weightUnit: WeightUnit;
417
+ createdAt?: IsoDateString;
418
+ updatedAt?: IsoDateString;
419
+ }
420
+ interface SupabaseAuthResponse {
421
+ user: SupabaseAuthUser;
422
+ message?: string;
423
+ requiresEmailVerification?: boolean;
424
+ }
425
+ interface SupabaseMigrationResponse {
426
+ message: string;
427
+ userId: string;
428
+ email: string;
429
+ }
430
+
431
+ interface Exercise {
432
+ id: string;
433
+ name: string;
434
+ primaryMuscles: MuscleGroup[];
435
+ secondaryMuscles: MuscleGroup[];
436
+ equipment: string;
437
+ createdAt: IsoDateString;
438
+ updatedAt: IsoDateString;
439
+ }
440
+
441
+ interface RoutineSet {
442
+ setNumber: number;
443
+ repType: RepType;
444
+ reps?: number | null;
445
+ minReps?: number | null;
446
+ maxReps?: number | null;
447
+ weight?: number | null;
448
+ rir?: number | null;
449
+ }
450
+ interface RoutineExercise {
451
+ id: string;
452
+ order: number;
453
+ restSeconds: number;
454
+ note?: string | null;
455
+ progressionScheme: ProgressionScheme;
456
+ minWeightIncrement: number;
457
+ exercise: {
458
+ id: string;
459
+ name: string;
460
+ primaryMuscles?: MuscleGroup[];
461
+ secondaryMuscles?: MuscleGroup[];
462
+ };
463
+ sets: RoutineSet[];
464
+ }
465
+ interface CreateRoutineExerciseInput {
466
+ exerciseId: string;
467
+ order?: number;
468
+ restSeconds: number;
469
+ note?: string;
470
+ progressionScheme: ProgressionScheme;
471
+ minWeightIncrement: number;
472
+ sets: RoutineSet[];
473
+ }
474
+ interface RoutineDay {
475
+ id: string;
476
+ dayOfWeek: number;
477
+ order: number;
478
+ exercises: RoutineExercise[];
479
+ }
480
+ interface CreateRoutineDayInput {
481
+ dayOfWeek: number;
482
+ order?: number;
483
+ exercises: CreateRoutineExerciseInput[];
484
+ }
485
+ interface Routine {
486
+ id: string;
487
+ userId: string;
488
+ name: string;
489
+ description?: string | null;
490
+ isPeriodized: boolean;
491
+ isFavorite: boolean;
492
+ isCompleted: boolean;
493
+ days: RoutineDay[];
494
+ createdAt: IsoDateString;
495
+ updatedAt: IsoDateString;
496
+ }
497
+ interface CreateRoutineRequest {
498
+ name: string;
499
+ description?: string;
500
+ isPeriodized: boolean;
501
+ days: CreateRoutineDayInput[];
502
+ }
503
+ type UpdateRoutineRequest = Partial<CreateRoutineRequest>;
504
+
505
+ 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, PROFILE_VISIBILITY_VALUES, PROGRESSION_SCHEMES, type PaginatedResponse, type PersonalRecordEntry, type PersonalRecordKind, type PlatePairInventory, type PreviousPerformanceResponse, type PreviousSessionRecap, type PreviousSetPerformance, type ProfilePrivacySettings, type ProfileViewerAccess, type ProfileVisibility, type ProgressionChange, type ProgressionRule, type ProgressionScheme, type ProgressionSetChange, type PublicBodyMetrics, type PublicTrainingSummary, 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 UpdateProfilePrivacyRequest, 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,48 @@ 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
+ var PROFILE_VISIBILITY_VALUES = [
72
+ "PUBLIC",
73
+ "FOLLOWERS",
74
+ "PRIVATE"
75
+ ];
76
+
35
77
  // src/analytics.ts
36
78
  var TRAINING_EVENT_TYPES = [
37
79
  "SESSION_COMPLETED",
@@ -40,10 +82,15 @@ var TRAINING_EVENT_TYPES = [
40
82
  ];
41
83
  export {
42
84
  MUSCLE_GROUPS,
85
+ PROFILE_VISIBILITY_VALUES,
43
86
  PROGRESSION_SCHEMES,
44
87
  REP_TYPES,
88
+ RESERVED_USERNAMES,
45
89
  SEXES,
46
90
  TRAINING_EVENT_TYPES,
91
+ USERNAME_MAX_LENGTH,
92
+ USERNAME_MIN_LENGTH,
93
+ USERNAME_PATTERN_SOURCE,
47
94
  WEIGHT_UNITS,
48
95
  WORKOUT_SESSION_STATUSES
49
96
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sunsteel/contracts",
3
- "version": "0.12.0",
3
+ "version": "0.14.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ezee969/sunsteel-contracts.git"