@sunsteel/contracts 0.35.0 → 0.36.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 +35 -2
- package/dist/index.d.cts +39 -4
- package/dist/index.d.ts +39 -4
- package/dist/index.js +30 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -53,6 +53,9 @@ __export(index_exports, {
|
|
|
53
53
|
RENAISSANCE_RANK_DEFINITIONS: () => RENAISSANCE_RANK_DEFINITIONS,
|
|
54
54
|
REP_TYPES: () => REP_TYPES,
|
|
55
55
|
RESERVED_USERNAMES: () => RESERVED_USERNAMES,
|
|
56
|
+
ROUTINE_DAYS_MAX: () => ROUTINE_DAYS_MAX,
|
|
57
|
+
ROUTINE_DAY_NAME_MAX: () => ROUTINE_DAY_NAME_MAX,
|
|
58
|
+
ROUTINE_SCHEDULE_MODES: () => ROUTINE_SCHEDULE_MODES,
|
|
56
59
|
SESSION_SHARE_DEFAULT_FIELDS: () => SESSION_SHARE_DEFAULT_FIELDS,
|
|
57
60
|
SESSION_SHARE_FIELDS: () => SESSION_SHARE_FIELDS,
|
|
58
61
|
SESSION_SHARE_MAX_ACTIVE_LINKS: () => SESSION_SHARE_MAX_ACTIVE_LINKS,
|
|
@@ -66,7 +69,8 @@ __export(index_exports, {
|
|
|
66
69
|
USERNAME_MIN_LENGTH: () => USERNAME_MIN_LENGTH,
|
|
67
70
|
USERNAME_PATTERN_SOURCE: () => USERNAME_PATTERN_SOURCE,
|
|
68
71
|
WEIGHT_UNITS: () => WEIGHT_UNITS,
|
|
69
|
-
WORKOUT_SESSION_STATUSES: () => WORKOUT_SESSION_STATUSES
|
|
72
|
+
WORKOUT_SESSION_STATUSES: () => WORKOUT_SESSION_STATUSES,
|
|
73
|
+
routineDayLabel: () => routineDayLabel
|
|
70
74
|
});
|
|
71
75
|
module.exports = __toCommonJS(index_exports);
|
|
72
76
|
|
|
@@ -348,6 +352,31 @@ var RENAISSANCE_RANK_DEFINITIONS = [
|
|
|
348
352
|
}
|
|
349
353
|
];
|
|
350
354
|
|
|
355
|
+
// src/routine.ts
|
|
356
|
+
var ROUTINE_SCHEDULE_MODES = ["WEEKLY", "ROTATION"];
|
|
357
|
+
var ROUTINE_DAYS_MAX = 7;
|
|
358
|
+
var ROUTINE_DAY_NAME_MAX = 40;
|
|
359
|
+
var WEEKDAY_NAMES = [
|
|
360
|
+
"Sunday",
|
|
361
|
+
"Monday",
|
|
362
|
+
"Tuesday",
|
|
363
|
+
"Wednesday",
|
|
364
|
+
"Thursday",
|
|
365
|
+
"Friday",
|
|
366
|
+
"Saturday"
|
|
367
|
+
];
|
|
368
|
+
function routineDayLabel(day) {
|
|
369
|
+
const name = day.name?.trim();
|
|
370
|
+
if (name) return name;
|
|
371
|
+
if (typeof day.dayOfWeek === "number") {
|
|
372
|
+
return WEEKDAY_NAMES[day.dayOfWeek] ?? "";
|
|
373
|
+
}
|
|
374
|
+
if (typeof day.order === "number" && day.order >= 0 && day.order < 26) {
|
|
375
|
+
return `Day ${String.fromCharCode(65 + day.order)}`;
|
|
376
|
+
}
|
|
377
|
+
return "";
|
|
378
|
+
}
|
|
379
|
+
|
|
351
380
|
// src/workout.ts
|
|
352
381
|
var SESSION_SHARE_FIELDS = [
|
|
353
382
|
"duration",
|
|
@@ -418,6 +447,9 @@ var PLATEAU_MIN_SESSIONS_MAX = 8;
|
|
|
418
447
|
RENAISSANCE_RANK_DEFINITIONS,
|
|
419
448
|
REP_TYPES,
|
|
420
449
|
RESERVED_USERNAMES,
|
|
450
|
+
ROUTINE_DAYS_MAX,
|
|
451
|
+
ROUTINE_DAY_NAME_MAX,
|
|
452
|
+
ROUTINE_SCHEDULE_MODES,
|
|
421
453
|
SESSION_SHARE_DEFAULT_FIELDS,
|
|
422
454
|
SESSION_SHARE_FIELDS,
|
|
423
455
|
SESSION_SHARE_MAX_ACTIVE_LINKS,
|
|
@@ -431,5 +463,6 @@ var PLATEAU_MIN_SESSIONS_MAX = 8;
|
|
|
431
463
|
USERNAME_MIN_LENGTH,
|
|
432
464
|
USERNAME_PATTERN_SOURCE,
|
|
433
465
|
WEIGHT_UNITS,
|
|
434
|
-
WORKOUT_SESSION_STATUSES
|
|
466
|
+
WORKOUT_SESSION_STATUSES,
|
|
467
|
+
routineDayLabel
|
|
435
468
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -66,7 +66,8 @@ interface WorkoutSession {
|
|
|
66
66
|
id: string;
|
|
67
67
|
name?: string | null;
|
|
68
68
|
order?: number;
|
|
69
|
-
|
|
69
|
+
/** Null on a ROTATION routine day (ROUT-11). */
|
|
70
|
+
dayOfWeek?: number | null;
|
|
70
71
|
exercises: Array<{
|
|
71
72
|
id: string;
|
|
72
73
|
order: number;
|
|
@@ -1106,6 +1107,26 @@ interface AchievementsResponse {
|
|
|
1106
1107
|
milestoneProgress: AchievementCategoryProgress[];
|
|
1107
1108
|
}
|
|
1108
1109
|
|
|
1110
|
+
/**
|
|
1111
|
+
* ROUT-11: a WEEKLY routine ties each day to a weekday; a ROTATION routine
|
|
1112
|
+
* runs its days in `order`, each after the last completed one, whatever the
|
|
1113
|
+
* weekday.
|
|
1114
|
+
*/
|
|
1115
|
+
declare const ROUTINE_SCHEDULE_MODES: readonly ["WEEKLY", "ROTATION"];
|
|
1116
|
+
type RoutineScheduleMode = (typeof ROUTINE_SCHEDULE_MODES)[number];
|
|
1117
|
+
/** At most seven days in either mode. */
|
|
1118
|
+
declare const ROUTINE_DAYS_MAX = 7;
|
|
1119
|
+
declare const ROUTINE_DAY_NAME_MAX = 40;
|
|
1120
|
+
/**
|
|
1121
|
+
* How a routine day is named everywhere, including history snapshots taken
|
|
1122
|
+
* before ROUT-11: its own name, else its weekday, else its rotation letter
|
|
1123
|
+
* ("Day A" for order 0).
|
|
1124
|
+
*/
|
|
1125
|
+
declare function routineDayLabel(day: {
|
|
1126
|
+
name?: string | null;
|
|
1127
|
+
dayOfWeek?: number | null;
|
|
1128
|
+
order?: number | null;
|
|
1129
|
+
}): string;
|
|
1109
1130
|
interface RoutineSet {
|
|
1110
1131
|
setNumber: number;
|
|
1111
1132
|
repType: RepType;
|
|
@@ -1141,12 +1162,18 @@ interface CreateRoutineExerciseInput {
|
|
|
1141
1162
|
}
|
|
1142
1163
|
interface RoutineDay {
|
|
1143
1164
|
id: string;
|
|
1144
|
-
|
|
1165
|
+
/** 0=Sun..6=Sat on a WEEKLY routine; null on a ROTATION routine. */
|
|
1166
|
+
dayOfWeek: number | null;
|
|
1167
|
+
/** Optional label such as "Push" or "Upper A" (see `routineDayLabel`). */
|
|
1168
|
+
name: string | null;
|
|
1169
|
+
/** Rotation sequence, 0-based; also the display order. */
|
|
1145
1170
|
order: number;
|
|
1146
1171
|
exercises: RoutineExercise[];
|
|
1147
1172
|
}
|
|
1148
1173
|
interface CreateRoutineDayInput {
|
|
1149
|
-
|
|
1174
|
+
/** Required and unique on a WEEKLY routine; omitted or null on a ROTATION. */
|
|
1175
|
+
dayOfWeek?: number | null;
|
|
1176
|
+
name?: string | null;
|
|
1150
1177
|
order?: number;
|
|
1151
1178
|
exercises: CreateRoutineExerciseInput[];
|
|
1152
1179
|
}
|
|
@@ -1158,6 +1185,12 @@ interface Routine {
|
|
|
1158
1185
|
isPeriodized: boolean;
|
|
1159
1186
|
isFavorite: boolean;
|
|
1160
1187
|
isCompleted: boolean;
|
|
1188
|
+
scheduleMode: RoutineScheduleMode;
|
|
1189
|
+
/**
|
|
1190
|
+
* ROTATION only: the day after the one of the last completed session (an
|
|
1191
|
+
* aborted session does not advance it), or the first day before any.
|
|
1192
|
+
*/
|
|
1193
|
+
nextRotationDayId: string | null;
|
|
1161
1194
|
days: RoutineDay[];
|
|
1162
1195
|
createdAt: IsoDateString;
|
|
1163
1196
|
updatedAt: IsoDateString;
|
|
@@ -1166,8 +1199,10 @@ interface CreateRoutineRequest {
|
|
|
1166
1199
|
name: string;
|
|
1167
1200
|
description?: string;
|
|
1168
1201
|
isPeriodized: boolean;
|
|
1202
|
+
/** Defaults to WEEKLY. Changing it on update requires `days`. */
|
|
1203
|
+
scheduleMode?: RoutineScheduleMode;
|
|
1169
1204
|
days: CreateRoutineDayInput[];
|
|
1170
1205
|
}
|
|
1171
1206
|
type UpdateRoutineRequest = Partial<CreateRoutineRequest>;
|
|
1172
1207
|
|
|
1173
|
-
export { ACHIEVEMENT_CATEGORIES, ACHIEVEMENT_DEFINITIONS, type AchievementCategory, type AchievementCategoryProgress, type AchievementDefinition, type AchievementUnlockedEventPayload, type AchievementsResponse, type Brand, type CreateRoutineDayInput, type CreateRoutineExerciseInput, type CreateRoutineRequest, type CreateSessionShareRequest, EXERCISE_EQUIPMENT, EXERCISE_MECHANICS, type EarnedAchievement, type EarnedPersonalRecord, type Exercise, type ExerciseEquipment, type ExerciseId, type ExerciseMechanic, type ExercisePerformanceHistoryQuery, type ExercisePerformanceHistoryResponse, type ExercisePerformancePrescription, type ExercisePerformancePrescriptionSet, type ExercisePerformanceSession, type ExercisePerformanceSet, type ExercisePerformanceSummary, type ExercisePlateau, type ExerciseStrengthSummary, type ExerciseStrengthTrendPoint, type ExerciseStrengthTrendQuery, type ExerciseStrengthTrendResponse, FOLLOW_SUGGESTIONS_DEFAULT_LIMIT, FOLLOW_SUGGESTIONS_MAX_LIMIT, FOLLOW_SUGGESTION_REASONS, type FinishStatus, type FinishWorkoutRequest, type FinishWorkoutResponse, type FollowSuggestion, type FollowSuggestionReason, type FollowSuggestionsResponse, type IsoDateString, type ListSessionsParams, MEASURABLE_GOALS_MAX, MEASURABLE_GOAL_DIRECTIONS, MEASURABLE_GOAL_TYPES, MOVEMENT_PATTERNS, MUSCLE_GROUPS, type MeasurableGoal, type MeasurableGoalDirection, type MeasurableGoalExercise, type MeasurableGoalInput, type MeasurableGoalType, type MovementPattern, type MuscleGroup, type MuscleGroupHeatmapQuery, type MuscleGroupHeatmapResponse, type MuscleGroupHeatmapValue, type MuscleGroupHeatmapWeek, type MuscleVolumeTrendSeries, PLATEAU_MIN_DAYS_SINCE_BEST, PLATEAU_MIN_SESSIONS, PLATEAU_MIN_SESSIONS_MAX, PLATEAU_MIN_SESSIONS_MIN, PLATEAU_RECENT_DAYS, PLATEAU_WINDOW_DAYS, PREFERRED_TRAINING_STYLE_VALUES, PROFILE_BIO_MAX_LENGTH, PROFILE_FAVORITE_EXERCISES_MAX, PROFILE_LOCATION_MAX_LENGTH, PROFILE_TRAINING_DISCIPLINES_MAX, PROFILE_TRAINING_GOALS_MAX, PROFILE_VISIBILITY_VALUES, PROGRESSION_SCHEMES, PROGRESS_TIMELINE_EVENT_TYPES, type PaginatedResponse, type PersonalGoalProgress, type PersonalGoalsResponse, type PersonalRecordEntry, type PersonalRecordKind, type PlatePairInventory, type PlateauPreferences, type PlateauSet, type PlateausResponse, type PreferredTrainingStyle, type PreviousPerformanceResponse, type PreviousSessionRecap, type PreviousSetPerformance, type ProfileDiscoverySettings, type ProfileFavoriteExercise, type ProfilePrivacySettings, type ProfileViewerAccess, type ProfileVisibility, type ProgressTimelineEventType, type ProgressTimelineItem, type ProgressTimelinePersonalRecordItem, type ProgressTimelineProgressionItem, type ProgressTimelineQuery, type ProgressTimelineRecordPerformance, type ProgressTimelineRecordReason, type ProgressTimelineResponse, type ProgressTimelineSessionContext, type ProgressionChange, type ProgressionRule, type ProgressionScheme, type ProgressionSetChange, type PublicBodyMetrics, type PublicTrainingSummary, type PublicUserProfile, RELATIONSHIP_LIST_DEFAULT_LIMIT, RELATIONSHIP_LIST_KINDS, RELATIONSHIP_LIST_MAX_LIMIT, RENAISSANCE_RANK_DEFINITIONS, REP_TYPES, RESERVED_USERNAMES, type RecentActivityEntry, type RelationshipListKind, type RelationshipListQuery, type RelationshipListResponse, type RelationshipMember, type RenaissanceRankDefinition, type RenaissanceRankProgress, type RepType, type ReplaceMeasurableGoalsRequest, type ReplaceTrainingLocationsRequest, type Routine, type RoutineDay, type RoutineDayId, type RoutineExercise, type RoutineId, type RoutineSet, SESSION_SHARE_DEFAULT_FIELDS, SESSION_SHARE_FIELDS, SESSION_SHARE_MAX_ACTIVE_LINKS, SEXES, STARRED_EXERCISES_MAX, type SessionComparisonExercise, type SessionComparisonQuery, type SessionComparisonResponse, type SessionComparisonRoutineDay, type SessionComparisonSession, type SessionComparisonSet, type SessionExerciseSubstitution, type SessionRecapRecord, type SessionShare, type SessionShareField, type SessionShareListResponse, type SetAccountTimeZoneRequest, type SetLog, type Sex, type SharedSessionOwner, type SharedSessionRecap, type StarredExercise, type StarredExercisesResponse, type StartWorkoutRequest, type StartWorkoutResponse, type StreakMilestoneEventPayload, type SubstituteSessionExerciseRequest, type SubstituteSessionExerciseResponse, type SupabaseAuthResponse, type SupabaseAuthUser, type SupabaseMigrationResponse, TRAINING_DISCIPLINE_VALUES, TRAINING_EVENT_TYPES, TRAINING_EXPERIENCE_LEVEL_VALUES, TRAINING_GOAL_VALUES, type TrainingDiscipline, type TrainingEventType, type TrainingExperienceLevel, type TrainingGoal, type TrainingIdentity, type TrainingLocationPreference, type TrainingLocationPreferenceInput, USERNAME_MAX_LENGTH, USERNAME_MIN_LENGTH, USERNAME_PATTERN_SOURCE, type UpdateProfileDiscoveryRequest, type UpdateProfilePrivacyRequest, type UpdateProfileRequest, type UpdateRoutineRequest, type UpsertSetLogRequest, type UpsertSetLogResponse, type UserId, type UserProfile, type UserSearchResponse, type VolumeTrendPoint, type VolumeTrendQuery, type VolumeTrendResponse, type VolumeTrendSeries, 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 };
|
|
1208
|
+
export { ACHIEVEMENT_CATEGORIES, ACHIEVEMENT_DEFINITIONS, type AchievementCategory, type AchievementCategoryProgress, type AchievementDefinition, type AchievementUnlockedEventPayload, type AchievementsResponse, type Brand, type CreateRoutineDayInput, type CreateRoutineExerciseInput, type CreateRoutineRequest, type CreateSessionShareRequest, EXERCISE_EQUIPMENT, EXERCISE_MECHANICS, type EarnedAchievement, type EarnedPersonalRecord, type Exercise, type ExerciseEquipment, type ExerciseId, type ExerciseMechanic, type ExercisePerformanceHistoryQuery, type ExercisePerformanceHistoryResponse, type ExercisePerformancePrescription, type ExercisePerformancePrescriptionSet, type ExercisePerformanceSession, type ExercisePerformanceSet, type ExercisePerformanceSummary, type ExercisePlateau, type ExerciseStrengthSummary, type ExerciseStrengthTrendPoint, type ExerciseStrengthTrendQuery, type ExerciseStrengthTrendResponse, FOLLOW_SUGGESTIONS_DEFAULT_LIMIT, FOLLOW_SUGGESTIONS_MAX_LIMIT, FOLLOW_SUGGESTION_REASONS, type FinishStatus, type FinishWorkoutRequest, type FinishWorkoutResponse, type FollowSuggestion, type FollowSuggestionReason, type FollowSuggestionsResponse, type IsoDateString, type ListSessionsParams, MEASURABLE_GOALS_MAX, MEASURABLE_GOAL_DIRECTIONS, MEASURABLE_GOAL_TYPES, MOVEMENT_PATTERNS, MUSCLE_GROUPS, type MeasurableGoal, type MeasurableGoalDirection, type MeasurableGoalExercise, type MeasurableGoalInput, type MeasurableGoalType, type MovementPattern, type MuscleGroup, type MuscleGroupHeatmapQuery, type MuscleGroupHeatmapResponse, type MuscleGroupHeatmapValue, type MuscleGroupHeatmapWeek, type MuscleVolumeTrendSeries, PLATEAU_MIN_DAYS_SINCE_BEST, PLATEAU_MIN_SESSIONS, PLATEAU_MIN_SESSIONS_MAX, PLATEAU_MIN_SESSIONS_MIN, PLATEAU_RECENT_DAYS, PLATEAU_WINDOW_DAYS, PREFERRED_TRAINING_STYLE_VALUES, PROFILE_BIO_MAX_LENGTH, PROFILE_FAVORITE_EXERCISES_MAX, PROFILE_LOCATION_MAX_LENGTH, PROFILE_TRAINING_DISCIPLINES_MAX, PROFILE_TRAINING_GOALS_MAX, PROFILE_VISIBILITY_VALUES, PROGRESSION_SCHEMES, PROGRESS_TIMELINE_EVENT_TYPES, type PaginatedResponse, type PersonalGoalProgress, type PersonalGoalsResponse, type PersonalRecordEntry, type PersonalRecordKind, type PlatePairInventory, type PlateauPreferences, type PlateauSet, type PlateausResponse, type PreferredTrainingStyle, type PreviousPerformanceResponse, type PreviousSessionRecap, type PreviousSetPerformance, type ProfileDiscoverySettings, type ProfileFavoriteExercise, type ProfilePrivacySettings, type ProfileViewerAccess, type ProfileVisibility, type ProgressTimelineEventType, type ProgressTimelineItem, type ProgressTimelinePersonalRecordItem, type ProgressTimelineProgressionItem, type ProgressTimelineQuery, type ProgressTimelineRecordPerformance, type ProgressTimelineRecordReason, type ProgressTimelineResponse, type ProgressTimelineSessionContext, type ProgressionChange, type ProgressionRule, type ProgressionScheme, type ProgressionSetChange, type PublicBodyMetrics, type PublicTrainingSummary, type PublicUserProfile, RELATIONSHIP_LIST_DEFAULT_LIMIT, RELATIONSHIP_LIST_KINDS, RELATIONSHIP_LIST_MAX_LIMIT, RENAISSANCE_RANK_DEFINITIONS, REP_TYPES, RESERVED_USERNAMES, ROUTINE_DAYS_MAX, ROUTINE_DAY_NAME_MAX, ROUTINE_SCHEDULE_MODES, type RecentActivityEntry, type RelationshipListKind, type RelationshipListQuery, type RelationshipListResponse, type RelationshipMember, type RenaissanceRankDefinition, type RenaissanceRankProgress, type RepType, type ReplaceMeasurableGoalsRequest, type ReplaceTrainingLocationsRequest, type Routine, type RoutineDay, type RoutineDayId, type RoutineExercise, type RoutineId, type RoutineScheduleMode, type RoutineSet, SESSION_SHARE_DEFAULT_FIELDS, SESSION_SHARE_FIELDS, SESSION_SHARE_MAX_ACTIVE_LINKS, SEXES, STARRED_EXERCISES_MAX, type SessionComparisonExercise, type SessionComparisonQuery, type SessionComparisonResponse, type SessionComparisonRoutineDay, type SessionComparisonSession, type SessionComparisonSet, type SessionExerciseSubstitution, type SessionRecapRecord, type SessionShare, type SessionShareField, type SessionShareListResponse, type SetAccountTimeZoneRequest, type SetLog, type Sex, type SharedSessionOwner, type SharedSessionRecap, type StarredExercise, type StarredExercisesResponse, type StartWorkoutRequest, type StartWorkoutResponse, type StreakMilestoneEventPayload, type SubstituteSessionExerciseRequest, type SubstituteSessionExerciseResponse, type SupabaseAuthResponse, type SupabaseAuthUser, type SupabaseMigrationResponse, TRAINING_DISCIPLINE_VALUES, TRAINING_EVENT_TYPES, TRAINING_EXPERIENCE_LEVEL_VALUES, TRAINING_GOAL_VALUES, type TrainingDiscipline, type TrainingEventType, type TrainingExperienceLevel, type TrainingGoal, type TrainingIdentity, type TrainingLocationPreference, type TrainingLocationPreferenceInput, USERNAME_MAX_LENGTH, USERNAME_MIN_LENGTH, USERNAME_PATTERN_SOURCE, type UpdateProfileDiscoveryRequest, type UpdateProfilePrivacyRequest, type UpdateProfileRequest, type UpdateRoutineRequest, type UpsertSetLogRequest, type UpsertSetLogResponse, type UserId, type UserProfile, type UserSearchResponse, type VolumeTrendPoint, type VolumeTrendQuery, type VolumeTrendResponse, type VolumeTrendSeries, 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, routineDayLabel };
|
package/dist/index.d.ts
CHANGED
|
@@ -66,7 +66,8 @@ interface WorkoutSession {
|
|
|
66
66
|
id: string;
|
|
67
67
|
name?: string | null;
|
|
68
68
|
order?: number;
|
|
69
|
-
|
|
69
|
+
/** Null on a ROTATION routine day (ROUT-11). */
|
|
70
|
+
dayOfWeek?: number | null;
|
|
70
71
|
exercises: Array<{
|
|
71
72
|
id: string;
|
|
72
73
|
order: number;
|
|
@@ -1106,6 +1107,26 @@ interface AchievementsResponse {
|
|
|
1106
1107
|
milestoneProgress: AchievementCategoryProgress[];
|
|
1107
1108
|
}
|
|
1108
1109
|
|
|
1110
|
+
/**
|
|
1111
|
+
* ROUT-11: a WEEKLY routine ties each day to a weekday; a ROTATION routine
|
|
1112
|
+
* runs its days in `order`, each after the last completed one, whatever the
|
|
1113
|
+
* weekday.
|
|
1114
|
+
*/
|
|
1115
|
+
declare const ROUTINE_SCHEDULE_MODES: readonly ["WEEKLY", "ROTATION"];
|
|
1116
|
+
type RoutineScheduleMode = (typeof ROUTINE_SCHEDULE_MODES)[number];
|
|
1117
|
+
/** At most seven days in either mode. */
|
|
1118
|
+
declare const ROUTINE_DAYS_MAX = 7;
|
|
1119
|
+
declare const ROUTINE_DAY_NAME_MAX = 40;
|
|
1120
|
+
/**
|
|
1121
|
+
* How a routine day is named everywhere, including history snapshots taken
|
|
1122
|
+
* before ROUT-11: its own name, else its weekday, else its rotation letter
|
|
1123
|
+
* ("Day A" for order 0).
|
|
1124
|
+
*/
|
|
1125
|
+
declare function routineDayLabel(day: {
|
|
1126
|
+
name?: string | null;
|
|
1127
|
+
dayOfWeek?: number | null;
|
|
1128
|
+
order?: number | null;
|
|
1129
|
+
}): string;
|
|
1109
1130
|
interface RoutineSet {
|
|
1110
1131
|
setNumber: number;
|
|
1111
1132
|
repType: RepType;
|
|
@@ -1141,12 +1162,18 @@ interface CreateRoutineExerciseInput {
|
|
|
1141
1162
|
}
|
|
1142
1163
|
interface RoutineDay {
|
|
1143
1164
|
id: string;
|
|
1144
|
-
|
|
1165
|
+
/** 0=Sun..6=Sat on a WEEKLY routine; null on a ROTATION routine. */
|
|
1166
|
+
dayOfWeek: number | null;
|
|
1167
|
+
/** Optional label such as "Push" or "Upper A" (see `routineDayLabel`). */
|
|
1168
|
+
name: string | null;
|
|
1169
|
+
/** Rotation sequence, 0-based; also the display order. */
|
|
1145
1170
|
order: number;
|
|
1146
1171
|
exercises: RoutineExercise[];
|
|
1147
1172
|
}
|
|
1148
1173
|
interface CreateRoutineDayInput {
|
|
1149
|
-
|
|
1174
|
+
/** Required and unique on a WEEKLY routine; omitted or null on a ROTATION. */
|
|
1175
|
+
dayOfWeek?: number | null;
|
|
1176
|
+
name?: string | null;
|
|
1150
1177
|
order?: number;
|
|
1151
1178
|
exercises: CreateRoutineExerciseInput[];
|
|
1152
1179
|
}
|
|
@@ -1158,6 +1185,12 @@ interface Routine {
|
|
|
1158
1185
|
isPeriodized: boolean;
|
|
1159
1186
|
isFavorite: boolean;
|
|
1160
1187
|
isCompleted: boolean;
|
|
1188
|
+
scheduleMode: RoutineScheduleMode;
|
|
1189
|
+
/**
|
|
1190
|
+
* ROTATION only: the day after the one of the last completed session (an
|
|
1191
|
+
* aborted session does not advance it), or the first day before any.
|
|
1192
|
+
*/
|
|
1193
|
+
nextRotationDayId: string | null;
|
|
1161
1194
|
days: RoutineDay[];
|
|
1162
1195
|
createdAt: IsoDateString;
|
|
1163
1196
|
updatedAt: IsoDateString;
|
|
@@ -1166,8 +1199,10 @@ interface CreateRoutineRequest {
|
|
|
1166
1199
|
name: string;
|
|
1167
1200
|
description?: string;
|
|
1168
1201
|
isPeriodized: boolean;
|
|
1202
|
+
/** Defaults to WEEKLY. Changing it on update requires `days`. */
|
|
1203
|
+
scheduleMode?: RoutineScheduleMode;
|
|
1169
1204
|
days: CreateRoutineDayInput[];
|
|
1170
1205
|
}
|
|
1171
1206
|
type UpdateRoutineRequest = Partial<CreateRoutineRequest>;
|
|
1172
1207
|
|
|
1173
|
-
export { ACHIEVEMENT_CATEGORIES, ACHIEVEMENT_DEFINITIONS, type AchievementCategory, type AchievementCategoryProgress, type AchievementDefinition, type AchievementUnlockedEventPayload, type AchievementsResponse, type Brand, type CreateRoutineDayInput, type CreateRoutineExerciseInput, type CreateRoutineRequest, type CreateSessionShareRequest, EXERCISE_EQUIPMENT, EXERCISE_MECHANICS, type EarnedAchievement, type EarnedPersonalRecord, type Exercise, type ExerciseEquipment, type ExerciseId, type ExerciseMechanic, type ExercisePerformanceHistoryQuery, type ExercisePerformanceHistoryResponse, type ExercisePerformancePrescription, type ExercisePerformancePrescriptionSet, type ExercisePerformanceSession, type ExercisePerformanceSet, type ExercisePerformanceSummary, type ExercisePlateau, type ExerciseStrengthSummary, type ExerciseStrengthTrendPoint, type ExerciseStrengthTrendQuery, type ExerciseStrengthTrendResponse, FOLLOW_SUGGESTIONS_DEFAULT_LIMIT, FOLLOW_SUGGESTIONS_MAX_LIMIT, FOLLOW_SUGGESTION_REASONS, type FinishStatus, type FinishWorkoutRequest, type FinishWorkoutResponse, type FollowSuggestion, type FollowSuggestionReason, type FollowSuggestionsResponse, type IsoDateString, type ListSessionsParams, MEASURABLE_GOALS_MAX, MEASURABLE_GOAL_DIRECTIONS, MEASURABLE_GOAL_TYPES, MOVEMENT_PATTERNS, MUSCLE_GROUPS, type MeasurableGoal, type MeasurableGoalDirection, type MeasurableGoalExercise, type MeasurableGoalInput, type MeasurableGoalType, type MovementPattern, type MuscleGroup, type MuscleGroupHeatmapQuery, type MuscleGroupHeatmapResponse, type MuscleGroupHeatmapValue, type MuscleGroupHeatmapWeek, type MuscleVolumeTrendSeries, PLATEAU_MIN_DAYS_SINCE_BEST, PLATEAU_MIN_SESSIONS, PLATEAU_MIN_SESSIONS_MAX, PLATEAU_MIN_SESSIONS_MIN, PLATEAU_RECENT_DAYS, PLATEAU_WINDOW_DAYS, PREFERRED_TRAINING_STYLE_VALUES, PROFILE_BIO_MAX_LENGTH, PROFILE_FAVORITE_EXERCISES_MAX, PROFILE_LOCATION_MAX_LENGTH, PROFILE_TRAINING_DISCIPLINES_MAX, PROFILE_TRAINING_GOALS_MAX, PROFILE_VISIBILITY_VALUES, PROGRESSION_SCHEMES, PROGRESS_TIMELINE_EVENT_TYPES, type PaginatedResponse, type PersonalGoalProgress, type PersonalGoalsResponse, type PersonalRecordEntry, type PersonalRecordKind, type PlatePairInventory, type PlateauPreferences, type PlateauSet, type PlateausResponse, type PreferredTrainingStyle, type PreviousPerformanceResponse, type PreviousSessionRecap, type PreviousSetPerformance, type ProfileDiscoverySettings, type ProfileFavoriteExercise, type ProfilePrivacySettings, type ProfileViewerAccess, type ProfileVisibility, type ProgressTimelineEventType, type ProgressTimelineItem, type ProgressTimelinePersonalRecordItem, type ProgressTimelineProgressionItem, type ProgressTimelineQuery, type ProgressTimelineRecordPerformance, type ProgressTimelineRecordReason, type ProgressTimelineResponse, type ProgressTimelineSessionContext, type ProgressionChange, type ProgressionRule, type ProgressionScheme, type ProgressionSetChange, type PublicBodyMetrics, type PublicTrainingSummary, type PublicUserProfile, RELATIONSHIP_LIST_DEFAULT_LIMIT, RELATIONSHIP_LIST_KINDS, RELATIONSHIP_LIST_MAX_LIMIT, RENAISSANCE_RANK_DEFINITIONS, REP_TYPES, RESERVED_USERNAMES, type RecentActivityEntry, type RelationshipListKind, type RelationshipListQuery, type RelationshipListResponse, type RelationshipMember, type RenaissanceRankDefinition, type RenaissanceRankProgress, type RepType, type ReplaceMeasurableGoalsRequest, type ReplaceTrainingLocationsRequest, type Routine, type RoutineDay, type RoutineDayId, type RoutineExercise, type RoutineId, type RoutineSet, SESSION_SHARE_DEFAULT_FIELDS, SESSION_SHARE_FIELDS, SESSION_SHARE_MAX_ACTIVE_LINKS, SEXES, STARRED_EXERCISES_MAX, type SessionComparisonExercise, type SessionComparisonQuery, type SessionComparisonResponse, type SessionComparisonRoutineDay, type SessionComparisonSession, type SessionComparisonSet, type SessionExerciseSubstitution, type SessionRecapRecord, type SessionShare, type SessionShareField, type SessionShareListResponse, type SetAccountTimeZoneRequest, type SetLog, type Sex, type SharedSessionOwner, type SharedSessionRecap, type StarredExercise, type StarredExercisesResponse, type StartWorkoutRequest, type StartWorkoutResponse, type StreakMilestoneEventPayload, type SubstituteSessionExerciseRequest, type SubstituteSessionExerciseResponse, type SupabaseAuthResponse, type SupabaseAuthUser, type SupabaseMigrationResponse, TRAINING_DISCIPLINE_VALUES, TRAINING_EVENT_TYPES, TRAINING_EXPERIENCE_LEVEL_VALUES, TRAINING_GOAL_VALUES, type TrainingDiscipline, type TrainingEventType, type TrainingExperienceLevel, type TrainingGoal, type TrainingIdentity, type TrainingLocationPreference, type TrainingLocationPreferenceInput, USERNAME_MAX_LENGTH, USERNAME_MIN_LENGTH, USERNAME_PATTERN_SOURCE, type UpdateProfileDiscoveryRequest, type UpdateProfilePrivacyRequest, type UpdateProfileRequest, type UpdateRoutineRequest, type UpsertSetLogRequest, type UpsertSetLogResponse, type UserId, type UserProfile, type UserSearchResponse, type VolumeTrendPoint, type VolumeTrendQuery, type VolumeTrendResponse, type VolumeTrendSeries, 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 };
|
|
1208
|
+
export { ACHIEVEMENT_CATEGORIES, ACHIEVEMENT_DEFINITIONS, type AchievementCategory, type AchievementCategoryProgress, type AchievementDefinition, type AchievementUnlockedEventPayload, type AchievementsResponse, type Brand, type CreateRoutineDayInput, type CreateRoutineExerciseInput, type CreateRoutineRequest, type CreateSessionShareRequest, EXERCISE_EQUIPMENT, EXERCISE_MECHANICS, type EarnedAchievement, type EarnedPersonalRecord, type Exercise, type ExerciseEquipment, type ExerciseId, type ExerciseMechanic, type ExercisePerformanceHistoryQuery, type ExercisePerformanceHistoryResponse, type ExercisePerformancePrescription, type ExercisePerformancePrescriptionSet, type ExercisePerformanceSession, type ExercisePerformanceSet, type ExercisePerformanceSummary, type ExercisePlateau, type ExerciseStrengthSummary, type ExerciseStrengthTrendPoint, type ExerciseStrengthTrendQuery, type ExerciseStrengthTrendResponse, FOLLOW_SUGGESTIONS_DEFAULT_LIMIT, FOLLOW_SUGGESTIONS_MAX_LIMIT, FOLLOW_SUGGESTION_REASONS, type FinishStatus, type FinishWorkoutRequest, type FinishWorkoutResponse, type FollowSuggestion, type FollowSuggestionReason, type FollowSuggestionsResponse, type IsoDateString, type ListSessionsParams, MEASURABLE_GOALS_MAX, MEASURABLE_GOAL_DIRECTIONS, MEASURABLE_GOAL_TYPES, MOVEMENT_PATTERNS, MUSCLE_GROUPS, type MeasurableGoal, type MeasurableGoalDirection, type MeasurableGoalExercise, type MeasurableGoalInput, type MeasurableGoalType, type MovementPattern, type MuscleGroup, type MuscleGroupHeatmapQuery, type MuscleGroupHeatmapResponse, type MuscleGroupHeatmapValue, type MuscleGroupHeatmapWeek, type MuscleVolumeTrendSeries, PLATEAU_MIN_DAYS_SINCE_BEST, PLATEAU_MIN_SESSIONS, PLATEAU_MIN_SESSIONS_MAX, PLATEAU_MIN_SESSIONS_MIN, PLATEAU_RECENT_DAYS, PLATEAU_WINDOW_DAYS, PREFERRED_TRAINING_STYLE_VALUES, PROFILE_BIO_MAX_LENGTH, PROFILE_FAVORITE_EXERCISES_MAX, PROFILE_LOCATION_MAX_LENGTH, PROFILE_TRAINING_DISCIPLINES_MAX, PROFILE_TRAINING_GOALS_MAX, PROFILE_VISIBILITY_VALUES, PROGRESSION_SCHEMES, PROGRESS_TIMELINE_EVENT_TYPES, type PaginatedResponse, type PersonalGoalProgress, type PersonalGoalsResponse, type PersonalRecordEntry, type PersonalRecordKind, type PlatePairInventory, type PlateauPreferences, type PlateauSet, type PlateausResponse, type PreferredTrainingStyle, type PreviousPerformanceResponse, type PreviousSessionRecap, type PreviousSetPerformance, type ProfileDiscoverySettings, type ProfileFavoriteExercise, type ProfilePrivacySettings, type ProfileViewerAccess, type ProfileVisibility, type ProgressTimelineEventType, type ProgressTimelineItem, type ProgressTimelinePersonalRecordItem, type ProgressTimelineProgressionItem, type ProgressTimelineQuery, type ProgressTimelineRecordPerformance, type ProgressTimelineRecordReason, type ProgressTimelineResponse, type ProgressTimelineSessionContext, type ProgressionChange, type ProgressionRule, type ProgressionScheme, type ProgressionSetChange, type PublicBodyMetrics, type PublicTrainingSummary, type PublicUserProfile, RELATIONSHIP_LIST_DEFAULT_LIMIT, RELATIONSHIP_LIST_KINDS, RELATIONSHIP_LIST_MAX_LIMIT, RENAISSANCE_RANK_DEFINITIONS, REP_TYPES, RESERVED_USERNAMES, ROUTINE_DAYS_MAX, ROUTINE_DAY_NAME_MAX, ROUTINE_SCHEDULE_MODES, type RecentActivityEntry, type RelationshipListKind, type RelationshipListQuery, type RelationshipListResponse, type RelationshipMember, type RenaissanceRankDefinition, type RenaissanceRankProgress, type RepType, type ReplaceMeasurableGoalsRequest, type ReplaceTrainingLocationsRequest, type Routine, type RoutineDay, type RoutineDayId, type RoutineExercise, type RoutineId, type RoutineScheduleMode, type RoutineSet, SESSION_SHARE_DEFAULT_FIELDS, SESSION_SHARE_FIELDS, SESSION_SHARE_MAX_ACTIVE_LINKS, SEXES, STARRED_EXERCISES_MAX, type SessionComparisonExercise, type SessionComparisonQuery, type SessionComparisonResponse, type SessionComparisonRoutineDay, type SessionComparisonSession, type SessionComparisonSet, type SessionExerciseSubstitution, type SessionRecapRecord, type SessionShare, type SessionShareField, type SessionShareListResponse, type SetAccountTimeZoneRequest, type SetLog, type Sex, type SharedSessionOwner, type SharedSessionRecap, type StarredExercise, type StarredExercisesResponse, type StartWorkoutRequest, type StartWorkoutResponse, type StreakMilestoneEventPayload, type SubstituteSessionExerciseRequest, type SubstituteSessionExerciseResponse, type SupabaseAuthResponse, type SupabaseAuthUser, type SupabaseMigrationResponse, TRAINING_DISCIPLINE_VALUES, TRAINING_EVENT_TYPES, TRAINING_EXPERIENCE_LEVEL_VALUES, TRAINING_GOAL_VALUES, type TrainingDiscipline, type TrainingEventType, type TrainingExperienceLevel, type TrainingGoal, type TrainingIdentity, type TrainingLocationPreference, type TrainingLocationPreferenceInput, USERNAME_MAX_LENGTH, USERNAME_MIN_LENGTH, USERNAME_PATTERN_SOURCE, type UpdateProfileDiscoveryRequest, type UpdateProfilePrivacyRequest, type UpdateProfileRequest, type UpdateRoutineRequest, type UpsertSetLogRequest, type UpsertSetLogResponse, type UserId, type UserProfile, type UserSearchResponse, type VolumeTrendPoint, type VolumeTrendQuery, type VolumeTrendResponse, type VolumeTrendSeries, 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, routineDayLabel };
|
package/dist/index.js
CHANGED
|
@@ -276,6 +276,31 @@ var RENAISSANCE_RANK_DEFINITIONS = [
|
|
|
276
276
|
}
|
|
277
277
|
];
|
|
278
278
|
|
|
279
|
+
// src/routine.ts
|
|
280
|
+
var ROUTINE_SCHEDULE_MODES = ["WEEKLY", "ROTATION"];
|
|
281
|
+
var ROUTINE_DAYS_MAX = 7;
|
|
282
|
+
var ROUTINE_DAY_NAME_MAX = 40;
|
|
283
|
+
var WEEKDAY_NAMES = [
|
|
284
|
+
"Sunday",
|
|
285
|
+
"Monday",
|
|
286
|
+
"Tuesday",
|
|
287
|
+
"Wednesday",
|
|
288
|
+
"Thursday",
|
|
289
|
+
"Friday",
|
|
290
|
+
"Saturday"
|
|
291
|
+
];
|
|
292
|
+
function routineDayLabel(day) {
|
|
293
|
+
const name = day.name?.trim();
|
|
294
|
+
if (name) return name;
|
|
295
|
+
if (typeof day.dayOfWeek === "number") {
|
|
296
|
+
return WEEKDAY_NAMES[day.dayOfWeek] ?? "";
|
|
297
|
+
}
|
|
298
|
+
if (typeof day.order === "number" && day.order >= 0 && day.order < 26) {
|
|
299
|
+
return `Day ${String.fromCharCode(65 + day.order)}`;
|
|
300
|
+
}
|
|
301
|
+
return "";
|
|
302
|
+
}
|
|
303
|
+
|
|
279
304
|
// src/workout.ts
|
|
280
305
|
var SESSION_SHARE_FIELDS = [
|
|
281
306
|
"duration",
|
|
@@ -345,6 +370,9 @@ export {
|
|
|
345
370
|
RENAISSANCE_RANK_DEFINITIONS,
|
|
346
371
|
REP_TYPES,
|
|
347
372
|
RESERVED_USERNAMES,
|
|
373
|
+
ROUTINE_DAYS_MAX,
|
|
374
|
+
ROUTINE_DAY_NAME_MAX,
|
|
375
|
+
ROUTINE_SCHEDULE_MODES,
|
|
348
376
|
SESSION_SHARE_DEFAULT_FIELDS,
|
|
349
377
|
SESSION_SHARE_FIELDS,
|
|
350
378
|
SESSION_SHARE_MAX_ACTIVE_LINKS,
|
|
@@ -358,5 +386,6 @@ export {
|
|
|
358
386
|
USERNAME_MIN_LENGTH,
|
|
359
387
|
USERNAME_PATTERN_SOURCE,
|
|
360
388
|
WEIGHT_UNITS,
|
|
361
|
-
WORKOUT_SESSION_STATUSES
|
|
389
|
+
WORKOUT_SESSION_STATUSES,
|
|
390
|
+
routineDayLabel
|
|
362
391
|
};
|