@sunsteel/contracts 0.60.0 → 0.62.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 +52 -2
- package/dist/index.d.cts +268 -1
- package/dist/index.d.ts +268 -1
- package/dist/index.js +43 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -20,6 +20,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
ACCOUNT_EXPORT_FORMAT: () => ACCOUNT_EXPORT_FORMAT,
|
|
24
|
+
ACCOUNT_EXPORT_VERSION: () => ACCOUNT_EXPORT_VERSION,
|
|
23
25
|
ACHIEVEMENT_CATEGORIES: () => ACHIEVEMENT_CATEGORIES,
|
|
24
26
|
ACHIEVEMENT_DEFINITIONS: () => ACHIEVEMENT_DEFINITIONS,
|
|
25
27
|
ACTIVITY_CAPS: () => ACTIVITY_CAPS,
|
|
@@ -118,6 +120,9 @@ __export(index_exports, {
|
|
|
118
120
|
SCHEDULE_OVERRIDES_MAX_RANGE_DAYS: () => SCHEDULE_OVERRIDES_MAX_RANGE_DAYS,
|
|
119
121
|
SCHEDULE_OVERRIDE_KINDS: () => SCHEDULE_OVERRIDE_KINDS,
|
|
120
122
|
SCHEDULE_SKIP_PAST_DAYS: () => SCHEDULE_SKIP_PAST_DAYS,
|
|
123
|
+
SESSION_CORRECTIONS_MAX: () => SESSION_CORRECTIONS_MAX,
|
|
124
|
+
SESSION_CORRECTION_LIMITS: () => SESSION_CORRECTION_LIMITS,
|
|
125
|
+
SESSION_CORRECTION_WINDOW_HOURS: () => SESSION_CORRECTION_WINDOW_HOURS,
|
|
121
126
|
SESSION_SHARE_DEFAULT_FIELDS: () => SESSION_SHARE_DEFAULT_FIELDS,
|
|
122
127
|
SESSION_SHARE_FIELDS: () => SESSION_SHARE_FIELDS,
|
|
123
128
|
SESSION_SHARE_MAX_ACTIVE_LINKS: () => SESSION_SHARE_MAX_ACTIVE_LINKS,
|
|
@@ -140,9 +145,12 @@ __export(index_exports, {
|
|
|
140
145
|
USERNAME_PATTERN_SOURCE: () => USERNAME_PATTERN_SOURCE,
|
|
141
146
|
WEIGHT_UNITS: () => WEIGHT_UNITS,
|
|
142
147
|
WORKOUT_SESSION_STATUSES: () => WORKOUT_SESSION_STATUSES,
|
|
148
|
+
accountExportFileName: () => accountExportFileName,
|
|
143
149
|
isWithinQuietHours: () => isWithinQuietHours,
|
|
144
150
|
matchesDeletionConfirmation: () => matchesDeletionConfirmation,
|
|
145
|
-
routineDayLabel: () => routineDayLabel
|
|
151
|
+
routineDayLabel: () => routineDayLabel,
|
|
152
|
+
sessionCorrectionWindow: () => sessionCorrectionWindow,
|
|
153
|
+
setLogValuesDiffer: () => setLogValuesDiffer
|
|
146
154
|
});
|
|
147
155
|
module.exports = __toCommonJS(index_exports);
|
|
148
156
|
|
|
@@ -593,6 +601,33 @@ var SESSION_SHARE_DEFAULT_FIELDS = [
|
|
|
593
601
|
];
|
|
594
602
|
var SESSION_SHARE_MAX_ACTIVE_LINKS = 10;
|
|
595
603
|
|
|
604
|
+
// src/session-corrections.ts
|
|
605
|
+
var SESSION_CORRECTION_WINDOW_HOURS = 48;
|
|
606
|
+
var SESSION_CORRECTIONS_MAX = 10;
|
|
607
|
+
var SESSION_CORRECTION_LIMITS = {
|
|
608
|
+
weightKgMax: 1500,
|
|
609
|
+
repsMax: 1e3,
|
|
610
|
+
rpeMin: 0,
|
|
611
|
+
rpeMax: 10
|
|
612
|
+
};
|
|
613
|
+
function sessionCorrectionWindow(input, now = /* @__PURE__ */ new Date()) {
|
|
614
|
+
const closed = (closedReason) => ({ correctableUntil: null, closedReason });
|
|
615
|
+
if (input.status !== "COMPLETED" || !input.endedAt)
|
|
616
|
+
return closed("NOT_COMPLETED");
|
|
617
|
+
if (!input.isLatest) return closed("NOT_LATEST");
|
|
618
|
+
if (input.laterSessionStarted) return closed("LATER_SESSION");
|
|
619
|
+
const until = new Date(
|
|
620
|
+
new Date(input.endedAt).getTime() + SESSION_CORRECTION_WINDOW_HOURS * 3600 * 1e3
|
|
621
|
+
);
|
|
622
|
+
if (now.getTime() >= until.getTime()) return closed("WINDOW_PASSED");
|
|
623
|
+
if (input.correctionCount >= SESSION_CORRECTIONS_MAX)
|
|
624
|
+
return closed("LIMIT_REACHED");
|
|
625
|
+
return { correctableUntil: until.toISOString(), closedReason: null };
|
|
626
|
+
}
|
|
627
|
+
function setLogValuesDiffer(a, b) {
|
|
628
|
+
return a.weight !== b.weight || a.reps !== b.reps || a.rpe !== b.rpe || a.isCompleted !== b.isCompleted;
|
|
629
|
+
}
|
|
630
|
+
|
|
596
631
|
// src/analytics.ts
|
|
597
632
|
var TRAINING_EVENT_TYPES = [
|
|
598
633
|
"SESSION_COMPLETED",
|
|
@@ -689,8 +724,17 @@ function matchesDeletionConfirmation(typed, username) {
|
|
|
689
724
|
const normalized = typed.trim().replace(/^@/, "").toLowerCase();
|
|
690
725
|
return normalized.length > 0 && normalized === username.toLowerCase();
|
|
691
726
|
}
|
|
727
|
+
|
|
728
|
+
// src/account-export.ts
|
|
729
|
+
var ACCOUNT_EXPORT_FORMAT = "sunnsteel-account-export";
|
|
730
|
+
var ACCOUNT_EXPORT_VERSION = 1;
|
|
731
|
+
function accountExportFileName(username, exportedAt) {
|
|
732
|
+
return `sunnsteel-${username}-${exportedAt.slice(0, 10)}.json`;
|
|
733
|
+
}
|
|
692
734
|
// Annotate the CommonJS export names for ESM import in node:
|
|
693
735
|
0 && (module.exports = {
|
|
736
|
+
ACCOUNT_EXPORT_FORMAT,
|
|
737
|
+
ACCOUNT_EXPORT_VERSION,
|
|
694
738
|
ACHIEVEMENT_CATEGORIES,
|
|
695
739
|
ACHIEVEMENT_DEFINITIONS,
|
|
696
740
|
ACTIVITY_CAPS,
|
|
@@ -789,6 +833,9 @@ function matchesDeletionConfirmation(typed, username) {
|
|
|
789
833
|
SCHEDULE_OVERRIDES_MAX_RANGE_DAYS,
|
|
790
834
|
SCHEDULE_OVERRIDE_KINDS,
|
|
791
835
|
SCHEDULE_SKIP_PAST_DAYS,
|
|
836
|
+
SESSION_CORRECTIONS_MAX,
|
|
837
|
+
SESSION_CORRECTION_LIMITS,
|
|
838
|
+
SESSION_CORRECTION_WINDOW_HOURS,
|
|
792
839
|
SESSION_SHARE_DEFAULT_FIELDS,
|
|
793
840
|
SESSION_SHARE_FIELDS,
|
|
794
841
|
SESSION_SHARE_MAX_ACTIVE_LINKS,
|
|
@@ -811,7 +858,10 @@ function matchesDeletionConfirmation(typed, username) {
|
|
|
811
858
|
USERNAME_PATTERN_SOURCE,
|
|
812
859
|
WEIGHT_UNITS,
|
|
813
860
|
WORKOUT_SESSION_STATUSES,
|
|
861
|
+
accountExportFileName,
|
|
814
862
|
isWithinQuietHours,
|
|
815
863
|
matchesDeletionConfirmation,
|
|
816
|
-
routineDayLabel
|
|
864
|
+
routineDayLabel,
|
|
865
|
+
sessionCorrectionWindow,
|
|
866
|
+
setLogValuesDiffer
|
|
817
867
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -2226,6 +2226,109 @@ interface DeleteActivityCommentResponse {
|
|
|
2226
2226
|
summary: ActivityCommentSummary;
|
|
2227
2227
|
}
|
|
2228
2228
|
|
|
2229
|
+
/**
|
|
2230
|
+
* LIVE-17. Correcting a finished workout: the owner fixes a mistyped weight,
|
|
2231
|
+
* reps or RPE, or a set left unticked, and everything the workout fed --
|
|
2232
|
+
* records, totals, achievements, its own load changes and the activity built
|
|
2233
|
+
* from them -- is re-derived from the corrected sets.
|
|
2234
|
+
*
|
|
2235
|
+
* Only the most recent completed workout can be corrected, for a bounded time
|
|
2236
|
+
* and until another workout starts, because the next workout is built on this
|
|
2237
|
+
* one: its "last time", the loads it prescribes and the records it is measured
|
|
2238
|
+
* against. Every saved correction is kept, with the values before and after.
|
|
2239
|
+
*/
|
|
2240
|
+
/** How long after finishing a workout it can still be corrected. */
|
|
2241
|
+
declare const SESSION_CORRECTION_WINDOW_HOURS = 48;
|
|
2242
|
+
/** Saved corrections per workout, so the trail stays readable. */
|
|
2243
|
+
declare const SESSION_CORRECTIONS_MAX = 10;
|
|
2244
|
+
/**
|
|
2245
|
+
* Bounds a corrected value must respect. Weight is kilograms. The live logging
|
|
2246
|
+
* path is looser; a correction exists to replace an implausible value, so it
|
|
2247
|
+
* does not accept one.
|
|
2248
|
+
*/
|
|
2249
|
+
declare const SESSION_CORRECTION_LIMITS: {
|
|
2250
|
+
readonly weightKgMax: 1500;
|
|
2251
|
+
readonly repsMax: 1000;
|
|
2252
|
+
readonly rpeMin: 0;
|
|
2253
|
+
readonly rpeMax: 10;
|
|
2254
|
+
};
|
|
2255
|
+
/** The four things a correction can change on one logged set. */
|
|
2256
|
+
interface SetLogValues {
|
|
2257
|
+
weight: number | null;
|
|
2258
|
+
reps: number | null;
|
|
2259
|
+
rpe: number | null;
|
|
2260
|
+
isCompleted: boolean;
|
|
2261
|
+
}
|
|
2262
|
+
/** One changed set, as it was and as it became. */
|
|
2263
|
+
interface SessionSetCorrection {
|
|
2264
|
+
setLogId: string;
|
|
2265
|
+
exerciseId: string;
|
|
2266
|
+
/** As named when the correction was saved. */
|
|
2267
|
+
exerciseName: string;
|
|
2268
|
+
setNumber: number;
|
|
2269
|
+
before: SetLogValues;
|
|
2270
|
+
after: SetLogValues;
|
|
2271
|
+
}
|
|
2272
|
+
/** One saved correction. Never edited or deleted once written. */
|
|
2273
|
+
interface SessionCorrection {
|
|
2274
|
+
id: string;
|
|
2275
|
+
createdAt: IsoDateString;
|
|
2276
|
+
changes: SessionSetCorrection[];
|
|
2277
|
+
}
|
|
2278
|
+
type SessionCorrectionClosedReason = "NOT_COMPLETED" | "NOT_LATEST" | "LATER_SESSION" | "WINDOW_PASSED" | "LIMIT_REACHED";
|
|
2279
|
+
/**
|
|
2280
|
+
* Whether the workout can be corrected now. `correctableUntil` is set only
|
|
2281
|
+
* while it can; `closedReason` says why it cannot.
|
|
2282
|
+
*/
|
|
2283
|
+
interface SessionCorrectionWindow {
|
|
2284
|
+
correctableUntil: IsoDateString | null;
|
|
2285
|
+
closedReason: SessionCorrectionClosedReason | null;
|
|
2286
|
+
}
|
|
2287
|
+
/** GET /workouts/sessions/:id/corrections */
|
|
2288
|
+
interface SessionCorrectionsResponse {
|
|
2289
|
+
window: SessionCorrectionWindow;
|
|
2290
|
+
/** Oldest first. */
|
|
2291
|
+
corrections: SessionCorrection[];
|
|
2292
|
+
}
|
|
2293
|
+
interface CorrectSessionSetRequest extends SetLogValues {
|
|
2294
|
+
setLogId: string;
|
|
2295
|
+
}
|
|
2296
|
+
/**
|
|
2297
|
+
* POST /workouts/sessions/:id/corrections. Each set carries all four values
|
|
2298
|
+
* as they should now read; sets that end up unchanged are ignored, and a
|
|
2299
|
+
* request that changes nothing is refused.
|
|
2300
|
+
*/
|
|
2301
|
+
interface CorrectSessionRequest {
|
|
2302
|
+
sets: CorrectSessionSetRequest[];
|
|
2303
|
+
}
|
|
2304
|
+
interface CorrectSessionResponse {
|
|
2305
|
+
correction: SessionCorrection;
|
|
2306
|
+
window: SessionCorrectionWindow;
|
|
2307
|
+
/**
|
|
2308
|
+
* Exercises whose load change from this workout was left as it is, because
|
|
2309
|
+
* the routine was edited after the workout and re-deriving it would undo
|
|
2310
|
+
* that edit.
|
|
2311
|
+
*/
|
|
2312
|
+
progressionKept: Array<{
|
|
2313
|
+
exerciseId: string;
|
|
2314
|
+
exerciseName: string;
|
|
2315
|
+
}>;
|
|
2316
|
+
}
|
|
2317
|
+
/**
|
|
2318
|
+
* The window rule, shared so the server and the page state it the same way.
|
|
2319
|
+
* `isLatest` means no other completed workout ended later; `laterSessionStarted`
|
|
2320
|
+
* means any workout started after this one ended.
|
|
2321
|
+
*/
|
|
2322
|
+
declare function sessionCorrectionWindow(input: {
|
|
2323
|
+
status: string;
|
|
2324
|
+
endedAt: IsoDateString | Date | null | undefined;
|
|
2325
|
+
isLatest: boolean;
|
|
2326
|
+
laterSessionStarted: boolean;
|
|
2327
|
+
correctionCount: number;
|
|
2328
|
+
}, now?: Date): SessionCorrectionWindow;
|
|
2329
|
+
/** Whether two sets of values differ in anything a correction records. */
|
|
2330
|
+
declare function setLogValuesDiffer(a: SetLogValues, b: SetLogValues): boolean;
|
|
2331
|
+
|
|
2229
2332
|
/** SOC-08: one explicit grant from a member to their active training partner. */
|
|
2230
2333
|
interface TrainingPartnerPermissions {
|
|
2231
2334
|
schedule: boolean;
|
|
@@ -2604,4 +2707,168 @@ interface DeleteAccountResponse {
|
|
|
2604
2707
|
*/
|
|
2605
2708
|
declare function matchesDeletionConfirmation(typed: string, username: string): boolean;
|
|
2606
2709
|
|
|
2607
|
-
export { ACHIEVEMENT_CATEGORIES, ACHIEVEMENT_DEFINITIONS, ACTIVITY_CAPS, ACTIVITY_COMMENTS_PAGE_SIZE, ACTIVITY_COMMENTS_PER_DAY_MAX, ACTIVITY_COMMENT_MAX_LENGTH, ACTIVITY_DEFAULT_AUDIENCE, ACTIVITY_ENTRY_ID_MAX_LENGTH, ACTIVITY_FEED_FOLLOWED_MAX, ACTIVITY_PAGE_DEFAULT_LIMIT, ACTIVITY_PAGE_MAX_LIMIT, ACTIVITY_PREVIEW_AUDIENCES, ACTIVITY_REACTIONS, ACTIVITY_TYPES, ACTIVITY_TYPE_SECTIONS, type AchievementActivity, type AchievementCategory, type AchievementCategoryProgress, type AchievementDefinition, type AchievementNotification, type AchievementUnlockedEventPayload, type AchievementsResponse, type ActivityAudience, type ActivityCap, type ActivityComment, type ActivityCommentNotification, type ActivityCommentSummary, type ActivityCommentsQuery, type ActivityCommentsResponse, type ActivityEntry, type ActivityEntrySharing, type ActivityFeedResponse, type ActivityLink, type ActivityPage, type ActivityPageQuery, type ActivityPreviewAudience, type ActivityPreviewQuery, type ActivityReaction, type ActivityReactionSummary, type ActivitySection, type ActivitySharingSettings, type ActivityType, type AppNotification, BLOCKED_MEMBERS_MAX, type BlockedMember, type BlockedMembersResponse, type Brand, CLONE_ROUTINE_REFUSALS, COMEBACK_MIN_INACTIVE_DAYS, COMEBACK_RECOGNITION_LIMIT, COMEBACK_REQUIRED_ACTIVE_DAYS, COMEBACK_SESSION_LOOKBACK, COMEBACK_WINDOW_DAYS, type CalendarDate, type CloneRoutineRefusal, type CloneRoutineRequest, type ComebackActivity, type ComebackRecognition, type ComebackRecognitionSummary, type CreateActivityCommentRequest, type CreateActivityCommentResponse, type CreateReportRequest, type CreateReportResponse, type CreateRoutineDayInput, type CreateRoutineExerciseInput, type CreateRoutineRequest, type CreateRoutineVersionRequest, type CreateSessionShareRequest, type DeleteAccountRequest, type DeleteAccountResponse, type DeleteActivityCommentResponse, type DeletePushSubscriptionRequest, type DiscoverableRoutine, 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, FEATURED_PROFILE_ITEMS_MAX, FEATURED_PROFILE_ITEM_KINDS, FEATURED_PROFILE_REFERENCE_MAX_LENGTH, FOLLOW_SUGGESTIONS_DEFAULT_LIMIT, FOLLOW_SUGGESTIONS_MAX_LIMIT, FOLLOW_SUGGESTION_REASONS, type FeaturedProfileAchievementItem, type FeaturedProfileItem, type FeaturedProfileItemKind, type FeaturedProfileRankItem, type FeaturedProfileRecordItem, type FeaturedProfileRoutineItem, type FeaturedProfileSelection, type FeaturedProfileSelectionInput, type FeaturedProfileSelectionsResponse, 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, MINUTES_IN_DAY, MODERATION_ACTION_KINDS, MODERATION_HISTORY_PAGE_SIZE, MODERATION_NOTE_MAX_LENGTH, MODERATION_QUEUE_PAGE_SIZE, MOVEMENT_PATTERNS, MUSCLE_GROUPS, type MarkNotificationsReadRequest, type MarkNotificationsReadResponse, type MeasurableGoal, type MeasurableGoalDirection, type MeasurableGoalExercise, type MeasurableGoalInput, type MeasurableGoalType, type MemberActivityResponse, type MemberModerationState, type MemberRoutinesResponse, type ModerationActionKind, type ModerationActionRecord, type ModerationHistoryQuery, type ModerationHistoryResponse, type ModerationQueueQuery, type ModerationQueueResponse, type ModerationReport, type ModeratorState, type MoveOccurrenceRequest, type MovementPattern, type MuscleGroup, type MuscleGroupHeatmapQuery, type MuscleGroupHeatmapResponse, type MuscleGroupHeatmapValue, type MuscleGroupHeatmapWeek, type MuscleVolumeTrendSeries, NOTIFICATIONS_LIST_LIMIT, NOTIFICATIONS_LOOKBACK_DAYS, NOTIFICATIONS_RETENTION_DAYS, NOTIFICATION_CATEGORIES, NOTIFICATION_KINDS, type NewFollowerNotification, type NotificationCategory, type NotificationKind, type NotificationPreferences, type NotificationPreferencesResponse, type NotificationsResponse, type OwnActivityEntry, type OwnActivityResponse, 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, PUSH_PAYLOAD_KINDS, PUSH_SUBSCRIPTIONS_MAX, type PaginatedResponse, type PersonalGoalProgress, type PersonalGoalsResponse, type PersonalRecordActivity, type PersonalRecordEntry, type PersonalRecordKind, type PlannedReminder, 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 ProgressionActivity, type ProgressionChange, type ProgressionRule, type ProgressionScheme, type ProgressionSetChange, type PublicBodyMetrics, type PublicProfileAchievements, type PublicTrainingSummary, type PublicUserProfile, type PushPayload, type PushPayloadKind, type PushSubscriptionKeys, type PushSubscriptionSummary, type PushSubscriptionsResponse, type QuietHours, RELATIONSHIP_LIST_DEFAULT_LIMIT, RELATIONSHIP_LIST_KINDS, RELATIONSHIP_LIST_MAX_LIMIT, RENAISSANCE_RANK_DEFINITIONS, REPORTS_PER_DAY_MAX, REPORT_DETAILS_MAX_LENGTH, REPORT_REASONS, REPORT_STATUSES, REPORT_SUBJECT_KINDS, REP_TYPES, RESERVED_USERNAMES, REST_ALERT_MAX_LEAD_SECONDS, REST_ALERT_MIN_LEAD_SECONDS, REST_ALERT_REFUSALS, ROUTINE_DAYS_MAX, ROUTINE_DAY_NAME_MAX, ROUTINE_DISCOVERY_DEFAULT_LIMIT, ROUTINE_DISCOVERY_MAX_LIMIT, ROUTINE_DISCOVERY_SCAN_LIMIT, ROUTINE_DURATION_BANDS, ROUTINE_DURATION_BAND_MAX_MINUTES, ROUTINE_SCHEDULE_MODES, ROUTINE_SHARE_MAX_ACTIVE_LINKS, ROUTINE_TRAINING_BLOCKS_MAX, ROUTINE_TRAINING_BLOCK_NAME_MAX, ROUTINE_TRAINING_BLOCK_REVISIONS_MAX, ROUTINE_TRAINING_BLOCK_SOURCE_KINDS, ROUTINE_TRAINING_BLOCK_STATES, ROUTINE_VERSIONS_MAX, ROUTINE_VERSION_KINDS, ROUTINE_VERSION_NAME_MAX, ROUTINE_VISIBILITY_VALUES, type RecentActivityEntry, type RegisterPushSubscriptionRequest, type RelationshipListKind, type RelationshipListQuery, type RelationshipListResponse, type RelationshipMember, type RenaissanceRankDefinition, type RenaissanceRankProgress, type RepType, type ReplaceFeaturedProfileItemsRequest, type ReplaceMeasurableGoalsRequest, type ReplaceTrainingLocationsRequest, type ReportReason, type ReportStatus, type ReportSubjectKind, type ReportSubjectPreview, type RestAlertPushPayload, type RestAlertRefusal, type RestoreRoutineVersionResponse, type ReviewReportRequest, type ReviewReportResponse, type Routine, type RoutineClassification, type RoutineDay, type RoutineDayId, type RoutineDiscoveryQuery, type RoutineDiscoveryResponse, type RoutineDurationBand, type RoutineExercise, type RoutineFacets, type RoutineId, type RoutineLineage, type RoutineScheduleMode, type RoutineSet, type RoutineShare, type RoutineShareListResponse, type RoutineSharedActivity, type RoutineTrainingBlock, type RoutineTrainingBlockRevision, type RoutineTrainingBlockRevisionsResponse, type RoutineTrainingBlockSource, type RoutineTrainingBlockSourceKind, type RoutineTrainingBlockState, type RoutineTrainingBlocksResponse, type RoutineVersion, type RoutineVersionDay, type RoutineVersionExercise, type RoutineVersionKind, type RoutineVersionSetup, type RoutineVersionsResponse, type RoutineVisibility, SCHEDULE_MOVE_MAX_DAYS, SCHEDULE_OVERRIDES_MAX_RANGE_DAYS, SCHEDULE_OVERRIDE_KINDS, SCHEDULE_SKIP_PAST_DAYS, SESSION_SHARE_DEFAULT_FIELDS, SESSION_SHARE_FIELDS, SESSION_SHARE_MAX_ACTIVE_LINKS, SEXES, SHARED_ROUTINE_SOURCES, STARRED_EXERCISES_MAX, STREAK_MAX_GAP_DAYS, type ScheduleOverride, type ScheduleOverrideKind, type ScheduleOverridesQuery, type ScheduleOverridesResponse, type ScheduleRestAlertRequest, type ScheduleRestAlertResponse, type SendTrainingPartnerEncouragementRequest, type SendTrainingPartnerEncouragementResponse, type SessionComparisonExercise, type SessionComparisonQuery, type SessionComparisonResponse, type SessionComparisonRoutineDay, type SessionComparisonSession, type SessionComparisonSet, type SessionCompletedActivity, type SessionExerciseSubstitution, type SessionProgressNotification, type SessionRecapRecord, type SessionShare, type SessionShareField, type SessionShareListResponse, type SetAccountTimeZoneRequest, type SetActivityEntryAudienceRequest, type SetActivityEntryAudienceResponse, type SetActivityReactionRequest, type SetActivityReactionResponse, type SetLog, type Sex, type SharedRoutine, type SharedRoutineOwner, type SharedRoutineSource, type SharedRoutineSummary, type SharedSessionOwner, type SharedSessionRecap, type SkipOccurrenceRequest, type StarredExercise, type StarredExercisesResponse, type StartWorkoutRequest, type StartWorkoutResponse, type StreakAtRiskPushPayload, type StreakMilestoneActivity, 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, TRAINING_PARTNERSHIP_STATUSES, TRAINING_PARTNERS_MAX, TRAINING_PARTNER_ENCOURAGEMENTS_PER_24_HOURS_MAX, TRAINING_PARTNER_ENCOURAGEMENT_KINDS, TRAINING_PARTNER_PERMISSION_KEYS, TRAINING_PARTNER_REQUESTS_PER_DAY_MAX, type TrainingDiscipline, type TrainingEventType, type TrainingExperienceLevel, type TrainingGoal, type TrainingIdentity, type TrainingLocationPreference, type TrainingLocationPreferenceInput, type TrainingPartnerEncouragementKind, type TrainingPartnerEncouragementNotification, type TrainingPartnerPermissions, type TrainingPartnerScheduleDay, type TrainingPartnerScheduleResponse, type TrainingPartnership, type TrainingPartnershipStatus, type TrainingPartnershipsResponse, type TrainingReminderPreference, type TrainingReminderPushPayload, USERNAME_MAX_LENGTH, USERNAME_MIN_LENGTH, USERNAME_PATTERN_SOURCE, type UpdateActivitySharingRequest, type UpdateNotificationPreferencesRequest, type UpdateProfileDiscoveryRequest, type UpdateProfilePrivacyRequest, type UpdateProfileRequest, type UpdateRoutineRequest, type UpdateRoutineVisibilityRequest, type UpdateTrainingPartnerPermissionsRequest, type UpsertRoutineTrainingBlockRequest, 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, isWithinQuietHours, matchesDeletionConfirmation, routineDayLabel };
|
|
2710
|
+
/**
|
|
2711
|
+
* EXPORT-01. Everything a member put into Sunnsteel, in one JSON document they
|
|
2712
|
+
* can keep, read or take elsewhere.
|
|
2713
|
+
*
|
|
2714
|
+
* Stability is the point. `format` and `formatVersion` identify the document;
|
|
2715
|
+
* a field is only ever added within a version, and anything that changes the
|
|
2716
|
+
* meaning of an existing field is a new version. Sections reuse the shapes the
|
|
2717
|
+
* app itself serves (`UserProfile`, `Routine`, `WorkoutSession`), so the file
|
|
2718
|
+
* says what the member saw.
|
|
2719
|
+
*
|
|
2720
|
+
* **Every weight is kilograms**, whatever unit the account displays -- that is
|
|
2721
|
+
* how Sunnsteel stores them. `account.weightUnit` is the display preference.
|
|
2722
|
+
*
|
|
2723
|
+
* Left out on purpose, and stated in `omitted`: other members' data (people
|
|
2724
|
+
* appear by username only, never email), credentials (share-link tokens,
|
|
2725
|
+
* push-device endpoints), and anything derived from what is exported
|
|
2726
|
+
* (analytics rollups, the notification feed).
|
|
2727
|
+
*/
|
|
2728
|
+
declare const ACCOUNT_EXPORT_FORMAT: "sunnsteel-account-export";
|
|
2729
|
+
declare const ACCOUNT_EXPORT_VERSION: 1;
|
|
2730
|
+
/** Another member, as the export names them: never by email. */
|
|
2731
|
+
interface AccountExportMember {
|
|
2732
|
+
username: string;
|
|
2733
|
+
name: string;
|
|
2734
|
+
}
|
|
2735
|
+
interface AccountExportRoutine {
|
|
2736
|
+
routine: Routine;
|
|
2737
|
+
versions: Array<{
|
|
2738
|
+
number: number;
|
|
2739
|
+
name: string | null;
|
|
2740
|
+
kind: string;
|
|
2741
|
+
createdAt: IsoDateString;
|
|
2742
|
+
setup: RoutineVersionSetup;
|
|
2743
|
+
}>;
|
|
2744
|
+
}
|
|
2745
|
+
interface AccountExportPersonalRecord {
|
|
2746
|
+
exerciseId: string;
|
|
2747
|
+
exerciseName: string;
|
|
2748
|
+
weightKg: number;
|
|
2749
|
+
reps: number;
|
|
2750
|
+
estimated1rmKg: number;
|
|
2751
|
+
achievedAt: IsoDateString;
|
|
2752
|
+
sessionId: string;
|
|
2753
|
+
}
|
|
2754
|
+
/**
|
|
2755
|
+
* The member's training history as recorded events: completed sessions,
|
|
2756
|
+
* records, load changes, achievements and streaks. `payload` is versioned by
|
|
2757
|
+
* `schemaVersion`.
|
|
2758
|
+
*/
|
|
2759
|
+
interface AccountExportTrainingEvent {
|
|
2760
|
+
type: string;
|
|
2761
|
+
occurredAt: IsoDateString;
|
|
2762
|
+
sessionId: string | null;
|
|
2763
|
+
schemaVersion: number;
|
|
2764
|
+
payload: unknown;
|
|
2765
|
+
}
|
|
2766
|
+
interface AccountExportGoal {
|
|
2767
|
+
type: string;
|
|
2768
|
+
direction: string;
|
|
2769
|
+
targetValue: number;
|
|
2770
|
+
exerciseId: string | null;
|
|
2771
|
+
createdAt: IsoDateString;
|
|
2772
|
+
}
|
|
2773
|
+
interface AccountExportTrainingLocation {
|
|
2774
|
+
name: string;
|
|
2775
|
+
isDefault: boolean;
|
|
2776
|
+
barWeightKg: number;
|
|
2777
|
+
availablePlatePairs: unknown;
|
|
2778
|
+
equipment: string[];
|
|
2779
|
+
}
|
|
2780
|
+
interface AccountExportScheduleOverride {
|
|
2781
|
+
routineId: string;
|
|
2782
|
+
date: string;
|
|
2783
|
+
kind: string;
|
|
2784
|
+
toDate: string | null;
|
|
2785
|
+
}
|
|
2786
|
+
interface AccountExportV1 {
|
|
2787
|
+
format: typeof ACCOUNT_EXPORT_FORMAT;
|
|
2788
|
+
formatVersion: typeof ACCOUNT_EXPORT_VERSION;
|
|
2789
|
+
exportedAt: IsoDateString;
|
|
2790
|
+
weightsAreKilograms: true;
|
|
2791
|
+
account: UserProfile;
|
|
2792
|
+
preferences: {
|
|
2793
|
+
notifications: {
|
|
2794
|
+
restAlert: boolean;
|
|
2795
|
+
trainingReminder: boolean;
|
|
2796
|
+
streakAtRisk: boolean;
|
|
2797
|
+
quietHours: {
|
|
2798
|
+
startMinute: number;
|
|
2799
|
+
endMinute: number;
|
|
2800
|
+
} | null;
|
|
2801
|
+
reminderMinuteOfDay: number | null;
|
|
2802
|
+
};
|
|
2803
|
+
timeZone: string | null;
|
|
2804
|
+
plateauMinSessions: number;
|
|
2805
|
+
activitySharingDefaults: Array<{
|
|
2806
|
+
type: string;
|
|
2807
|
+
audience: string;
|
|
2808
|
+
}>;
|
|
2809
|
+
activityEntryAudiences: Array<{
|
|
2810
|
+
entryKey: string;
|
|
2811
|
+
audience: string;
|
|
2812
|
+
}>;
|
|
2813
|
+
};
|
|
2814
|
+
routines: AccountExportRoutine[];
|
|
2815
|
+
workouts: WorkoutSession[];
|
|
2816
|
+
/** LIVE-17: every saved correction of a workout, with its before and after values. */
|
|
2817
|
+
workoutCorrections: Array<SessionCorrection & {
|
|
2818
|
+
sessionId: string;
|
|
2819
|
+
}>;
|
|
2820
|
+
personalRecords: AccountExportPersonalRecord[];
|
|
2821
|
+
trainingEvents: AccountExportTrainingEvent[];
|
|
2822
|
+
goals: AccountExportGoal[];
|
|
2823
|
+
trainingLocations: AccountExportTrainingLocation[];
|
|
2824
|
+
scheduleOverrides: AccountExportScheduleOverride[];
|
|
2825
|
+
exercises: {
|
|
2826
|
+
starred: Array<{
|
|
2827
|
+
exerciseId: string;
|
|
2828
|
+
name: string;
|
|
2829
|
+
starredAt: IsoDateString;
|
|
2830
|
+
}>;
|
|
2831
|
+
};
|
|
2832
|
+
social: {
|
|
2833
|
+
following: Array<AccountExportMember & {
|
|
2834
|
+
since: IsoDateString;
|
|
2835
|
+
}>;
|
|
2836
|
+
followers: Array<AccountExportMember & {
|
|
2837
|
+
since: IsoDateString;
|
|
2838
|
+
}>;
|
|
2839
|
+
blocked: Array<AccountExportMember & {
|
|
2840
|
+
since: IsoDateString;
|
|
2841
|
+
}>;
|
|
2842
|
+
trainingPartners: Array<{
|
|
2843
|
+
member: AccountExportMember;
|
|
2844
|
+
status: string;
|
|
2845
|
+
requestedByMe: boolean;
|
|
2846
|
+
since: IsoDateString;
|
|
2847
|
+
}>;
|
|
2848
|
+
commentsWritten: Array<{
|
|
2849
|
+
onActivityOf: AccountExportMember;
|
|
2850
|
+
entryKey: string;
|
|
2851
|
+
body: string;
|
|
2852
|
+
createdAt: IsoDateString;
|
|
2853
|
+
}>;
|
|
2854
|
+
reactionsGiven: Array<{
|
|
2855
|
+
onActivityOf: AccountExportMember;
|
|
2856
|
+
entryKey: string;
|
|
2857
|
+
reaction: string;
|
|
2858
|
+
createdAt: IsoDateString;
|
|
2859
|
+
}>;
|
|
2860
|
+
reportsFiled: Array<{
|
|
2861
|
+
subjectKind: string;
|
|
2862
|
+
reason: string;
|
|
2863
|
+
details: string | null;
|
|
2864
|
+
status: string;
|
|
2865
|
+
createdAt: IsoDateString;
|
|
2866
|
+
}>;
|
|
2867
|
+
};
|
|
2868
|
+
/** What the file deliberately does not contain, and why. */
|
|
2869
|
+
omitted: string[];
|
|
2870
|
+
}
|
|
2871
|
+
/** The file name a download of the export is saved under. */
|
|
2872
|
+
declare function accountExportFileName(username: string, exportedAt: string): string;
|
|
2873
|
+
|
|
2874
|
+
export { ACCOUNT_EXPORT_FORMAT, ACCOUNT_EXPORT_VERSION, ACHIEVEMENT_CATEGORIES, ACHIEVEMENT_DEFINITIONS, ACTIVITY_CAPS, ACTIVITY_COMMENTS_PAGE_SIZE, ACTIVITY_COMMENTS_PER_DAY_MAX, ACTIVITY_COMMENT_MAX_LENGTH, ACTIVITY_DEFAULT_AUDIENCE, ACTIVITY_ENTRY_ID_MAX_LENGTH, ACTIVITY_FEED_FOLLOWED_MAX, ACTIVITY_PAGE_DEFAULT_LIMIT, ACTIVITY_PAGE_MAX_LIMIT, ACTIVITY_PREVIEW_AUDIENCES, ACTIVITY_REACTIONS, ACTIVITY_TYPES, ACTIVITY_TYPE_SECTIONS, type AccountExportGoal, type AccountExportMember, type AccountExportPersonalRecord, type AccountExportRoutine, type AccountExportScheduleOverride, type AccountExportTrainingEvent, type AccountExportTrainingLocation, type AccountExportV1, type AchievementActivity, type AchievementCategory, type AchievementCategoryProgress, type AchievementDefinition, type AchievementNotification, type AchievementUnlockedEventPayload, type AchievementsResponse, type ActivityAudience, type ActivityCap, type ActivityComment, type ActivityCommentNotification, type ActivityCommentSummary, type ActivityCommentsQuery, type ActivityCommentsResponse, type ActivityEntry, type ActivityEntrySharing, type ActivityFeedResponse, type ActivityLink, type ActivityPage, type ActivityPageQuery, type ActivityPreviewAudience, type ActivityPreviewQuery, type ActivityReaction, type ActivityReactionSummary, type ActivitySection, type ActivitySharingSettings, type ActivityType, type AppNotification, BLOCKED_MEMBERS_MAX, type BlockedMember, type BlockedMembersResponse, type Brand, CLONE_ROUTINE_REFUSALS, COMEBACK_MIN_INACTIVE_DAYS, COMEBACK_RECOGNITION_LIMIT, COMEBACK_REQUIRED_ACTIVE_DAYS, COMEBACK_SESSION_LOOKBACK, COMEBACK_WINDOW_DAYS, type CalendarDate, type CloneRoutineRefusal, type CloneRoutineRequest, type ComebackActivity, type ComebackRecognition, type ComebackRecognitionSummary, type CorrectSessionRequest, type CorrectSessionResponse, type CorrectSessionSetRequest, type CreateActivityCommentRequest, type CreateActivityCommentResponse, type CreateReportRequest, type CreateReportResponse, type CreateRoutineDayInput, type CreateRoutineExerciseInput, type CreateRoutineRequest, type CreateRoutineVersionRequest, type CreateSessionShareRequest, type DeleteAccountRequest, type DeleteAccountResponse, type DeleteActivityCommentResponse, type DeletePushSubscriptionRequest, type DiscoverableRoutine, 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, FEATURED_PROFILE_ITEMS_MAX, FEATURED_PROFILE_ITEM_KINDS, FEATURED_PROFILE_REFERENCE_MAX_LENGTH, FOLLOW_SUGGESTIONS_DEFAULT_LIMIT, FOLLOW_SUGGESTIONS_MAX_LIMIT, FOLLOW_SUGGESTION_REASONS, type FeaturedProfileAchievementItem, type FeaturedProfileItem, type FeaturedProfileItemKind, type FeaturedProfileRankItem, type FeaturedProfileRecordItem, type FeaturedProfileRoutineItem, type FeaturedProfileSelection, type FeaturedProfileSelectionInput, type FeaturedProfileSelectionsResponse, 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, MINUTES_IN_DAY, MODERATION_ACTION_KINDS, MODERATION_HISTORY_PAGE_SIZE, MODERATION_NOTE_MAX_LENGTH, MODERATION_QUEUE_PAGE_SIZE, MOVEMENT_PATTERNS, MUSCLE_GROUPS, type MarkNotificationsReadRequest, type MarkNotificationsReadResponse, type MeasurableGoal, type MeasurableGoalDirection, type MeasurableGoalExercise, type MeasurableGoalInput, type MeasurableGoalType, type MemberActivityResponse, type MemberModerationState, type MemberRoutinesResponse, type ModerationActionKind, type ModerationActionRecord, type ModerationHistoryQuery, type ModerationHistoryResponse, type ModerationQueueQuery, type ModerationQueueResponse, type ModerationReport, type ModeratorState, type MoveOccurrenceRequest, type MovementPattern, type MuscleGroup, type MuscleGroupHeatmapQuery, type MuscleGroupHeatmapResponse, type MuscleGroupHeatmapValue, type MuscleGroupHeatmapWeek, type MuscleVolumeTrendSeries, NOTIFICATIONS_LIST_LIMIT, NOTIFICATIONS_LOOKBACK_DAYS, NOTIFICATIONS_RETENTION_DAYS, NOTIFICATION_CATEGORIES, NOTIFICATION_KINDS, type NewFollowerNotification, type NotificationCategory, type NotificationKind, type NotificationPreferences, type NotificationPreferencesResponse, type NotificationsResponse, type OwnActivityEntry, type OwnActivityResponse, 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, PUSH_PAYLOAD_KINDS, PUSH_SUBSCRIPTIONS_MAX, type PaginatedResponse, type PersonalGoalProgress, type PersonalGoalsResponse, type PersonalRecordActivity, type PersonalRecordEntry, type PersonalRecordKind, type PlannedReminder, 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 ProgressionActivity, type ProgressionChange, type ProgressionRule, type ProgressionScheme, type ProgressionSetChange, type PublicBodyMetrics, type PublicProfileAchievements, type PublicTrainingSummary, type PublicUserProfile, type PushPayload, type PushPayloadKind, type PushSubscriptionKeys, type PushSubscriptionSummary, type PushSubscriptionsResponse, type QuietHours, RELATIONSHIP_LIST_DEFAULT_LIMIT, RELATIONSHIP_LIST_KINDS, RELATIONSHIP_LIST_MAX_LIMIT, RENAISSANCE_RANK_DEFINITIONS, REPORTS_PER_DAY_MAX, REPORT_DETAILS_MAX_LENGTH, REPORT_REASONS, REPORT_STATUSES, REPORT_SUBJECT_KINDS, REP_TYPES, RESERVED_USERNAMES, REST_ALERT_MAX_LEAD_SECONDS, REST_ALERT_MIN_LEAD_SECONDS, REST_ALERT_REFUSALS, ROUTINE_DAYS_MAX, ROUTINE_DAY_NAME_MAX, ROUTINE_DISCOVERY_DEFAULT_LIMIT, ROUTINE_DISCOVERY_MAX_LIMIT, ROUTINE_DISCOVERY_SCAN_LIMIT, ROUTINE_DURATION_BANDS, ROUTINE_DURATION_BAND_MAX_MINUTES, ROUTINE_SCHEDULE_MODES, ROUTINE_SHARE_MAX_ACTIVE_LINKS, ROUTINE_TRAINING_BLOCKS_MAX, ROUTINE_TRAINING_BLOCK_NAME_MAX, ROUTINE_TRAINING_BLOCK_REVISIONS_MAX, ROUTINE_TRAINING_BLOCK_SOURCE_KINDS, ROUTINE_TRAINING_BLOCK_STATES, ROUTINE_VERSIONS_MAX, ROUTINE_VERSION_KINDS, ROUTINE_VERSION_NAME_MAX, ROUTINE_VISIBILITY_VALUES, type RecentActivityEntry, type RegisterPushSubscriptionRequest, type RelationshipListKind, type RelationshipListQuery, type RelationshipListResponse, type RelationshipMember, type RenaissanceRankDefinition, type RenaissanceRankProgress, type RepType, type ReplaceFeaturedProfileItemsRequest, type ReplaceMeasurableGoalsRequest, type ReplaceTrainingLocationsRequest, type ReportReason, type ReportStatus, type ReportSubjectKind, type ReportSubjectPreview, type RestAlertPushPayload, type RestAlertRefusal, type RestoreRoutineVersionResponse, type ReviewReportRequest, type ReviewReportResponse, type Routine, type RoutineClassification, type RoutineDay, type RoutineDayId, type RoutineDiscoveryQuery, type RoutineDiscoveryResponse, type RoutineDurationBand, type RoutineExercise, type RoutineFacets, type RoutineId, type RoutineLineage, type RoutineScheduleMode, type RoutineSet, type RoutineShare, type RoutineShareListResponse, type RoutineSharedActivity, type RoutineTrainingBlock, type RoutineTrainingBlockRevision, type RoutineTrainingBlockRevisionsResponse, type RoutineTrainingBlockSource, type RoutineTrainingBlockSourceKind, type RoutineTrainingBlockState, type RoutineTrainingBlocksResponse, type RoutineVersion, type RoutineVersionDay, type RoutineVersionExercise, type RoutineVersionKind, type RoutineVersionSetup, type RoutineVersionsResponse, type RoutineVisibility, SCHEDULE_MOVE_MAX_DAYS, SCHEDULE_OVERRIDES_MAX_RANGE_DAYS, SCHEDULE_OVERRIDE_KINDS, SCHEDULE_SKIP_PAST_DAYS, SESSION_CORRECTIONS_MAX, SESSION_CORRECTION_LIMITS, SESSION_CORRECTION_WINDOW_HOURS, SESSION_SHARE_DEFAULT_FIELDS, SESSION_SHARE_FIELDS, SESSION_SHARE_MAX_ACTIVE_LINKS, SEXES, SHARED_ROUTINE_SOURCES, STARRED_EXERCISES_MAX, STREAK_MAX_GAP_DAYS, type ScheduleOverride, type ScheduleOverrideKind, type ScheduleOverridesQuery, type ScheduleOverridesResponse, type ScheduleRestAlertRequest, type ScheduleRestAlertResponse, type SendTrainingPartnerEncouragementRequest, type SendTrainingPartnerEncouragementResponse, type SessionComparisonExercise, type SessionComparisonQuery, type SessionComparisonResponse, type SessionComparisonRoutineDay, type SessionComparisonSession, type SessionComparisonSet, type SessionCompletedActivity, type SessionCorrection, type SessionCorrectionClosedReason, type SessionCorrectionWindow, type SessionCorrectionsResponse, type SessionExerciseSubstitution, type SessionProgressNotification, type SessionRecapRecord, type SessionSetCorrection, type SessionShare, type SessionShareField, type SessionShareListResponse, type SetAccountTimeZoneRequest, type SetActivityEntryAudienceRequest, type SetActivityEntryAudienceResponse, type SetActivityReactionRequest, type SetActivityReactionResponse, type SetLog, type SetLogValues, type Sex, type SharedRoutine, type SharedRoutineOwner, type SharedRoutineSource, type SharedRoutineSummary, type SharedSessionOwner, type SharedSessionRecap, type SkipOccurrenceRequest, type StarredExercise, type StarredExercisesResponse, type StartWorkoutRequest, type StartWorkoutResponse, type StreakAtRiskPushPayload, type StreakMilestoneActivity, 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, TRAINING_PARTNERSHIP_STATUSES, TRAINING_PARTNERS_MAX, TRAINING_PARTNER_ENCOURAGEMENTS_PER_24_HOURS_MAX, TRAINING_PARTNER_ENCOURAGEMENT_KINDS, TRAINING_PARTNER_PERMISSION_KEYS, TRAINING_PARTNER_REQUESTS_PER_DAY_MAX, type TrainingDiscipline, type TrainingEventType, type TrainingExperienceLevel, type TrainingGoal, type TrainingIdentity, type TrainingLocationPreference, type TrainingLocationPreferenceInput, type TrainingPartnerEncouragementKind, type TrainingPartnerEncouragementNotification, type TrainingPartnerPermissions, type TrainingPartnerScheduleDay, type TrainingPartnerScheduleResponse, type TrainingPartnership, type TrainingPartnershipStatus, type TrainingPartnershipsResponse, type TrainingReminderPreference, type TrainingReminderPushPayload, USERNAME_MAX_LENGTH, USERNAME_MIN_LENGTH, USERNAME_PATTERN_SOURCE, type UpdateActivitySharingRequest, type UpdateNotificationPreferencesRequest, type UpdateProfileDiscoveryRequest, type UpdateProfilePrivacyRequest, type UpdateProfileRequest, type UpdateRoutineRequest, type UpdateRoutineVisibilityRequest, type UpdateTrainingPartnerPermissionsRequest, type UpsertRoutineTrainingBlockRequest, 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, accountExportFileName, isWithinQuietHours, matchesDeletionConfirmation, routineDayLabel, sessionCorrectionWindow, setLogValuesDiffer };
|
package/dist/index.d.ts
CHANGED
|
@@ -2226,6 +2226,109 @@ interface DeleteActivityCommentResponse {
|
|
|
2226
2226
|
summary: ActivityCommentSummary;
|
|
2227
2227
|
}
|
|
2228
2228
|
|
|
2229
|
+
/**
|
|
2230
|
+
* LIVE-17. Correcting a finished workout: the owner fixes a mistyped weight,
|
|
2231
|
+
* reps or RPE, or a set left unticked, and everything the workout fed --
|
|
2232
|
+
* records, totals, achievements, its own load changes and the activity built
|
|
2233
|
+
* from them -- is re-derived from the corrected sets.
|
|
2234
|
+
*
|
|
2235
|
+
* Only the most recent completed workout can be corrected, for a bounded time
|
|
2236
|
+
* and until another workout starts, because the next workout is built on this
|
|
2237
|
+
* one: its "last time", the loads it prescribes and the records it is measured
|
|
2238
|
+
* against. Every saved correction is kept, with the values before and after.
|
|
2239
|
+
*/
|
|
2240
|
+
/** How long after finishing a workout it can still be corrected. */
|
|
2241
|
+
declare const SESSION_CORRECTION_WINDOW_HOURS = 48;
|
|
2242
|
+
/** Saved corrections per workout, so the trail stays readable. */
|
|
2243
|
+
declare const SESSION_CORRECTIONS_MAX = 10;
|
|
2244
|
+
/**
|
|
2245
|
+
* Bounds a corrected value must respect. Weight is kilograms. The live logging
|
|
2246
|
+
* path is looser; a correction exists to replace an implausible value, so it
|
|
2247
|
+
* does not accept one.
|
|
2248
|
+
*/
|
|
2249
|
+
declare const SESSION_CORRECTION_LIMITS: {
|
|
2250
|
+
readonly weightKgMax: 1500;
|
|
2251
|
+
readonly repsMax: 1000;
|
|
2252
|
+
readonly rpeMin: 0;
|
|
2253
|
+
readonly rpeMax: 10;
|
|
2254
|
+
};
|
|
2255
|
+
/** The four things a correction can change on one logged set. */
|
|
2256
|
+
interface SetLogValues {
|
|
2257
|
+
weight: number | null;
|
|
2258
|
+
reps: number | null;
|
|
2259
|
+
rpe: number | null;
|
|
2260
|
+
isCompleted: boolean;
|
|
2261
|
+
}
|
|
2262
|
+
/** One changed set, as it was and as it became. */
|
|
2263
|
+
interface SessionSetCorrection {
|
|
2264
|
+
setLogId: string;
|
|
2265
|
+
exerciseId: string;
|
|
2266
|
+
/** As named when the correction was saved. */
|
|
2267
|
+
exerciseName: string;
|
|
2268
|
+
setNumber: number;
|
|
2269
|
+
before: SetLogValues;
|
|
2270
|
+
after: SetLogValues;
|
|
2271
|
+
}
|
|
2272
|
+
/** One saved correction. Never edited or deleted once written. */
|
|
2273
|
+
interface SessionCorrection {
|
|
2274
|
+
id: string;
|
|
2275
|
+
createdAt: IsoDateString;
|
|
2276
|
+
changes: SessionSetCorrection[];
|
|
2277
|
+
}
|
|
2278
|
+
type SessionCorrectionClosedReason = "NOT_COMPLETED" | "NOT_LATEST" | "LATER_SESSION" | "WINDOW_PASSED" | "LIMIT_REACHED";
|
|
2279
|
+
/**
|
|
2280
|
+
* Whether the workout can be corrected now. `correctableUntil` is set only
|
|
2281
|
+
* while it can; `closedReason` says why it cannot.
|
|
2282
|
+
*/
|
|
2283
|
+
interface SessionCorrectionWindow {
|
|
2284
|
+
correctableUntil: IsoDateString | null;
|
|
2285
|
+
closedReason: SessionCorrectionClosedReason | null;
|
|
2286
|
+
}
|
|
2287
|
+
/** GET /workouts/sessions/:id/corrections */
|
|
2288
|
+
interface SessionCorrectionsResponse {
|
|
2289
|
+
window: SessionCorrectionWindow;
|
|
2290
|
+
/** Oldest first. */
|
|
2291
|
+
corrections: SessionCorrection[];
|
|
2292
|
+
}
|
|
2293
|
+
interface CorrectSessionSetRequest extends SetLogValues {
|
|
2294
|
+
setLogId: string;
|
|
2295
|
+
}
|
|
2296
|
+
/**
|
|
2297
|
+
* POST /workouts/sessions/:id/corrections. Each set carries all four values
|
|
2298
|
+
* as they should now read; sets that end up unchanged are ignored, and a
|
|
2299
|
+
* request that changes nothing is refused.
|
|
2300
|
+
*/
|
|
2301
|
+
interface CorrectSessionRequest {
|
|
2302
|
+
sets: CorrectSessionSetRequest[];
|
|
2303
|
+
}
|
|
2304
|
+
interface CorrectSessionResponse {
|
|
2305
|
+
correction: SessionCorrection;
|
|
2306
|
+
window: SessionCorrectionWindow;
|
|
2307
|
+
/**
|
|
2308
|
+
* Exercises whose load change from this workout was left as it is, because
|
|
2309
|
+
* the routine was edited after the workout and re-deriving it would undo
|
|
2310
|
+
* that edit.
|
|
2311
|
+
*/
|
|
2312
|
+
progressionKept: Array<{
|
|
2313
|
+
exerciseId: string;
|
|
2314
|
+
exerciseName: string;
|
|
2315
|
+
}>;
|
|
2316
|
+
}
|
|
2317
|
+
/**
|
|
2318
|
+
* The window rule, shared so the server and the page state it the same way.
|
|
2319
|
+
* `isLatest` means no other completed workout ended later; `laterSessionStarted`
|
|
2320
|
+
* means any workout started after this one ended.
|
|
2321
|
+
*/
|
|
2322
|
+
declare function sessionCorrectionWindow(input: {
|
|
2323
|
+
status: string;
|
|
2324
|
+
endedAt: IsoDateString | Date | null | undefined;
|
|
2325
|
+
isLatest: boolean;
|
|
2326
|
+
laterSessionStarted: boolean;
|
|
2327
|
+
correctionCount: number;
|
|
2328
|
+
}, now?: Date): SessionCorrectionWindow;
|
|
2329
|
+
/** Whether two sets of values differ in anything a correction records. */
|
|
2330
|
+
declare function setLogValuesDiffer(a: SetLogValues, b: SetLogValues): boolean;
|
|
2331
|
+
|
|
2229
2332
|
/** SOC-08: one explicit grant from a member to their active training partner. */
|
|
2230
2333
|
interface TrainingPartnerPermissions {
|
|
2231
2334
|
schedule: boolean;
|
|
@@ -2604,4 +2707,168 @@ interface DeleteAccountResponse {
|
|
|
2604
2707
|
*/
|
|
2605
2708
|
declare function matchesDeletionConfirmation(typed: string, username: string): boolean;
|
|
2606
2709
|
|
|
2607
|
-
export { ACHIEVEMENT_CATEGORIES, ACHIEVEMENT_DEFINITIONS, ACTIVITY_CAPS, ACTIVITY_COMMENTS_PAGE_SIZE, ACTIVITY_COMMENTS_PER_DAY_MAX, ACTIVITY_COMMENT_MAX_LENGTH, ACTIVITY_DEFAULT_AUDIENCE, ACTIVITY_ENTRY_ID_MAX_LENGTH, ACTIVITY_FEED_FOLLOWED_MAX, ACTIVITY_PAGE_DEFAULT_LIMIT, ACTIVITY_PAGE_MAX_LIMIT, ACTIVITY_PREVIEW_AUDIENCES, ACTIVITY_REACTIONS, ACTIVITY_TYPES, ACTIVITY_TYPE_SECTIONS, type AchievementActivity, type AchievementCategory, type AchievementCategoryProgress, type AchievementDefinition, type AchievementNotification, type AchievementUnlockedEventPayload, type AchievementsResponse, type ActivityAudience, type ActivityCap, type ActivityComment, type ActivityCommentNotification, type ActivityCommentSummary, type ActivityCommentsQuery, type ActivityCommentsResponse, type ActivityEntry, type ActivityEntrySharing, type ActivityFeedResponse, type ActivityLink, type ActivityPage, type ActivityPageQuery, type ActivityPreviewAudience, type ActivityPreviewQuery, type ActivityReaction, type ActivityReactionSummary, type ActivitySection, type ActivitySharingSettings, type ActivityType, type AppNotification, BLOCKED_MEMBERS_MAX, type BlockedMember, type BlockedMembersResponse, type Brand, CLONE_ROUTINE_REFUSALS, COMEBACK_MIN_INACTIVE_DAYS, COMEBACK_RECOGNITION_LIMIT, COMEBACK_REQUIRED_ACTIVE_DAYS, COMEBACK_SESSION_LOOKBACK, COMEBACK_WINDOW_DAYS, type CalendarDate, type CloneRoutineRefusal, type CloneRoutineRequest, type ComebackActivity, type ComebackRecognition, type ComebackRecognitionSummary, type CreateActivityCommentRequest, type CreateActivityCommentResponse, type CreateReportRequest, type CreateReportResponse, type CreateRoutineDayInput, type CreateRoutineExerciseInput, type CreateRoutineRequest, type CreateRoutineVersionRequest, type CreateSessionShareRequest, type DeleteAccountRequest, type DeleteAccountResponse, type DeleteActivityCommentResponse, type DeletePushSubscriptionRequest, type DiscoverableRoutine, 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, FEATURED_PROFILE_ITEMS_MAX, FEATURED_PROFILE_ITEM_KINDS, FEATURED_PROFILE_REFERENCE_MAX_LENGTH, FOLLOW_SUGGESTIONS_DEFAULT_LIMIT, FOLLOW_SUGGESTIONS_MAX_LIMIT, FOLLOW_SUGGESTION_REASONS, type FeaturedProfileAchievementItem, type FeaturedProfileItem, type FeaturedProfileItemKind, type FeaturedProfileRankItem, type FeaturedProfileRecordItem, type FeaturedProfileRoutineItem, type FeaturedProfileSelection, type FeaturedProfileSelectionInput, type FeaturedProfileSelectionsResponse, 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, MINUTES_IN_DAY, MODERATION_ACTION_KINDS, MODERATION_HISTORY_PAGE_SIZE, MODERATION_NOTE_MAX_LENGTH, MODERATION_QUEUE_PAGE_SIZE, MOVEMENT_PATTERNS, MUSCLE_GROUPS, type MarkNotificationsReadRequest, type MarkNotificationsReadResponse, type MeasurableGoal, type MeasurableGoalDirection, type MeasurableGoalExercise, type MeasurableGoalInput, type MeasurableGoalType, type MemberActivityResponse, type MemberModerationState, type MemberRoutinesResponse, type ModerationActionKind, type ModerationActionRecord, type ModerationHistoryQuery, type ModerationHistoryResponse, type ModerationQueueQuery, type ModerationQueueResponse, type ModerationReport, type ModeratorState, type MoveOccurrenceRequest, type MovementPattern, type MuscleGroup, type MuscleGroupHeatmapQuery, type MuscleGroupHeatmapResponse, type MuscleGroupHeatmapValue, type MuscleGroupHeatmapWeek, type MuscleVolumeTrendSeries, NOTIFICATIONS_LIST_LIMIT, NOTIFICATIONS_LOOKBACK_DAYS, NOTIFICATIONS_RETENTION_DAYS, NOTIFICATION_CATEGORIES, NOTIFICATION_KINDS, type NewFollowerNotification, type NotificationCategory, type NotificationKind, type NotificationPreferences, type NotificationPreferencesResponse, type NotificationsResponse, type OwnActivityEntry, type OwnActivityResponse, 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, PUSH_PAYLOAD_KINDS, PUSH_SUBSCRIPTIONS_MAX, type PaginatedResponse, type PersonalGoalProgress, type PersonalGoalsResponse, type PersonalRecordActivity, type PersonalRecordEntry, type PersonalRecordKind, type PlannedReminder, 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 ProgressionActivity, type ProgressionChange, type ProgressionRule, type ProgressionScheme, type ProgressionSetChange, type PublicBodyMetrics, type PublicProfileAchievements, type PublicTrainingSummary, type PublicUserProfile, type PushPayload, type PushPayloadKind, type PushSubscriptionKeys, type PushSubscriptionSummary, type PushSubscriptionsResponse, type QuietHours, RELATIONSHIP_LIST_DEFAULT_LIMIT, RELATIONSHIP_LIST_KINDS, RELATIONSHIP_LIST_MAX_LIMIT, RENAISSANCE_RANK_DEFINITIONS, REPORTS_PER_DAY_MAX, REPORT_DETAILS_MAX_LENGTH, REPORT_REASONS, REPORT_STATUSES, REPORT_SUBJECT_KINDS, REP_TYPES, RESERVED_USERNAMES, REST_ALERT_MAX_LEAD_SECONDS, REST_ALERT_MIN_LEAD_SECONDS, REST_ALERT_REFUSALS, ROUTINE_DAYS_MAX, ROUTINE_DAY_NAME_MAX, ROUTINE_DISCOVERY_DEFAULT_LIMIT, ROUTINE_DISCOVERY_MAX_LIMIT, ROUTINE_DISCOVERY_SCAN_LIMIT, ROUTINE_DURATION_BANDS, ROUTINE_DURATION_BAND_MAX_MINUTES, ROUTINE_SCHEDULE_MODES, ROUTINE_SHARE_MAX_ACTIVE_LINKS, ROUTINE_TRAINING_BLOCKS_MAX, ROUTINE_TRAINING_BLOCK_NAME_MAX, ROUTINE_TRAINING_BLOCK_REVISIONS_MAX, ROUTINE_TRAINING_BLOCK_SOURCE_KINDS, ROUTINE_TRAINING_BLOCK_STATES, ROUTINE_VERSIONS_MAX, ROUTINE_VERSION_KINDS, ROUTINE_VERSION_NAME_MAX, ROUTINE_VISIBILITY_VALUES, type RecentActivityEntry, type RegisterPushSubscriptionRequest, type RelationshipListKind, type RelationshipListQuery, type RelationshipListResponse, type RelationshipMember, type RenaissanceRankDefinition, type RenaissanceRankProgress, type RepType, type ReplaceFeaturedProfileItemsRequest, type ReplaceMeasurableGoalsRequest, type ReplaceTrainingLocationsRequest, type ReportReason, type ReportStatus, type ReportSubjectKind, type ReportSubjectPreview, type RestAlertPushPayload, type RestAlertRefusal, type RestoreRoutineVersionResponse, type ReviewReportRequest, type ReviewReportResponse, type Routine, type RoutineClassification, type RoutineDay, type RoutineDayId, type RoutineDiscoveryQuery, type RoutineDiscoveryResponse, type RoutineDurationBand, type RoutineExercise, type RoutineFacets, type RoutineId, type RoutineLineage, type RoutineScheduleMode, type RoutineSet, type RoutineShare, type RoutineShareListResponse, type RoutineSharedActivity, type RoutineTrainingBlock, type RoutineTrainingBlockRevision, type RoutineTrainingBlockRevisionsResponse, type RoutineTrainingBlockSource, type RoutineTrainingBlockSourceKind, type RoutineTrainingBlockState, type RoutineTrainingBlocksResponse, type RoutineVersion, type RoutineVersionDay, type RoutineVersionExercise, type RoutineVersionKind, type RoutineVersionSetup, type RoutineVersionsResponse, type RoutineVisibility, SCHEDULE_MOVE_MAX_DAYS, SCHEDULE_OVERRIDES_MAX_RANGE_DAYS, SCHEDULE_OVERRIDE_KINDS, SCHEDULE_SKIP_PAST_DAYS, SESSION_SHARE_DEFAULT_FIELDS, SESSION_SHARE_FIELDS, SESSION_SHARE_MAX_ACTIVE_LINKS, SEXES, SHARED_ROUTINE_SOURCES, STARRED_EXERCISES_MAX, STREAK_MAX_GAP_DAYS, type ScheduleOverride, type ScheduleOverrideKind, type ScheduleOverridesQuery, type ScheduleOverridesResponse, type ScheduleRestAlertRequest, type ScheduleRestAlertResponse, type SendTrainingPartnerEncouragementRequest, type SendTrainingPartnerEncouragementResponse, type SessionComparisonExercise, type SessionComparisonQuery, type SessionComparisonResponse, type SessionComparisonRoutineDay, type SessionComparisonSession, type SessionComparisonSet, type SessionCompletedActivity, type SessionExerciseSubstitution, type SessionProgressNotification, type SessionRecapRecord, type SessionShare, type SessionShareField, type SessionShareListResponse, type SetAccountTimeZoneRequest, type SetActivityEntryAudienceRequest, type SetActivityEntryAudienceResponse, type SetActivityReactionRequest, type SetActivityReactionResponse, type SetLog, type Sex, type SharedRoutine, type SharedRoutineOwner, type SharedRoutineSource, type SharedRoutineSummary, type SharedSessionOwner, type SharedSessionRecap, type SkipOccurrenceRequest, type StarredExercise, type StarredExercisesResponse, type StartWorkoutRequest, type StartWorkoutResponse, type StreakAtRiskPushPayload, type StreakMilestoneActivity, 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, TRAINING_PARTNERSHIP_STATUSES, TRAINING_PARTNERS_MAX, TRAINING_PARTNER_ENCOURAGEMENTS_PER_24_HOURS_MAX, TRAINING_PARTNER_ENCOURAGEMENT_KINDS, TRAINING_PARTNER_PERMISSION_KEYS, TRAINING_PARTNER_REQUESTS_PER_DAY_MAX, type TrainingDiscipline, type TrainingEventType, type TrainingExperienceLevel, type TrainingGoal, type TrainingIdentity, type TrainingLocationPreference, type TrainingLocationPreferenceInput, type TrainingPartnerEncouragementKind, type TrainingPartnerEncouragementNotification, type TrainingPartnerPermissions, type TrainingPartnerScheduleDay, type TrainingPartnerScheduleResponse, type TrainingPartnership, type TrainingPartnershipStatus, type TrainingPartnershipsResponse, type TrainingReminderPreference, type TrainingReminderPushPayload, USERNAME_MAX_LENGTH, USERNAME_MIN_LENGTH, USERNAME_PATTERN_SOURCE, type UpdateActivitySharingRequest, type UpdateNotificationPreferencesRequest, type UpdateProfileDiscoveryRequest, type UpdateProfilePrivacyRequest, type UpdateProfileRequest, type UpdateRoutineRequest, type UpdateRoutineVisibilityRequest, type UpdateTrainingPartnerPermissionsRequest, type UpsertRoutineTrainingBlockRequest, 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, isWithinQuietHours, matchesDeletionConfirmation, routineDayLabel };
|
|
2710
|
+
/**
|
|
2711
|
+
* EXPORT-01. Everything a member put into Sunnsteel, in one JSON document they
|
|
2712
|
+
* can keep, read or take elsewhere.
|
|
2713
|
+
*
|
|
2714
|
+
* Stability is the point. `format` and `formatVersion` identify the document;
|
|
2715
|
+
* a field is only ever added within a version, and anything that changes the
|
|
2716
|
+
* meaning of an existing field is a new version. Sections reuse the shapes the
|
|
2717
|
+
* app itself serves (`UserProfile`, `Routine`, `WorkoutSession`), so the file
|
|
2718
|
+
* says what the member saw.
|
|
2719
|
+
*
|
|
2720
|
+
* **Every weight is kilograms**, whatever unit the account displays -- that is
|
|
2721
|
+
* how Sunnsteel stores them. `account.weightUnit` is the display preference.
|
|
2722
|
+
*
|
|
2723
|
+
* Left out on purpose, and stated in `omitted`: other members' data (people
|
|
2724
|
+
* appear by username only, never email), credentials (share-link tokens,
|
|
2725
|
+
* push-device endpoints), and anything derived from what is exported
|
|
2726
|
+
* (analytics rollups, the notification feed).
|
|
2727
|
+
*/
|
|
2728
|
+
declare const ACCOUNT_EXPORT_FORMAT: "sunnsteel-account-export";
|
|
2729
|
+
declare const ACCOUNT_EXPORT_VERSION: 1;
|
|
2730
|
+
/** Another member, as the export names them: never by email. */
|
|
2731
|
+
interface AccountExportMember {
|
|
2732
|
+
username: string;
|
|
2733
|
+
name: string;
|
|
2734
|
+
}
|
|
2735
|
+
interface AccountExportRoutine {
|
|
2736
|
+
routine: Routine;
|
|
2737
|
+
versions: Array<{
|
|
2738
|
+
number: number;
|
|
2739
|
+
name: string | null;
|
|
2740
|
+
kind: string;
|
|
2741
|
+
createdAt: IsoDateString;
|
|
2742
|
+
setup: RoutineVersionSetup;
|
|
2743
|
+
}>;
|
|
2744
|
+
}
|
|
2745
|
+
interface AccountExportPersonalRecord {
|
|
2746
|
+
exerciseId: string;
|
|
2747
|
+
exerciseName: string;
|
|
2748
|
+
weightKg: number;
|
|
2749
|
+
reps: number;
|
|
2750
|
+
estimated1rmKg: number;
|
|
2751
|
+
achievedAt: IsoDateString;
|
|
2752
|
+
sessionId: string;
|
|
2753
|
+
}
|
|
2754
|
+
/**
|
|
2755
|
+
* The member's training history as recorded events: completed sessions,
|
|
2756
|
+
* records, load changes, achievements and streaks. `payload` is versioned by
|
|
2757
|
+
* `schemaVersion`.
|
|
2758
|
+
*/
|
|
2759
|
+
interface AccountExportTrainingEvent {
|
|
2760
|
+
type: string;
|
|
2761
|
+
occurredAt: IsoDateString;
|
|
2762
|
+
sessionId: string | null;
|
|
2763
|
+
schemaVersion: number;
|
|
2764
|
+
payload: unknown;
|
|
2765
|
+
}
|
|
2766
|
+
interface AccountExportGoal {
|
|
2767
|
+
type: string;
|
|
2768
|
+
direction: string;
|
|
2769
|
+
targetValue: number;
|
|
2770
|
+
exerciseId: string | null;
|
|
2771
|
+
createdAt: IsoDateString;
|
|
2772
|
+
}
|
|
2773
|
+
interface AccountExportTrainingLocation {
|
|
2774
|
+
name: string;
|
|
2775
|
+
isDefault: boolean;
|
|
2776
|
+
barWeightKg: number;
|
|
2777
|
+
availablePlatePairs: unknown;
|
|
2778
|
+
equipment: string[];
|
|
2779
|
+
}
|
|
2780
|
+
interface AccountExportScheduleOverride {
|
|
2781
|
+
routineId: string;
|
|
2782
|
+
date: string;
|
|
2783
|
+
kind: string;
|
|
2784
|
+
toDate: string | null;
|
|
2785
|
+
}
|
|
2786
|
+
interface AccountExportV1 {
|
|
2787
|
+
format: typeof ACCOUNT_EXPORT_FORMAT;
|
|
2788
|
+
formatVersion: typeof ACCOUNT_EXPORT_VERSION;
|
|
2789
|
+
exportedAt: IsoDateString;
|
|
2790
|
+
weightsAreKilograms: true;
|
|
2791
|
+
account: UserProfile;
|
|
2792
|
+
preferences: {
|
|
2793
|
+
notifications: {
|
|
2794
|
+
restAlert: boolean;
|
|
2795
|
+
trainingReminder: boolean;
|
|
2796
|
+
streakAtRisk: boolean;
|
|
2797
|
+
quietHours: {
|
|
2798
|
+
startMinute: number;
|
|
2799
|
+
endMinute: number;
|
|
2800
|
+
} | null;
|
|
2801
|
+
reminderMinuteOfDay: number | null;
|
|
2802
|
+
};
|
|
2803
|
+
timeZone: string | null;
|
|
2804
|
+
plateauMinSessions: number;
|
|
2805
|
+
activitySharingDefaults: Array<{
|
|
2806
|
+
type: string;
|
|
2807
|
+
audience: string;
|
|
2808
|
+
}>;
|
|
2809
|
+
activityEntryAudiences: Array<{
|
|
2810
|
+
entryKey: string;
|
|
2811
|
+
audience: string;
|
|
2812
|
+
}>;
|
|
2813
|
+
};
|
|
2814
|
+
routines: AccountExportRoutine[];
|
|
2815
|
+
workouts: WorkoutSession[];
|
|
2816
|
+
/** LIVE-17: every saved correction of a workout, with its before and after values. */
|
|
2817
|
+
workoutCorrections: Array<SessionCorrection & {
|
|
2818
|
+
sessionId: string;
|
|
2819
|
+
}>;
|
|
2820
|
+
personalRecords: AccountExportPersonalRecord[];
|
|
2821
|
+
trainingEvents: AccountExportTrainingEvent[];
|
|
2822
|
+
goals: AccountExportGoal[];
|
|
2823
|
+
trainingLocations: AccountExportTrainingLocation[];
|
|
2824
|
+
scheduleOverrides: AccountExportScheduleOverride[];
|
|
2825
|
+
exercises: {
|
|
2826
|
+
starred: Array<{
|
|
2827
|
+
exerciseId: string;
|
|
2828
|
+
name: string;
|
|
2829
|
+
starredAt: IsoDateString;
|
|
2830
|
+
}>;
|
|
2831
|
+
};
|
|
2832
|
+
social: {
|
|
2833
|
+
following: Array<AccountExportMember & {
|
|
2834
|
+
since: IsoDateString;
|
|
2835
|
+
}>;
|
|
2836
|
+
followers: Array<AccountExportMember & {
|
|
2837
|
+
since: IsoDateString;
|
|
2838
|
+
}>;
|
|
2839
|
+
blocked: Array<AccountExportMember & {
|
|
2840
|
+
since: IsoDateString;
|
|
2841
|
+
}>;
|
|
2842
|
+
trainingPartners: Array<{
|
|
2843
|
+
member: AccountExportMember;
|
|
2844
|
+
status: string;
|
|
2845
|
+
requestedByMe: boolean;
|
|
2846
|
+
since: IsoDateString;
|
|
2847
|
+
}>;
|
|
2848
|
+
commentsWritten: Array<{
|
|
2849
|
+
onActivityOf: AccountExportMember;
|
|
2850
|
+
entryKey: string;
|
|
2851
|
+
body: string;
|
|
2852
|
+
createdAt: IsoDateString;
|
|
2853
|
+
}>;
|
|
2854
|
+
reactionsGiven: Array<{
|
|
2855
|
+
onActivityOf: AccountExportMember;
|
|
2856
|
+
entryKey: string;
|
|
2857
|
+
reaction: string;
|
|
2858
|
+
createdAt: IsoDateString;
|
|
2859
|
+
}>;
|
|
2860
|
+
reportsFiled: Array<{
|
|
2861
|
+
subjectKind: string;
|
|
2862
|
+
reason: string;
|
|
2863
|
+
details: string | null;
|
|
2864
|
+
status: string;
|
|
2865
|
+
createdAt: IsoDateString;
|
|
2866
|
+
}>;
|
|
2867
|
+
};
|
|
2868
|
+
/** What the file deliberately does not contain, and why. */
|
|
2869
|
+
omitted: string[];
|
|
2870
|
+
}
|
|
2871
|
+
/** The file name a download of the export is saved under. */
|
|
2872
|
+
declare function accountExportFileName(username: string, exportedAt: string): string;
|
|
2873
|
+
|
|
2874
|
+
export { ACCOUNT_EXPORT_FORMAT, ACCOUNT_EXPORT_VERSION, ACHIEVEMENT_CATEGORIES, ACHIEVEMENT_DEFINITIONS, ACTIVITY_CAPS, ACTIVITY_COMMENTS_PAGE_SIZE, ACTIVITY_COMMENTS_PER_DAY_MAX, ACTIVITY_COMMENT_MAX_LENGTH, ACTIVITY_DEFAULT_AUDIENCE, ACTIVITY_ENTRY_ID_MAX_LENGTH, ACTIVITY_FEED_FOLLOWED_MAX, ACTIVITY_PAGE_DEFAULT_LIMIT, ACTIVITY_PAGE_MAX_LIMIT, ACTIVITY_PREVIEW_AUDIENCES, ACTIVITY_REACTIONS, ACTIVITY_TYPES, ACTIVITY_TYPE_SECTIONS, type AccountExportGoal, type AccountExportMember, type AccountExportPersonalRecord, type AccountExportRoutine, type AccountExportScheduleOverride, type AccountExportTrainingEvent, type AccountExportTrainingLocation, type AccountExportV1, type AchievementActivity, type AchievementCategory, type AchievementCategoryProgress, type AchievementDefinition, type AchievementNotification, type AchievementUnlockedEventPayload, type AchievementsResponse, type ActivityAudience, type ActivityCap, type ActivityComment, type ActivityCommentNotification, type ActivityCommentSummary, type ActivityCommentsQuery, type ActivityCommentsResponse, type ActivityEntry, type ActivityEntrySharing, type ActivityFeedResponse, type ActivityLink, type ActivityPage, type ActivityPageQuery, type ActivityPreviewAudience, type ActivityPreviewQuery, type ActivityReaction, type ActivityReactionSummary, type ActivitySection, type ActivitySharingSettings, type ActivityType, type AppNotification, BLOCKED_MEMBERS_MAX, type BlockedMember, type BlockedMembersResponse, type Brand, CLONE_ROUTINE_REFUSALS, COMEBACK_MIN_INACTIVE_DAYS, COMEBACK_RECOGNITION_LIMIT, COMEBACK_REQUIRED_ACTIVE_DAYS, COMEBACK_SESSION_LOOKBACK, COMEBACK_WINDOW_DAYS, type CalendarDate, type CloneRoutineRefusal, type CloneRoutineRequest, type ComebackActivity, type ComebackRecognition, type ComebackRecognitionSummary, type CorrectSessionRequest, type CorrectSessionResponse, type CorrectSessionSetRequest, type CreateActivityCommentRequest, type CreateActivityCommentResponse, type CreateReportRequest, type CreateReportResponse, type CreateRoutineDayInput, type CreateRoutineExerciseInput, type CreateRoutineRequest, type CreateRoutineVersionRequest, type CreateSessionShareRequest, type DeleteAccountRequest, type DeleteAccountResponse, type DeleteActivityCommentResponse, type DeletePushSubscriptionRequest, type DiscoverableRoutine, 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, FEATURED_PROFILE_ITEMS_MAX, FEATURED_PROFILE_ITEM_KINDS, FEATURED_PROFILE_REFERENCE_MAX_LENGTH, FOLLOW_SUGGESTIONS_DEFAULT_LIMIT, FOLLOW_SUGGESTIONS_MAX_LIMIT, FOLLOW_SUGGESTION_REASONS, type FeaturedProfileAchievementItem, type FeaturedProfileItem, type FeaturedProfileItemKind, type FeaturedProfileRankItem, type FeaturedProfileRecordItem, type FeaturedProfileRoutineItem, type FeaturedProfileSelection, type FeaturedProfileSelectionInput, type FeaturedProfileSelectionsResponse, 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, MINUTES_IN_DAY, MODERATION_ACTION_KINDS, MODERATION_HISTORY_PAGE_SIZE, MODERATION_NOTE_MAX_LENGTH, MODERATION_QUEUE_PAGE_SIZE, MOVEMENT_PATTERNS, MUSCLE_GROUPS, type MarkNotificationsReadRequest, type MarkNotificationsReadResponse, type MeasurableGoal, type MeasurableGoalDirection, type MeasurableGoalExercise, type MeasurableGoalInput, type MeasurableGoalType, type MemberActivityResponse, type MemberModerationState, type MemberRoutinesResponse, type ModerationActionKind, type ModerationActionRecord, type ModerationHistoryQuery, type ModerationHistoryResponse, type ModerationQueueQuery, type ModerationQueueResponse, type ModerationReport, type ModeratorState, type MoveOccurrenceRequest, type MovementPattern, type MuscleGroup, type MuscleGroupHeatmapQuery, type MuscleGroupHeatmapResponse, type MuscleGroupHeatmapValue, type MuscleGroupHeatmapWeek, type MuscleVolumeTrendSeries, NOTIFICATIONS_LIST_LIMIT, NOTIFICATIONS_LOOKBACK_DAYS, NOTIFICATIONS_RETENTION_DAYS, NOTIFICATION_CATEGORIES, NOTIFICATION_KINDS, type NewFollowerNotification, type NotificationCategory, type NotificationKind, type NotificationPreferences, type NotificationPreferencesResponse, type NotificationsResponse, type OwnActivityEntry, type OwnActivityResponse, 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, PUSH_PAYLOAD_KINDS, PUSH_SUBSCRIPTIONS_MAX, type PaginatedResponse, type PersonalGoalProgress, type PersonalGoalsResponse, type PersonalRecordActivity, type PersonalRecordEntry, type PersonalRecordKind, type PlannedReminder, 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 ProgressionActivity, type ProgressionChange, type ProgressionRule, type ProgressionScheme, type ProgressionSetChange, type PublicBodyMetrics, type PublicProfileAchievements, type PublicTrainingSummary, type PublicUserProfile, type PushPayload, type PushPayloadKind, type PushSubscriptionKeys, type PushSubscriptionSummary, type PushSubscriptionsResponse, type QuietHours, RELATIONSHIP_LIST_DEFAULT_LIMIT, RELATIONSHIP_LIST_KINDS, RELATIONSHIP_LIST_MAX_LIMIT, RENAISSANCE_RANK_DEFINITIONS, REPORTS_PER_DAY_MAX, REPORT_DETAILS_MAX_LENGTH, REPORT_REASONS, REPORT_STATUSES, REPORT_SUBJECT_KINDS, REP_TYPES, RESERVED_USERNAMES, REST_ALERT_MAX_LEAD_SECONDS, REST_ALERT_MIN_LEAD_SECONDS, REST_ALERT_REFUSALS, ROUTINE_DAYS_MAX, ROUTINE_DAY_NAME_MAX, ROUTINE_DISCOVERY_DEFAULT_LIMIT, ROUTINE_DISCOVERY_MAX_LIMIT, ROUTINE_DISCOVERY_SCAN_LIMIT, ROUTINE_DURATION_BANDS, ROUTINE_DURATION_BAND_MAX_MINUTES, ROUTINE_SCHEDULE_MODES, ROUTINE_SHARE_MAX_ACTIVE_LINKS, ROUTINE_TRAINING_BLOCKS_MAX, ROUTINE_TRAINING_BLOCK_NAME_MAX, ROUTINE_TRAINING_BLOCK_REVISIONS_MAX, ROUTINE_TRAINING_BLOCK_SOURCE_KINDS, ROUTINE_TRAINING_BLOCK_STATES, ROUTINE_VERSIONS_MAX, ROUTINE_VERSION_KINDS, ROUTINE_VERSION_NAME_MAX, ROUTINE_VISIBILITY_VALUES, type RecentActivityEntry, type RegisterPushSubscriptionRequest, type RelationshipListKind, type RelationshipListQuery, type RelationshipListResponse, type RelationshipMember, type RenaissanceRankDefinition, type RenaissanceRankProgress, type RepType, type ReplaceFeaturedProfileItemsRequest, type ReplaceMeasurableGoalsRequest, type ReplaceTrainingLocationsRequest, type ReportReason, type ReportStatus, type ReportSubjectKind, type ReportSubjectPreview, type RestAlertPushPayload, type RestAlertRefusal, type RestoreRoutineVersionResponse, type ReviewReportRequest, type ReviewReportResponse, type Routine, type RoutineClassification, type RoutineDay, type RoutineDayId, type RoutineDiscoveryQuery, type RoutineDiscoveryResponse, type RoutineDurationBand, type RoutineExercise, type RoutineFacets, type RoutineId, type RoutineLineage, type RoutineScheduleMode, type RoutineSet, type RoutineShare, type RoutineShareListResponse, type RoutineSharedActivity, type RoutineTrainingBlock, type RoutineTrainingBlockRevision, type RoutineTrainingBlockRevisionsResponse, type RoutineTrainingBlockSource, type RoutineTrainingBlockSourceKind, type RoutineTrainingBlockState, type RoutineTrainingBlocksResponse, type RoutineVersion, type RoutineVersionDay, type RoutineVersionExercise, type RoutineVersionKind, type RoutineVersionSetup, type RoutineVersionsResponse, type RoutineVisibility, SCHEDULE_MOVE_MAX_DAYS, SCHEDULE_OVERRIDES_MAX_RANGE_DAYS, SCHEDULE_OVERRIDE_KINDS, SCHEDULE_SKIP_PAST_DAYS, SESSION_CORRECTIONS_MAX, SESSION_CORRECTION_LIMITS, SESSION_CORRECTION_WINDOW_HOURS, SESSION_SHARE_DEFAULT_FIELDS, SESSION_SHARE_FIELDS, SESSION_SHARE_MAX_ACTIVE_LINKS, SEXES, SHARED_ROUTINE_SOURCES, STARRED_EXERCISES_MAX, STREAK_MAX_GAP_DAYS, type ScheduleOverride, type ScheduleOverrideKind, type ScheduleOverridesQuery, type ScheduleOverridesResponse, type ScheduleRestAlertRequest, type ScheduleRestAlertResponse, type SendTrainingPartnerEncouragementRequest, type SendTrainingPartnerEncouragementResponse, type SessionComparisonExercise, type SessionComparisonQuery, type SessionComparisonResponse, type SessionComparisonRoutineDay, type SessionComparisonSession, type SessionComparisonSet, type SessionCompletedActivity, type SessionCorrection, type SessionCorrectionClosedReason, type SessionCorrectionWindow, type SessionCorrectionsResponse, type SessionExerciseSubstitution, type SessionProgressNotification, type SessionRecapRecord, type SessionSetCorrection, type SessionShare, type SessionShareField, type SessionShareListResponse, type SetAccountTimeZoneRequest, type SetActivityEntryAudienceRequest, type SetActivityEntryAudienceResponse, type SetActivityReactionRequest, type SetActivityReactionResponse, type SetLog, type SetLogValues, type Sex, type SharedRoutine, type SharedRoutineOwner, type SharedRoutineSource, type SharedRoutineSummary, type SharedSessionOwner, type SharedSessionRecap, type SkipOccurrenceRequest, type StarredExercise, type StarredExercisesResponse, type StartWorkoutRequest, type StartWorkoutResponse, type StreakAtRiskPushPayload, type StreakMilestoneActivity, 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, TRAINING_PARTNERSHIP_STATUSES, TRAINING_PARTNERS_MAX, TRAINING_PARTNER_ENCOURAGEMENTS_PER_24_HOURS_MAX, TRAINING_PARTNER_ENCOURAGEMENT_KINDS, TRAINING_PARTNER_PERMISSION_KEYS, TRAINING_PARTNER_REQUESTS_PER_DAY_MAX, type TrainingDiscipline, type TrainingEventType, type TrainingExperienceLevel, type TrainingGoal, type TrainingIdentity, type TrainingLocationPreference, type TrainingLocationPreferenceInput, type TrainingPartnerEncouragementKind, type TrainingPartnerEncouragementNotification, type TrainingPartnerPermissions, type TrainingPartnerScheduleDay, type TrainingPartnerScheduleResponse, type TrainingPartnership, type TrainingPartnershipStatus, type TrainingPartnershipsResponse, type TrainingReminderPreference, type TrainingReminderPushPayload, USERNAME_MAX_LENGTH, USERNAME_MIN_LENGTH, USERNAME_PATTERN_SOURCE, type UpdateActivitySharingRequest, type UpdateNotificationPreferencesRequest, type UpdateProfileDiscoveryRequest, type UpdateProfilePrivacyRequest, type UpdateProfileRequest, type UpdateRoutineRequest, type UpdateRoutineVisibilityRequest, type UpdateTrainingPartnerPermissionsRequest, type UpsertRoutineTrainingBlockRequest, 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, accountExportFileName, isWithinQuietHours, matchesDeletionConfirmation, routineDayLabel, sessionCorrectionWindow, setLogValuesDiffer };
|
package/dist/index.js
CHANGED
|
@@ -445,6 +445,33 @@ var SESSION_SHARE_DEFAULT_FIELDS = [
|
|
|
445
445
|
];
|
|
446
446
|
var SESSION_SHARE_MAX_ACTIVE_LINKS = 10;
|
|
447
447
|
|
|
448
|
+
// src/session-corrections.ts
|
|
449
|
+
var SESSION_CORRECTION_WINDOW_HOURS = 48;
|
|
450
|
+
var SESSION_CORRECTIONS_MAX = 10;
|
|
451
|
+
var SESSION_CORRECTION_LIMITS = {
|
|
452
|
+
weightKgMax: 1500,
|
|
453
|
+
repsMax: 1e3,
|
|
454
|
+
rpeMin: 0,
|
|
455
|
+
rpeMax: 10
|
|
456
|
+
};
|
|
457
|
+
function sessionCorrectionWindow(input, now = /* @__PURE__ */ new Date()) {
|
|
458
|
+
const closed = (closedReason) => ({ correctableUntil: null, closedReason });
|
|
459
|
+
if (input.status !== "COMPLETED" || !input.endedAt)
|
|
460
|
+
return closed("NOT_COMPLETED");
|
|
461
|
+
if (!input.isLatest) return closed("NOT_LATEST");
|
|
462
|
+
if (input.laterSessionStarted) return closed("LATER_SESSION");
|
|
463
|
+
const until = new Date(
|
|
464
|
+
new Date(input.endedAt).getTime() + SESSION_CORRECTION_WINDOW_HOURS * 3600 * 1e3
|
|
465
|
+
);
|
|
466
|
+
if (now.getTime() >= until.getTime()) return closed("WINDOW_PASSED");
|
|
467
|
+
if (input.correctionCount >= SESSION_CORRECTIONS_MAX)
|
|
468
|
+
return closed("LIMIT_REACHED");
|
|
469
|
+
return { correctableUntil: until.toISOString(), closedReason: null };
|
|
470
|
+
}
|
|
471
|
+
function setLogValuesDiffer(a, b) {
|
|
472
|
+
return a.weight !== b.weight || a.reps !== b.reps || a.rpe !== b.rpe || a.isCompleted !== b.isCompleted;
|
|
473
|
+
}
|
|
474
|
+
|
|
448
475
|
// src/analytics.ts
|
|
449
476
|
var TRAINING_EVENT_TYPES = [
|
|
450
477
|
"SESSION_COMPLETED",
|
|
@@ -541,7 +568,16 @@ function matchesDeletionConfirmation(typed, username) {
|
|
|
541
568
|
const normalized = typed.trim().replace(/^@/, "").toLowerCase();
|
|
542
569
|
return normalized.length > 0 && normalized === username.toLowerCase();
|
|
543
570
|
}
|
|
571
|
+
|
|
572
|
+
// src/account-export.ts
|
|
573
|
+
var ACCOUNT_EXPORT_FORMAT = "sunnsteel-account-export";
|
|
574
|
+
var ACCOUNT_EXPORT_VERSION = 1;
|
|
575
|
+
function accountExportFileName(username, exportedAt) {
|
|
576
|
+
return `sunnsteel-${username}-${exportedAt.slice(0, 10)}.json`;
|
|
577
|
+
}
|
|
544
578
|
export {
|
|
579
|
+
ACCOUNT_EXPORT_FORMAT,
|
|
580
|
+
ACCOUNT_EXPORT_VERSION,
|
|
545
581
|
ACHIEVEMENT_CATEGORIES,
|
|
546
582
|
ACHIEVEMENT_DEFINITIONS,
|
|
547
583
|
ACTIVITY_CAPS,
|
|
@@ -640,6 +676,9 @@ export {
|
|
|
640
676
|
SCHEDULE_OVERRIDES_MAX_RANGE_DAYS,
|
|
641
677
|
SCHEDULE_OVERRIDE_KINDS,
|
|
642
678
|
SCHEDULE_SKIP_PAST_DAYS,
|
|
679
|
+
SESSION_CORRECTIONS_MAX,
|
|
680
|
+
SESSION_CORRECTION_LIMITS,
|
|
681
|
+
SESSION_CORRECTION_WINDOW_HOURS,
|
|
643
682
|
SESSION_SHARE_DEFAULT_FIELDS,
|
|
644
683
|
SESSION_SHARE_FIELDS,
|
|
645
684
|
SESSION_SHARE_MAX_ACTIVE_LINKS,
|
|
@@ -662,7 +701,10 @@ export {
|
|
|
662
701
|
USERNAME_PATTERN_SOURCE,
|
|
663
702
|
WEIGHT_UNITS,
|
|
664
703
|
WORKOUT_SESSION_STATUSES,
|
|
704
|
+
accountExportFileName,
|
|
665
705
|
isWithinQuietHours,
|
|
666
706
|
matchesDeletionConfirmation,
|
|
667
|
-
routineDayLabel
|
|
707
|
+
routineDayLabel,
|
|
708
|
+
sessionCorrectionWindow,
|
|
709
|
+
setLogValuesDiffer
|
|
668
710
|
};
|