@sunsteel/contracts 0.1.1 → 0.2.1
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 +39 -0
- package/dist/index.d.cts +319 -1
- package/dist/index.d.ts +319 -1
- package/dist/index.js +35 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -20,7 +20,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
MUSCLE_GROUPS: () => MUSCLE_GROUPS,
|
|
23
24
|
PROGRAM_STYLES: () => PROGRAM_STYLES,
|
|
25
|
+
PROGRESSION_SCHEMES: () => PROGRESSION_SCHEMES,
|
|
26
|
+
REP_TYPES: () => REP_TYPES,
|
|
27
|
+
TM_ADJUSTMENT_CONSTANTS: () => TM_ADJUSTMENT_CONSTANTS,
|
|
24
28
|
WEIGHT_UNITS: () => WEIGHT_UNITS,
|
|
25
29
|
WORKOUT_SESSION_STATUSES: () => WORKOUT_SESSION_STATUSES
|
|
26
30
|
});
|
|
@@ -32,9 +36,44 @@ var WORKOUT_SESSION_STATUSES = [
|
|
|
32
36
|
"ABORTED"
|
|
33
37
|
];
|
|
34
38
|
var WEIGHT_UNITS = ["KG", "LB"];
|
|
39
|
+
var REP_TYPES = ["FIXED", "RANGE"];
|
|
40
|
+
var PROGRESSION_SCHEMES = [
|
|
41
|
+
"NONE",
|
|
42
|
+
"DOUBLE_PROGRESSION",
|
|
43
|
+
"DYNAMIC_DOUBLE_PROGRESSION",
|
|
44
|
+
"PROGRAMMED_RTF",
|
|
45
|
+
"PROGRAMMED_RTF_HYPERTROPHY"
|
|
46
|
+
];
|
|
47
|
+
var MUSCLE_GROUPS = [
|
|
48
|
+
"PECTORAL",
|
|
49
|
+
"LATISSIMUS_DORSI",
|
|
50
|
+
"DELTOID",
|
|
51
|
+
"TRAPEZIUS",
|
|
52
|
+
"BICEPS",
|
|
53
|
+
"TRICEPS",
|
|
54
|
+
"FOREARM",
|
|
55
|
+
"ABDOMINAL",
|
|
56
|
+
"OBLIQUE",
|
|
57
|
+
"ERECTOR_SPINAE",
|
|
58
|
+
"GLUTEUS",
|
|
59
|
+
"QUADRICEPS",
|
|
60
|
+
"HAMSTRINGS",
|
|
61
|
+
"CALVES"
|
|
62
|
+
];
|
|
63
|
+
var TM_ADJUSTMENT_CONSTANTS = {
|
|
64
|
+
MAX_DELTA_KG: 15,
|
|
65
|
+
MIN_DELTA_KG: -15,
|
|
66
|
+
MIN_WEEK: 1,
|
|
67
|
+
MAX_WEEK: 21,
|
|
68
|
+
MAX_REASON_LENGTH: 160
|
|
69
|
+
};
|
|
35
70
|
// Annotate the CommonJS export names for ESM import in node:
|
|
36
71
|
0 && (module.exports = {
|
|
72
|
+
MUSCLE_GROUPS,
|
|
37
73
|
PROGRAM_STYLES,
|
|
74
|
+
PROGRESSION_SCHEMES,
|
|
75
|
+
REP_TYPES,
|
|
76
|
+
TM_ADJUSTMENT_CONSTANTS,
|
|
38
77
|
WEIGHT_UNITS,
|
|
39
78
|
WORKOUT_SESSION_STATUSES
|
|
40
79
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -4,6 +4,13 @@ declare const WORKOUT_SESSION_STATUSES: readonly ["IN_PROGRESS", "COMPLETED", "A
|
|
|
4
4
|
type WorkoutSessionStatus = (typeof WORKOUT_SESSION_STATUSES)[number];
|
|
5
5
|
declare const WEIGHT_UNITS: readonly ["KG", "LB"];
|
|
6
6
|
type WeightUnit = (typeof WEIGHT_UNITS)[number];
|
|
7
|
+
declare const REP_TYPES: readonly ["FIXED", "RANGE"];
|
|
8
|
+
type RepType = (typeof REP_TYPES)[number];
|
|
9
|
+
declare const PROGRESSION_SCHEMES: readonly ["NONE", "DOUBLE_PROGRESSION", "DYNAMIC_DOUBLE_PROGRESSION", "PROGRAMMED_RTF", "PROGRAMMED_RTF_HYPERTROPHY"];
|
|
10
|
+
type ProgressionScheme = (typeof PROGRESSION_SCHEMES)[number];
|
|
11
|
+
declare const MUSCLE_GROUPS: readonly ["PECTORAL", "LATISSIMUS_DORSI", "DELTOID", "TRAPEZIUS", "BICEPS", "TRICEPS", "FOREARM", "ABDOMINAL", "OBLIQUE", "ERECTOR_SPINAE", "GLUTEUS", "QUADRICEPS", "HAMSTRINGS", "CALVES"];
|
|
12
|
+
type MuscleGroup = (typeof MUSCLE_GROUPS)[number];
|
|
13
|
+
type IsoDateString = string;
|
|
7
14
|
type Brand<T, B> = T & {
|
|
8
15
|
readonly __brand: B;
|
|
9
16
|
};
|
|
@@ -11,5 +18,316 @@ type UserId = Brand<string, 'UserId'>;
|
|
|
11
18
|
type RoutineId = Brand<string, 'RoutineId'>;
|
|
12
19
|
type RoutineDayId = Brand<string, 'RoutineDayId'>;
|
|
13
20
|
type WorkoutSessionId = Brand<string, 'WorkoutSessionId'>;
|
|
21
|
+
type ExerciseId = Brand<string, 'ExerciseId'>;
|
|
22
|
+
interface RoutineSet {
|
|
23
|
+
setNumber: number;
|
|
24
|
+
repType: RepType;
|
|
25
|
+
reps?: number | null;
|
|
26
|
+
minReps?: number | null;
|
|
27
|
+
maxReps?: number | null;
|
|
28
|
+
weight?: number | null;
|
|
29
|
+
}
|
|
30
|
+
interface RoutineExercise {
|
|
31
|
+
id: string;
|
|
32
|
+
order: number;
|
|
33
|
+
restSeconds: number;
|
|
34
|
+
progressionScheme: ProgressionScheme;
|
|
35
|
+
minWeightIncrement: number;
|
|
36
|
+
programTMKg?: number;
|
|
37
|
+
programRoundingKg?: number;
|
|
38
|
+
programStyle?: ProgramStyle;
|
|
39
|
+
exercise: {
|
|
40
|
+
id: string;
|
|
41
|
+
name: string;
|
|
42
|
+
primaryMuscles?: MuscleGroup[];
|
|
43
|
+
secondaryMuscles?: MuscleGroup[];
|
|
44
|
+
};
|
|
45
|
+
sets: RoutineSet[];
|
|
46
|
+
}
|
|
47
|
+
interface CreateRoutineExerciseInput {
|
|
48
|
+
exerciseId: string;
|
|
49
|
+
order?: number;
|
|
50
|
+
restSeconds: number;
|
|
51
|
+
progressionScheme: ProgressionScheme;
|
|
52
|
+
minWeightIncrement: number;
|
|
53
|
+
programTMKg?: number;
|
|
54
|
+
programRoundingKg?: number;
|
|
55
|
+
programStyle?: ProgramStyle;
|
|
56
|
+
sets: RoutineSet[];
|
|
57
|
+
}
|
|
58
|
+
interface RoutineDay {
|
|
59
|
+
id: string;
|
|
60
|
+
dayOfWeek: number;
|
|
61
|
+
order: number;
|
|
62
|
+
exercises: RoutineExercise[];
|
|
63
|
+
}
|
|
64
|
+
interface CreateRoutineDayInput {
|
|
65
|
+
dayOfWeek: number;
|
|
66
|
+
order?: number;
|
|
67
|
+
exercises: CreateRoutineExerciseInput[];
|
|
68
|
+
}
|
|
69
|
+
interface Routine {
|
|
70
|
+
id: string;
|
|
71
|
+
userId: string;
|
|
72
|
+
name: string;
|
|
73
|
+
description?: string | null;
|
|
74
|
+
isPeriodized: boolean;
|
|
75
|
+
isFavorite: boolean;
|
|
76
|
+
isCompleted: boolean;
|
|
77
|
+
programStyle?: ProgramStyle;
|
|
78
|
+
programWithDeloads?: boolean;
|
|
79
|
+
programDurationWeeks?: number;
|
|
80
|
+
programStartWeek?: number;
|
|
81
|
+
programStartDate?: IsoDateString;
|
|
82
|
+
programEndDate?: IsoDateString;
|
|
83
|
+
programTimezone?: string;
|
|
84
|
+
rtfGoals?: RtfWeekGoals;
|
|
85
|
+
days: RoutineDay[];
|
|
86
|
+
createdAt: IsoDateString;
|
|
87
|
+
updatedAt: IsoDateString;
|
|
88
|
+
}
|
|
89
|
+
interface CreateRoutineRequest {
|
|
90
|
+
name: string;
|
|
91
|
+
description?: string;
|
|
92
|
+
isPeriodized: boolean;
|
|
93
|
+
programWithDeloads?: boolean;
|
|
94
|
+
programStartDate?: IsoDateString;
|
|
95
|
+
programTimezone?: string;
|
|
96
|
+
programStartWeek?: number;
|
|
97
|
+
programStyle?: ProgramStyle;
|
|
98
|
+
days: CreateRoutineDayInput[];
|
|
99
|
+
}
|
|
100
|
+
interface SetLog {
|
|
101
|
+
id: string;
|
|
102
|
+
sessionId: string;
|
|
103
|
+
routineExerciseId: string;
|
|
104
|
+
exerciseId: string;
|
|
105
|
+
setNumber: number;
|
|
106
|
+
reps: number;
|
|
107
|
+
weight?: number | null;
|
|
108
|
+
rpe?: number | null;
|
|
109
|
+
isCompleted: boolean;
|
|
110
|
+
completedAt?: IsoDateString | null;
|
|
111
|
+
createdAt: IsoDateString;
|
|
112
|
+
updatedAt: IsoDateString;
|
|
113
|
+
}
|
|
114
|
+
interface WorkoutSession {
|
|
115
|
+
id: string;
|
|
116
|
+
userId: string;
|
|
117
|
+
routineId: string;
|
|
118
|
+
routineDayId: string;
|
|
119
|
+
status: WorkoutSessionStatus;
|
|
120
|
+
startedAt: IsoDateString;
|
|
121
|
+
endedAt?: IsoDateString | null;
|
|
122
|
+
durationSec?: number | null;
|
|
123
|
+
notes?: string | null;
|
|
124
|
+
lastActivityAt?: IsoDateString | null;
|
|
125
|
+
setLogs?: SetLog[];
|
|
126
|
+
program?: {
|
|
127
|
+
currentWeek: number;
|
|
128
|
+
durationWeeks: number;
|
|
129
|
+
withDeloads: boolean;
|
|
130
|
+
isDeloadWeek: boolean;
|
|
131
|
+
startDate: IsoDateString;
|
|
132
|
+
endDate: IsoDateString;
|
|
133
|
+
timeZone: string;
|
|
134
|
+
};
|
|
135
|
+
rtfPlans?: unknown[];
|
|
136
|
+
reused?: boolean;
|
|
137
|
+
routine?: {
|
|
138
|
+
id: string;
|
|
139
|
+
name: string;
|
|
140
|
+
description?: string | null;
|
|
141
|
+
};
|
|
142
|
+
routineDay?: {
|
|
143
|
+
id: string;
|
|
144
|
+
name?: string | null;
|
|
145
|
+
order?: number;
|
|
146
|
+
dayOfWeek?: number;
|
|
147
|
+
exercises: Array<{
|
|
148
|
+
id: string;
|
|
149
|
+
order: number;
|
|
150
|
+
restSeconds?: number | null;
|
|
151
|
+
progressionScheme: ProgressionScheme;
|
|
152
|
+
minWeightIncrement: number;
|
|
153
|
+
exercise: {
|
|
154
|
+
id: string;
|
|
155
|
+
name: string;
|
|
156
|
+
primaryMuscles: MuscleGroup[];
|
|
157
|
+
secondaryMuscles?: MuscleGroup[];
|
|
158
|
+
};
|
|
159
|
+
sets: Array<{
|
|
160
|
+
id: string;
|
|
161
|
+
setNumber: number;
|
|
162
|
+
repType: RepType;
|
|
163
|
+
reps?: number | null;
|
|
164
|
+
minReps?: number | null;
|
|
165
|
+
maxReps?: number | null;
|
|
166
|
+
weight?: number | null;
|
|
167
|
+
}>;
|
|
168
|
+
}>;
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
interface StartWorkoutRequest {
|
|
172
|
+
routineId: string;
|
|
173
|
+
routineDayId: string;
|
|
174
|
+
notes?: string;
|
|
175
|
+
}
|
|
176
|
+
interface StartWorkoutResponse {
|
|
177
|
+
id: string;
|
|
178
|
+
routineId: string;
|
|
179
|
+
routineDayId: string;
|
|
180
|
+
status: WorkoutSessionStatus;
|
|
181
|
+
startedAt: IsoDateString;
|
|
182
|
+
endedAt?: IsoDateString | null;
|
|
183
|
+
program?: WorkoutSession['program'];
|
|
184
|
+
rtfPlans?: WorkoutSession['rtfPlans'];
|
|
185
|
+
reused: boolean;
|
|
186
|
+
}
|
|
187
|
+
type FinishStatus = Extract<WorkoutSessionStatus, 'COMPLETED' | 'ABORTED'>;
|
|
188
|
+
interface FinishWorkoutRequest {
|
|
189
|
+
status: FinishStatus;
|
|
190
|
+
notes?: string;
|
|
191
|
+
}
|
|
192
|
+
interface UpsertSetLogRequest {
|
|
193
|
+
routineExerciseId: string;
|
|
194
|
+
exerciseId: string;
|
|
195
|
+
setNumber: number;
|
|
196
|
+
reps: number;
|
|
197
|
+
weight?: number;
|
|
198
|
+
rpe?: number;
|
|
199
|
+
isCompleted?: boolean;
|
|
200
|
+
}
|
|
201
|
+
interface WorkoutSessionSummary {
|
|
202
|
+
id: string;
|
|
203
|
+
status: WorkoutSessionStatus;
|
|
204
|
+
startedAt: IsoDateString;
|
|
205
|
+
endedAt?: IsoDateString | null;
|
|
206
|
+
durationSec?: number | null;
|
|
207
|
+
totalVolume?: number | null;
|
|
208
|
+
totalSets?: number | null;
|
|
209
|
+
totalExercises?: number | null;
|
|
210
|
+
notes?: string | null;
|
|
211
|
+
routine: {
|
|
212
|
+
id: string;
|
|
213
|
+
name: string;
|
|
214
|
+
dayName?: string | null;
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
interface PaginatedResponse<T> {
|
|
218
|
+
items: T[];
|
|
219
|
+
nextCursor?: string;
|
|
220
|
+
}
|
|
221
|
+
interface ListSessionsParams {
|
|
222
|
+
status?: WorkoutSessionStatus;
|
|
223
|
+
routineId?: string;
|
|
224
|
+
from?: IsoDateString;
|
|
225
|
+
to?: IsoDateString;
|
|
226
|
+
q?: string;
|
|
227
|
+
cursor?: string;
|
|
228
|
+
limit?: number;
|
|
229
|
+
sort?: 'finishedAt:desc' | 'finishedAt:asc' | 'startedAt:desc' | 'startedAt:asc';
|
|
230
|
+
}
|
|
231
|
+
type RtfVariant = ProgramStyle;
|
|
232
|
+
interface RtfExerciseGoal {
|
|
233
|
+
routineExerciseId: string;
|
|
234
|
+
exerciseId: string;
|
|
235
|
+
exerciseName: string;
|
|
236
|
+
variant: RtfVariant;
|
|
237
|
+
week: number;
|
|
238
|
+
isDeload: boolean;
|
|
239
|
+
intensity: number;
|
|
240
|
+
fixedReps: number;
|
|
241
|
+
setsPlanned: number;
|
|
242
|
+
amrapTarget: number | null;
|
|
243
|
+
amrapSetNumber: number | null;
|
|
244
|
+
workingWeightKg?: number;
|
|
245
|
+
trainingMaxKg?: number;
|
|
246
|
+
}
|
|
247
|
+
interface RtfWeekGoals {
|
|
248
|
+
routineId: string;
|
|
249
|
+
week: number;
|
|
250
|
+
withDeloads: boolean;
|
|
251
|
+
goals: RtfExerciseGoal[];
|
|
252
|
+
version: number;
|
|
253
|
+
_cache?: 'HIT' | 'MISS';
|
|
254
|
+
}
|
|
255
|
+
interface RtfTimelineEntry {
|
|
256
|
+
week: number;
|
|
257
|
+
isDeload: boolean;
|
|
258
|
+
startDate: IsoDateString;
|
|
259
|
+
endDate: IsoDateString;
|
|
260
|
+
}
|
|
261
|
+
interface RtfTimeline {
|
|
262
|
+
routineId: string;
|
|
263
|
+
totalWeeks: number;
|
|
264
|
+
withDeloads: boolean;
|
|
265
|
+
timeline: RtfTimelineEntry[];
|
|
266
|
+
version: number;
|
|
267
|
+
_cache?: 'HIT' | 'MISS';
|
|
268
|
+
}
|
|
269
|
+
interface RtfForecastData {
|
|
270
|
+
intensity: number;
|
|
271
|
+
fixedReps: number;
|
|
272
|
+
amrapTarget: number;
|
|
273
|
+
sets: number;
|
|
274
|
+
amrapSet: number;
|
|
275
|
+
isDeload?: boolean;
|
|
276
|
+
}
|
|
277
|
+
interface RtfForecastWeek {
|
|
278
|
+
week: number;
|
|
279
|
+
isDeload: boolean;
|
|
280
|
+
standard?: RtfForecastData;
|
|
281
|
+
hypertrophy?: RtfForecastData;
|
|
282
|
+
}
|
|
283
|
+
interface RtfForecast {
|
|
284
|
+
routineId: string;
|
|
285
|
+
weeks: number;
|
|
286
|
+
version: number;
|
|
287
|
+
withDeloads: boolean;
|
|
288
|
+
forecast: RtfForecastWeek[];
|
|
289
|
+
_cache?: 'HIT' | 'MISS';
|
|
290
|
+
}
|
|
291
|
+
interface CreateTmEventRequest {
|
|
292
|
+
exerciseId: string;
|
|
293
|
+
weekNumber: number;
|
|
294
|
+
deltaKg: number;
|
|
295
|
+
preTmKg: number;
|
|
296
|
+
postTmKg: number;
|
|
297
|
+
reason?: string;
|
|
298
|
+
}
|
|
299
|
+
interface TmEventResponse {
|
|
300
|
+
id: string;
|
|
301
|
+
routineId: string;
|
|
302
|
+
exerciseId: string;
|
|
303
|
+
exerciseName: string;
|
|
304
|
+
weekNumber: number;
|
|
305
|
+
deltaKg: number;
|
|
306
|
+
preTmKg: number;
|
|
307
|
+
postTmKg: number;
|
|
308
|
+
reason?: string;
|
|
309
|
+
style: ProgramStyle | null;
|
|
310
|
+
createdAt: IsoDateString;
|
|
311
|
+
}
|
|
312
|
+
interface TmEventSummary {
|
|
313
|
+
exerciseId: string;
|
|
314
|
+
exerciseName: string;
|
|
315
|
+
totalDeltaKg: number;
|
|
316
|
+
averageDeltaKg: number;
|
|
317
|
+
adjustmentCount: number;
|
|
318
|
+
lastAdjustmentDate: IsoDateString | null;
|
|
319
|
+
}
|
|
320
|
+
interface GetTmAdjustmentsParams {
|
|
321
|
+
exerciseId?: string;
|
|
322
|
+
minWeek?: number;
|
|
323
|
+
maxWeek?: number;
|
|
324
|
+
}
|
|
325
|
+
declare const TM_ADJUSTMENT_CONSTANTS: {
|
|
326
|
+
readonly MAX_DELTA_KG: 15;
|
|
327
|
+
readonly MIN_DELTA_KG: -15;
|
|
328
|
+
readonly MIN_WEEK: 1;
|
|
329
|
+
readonly MAX_WEEK: 21;
|
|
330
|
+
readonly MAX_REASON_LENGTH: 160;
|
|
331
|
+
};
|
|
14
332
|
|
|
15
|
-
export { type Brand, PROGRAM_STYLES, type ProgramStyle, type RoutineDayId, type RoutineId, type UserId, WEIGHT_UNITS, WORKOUT_SESSION_STATUSES, type WeightUnit, type WorkoutSessionId, type WorkoutSessionStatus };
|
|
333
|
+
export { type Brand, type CreateRoutineDayInput, type CreateRoutineExerciseInput, type CreateRoutineRequest, type CreateTmEventRequest, type ExerciseId, type FinishStatus, type FinishWorkoutRequest, type GetTmAdjustmentsParams, type IsoDateString, type ListSessionsParams, MUSCLE_GROUPS, type MuscleGroup, PROGRAM_STYLES, PROGRESSION_SCHEMES, type PaginatedResponse, type ProgramStyle, type ProgressionScheme, REP_TYPES, type RepType, type Routine, type RoutineDay, type RoutineDayId, type RoutineExercise, type RoutineId, type RoutineSet, type RtfExerciseGoal, type RtfForecast, type RtfForecastData, type RtfForecastWeek, type RtfTimeline, type RtfTimelineEntry, type RtfVariant, type RtfWeekGoals, type SetLog, type StartWorkoutRequest, type StartWorkoutResponse, TM_ADJUSTMENT_CONSTANTS, type TmEventResponse, type TmEventSummary, type UpsertSetLogRequest, type UserId, WEIGHT_UNITS, WORKOUT_SESSION_STATUSES, type WeightUnit, type WorkoutSession, type WorkoutSessionId, type WorkoutSessionStatus, type WorkoutSessionSummary };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,13 @@ declare const WORKOUT_SESSION_STATUSES: readonly ["IN_PROGRESS", "COMPLETED", "A
|
|
|
4
4
|
type WorkoutSessionStatus = (typeof WORKOUT_SESSION_STATUSES)[number];
|
|
5
5
|
declare const WEIGHT_UNITS: readonly ["KG", "LB"];
|
|
6
6
|
type WeightUnit = (typeof WEIGHT_UNITS)[number];
|
|
7
|
+
declare const REP_TYPES: readonly ["FIXED", "RANGE"];
|
|
8
|
+
type RepType = (typeof REP_TYPES)[number];
|
|
9
|
+
declare const PROGRESSION_SCHEMES: readonly ["NONE", "DOUBLE_PROGRESSION", "DYNAMIC_DOUBLE_PROGRESSION", "PROGRAMMED_RTF", "PROGRAMMED_RTF_HYPERTROPHY"];
|
|
10
|
+
type ProgressionScheme = (typeof PROGRESSION_SCHEMES)[number];
|
|
11
|
+
declare const MUSCLE_GROUPS: readonly ["PECTORAL", "LATISSIMUS_DORSI", "DELTOID", "TRAPEZIUS", "BICEPS", "TRICEPS", "FOREARM", "ABDOMINAL", "OBLIQUE", "ERECTOR_SPINAE", "GLUTEUS", "QUADRICEPS", "HAMSTRINGS", "CALVES"];
|
|
12
|
+
type MuscleGroup = (typeof MUSCLE_GROUPS)[number];
|
|
13
|
+
type IsoDateString = string;
|
|
7
14
|
type Brand<T, B> = T & {
|
|
8
15
|
readonly __brand: B;
|
|
9
16
|
};
|
|
@@ -11,5 +18,316 @@ type UserId = Brand<string, 'UserId'>;
|
|
|
11
18
|
type RoutineId = Brand<string, 'RoutineId'>;
|
|
12
19
|
type RoutineDayId = Brand<string, 'RoutineDayId'>;
|
|
13
20
|
type WorkoutSessionId = Brand<string, 'WorkoutSessionId'>;
|
|
21
|
+
type ExerciseId = Brand<string, 'ExerciseId'>;
|
|
22
|
+
interface RoutineSet {
|
|
23
|
+
setNumber: number;
|
|
24
|
+
repType: RepType;
|
|
25
|
+
reps?: number | null;
|
|
26
|
+
minReps?: number | null;
|
|
27
|
+
maxReps?: number | null;
|
|
28
|
+
weight?: number | null;
|
|
29
|
+
}
|
|
30
|
+
interface RoutineExercise {
|
|
31
|
+
id: string;
|
|
32
|
+
order: number;
|
|
33
|
+
restSeconds: number;
|
|
34
|
+
progressionScheme: ProgressionScheme;
|
|
35
|
+
minWeightIncrement: number;
|
|
36
|
+
programTMKg?: number;
|
|
37
|
+
programRoundingKg?: number;
|
|
38
|
+
programStyle?: ProgramStyle;
|
|
39
|
+
exercise: {
|
|
40
|
+
id: string;
|
|
41
|
+
name: string;
|
|
42
|
+
primaryMuscles?: MuscleGroup[];
|
|
43
|
+
secondaryMuscles?: MuscleGroup[];
|
|
44
|
+
};
|
|
45
|
+
sets: RoutineSet[];
|
|
46
|
+
}
|
|
47
|
+
interface CreateRoutineExerciseInput {
|
|
48
|
+
exerciseId: string;
|
|
49
|
+
order?: number;
|
|
50
|
+
restSeconds: number;
|
|
51
|
+
progressionScheme: ProgressionScheme;
|
|
52
|
+
minWeightIncrement: number;
|
|
53
|
+
programTMKg?: number;
|
|
54
|
+
programRoundingKg?: number;
|
|
55
|
+
programStyle?: ProgramStyle;
|
|
56
|
+
sets: RoutineSet[];
|
|
57
|
+
}
|
|
58
|
+
interface RoutineDay {
|
|
59
|
+
id: string;
|
|
60
|
+
dayOfWeek: number;
|
|
61
|
+
order: number;
|
|
62
|
+
exercises: RoutineExercise[];
|
|
63
|
+
}
|
|
64
|
+
interface CreateRoutineDayInput {
|
|
65
|
+
dayOfWeek: number;
|
|
66
|
+
order?: number;
|
|
67
|
+
exercises: CreateRoutineExerciseInput[];
|
|
68
|
+
}
|
|
69
|
+
interface Routine {
|
|
70
|
+
id: string;
|
|
71
|
+
userId: string;
|
|
72
|
+
name: string;
|
|
73
|
+
description?: string | null;
|
|
74
|
+
isPeriodized: boolean;
|
|
75
|
+
isFavorite: boolean;
|
|
76
|
+
isCompleted: boolean;
|
|
77
|
+
programStyle?: ProgramStyle;
|
|
78
|
+
programWithDeloads?: boolean;
|
|
79
|
+
programDurationWeeks?: number;
|
|
80
|
+
programStartWeek?: number;
|
|
81
|
+
programStartDate?: IsoDateString;
|
|
82
|
+
programEndDate?: IsoDateString;
|
|
83
|
+
programTimezone?: string;
|
|
84
|
+
rtfGoals?: RtfWeekGoals;
|
|
85
|
+
days: RoutineDay[];
|
|
86
|
+
createdAt: IsoDateString;
|
|
87
|
+
updatedAt: IsoDateString;
|
|
88
|
+
}
|
|
89
|
+
interface CreateRoutineRequest {
|
|
90
|
+
name: string;
|
|
91
|
+
description?: string;
|
|
92
|
+
isPeriodized: boolean;
|
|
93
|
+
programWithDeloads?: boolean;
|
|
94
|
+
programStartDate?: IsoDateString;
|
|
95
|
+
programTimezone?: string;
|
|
96
|
+
programStartWeek?: number;
|
|
97
|
+
programStyle?: ProgramStyle;
|
|
98
|
+
days: CreateRoutineDayInput[];
|
|
99
|
+
}
|
|
100
|
+
interface SetLog {
|
|
101
|
+
id: string;
|
|
102
|
+
sessionId: string;
|
|
103
|
+
routineExerciseId: string;
|
|
104
|
+
exerciseId: string;
|
|
105
|
+
setNumber: number;
|
|
106
|
+
reps: number;
|
|
107
|
+
weight?: number | null;
|
|
108
|
+
rpe?: number | null;
|
|
109
|
+
isCompleted: boolean;
|
|
110
|
+
completedAt?: IsoDateString | null;
|
|
111
|
+
createdAt: IsoDateString;
|
|
112
|
+
updatedAt: IsoDateString;
|
|
113
|
+
}
|
|
114
|
+
interface WorkoutSession {
|
|
115
|
+
id: string;
|
|
116
|
+
userId: string;
|
|
117
|
+
routineId: string;
|
|
118
|
+
routineDayId: string;
|
|
119
|
+
status: WorkoutSessionStatus;
|
|
120
|
+
startedAt: IsoDateString;
|
|
121
|
+
endedAt?: IsoDateString | null;
|
|
122
|
+
durationSec?: number | null;
|
|
123
|
+
notes?: string | null;
|
|
124
|
+
lastActivityAt?: IsoDateString | null;
|
|
125
|
+
setLogs?: SetLog[];
|
|
126
|
+
program?: {
|
|
127
|
+
currentWeek: number;
|
|
128
|
+
durationWeeks: number;
|
|
129
|
+
withDeloads: boolean;
|
|
130
|
+
isDeloadWeek: boolean;
|
|
131
|
+
startDate: IsoDateString;
|
|
132
|
+
endDate: IsoDateString;
|
|
133
|
+
timeZone: string;
|
|
134
|
+
};
|
|
135
|
+
rtfPlans?: unknown[];
|
|
136
|
+
reused?: boolean;
|
|
137
|
+
routine?: {
|
|
138
|
+
id: string;
|
|
139
|
+
name: string;
|
|
140
|
+
description?: string | null;
|
|
141
|
+
};
|
|
142
|
+
routineDay?: {
|
|
143
|
+
id: string;
|
|
144
|
+
name?: string | null;
|
|
145
|
+
order?: number;
|
|
146
|
+
dayOfWeek?: number;
|
|
147
|
+
exercises: Array<{
|
|
148
|
+
id: string;
|
|
149
|
+
order: number;
|
|
150
|
+
restSeconds?: number | null;
|
|
151
|
+
progressionScheme: ProgressionScheme;
|
|
152
|
+
minWeightIncrement: number;
|
|
153
|
+
exercise: {
|
|
154
|
+
id: string;
|
|
155
|
+
name: string;
|
|
156
|
+
primaryMuscles: MuscleGroup[];
|
|
157
|
+
secondaryMuscles?: MuscleGroup[];
|
|
158
|
+
};
|
|
159
|
+
sets: Array<{
|
|
160
|
+
id: string;
|
|
161
|
+
setNumber: number;
|
|
162
|
+
repType: RepType;
|
|
163
|
+
reps?: number | null;
|
|
164
|
+
minReps?: number | null;
|
|
165
|
+
maxReps?: number | null;
|
|
166
|
+
weight?: number | null;
|
|
167
|
+
}>;
|
|
168
|
+
}>;
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
interface StartWorkoutRequest {
|
|
172
|
+
routineId: string;
|
|
173
|
+
routineDayId: string;
|
|
174
|
+
notes?: string;
|
|
175
|
+
}
|
|
176
|
+
interface StartWorkoutResponse {
|
|
177
|
+
id: string;
|
|
178
|
+
routineId: string;
|
|
179
|
+
routineDayId: string;
|
|
180
|
+
status: WorkoutSessionStatus;
|
|
181
|
+
startedAt: IsoDateString;
|
|
182
|
+
endedAt?: IsoDateString | null;
|
|
183
|
+
program?: WorkoutSession['program'];
|
|
184
|
+
rtfPlans?: WorkoutSession['rtfPlans'];
|
|
185
|
+
reused: boolean;
|
|
186
|
+
}
|
|
187
|
+
type FinishStatus = Extract<WorkoutSessionStatus, 'COMPLETED' | 'ABORTED'>;
|
|
188
|
+
interface FinishWorkoutRequest {
|
|
189
|
+
status: FinishStatus;
|
|
190
|
+
notes?: string;
|
|
191
|
+
}
|
|
192
|
+
interface UpsertSetLogRequest {
|
|
193
|
+
routineExerciseId: string;
|
|
194
|
+
exerciseId: string;
|
|
195
|
+
setNumber: number;
|
|
196
|
+
reps: number;
|
|
197
|
+
weight?: number;
|
|
198
|
+
rpe?: number;
|
|
199
|
+
isCompleted?: boolean;
|
|
200
|
+
}
|
|
201
|
+
interface WorkoutSessionSummary {
|
|
202
|
+
id: string;
|
|
203
|
+
status: WorkoutSessionStatus;
|
|
204
|
+
startedAt: IsoDateString;
|
|
205
|
+
endedAt?: IsoDateString | null;
|
|
206
|
+
durationSec?: number | null;
|
|
207
|
+
totalVolume?: number | null;
|
|
208
|
+
totalSets?: number | null;
|
|
209
|
+
totalExercises?: number | null;
|
|
210
|
+
notes?: string | null;
|
|
211
|
+
routine: {
|
|
212
|
+
id: string;
|
|
213
|
+
name: string;
|
|
214
|
+
dayName?: string | null;
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
interface PaginatedResponse<T> {
|
|
218
|
+
items: T[];
|
|
219
|
+
nextCursor?: string;
|
|
220
|
+
}
|
|
221
|
+
interface ListSessionsParams {
|
|
222
|
+
status?: WorkoutSessionStatus;
|
|
223
|
+
routineId?: string;
|
|
224
|
+
from?: IsoDateString;
|
|
225
|
+
to?: IsoDateString;
|
|
226
|
+
q?: string;
|
|
227
|
+
cursor?: string;
|
|
228
|
+
limit?: number;
|
|
229
|
+
sort?: 'finishedAt:desc' | 'finishedAt:asc' | 'startedAt:desc' | 'startedAt:asc';
|
|
230
|
+
}
|
|
231
|
+
type RtfVariant = ProgramStyle;
|
|
232
|
+
interface RtfExerciseGoal {
|
|
233
|
+
routineExerciseId: string;
|
|
234
|
+
exerciseId: string;
|
|
235
|
+
exerciseName: string;
|
|
236
|
+
variant: RtfVariant;
|
|
237
|
+
week: number;
|
|
238
|
+
isDeload: boolean;
|
|
239
|
+
intensity: number;
|
|
240
|
+
fixedReps: number;
|
|
241
|
+
setsPlanned: number;
|
|
242
|
+
amrapTarget: number | null;
|
|
243
|
+
amrapSetNumber: number | null;
|
|
244
|
+
workingWeightKg?: number;
|
|
245
|
+
trainingMaxKg?: number;
|
|
246
|
+
}
|
|
247
|
+
interface RtfWeekGoals {
|
|
248
|
+
routineId: string;
|
|
249
|
+
week: number;
|
|
250
|
+
withDeloads: boolean;
|
|
251
|
+
goals: RtfExerciseGoal[];
|
|
252
|
+
version: number;
|
|
253
|
+
_cache?: 'HIT' | 'MISS';
|
|
254
|
+
}
|
|
255
|
+
interface RtfTimelineEntry {
|
|
256
|
+
week: number;
|
|
257
|
+
isDeload: boolean;
|
|
258
|
+
startDate: IsoDateString;
|
|
259
|
+
endDate: IsoDateString;
|
|
260
|
+
}
|
|
261
|
+
interface RtfTimeline {
|
|
262
|
+
routineId: string;
|
|
263
|
+
totalWeeks: number;
|
|
264
|
+
withDeloads: boolean;
|
|
265
|
+
timeline: RtfTimelineEntry[];
|
|
266
|
+
version: number;
|
|
267
|
+
_cache?: 'HIT' | 'MISS';
|
|
268
|
+
}
|
|
269
|
+
interface RtfForecastData {
|
|
270
|
+
intensity: number;
|
|
271
|
+
fixedReps: number;
|
|
272
|
+
amrapTarget: number;
|
|
273
|
+
sets: number;
|
|
274
|
+
amrapSet: number;
|
|
275
|
+
isDeload?: boolean;
|
|
276
|
+
}
|
|
277
|
+
interface RtfForecastWeek {
|
|
278
|
+
week: number;
|
|
279
|
+
isDeload: boolean;
|
|
280
|
+
standard?: RtfForecastData;
|
|
281
|
+
hypertrophy?: RtfForecastData;
|
|
282
|
+
}
|
|
283
|
+
interface RtfForecast {
|
|
284
|
+
routineId: string;
|
|
285
|
+
weeks: number;
|
|
286
|
+
version: number;
|
|
287
|
+
withDeloads: boolean;
|
|
288
|
+
forecast: RtfForecastWeek[];
|
|
289
|
+
_cache?: 'HIT' | 'MISS';
|
|
290
|
+
}
|
|
291
|
+
interface CreateTmEventRequest {
|
|
292
|
+
exerciseId: string;
|
|
293
|
+
weekNumber: number;
|
|
294
|
+
deltaKg: number;
|
|
295
|
+
preTmKg: number;
|
|
296
|
+
postTmKg: number;
|
|
297
|
+
reason?: string;
|
|
298
|
+
}
|
|
299
|
+
interface TmEventResponse {
|
|
300
|
+
id: string;
|
|
301
|
+
routineId: string;
|
|
302
|
+
exerciseId: string;
|
|
303
|
+
exerciseName: string;
|
|
304
|
+
weekNumber: number;
|
|
305
|
+
deltaKg: number;
|
|
306
|
+
preTmKg: number;
|
|
307
|
+
postTmKg: number;
|
|
308
|
+
reason?: string;
|
|
309
|
+
style: ProgramStyle | null;
|
|
310
|
+
createdAt: IsoDateString;
|
|
311
|
+
}
|
|
312
|
+
interface TmEventSummary {
|
|
313
|
+
exerciseId: string;
|
|
314
|
+
exerciseName: string;
|
|
315
|
+
totalDeltaKg: number;
|
|
316
|
+
averageDeltaKg: number;
|
|
317
|
+
adjustmentCount: number;
|
|
318
|
+
lastAdjustmentDate: IsoDateString | null;
|
|
319
|
+
}
|
|
320
|
+
interface GetTmAdjustmentsParams {
|
|
321
|
+
exerciseId?: string;
|
|
322
|
+
minWeek?: number;
|
|
323
|
+
maxWeek?: number;
|
|
324
|
+
}
|
|
325
|
+
declare const TM_ADJUSTMENT_CONSTANTS: {
|
|
326
|
+
readonly MAX_DELTA_KG: 15;
|
|
327
|
+
readonly MIN_DELTA_KG: -15;
|
|
328
|
+
readonly MIN_WEEK: 1;
|
|
329
|
+
readonly MAX_WEEK: 21;
|
|
330
|
+
readonly MAX_REASON_LENGTH: 160;
|
|
331
|
+
};
|
|
14
332
|
|
|
15
|
-
export { type Brand, PROGRAM_STYLES, type ProgramStyle, type RoutineDayId, type RoutineId, type UserId, WEIGHT_UNITS, WORKOUT_SESSION_STATUSES, type WeightUnit, type WorkoutSessionId, type WorkoutSessionStatus };
|
|
333
|
+
export { type Brand, type CreateRoutineDayInput, type CreateRoutineExerciseInput, type CreateRoutineRequest, type CreateTmEventRequest, type ExerciseId, type FinishStatus, type FinishWorkoutRequest, type GetTmAdjustmentsParams, type IsoDateString, type ListSessionsParams, MUSCLE_GROUPS, type MuscleGroup, PROGRAM_STYLES, PROGRESSION_SCHEMES, type PaginatedResponse, type ProgramStyle, type ProgressionScheme, REP_TYPES, type RepType, type Routine, type RoutineDay, type RoutineDayId, type RoutineExercise, type RoutineId, type RoutineSet, type RtfExerciseGoal, type RtfForecast, type RtfForecastData, type RtfForecastWeek, type RtfTimeline, type RtfTimelineEntry, type RtfVariant, type RtfWeekGoals, type SetLog, type StartWorkoutRequest, type StartWorkoutResponse, TM_ADJUSTMENT_CONSTANTS, type TmEventResponse, type TmEventSummary, type UpsertSetLogRequest, type UserId, WEIGHT_UNITS, WORKOUT_SESSION_STATUSES, type WeightUnit, type WorkoutSession, type WorkoutSessionId, type WorkoutSessionStatus, type WorkoutSessionSummary };
|
package/dist/index.js
CHANGED
|
@@ -6,8 +6,43 @@ var WORKOUT_SESSION_STATUSES = [
|
|
|
6
6
|
"ABORTED"
|
|
7
7
|
];
|
|
8
8
|
var WEIGHT_UNITS = ["KG", "LB"];
|
|
9
|
+
var REP_TYPES = ["FIXED", "RANGE"];
|
|
10
|
+
var PROGRESSION_SCHEMES = [
|
|
11
|
+
"NONE",
|
|
12
|
+
"DOUBLE_PROGRESSION",
|
|
13
|
+
"DYNAMIC_DOUBLE_PROGRESSION",
|
|
14
|
+
"PROGRAMMED_RTF",
|
|
15
|
+
"PROGRAMMED_RTF_HYPERTROPHY"
|
|
16
|
+
];
|
|
17
|
+
var MUSCLE_GROUPS = [
|
|
18
|
+
"PECTORAL",
|
|
19
|
+
"LATISSIMUS_DORSI",
|
|
20
|
+
"DELTOID",
|
|
21
|
+
"TRAPEZIUS",
|
|
22
|
+
"BICEPS",
|
|
23
|
+
"TRICEPS",
|
|
24
|
+
"FOREARM",
|
|
25
|
+
"ABDOMINAL",
|
|
26
|
+
"OBLIQUE",
|
|
27
|
+
"ERECTOR_SPINAE",
|
|
28
|
+
"GLUTEUS",
|
|
29
|
+
"QUADRICEPS",
|
|
30
|
+
"HAMSTRINGS",
|
|
31
|
+
"CALVES"
|
|
32
|
+
];
|
|
33
|
+
var TM_ADJUSTMENT_CONSTANTS = {
|
|
34
|
+
MAX_DELTA_KG: 15,
|
|
35
|
+
MIN_DELTA_KG: -15,
|
|
36
|
+
MIN_WEEK: 1,
|
|
37
|
+
MAX_WEEK: 21,
|
|
38
|
+
MAX_REASON_LENGTH: 160
|
|
39
|
+
};
|
|
9
40
|
export {
|
|
41
|
+
MUSCLE_GROUPS,
|
|
10
42
|
PROGRAM_STYLES,
|
|
43
|
+
PROGRESSION_SCHEMES,
|
|
44
|
+
REP_TYPES,
|
|
45
|
+
TM_ADJUSTMENT_CONSTANTS,
|
|
11
46
|
WEIGHT_UNITS,
|
|
12
47
|
WORKOUT_SESSION_STATUSES
|
|
13
48
|
};
|