@openlifelog/sdk 1.0.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/EXAMPLES.md +624 -0
- package/README.md +824 -0
- package/client.ts +190 -0
- package/config.ts +96 -0
- package/constants/metrics.ts +116 -0
- package/dist/index.d.mts +1101 -0
- package/dist/index.d.ts +1101 -0
- package/dist/index.js +2023 -0
- package/dist/index.mjs +1969 -0
- package/index.ts +49 -0
- package/package.json +53 -0
- package/resources/ai.ts +26 -0
- package/resources/auth.ts +98 -0
- package/resources/exercises.ts +112 -0
- package/resources/food-logs.ts +132 -0
- package/resources/foods.ts +185 -0
- package/resources/goals.ts +155 -0
- package/resources/metrics.ts +115 -0
- package/resources/programs.ts +123 -0
- package/resources/sessions.ts +142 -0
- package/resources/users.ts +132 -0
- package/resources/workouts.ts +147 -0
- package/tsconfig.json +27 -0
- package/types/ai.ts +55 -0
- package/types/common.ts +177 -0
- package/types/exercise.ts +75 -0
- package/types/food.ts +208 -0
- package/types/goal.ts +169 -0
- package/types/index.ts +17 -0
- package/types/metric.ts +108 -0
- package/types/program.ts +120 -0
- package/types/session.ts +196 -0
- package/types/user.ts +79 -0
- package/types/workout.ts +97 -0
- package/utils/errors.ts +159 -0
- package/utils/http.ts +313 -0
- package/utils/index.ts +8 -0
- package/utils/pagination.ts +106 -0
- package/utils/units.ts +279 -0
package/types/goal.ts
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
DateTime,
|
|
3
|
+
UUID,
|
|
4
|
+
GoalTargetType,
|
|
5
|
+
NutritionGoalType,
|
|
6
|
+
DateString,
|
|
7
|
+
ListParams,
|
|
8
|
+
DateRangeParams,
|
|
9
|
+
} from './common';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Goals and targets types
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* User goal (for metrics)
|
|
17
|
+
*/
|
|
18
|
+
export interface UserGoal {
|
|
19
|
+
id: UUID;
|
|
20
|
+
userId: UUID;
|
|
21
|
+
metricId: UUID;
|
|
22
|
+
targetValue: number;
|
|
23
|
+
targetType: GoalTargetType;
|
|
24
|
+
effectiveFrom: DateString;
|
|
25
|
+
effectiveUntil?: DateString;
|
|
26
|
+
createdAt: DateTime;
|
|
27
|
+
metricKey?: string;
|
|
28
|
+
metricName?: string;
|
|
29
|
+
unit?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Create user goal request
|
|
34
|
+
*/
|
|
35
|
+
export interface CreateUserGoalRequest {
|
|
36
|
+
metricKey: string;
|
|
37
|
+
targetValue: number;
|
|
38
|
+
targetType: GoalTargetType;
|
|
39
|
+
effectiveFrom?: DateString;
|
|
40
|
+
effectiveUntil?: DateString;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Update user goal request
|
|
45
|
+
*/
|
|
46
|
+
export interface UpdateUserGoalRequest {
|
|
47
|
+
targetValue?: number;
|
|
48
|
+
targetType?: GoalTargetType;
|
|
49
|
+
effectiveFrom?: DateString;
|
|
50
|
+
effectiveUntil?: DateString;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Goal progress status
|
|
55
|
+
*/
|
|
56
|
+
export type GoalProgressStatus = 'on_track' | 'below' | 'above' | 'no_data';
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Goal progress entry
|
|
60
|
+
*/
|
|
61
|
+
export interface GoalProgress {
|
|
62
|
+
id: UUID;
|
|
63
|
+
metricName: string;
|
|
64
|
+
targetValue: number;
|
|
65
|
+
targetType: GoalTargetType;
|
|
66
|
+
currentValue?: number;
|
|
67
|
+
status: GoalProgressStatus;
|
|
68
|
+
percentage?: number;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Daily goal progress
|
|
73
|
+
*/
|
|
74
|
+
export interface DailyGoalProgress {
|
|
75
|
+
date: DateString;
|
|
76
|
+
goals: GoalProgress[];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Nutrition goal definition
|
|
81
|
+
*/
|
|
82
|
+
export interface NutritionGoal {
|
|
83
|
+
type: NutritionGoalType;
|
|
84
|
+
value?: number;
|
|
85
|
+
min?: number;
|
|
86
|
+
max?: number;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* User nutrition goals
|
|
91
|
+
*/
|
|
92
|
+
export interface UserNutritionGoals {
|
|
93
|
+
id: UUID;
|
|
94
|
+
userId: UUID;
|
|
95
|
+
effectiveDate: DateString;
|
|
96
|
+
goals: Record<string, NutritionGoal>;
|
|
97
|
+
caloriesTarget?: number;
|
|
98
|
+
proteinTarget?: number;
|
|
99
|
+
carbohydratesTarget?: number;
|
|
100
|
+
fatTarget?: number;
|
|
101
|
+
notes?: string;
|
|
102
|
+
createdAt: DateTime;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Create nutrition goals request
|
|
107
|
+
*/
|
|
108
|
+
export interface CreateNutritionGoalsRequest {
|
|
109
|
+
effectiveDate: DateString;
|
|
110
|
+
goals: Record<string, NutritionGoal>;
|
|
111
|
+
notes?: string;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Update nutrition goals request
|
|
116
|
+
*/
|
|
117
|
+
export type UpdateNutritionGoalsRequest = Partial<CreateNutritionGoalsRequest>;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Bulk create nutrition goals request
|
|
121
|
+
*/
|
|
122
|
+
export interface BulkCreateNutritionGoalsRequest {
|
|
123
|
+
goals: Array<{
|
|
124
|
+
effectiveDate: DateString;
|
|
125
|
+
goals: Record<string, NutritionGoal>;
|
|
126
|
+
notes?: string;
|
|
127
|
+
}>;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Copy nutrition goals request
|
|
132
|
+
*/
|
|
133
|
+
export interface CopyNutritionGoalsRequest {
|
|
134
|
+
fromDate: DateString;
|
|
135
|
+
toDate: DateString;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Nutrition progress entry
|
|
140
|
+
*/
|
|
141
|
+
export interface NutritionProgress {
|
|
142
|
+
nutrientKey: string;
|
|
143
|
+
goal: NutritionGoal;
|
|
144
|
+
current: number;
|
|
145
|
+
target?: number;
|
|
146
|
+
percentage: number;
|
|
147
|
+
status: GoalProgressStatus;
|
|
148
|
+
remaining?: number;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Daily nutrition progress
|
|
153
|
+
*/
|
|
154
|
+
export interface DailyNutritionProgress {
|
|
155
|
+
date: DateString;
|
|
156
|
+
effectiveGoalDate: DateString;
|
|
157
|
+
progress: NutritionProgress[];
|
|
158
|
+
summary: {
|
|
159
|
+
onTrack: number;
|
|
160
|
+
below: number;
|
|
161
|
+
over: number;
|
|
162
|
+
noData: number;
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* List nutrition goals history parameters
|
|
168
|
+
*/
|
|
169
|
+
export interface ListNutritionGoalsHistoryParams extends ListParams, DateRangeParams {}
|
package/types/index.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Export all types
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// Common types
|
|
6
|
+
export * from './common';
|
|
7
|
+
|
|
8
|
+
// Domain types
|
|
9
|
+
export * from './user';
|
|
10
|
+
export * from './food';
|
|
11
|
+
export * from './exercise';
|
|
12
|
+
export * from './workout';
|
|
13
|
+
export * from './session';
|
|
14
|
+
export * from './program';
|
|
15
|
+
export * from './metric';
|
|
16
|
+
export * from './goal';
|
|
17
|
+
export * from './ai';
|
package/types/metric.ts
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { DateTime, UUID, ListParams, DateRangeParams, DateString } from './common';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Metrics and tracking types
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Metric aggregation type
|
|
9
|
+
*/
|
|
10
|
+
export type MetricAggregationType = 'sum' | 'average' | 'min' | 'max' | 'latest';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Metric category
|
|
14
|
+
*/
|
|
15
|
+
export type MetricCategory =
|
|
16
|
+
| 'body_composition'
|
|
17
|
+
| 'cardiovascular'
|
|
18
|
+
| 'strength'
|
|
19
|
+
| 'flexibility'
|
|
20
|
+
| 'sleep'
|
|
21
|
+
| 'stress'
|
|
22
|
+
| 'nutrition'
|
|
23
|
+
| 'hydration'
|
|
24
|
+
| 'custom';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Metric definition
|
|
28
|
+
*/
|
|
29
|
+
export interface Metric {
|
|
30
|
+
id: UUID;
|
|
31
|
+
key: string;
|
|
32
|
+
name: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
category: MetricCategory | string;
|
|
35
|
+
unit: string;
|
|
36
|
+
aggregationType: MetricAggregationType;
|
|
37
|
+
createdAt: DateTime;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Metric event (tracked data point)
|
|
42
|
+
*/
|
|
43
|
+
export interface MetricEvent {
|
|
44
|
+
id: UUID;
|
|
45
|
+
userId: UUID;
|
|
46
|
+
metricId: UUID;
|
|
47
|
+
metricKey: string;
|
|
48
|
+
value: number;
|
|
49
|
+
metadata?: Record<string, any>;
|
|
50
|
+
loggedAt: DateTime;
|
|
51
|
+
source?: string;
|
|
52
|
+
referenceId?: UUID;
|
|
53
|
+
createdAt: DateTime;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Create metric event request
|
|
58
|
+
*/
|
|
59
|
+
export interface CreateMetricEventRequest {
|
|
60
|
+
metricKey: string;
|
|
61
|
+
value: number;
|
|
62
|
+
metadata?: Record<string, any>;
|
|
63
|
+
loggedAt?: DateTime;
|
|
64
|
+
source?: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Update metric event request
|
|
69
|
+
*/
|
|
70
|
+
export interface UpdateMetricEventRequest {
|
|
71
|
+
value?: number;
|
|
72
|
+
metadata?: Record<string, any>;
|
|
73
|
+
loggedAt?: DateTime;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Bulk create metric events request
|
|
78
|
+
*/
|
|
79
|
+
export interface BulkCreateMetricEventsRequest {
|
|
80
|
+
metrics: CreateMetricEventRequest[];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* List metric events parameters
|
|
85
|
+
*/
|
|
86
|
+
export interface ListMetricEventsParams extends ListParams, DateRangeParams {
|
|
87
|
+
metricId?: UUID;
|
|
88
|
+
metricKey?: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Daily metric aggregate
|
|
93
|
+
*/
|
|
94
|
+
export interface DailyMetricAggregate {
|
|
95
|
+
date: DateString;
|
|
96
|
+
metricKey: string;
|
|
97
|
+
value: number;
|
|
98
|
+
count: number;
|
|
99
|
+
min?: number;
|
|
100
|
+
max?: number;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Get daily metric parameters
|
|
105
|
+
*/
|
|
106
|
+
export interface GetDailyMetricParams {
|
|
107
|
+
date?: DateString;
|
|
108
|
+
}
|
package/types/program.ts
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import type { DateTime, UUID, DateString } from './common';
|
|
2
|
+
import type { SetData } from './workout';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Training program types
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Program schedule exercise
|
|
10
|
+
*/
|
|
11
|
+
export interface ProgramScheduleExercise {
|
|
12
|
+
exerciseId: UUID;
|
|
13
|
+
orderIndex: number;
|
|
14
|
+
sets: SetData[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Program schedule day
|
|
19
|
+
*/
|
|
20
|
+
export interface ProgramScheduleDay {
|
|
21
|
+
week: number;
|
|
22
|
+
day: number;
|
|
23
|
+
name: string;
|
|
24
|
+
exercises: ProgramScheduleExercise[];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Program metadata
|
|
29
|
+
*/
|
|
30
|
+
export interface ProgramMetadata {
|
|
31
|
+
difficulty?: string;
|
|
32
|
+
type?: string;
|
|
33
|
+
equipment?: string[];
|
|
34
|
+
duration?: string;
|
|
35
|
+
[key: string]: any;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Training program
|
|
40
|
+
*/
|
|
41
|
+
export interface Program {
|
|
42
|
+
id: UUID;
|
|
43
|
+
name: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
createdBy: UUID;
|
|
46
|
+
isTemplate: boolean;
|
|
47
|
+
schedule: ProgramScheduleDay[];
|
|
48
|
+
metadata?: ProgramMetadata;
|
|
49
|
+
createdAt: DateTime;
|
|
50
|
+
updatedAt: DateTime;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Create program request
|
|
55
|
+
*/
|
|
56
|
+
export interface CreateProgramRequest {
|
|
57
|
+
name: string;
|
|
58
|
+
description?: string;
|
|
59
|
+
schedule: ProgramScheduleDay[];
|
|
60
|
+
metadata?: ProgramMetadata;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Update program request
|
|
65
|
+
*/
|
|
66
|
+
export type UpdateProgramRequest = Partial<CreateProgramRequest>;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Enroll in program request
|
|
70
|
+
*/
|
|
71
|
+
export interface EnrollInProgramRequest {
|
|
72
|
+
startDate: DateString;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Program enrollment
|
|
77
|
+
*/
|
|
78
|
+
export interface ProgramEnrollment {
|
|
79
|
+
id: UUID;
|
|
80
|
+
userId: UUID;
|
|
81
|
+
programId: UUID;
|
|
82
|
+
startDate: DateString;
|
|
83
|
+
currentWeek: number;
|
|
84
|
+
currentDay: number;
|
|
85
|
+
status: 'active' | 'paused' | 'completed';
|
|
86
|
+
completedAt?: DateTime;
|
|
87
|
+
createdAt: DateTime;
|
|
88
|
+
updatedAt: DateTime;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Update enrollment request
|
|
93
|
+
*/
|
|
94
|
+
export interface UpdateEnrollmentRequest {
|
|
95
|
+
status?: 'active' | 'paused' | 'completed';
|
|
96
|
+
currentWeek?: number;
|
|
97
|
+
currentDay?: number;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Program enrollment progress
|
|
102
|
+
*/
|
|
103
|
+
export interface EnrollmentProgress {
|
|
104
|
+
enrollmentId: UUID;
|
|
105
|
+
totalWeeks: number;
|
|
106
|
+
totalDays: number;
|
|
107
|
+
completedDays: number;
|
|
108
|
+
currentWeek: number;
|
|
109
|
+
currentDay: number;
|
|
110
|
+
completionPercentage: number;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Current week schedule
|
|
115
|
+
*/
|
|
116
|
+
export interface CurrentWeekSchedule {
|
|
117
|
+
enrollmentId: UUID;
|
|
118
|
+
week: number;
|
|
119
|
+
days: ProgramScheduleDay[];
|
|
120
|
+
}
|
package/types/session.ts
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
DateTime,
|
|
3
|
+
UUID,
|
|
4
|
+
ListParams,
|
|
5
|
+
DateRangeParams,
|
|
6
|
+
SessionStatus,
|
|
7
|
+
RecordType,
|
|
8
|
+
DateString,
|
|
9
|
+
} from './common';
|
|
10
|
+
import type { SetData } from './workout';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Workout session types (performance tracking)
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Session exercise detail (actual performance in a session)
|
|
18
|
+
*/
|
|
19
|
+
export interface SessionExerciseDetail {
|
|
20
|
+
id: UUID;
|
|
21
|
+
sessionId: UUID;
|
|
22
|
+
exerciseId: UUID;
|
|
23
|
+
workoutExerciseId?: UUID;
|
|
24
|
+
orderPerformed: number;
|
|
25
|
+
startedAt?: DateTime;
|
|
26
|
+
completedAt?: DateTime;
|
|
27
|
+
workoutFormat: string;
|
|
28
|
+
setsData: SetData[];
|
|
29
|
+
totalSets: number;
|
|
30
|
+
completedSets: number;
|
|
31
|
+
totalVolume?: number;
|
|
32
|
+
totalDistance?: number;
|
|
33
|
+
totalDuration?: number;
|
|
34
|
+
skipped: boolean;
|
|
35
|
+
notes?: string;
|
|
36
|
+
formRating?: number; // 1-5
|
|
37
|
+
rpe?: number; // 1-10
|
|
38
|
+
exerciseName: string;
|
|
39
|
+
exerciseDescription?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Workout session
|
|
44
|
+
*/
|
|
45
|
+
export interface WorkoutSession {
|
|
46
|
+
id: UUID;
|
|
47
|
+
userId: UUID;
|
|
48
|
+
workoutId?: UUID;
|
|
49
|
+
name?: string;
|
|
50
|
+
programEnrollmentId?: UUID;
|
|
51
|
+
scheduledFor?: DateTime;
|
|
52
|
+
startedAt?: DateTime;
|
|
53
|
+
completedAt?: DateTime;
|
|
54
|
+
pausedDuration?: string;
|
|
55
|
+
status: SessionStatus;
|
|
56
|
+
userBodyweight?: number;
|
|
57
|
+
totalVolume?: number;
|
|
58
|
+
totalDistance?: number;
|
|
59
|
+
totalDuration?: number;
|
|
60
|
+
totalSetsCompleted: number;
|
|
61
|
+
totalExercisesCompleted: number;
|
|
62
|
+
notes?: string;
|
|
63
|
+
mood?: string;
|
|
64
|
+
location?: string;
|
|
65
|
+
createdAt: DateTime;
|
|
66
|
+
updatedAt: DateTime;
|
|
67
|
+
exercises?: SessionExerciseDetail[];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Create workout session request
|
|
72
|
+
*/
|
|
73
|
+
export interface CreateWorkoutSessionRequest {
|
|
74
|
+
workoutId?: UUID;
|
|
75
|
+
name?: string;
|
|
76
|
+
status?: SessionStatus;
|
|
77
|
+
userBodyweight?: number;
|
|
78
|
+
scheduledFor?: DateTime;
|
|
79
|
+
notes?: string;
|
|
80
|
+
mood?: string;
|
|
81
|
+
location?: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Add exercise to session (used in unified update)
|
|
86
|
+
*/
|
|
87
|
+
export interface AddExerciseItem {
|
|
88
|
+
exerciseId: UUID;
|
|
89
|
+
targetSets: number;
|
|
90
|
+
notes?: string;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Update exercise in session (used in unified update)
|
|
95
|
+
*/
|
|
96
|
+
export interface UpdateExerciseItem {
|
|
97
|
+
id: UUID;
|
|
98
|
+
targetSets?: number;
|
|
99
|
+
notes?: string;
|
|
100
|
+
startedAt?: DateTime;
|
|
101
|
+
completedAt?: DateTime;
|
|
102
|
+
skipped?: boolean;
|
|
103
|
+
skipReason?: string;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Update workout session request (Unified Update)
|
|
108
|
+
* Supports session-level updates, exercise operations, and set operations
|
|
109
|
+
*/
|
|
110
|
+
export interface UpdateWorkoutSessionRequest {
|
|
111
|
+
// Session-level updates
|
|
112
|
+
name?: string;
|
|
113
|
+
status?: SessionStatus;
|
|
114
|
+
startedAt?: DateTime;
|
|
115
|
+
completedAt?: DateTime;
|
|
116
|
+
notes?: string;
|
|
117
|
+
mood?: string;
|
|
118
|
+
location?: string;
|
|
119
|
+
completionPercentage?: number;
|
|
120
|
+
pausedDuration?: string;
|
|
121
|
+
userBodyweight?: number;
|
|
122
|
+
|
|
123
|
+
// Exercise operations
|
|
124
|
+
addExercises?: AddExerciseItem[];
|
|
125
|
+
updateExercises?: UpdateExerciseItem[];
|
|
126
|
+
removeExercises?: UUID[];
|
|
127
|
+
reorderExercises?: Record<UUID, number>;
|
|
128
|
+
|
|
129
|
+
// Sets operations (by exercise ID)
|
|
130
|
+
updateSets?: Record<UUID, any[]>;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* List workout sessions parameters
|
|
135
|
+
*/
|
|
136
|
+
export interface ListWorkoutSessionsParams extends ListParams, DateRangeParams {
|
|
137
|
+
status?: SessionStatus;
|
|
138
|
+
workoutId?: UUID;
|
|
139
|
+
includeExercises?: boolean;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Exercise performance history entry
|
|
144
|
+
*/
|
|
145
|
+
export interface ExerciseHistoryEntry {
|
|
146
|
+
date: DateString;
|
|
147
|
+
sessionId: UUID;
|
|
148
|
+
totalVolume?: number;
|
|
149
|
+
totalSets: number;
|
|
150
|
+
completedSets: number;
|
|
151
|
+
rpe?: number;
|
|
152
|
+
formRating?: number;
|
|
153
|
+
notes?: string;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Exercise performance history
|
|
158
|
+
*/
|
|
159
|
+
export interface ExerciseHistory {
|
|
160
|
+
exerciseId: UUID;
|
|
161
|
+
exerciseName: string;
|
|
162
|
+
history: ExerciseHistoryEntry[];
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Personal record
|
|
167
|
+
*/
|
|
168
|
+
export interface PersonalRecord {
|
|
169
|
+
exerciseId: UUID;
|
|
170
|
+
exerciseName: string;
|
|
171
|
+
recordType: RecordType;
|
|
172
|
+
value: number;
|
|
173
|
+
unit: string;
|
|
174
|
+
achievedDate: DateString;
|
|
175
|
+
sessionId: UUID;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Personal record history entry
|
|
180
|
+
*/
|
|
181
|
+
export interface PersonalRecordHistoryEntry {
|
|
182
|
+
value: number;
|
|
183
|
+
date: DateString;
|
|
184
|
+
sessionId: UUID;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Personal record history
|
|
189
|
+
*/
|
|
190
|
+
export interface PersonalRecordHistory {
|
|
191
|
+
exerciseId: UUID;
|
|
192
|
+
exerciseName: string;
|
|
193
|
+
recordType: RecordType;
|
|
194
|
+
unit: string;
|
|
195
|
+
history: PersonalRecordHistoryEntry[];
|
|
196
|
+
}
|
package/types/user.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { DateTime, UUID, MeasurementSystem } from './common';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* User types
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* User account information
|
|
9
|
+
*/
|
|
10
|
+
export interface User {
|
|
11
|
+
id: UUID;
|
|
12
|
+
name: string;
|
|
13
|
+
email: string;
|
|
14
|
+
emailVerified: boolean;
|
|
15
|
+
isActive: boolean;
|
|
16
|
+
isOnboarded: boolean;
|
|
17
|
+
timezone: string; // IANA timezone (e.g., "America/Denver")
|
|
18
|
+
locale: string; // e.g., "en-US"
|
|
19
|
+
dateFormat: string; // e.g., "ISO8601"
|
|
20
|
+
createdAt: DateTime;
|
|
21
|
+
updatedAt: DateTime;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* User preferences
|
|
26
|
+
*/
|
|
27
|
+
export interface UserPreferences {
|
|
28
|
+
userId: UUID;
|
|
29
|
+
measurementSystem: MeasurementSystem;
|
|
30
|
+
createdAt: DateTime;
|
|
31
|
+
updatedAt: DateTime;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Authentication request/response types
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
export interface SignupRequest {
|
|
39
|
+
name: string;
|
|
40
|
+
email: string;
|
|
41
|
+
password: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface LoginRequest {
|
|
45
|
+
email: string;
|
|
46
|
+
password: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface AuthResponse {
|
|
50
|
+
token: string;
|
|
51
|
+
user: User;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface PasswordResetRequest {
|
|
55
|
+
email: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface PasswordResetConfirm {
|
|
59
|
+
token: string;
|
|
60
|
+
newPassword: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Update user profile request
|
|
65
|
+
*/
|
|
66
|
+
export interface UpdateUserRequest {
|
|
67
|
+
name?: string;
|
|
68
|
+
isOnboarded?: boolean;
|
|
69
|
+
timezone?: string;
|
|
70
|
+
locale?: string;
|
|
71
|
+
dateFormat?: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Update user preferences request
|
|
76
|
+
*/
|
|
77
|
+
export interface UpdatePreferencesRequest {
|
|
78
|
+
measurementSystem?: MeasurementSystem;
|
|
79
|
+
}
|