@sunsteel/contracts 0.28.0 → 0.30.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 +109 -1
- package/dist/index.d.cts +96 -2
- package/dist/index.d.ts +96 -2
- package/dist/index.js +106 -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
|
+
ACHIEVEMENT_CATEGORIES: () => ACHIEVEMENT_CATEGORIES,
|
|
24
|
+
ACHIEVEMENT_DEFINITIONS: () => ACHIEVEMENT_DEFINITIONS,
|
|
23
25
|
EXERCISE_EQUIPMENT: () => EXERCISE_EQUIPMENT,
|
|
24
26
|
EXERCISE_MECHANICS: () => EXERCISE_MECHANICS,
|
|
25
27
|
FOLLOW_SUGGESTIONS_DEFAULT_LIMIT: () => FOLLOW_SUGGESTIONS_DEFAULT_LIMIT,
|
|
@@ -42,6 +44,7 @@ __export(index_exports, {
|
|
|
42
44
|
RELATIONSHIP_LIST_DEFAULT_LIMIT: () => RELATIONSHIP_LIST_DEFAULT_LIMIT,
|
|
43
45
|
RELATIONSHIP_LIST_KINDS: () => RELATIONSHIP_LIST_KINDS,
|
|
44
46
|
RELATIONSHIP_LIST_MAX_LIMIT: () => RELATIONSHIP_LIST_MAX_LIMIT,
|
|
47
|
+
RENAISSANCE_RANK_DEFINITIONS: () => RENAISSANCE_RANK_DEFINITIONS,
|
|
45
48
|
REP_TYPES: () => REP_TYPES,
|
|
46
49
|
RESERVED_USERNAMES: () => RESERVED_USERNAMES,
|
|
47
50
|
SESSION_SHARE_DEFAULT_FIELDS: () => SESSION_SHARE_DEFAULT_FIELDS,
|
|
@@ -237,6 +240,106 @@ var MEASURABLE_GOAL_TYPES = [
|
|
|
237
240
|
var MEASURABLE_GOAL_DIRECTIONS = ["AT_LEAST", "AT_MOST"];
|
|
238
241
|
var MEASURABLE_GOALS_MAX = 8;
|
|
239
242
|
|
|
243
|
+
// src/achievements.ts
|
|
244
|
+
var ACHIEVEMENT_CATEGORIES = [
|
|
245
|
+
"SESSIONS",
|
|
246
|
+
"SETS",
|
|
247
|
+
"VOLUME_KG",
|
|
248
|
+
"RECORDS",
|
|
249
|
+
"STREAK_DAYS"
|
|
250
|
+
];
|
|
251
|
+
var formatCount = (value) => value.toLocaleString("en-US");
|
|
252
|
+
function titleFor(category, threshold) {
|
|
253
|
+
const count = formatCount(threshold);
|
|
254
|
+
switch (category) {
|
|
255
|
+
case "SESSIONS":
|
|
256
|
+
return threshold === 1 ? "First Session" : `${count} Sessions`;
|
|
257
|
+
case "SETS":
|
|
258
|
+
return `${count} Sets Completed`;
|
|
259
|
+
case "VOLUME_KG":
|
|
260
|
+
return `${count} kg Moved`;
|
|
261
|
+
case "RECORDS":
|
|
262
|
+
return threshold === 1 ? "First Record" : `${count} Records`;
|
|
263
|
+
case "STREAK_DAYS":
|
|
264
|
+
return `${count}-Day Streak`;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
function descriptionFor(category, threshold) {
|
|
268
|
+
const count = formatCount(threshold);
|
|
269
|
+
switch (category) {
|
|
270
|
+
case "SESSIONS":
|
|
271
|
+
return `Complete ${count} ${threshold === 1 ? "training session" : "training sessions"}.`;
|
|
272
|
+
case "SETS":
|
|
273
|
+
return `Complete ${count} logged sets.`;
|
|
274
|
+
case "VOLUME_KG":
|
|
275
|
+
return `Accumulate ${count} kg of external-load volume.`;
|
|
276
|
+
case "RECORDS":
|
|
277
|
+
return `Establish records for ${count} ${threshold === 1 ? "exercise" : "exercises"}.`;
|
|
278
|
+
case "STREAK_DAYS":
|
|
279
|
+
return `Build a ${count}-day training streak.`;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
var THRESHOLDS = {
|
|
283
|
+
SESSIONS: [1, 10, 25, 50, 100],
|
|
284
|
+
SETS: [10, 100, 250, 500, 1e3],
|
|
285
|
+
VOLUME_KG: [1e3, 1e4, 5e4, 1e5, 25e4],
|
|
286
|
+
RECORDS: [1, 5, 10, 25, 50],
|
|
287
|
+
STREAK_DAYS: [2, 3, 5, 10, 20]
|
|
288
|
+
};
|
|
289
|
+
var ACHIEVEMENT_DEFINITIONS = ACHIEVEMENT_CATEGORIES.flatMap(
|
|
290
|
+
(category) => THRESHOLDS[category].map((threshold) => ({
|
|
291
|
+
id: `${category.toLowerCase()}:${threshold}`,
|
|
292
|
+
category,
|
|
293
|
+
threshold,
|
|
294
|
+
title: titleFor(category, threshold),
|
|
295
|
+
description: descriptionFor(category, threshold)
|
|
296
|
+
}))
|
|
297
|
+
);
|
|
298
|
+
var RENAISSANCE_RANK_DEFINITIONS = [
|
|
299
|
+
{
|
|
300
|
+
id: "INITIATE",
|
|
301
|
+
title: "Initiate",
|
|
302
|
+
description: "Your place in the training ledger begins here.",
|
|
303
|
+
minimumSessions: 0,
|
|
304
|
+
minimumActiveWeeks: 0
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
id: "APPRENTICE",
|
|
308
|
+
title: "Apprentice",
|
|
309
|
+
description: "Learning the craft through regular practice.",
|
|
310
|
+
minimumSessions: 5,
|
|
311
|
+
minimumActiveWeeks: 3
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
id: "ARTISAN",
|
|
315
|
+
title: "Artisan",
|
|
316
|
+
description: "Building a dependable training practice.",
|
|
317
|
+
minimumSessions: 15,
|
|
318
|
+
minimumActiveWeeks: 8
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
id: "MAESTRO",
|
|
322
|
+
title: "Maestro",
|
|
323
|
+
description: "Sustaining purposeful work across many weeks.",
|
|
324
|
+
minimumSessions: 30,
|
|
325
|
+
minimumActiveWeeks: 16
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
id: "VIRTUOSO",
|
|
329
|
+
title: "Virtuoso",
|
|
330
|
+
description: "Showing enduring discipline through repeated seasons.",
|
|
331
|
+
minimumSessions: 60,
|
|
332
|
+
minimumActiveWeeks: 32
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
id: "LAUREATE",
|
|
336
|
+
title: "Laureate",
|
|
337
|
+
description: "A lasting training practice recorded in the ledger.",
|
|
338
|
+
minimumSessions: 100,
|
|
339
|
+
minimumActiveWeeks: 52
|
|
340
|
+
}
|
|
341
|
+
];
|
|
342
|
+
|
|
240
343
|
// src/workout.ts
|
|
241
344
|
var SESSION_SHARE_FIELDS = [
|
|
242
345
|
"duration",
|
|
@@ -258,7 +361,9 @@ var SESSION_SHARE_MAX_ACTIVE_LINKS = 10;
|
|
|
258
361
|
var TRAINING_EVENT_TYPES = [
|
|
259
362
|
"SESSION_COMPLETED",
|
|
260
363
|
"PERSONAL_RECORD",
|
|
261
|
-
"PROGRESSION_CHANGED"
|
|
364
|
+
"PROGRESSION_CHANGED",
|
|
365
|
+
"STREAK_MILESTONE",
|
|
366
|
+
"ACHIEVEMENT_UNLOCKED"
|
|
262
367
|
];
|
|
263
368
|
var PROGRESS_TIMELINE_EVENT_TYPES = [
|
|
264
369
|
"PERSONAL_RECORD",
|
|
@@ -266,6 +371,8 @@ var PROGRESS_TIMELINE_EVENT_TYPES = [
|
|
|
266
371
|
];
|
|
267
372
|
// Annotate the CommonJS export names for ESM import in node:
|
|
268
373
|
0 && (module.exports = {
|
|
374
|
+
ACHIEVEMENT_CATEGORIES,
|
|
375
|
+
ACHIEVEMENT_DEFINITIONS,
|
|
269
376
|
EXERCISE_EQUIPMENT,
|
|
270
377
|
EXERCISE_MECHANICS,
|
|
271
378
|
FOLLOW_SUGGESTIONS_DEFAULT_LIMIT,
|
|
@@ -288,6 +395,7 @@ var PROGRESS_TIMELINE_EVENT_TYPES = [
|
|
|
288
395
|
RELATIONSHIP_LIST_DEFAULT_LIMIT,
|
|
289
396
|
RELATIONSHIP_LIST_KINDS,
|
|
290
397
|
RELATIONSHIP_LIST_MAX_LIMIT,
|
|
398
|
+
RENAISSANCE_RANK_DEFINITIONS,
|
|
291
399
|
REP_TYPES,
|
|
292
400
|
RESERVED_USERNAMES,
|
|
293
401
|
SESSION_SHARE_DEFAULT_FIELDS,
|
package/dist/index.d.cts
CHANGED
|
@@ -326,7 +326,7 @@ interface WorkoutStatsResponse {
|
|
|
326
326
|
activeDaysThisWeek: number;
|
|
327
327
|
}
|
|
328
328
|
|
|
329
|
-
declare const TRAINING_EVENT_TYPES: readonly ["SESSION_COMPLETED", "PERSONAL_RECORD", "PROGRESSION_CHANGED"];
|
|
329
|
+
declare const TRAINING_EVENT_TYPES: readonly ["SESSION_COMPLETED", "PERSONAL_RECORD", "PROGRESSION_CHANGED", "STREAK_MILESTONE", "ACHIEVEMENT_UNLOCKED"];
|
|
330
330
|
type TrainingEventType = (typeof TRAINING_EVENT_TYPES)[number];
|
|
331
331
|
/** Stable successful response of GET /workouts/progress. */
|
|
332
332
|
interface WorkoutProgressQuery {
|
|
@@ -921,6 +921,100 @@ interface PersonalGoalsResponse {
|
|
|
921
921
|
goals: PersonalGoalProgress[];
|
|
922
922
|
}
|
|
923
923
|
|
|
924
|
+
declare const ACHIEVEMENT_CATEGORIES: readonly ["SESSIONS", "SETS", "VOLUME_KG", "RECORDS", "STREAK_DAYS"];
|
|
925
|
+
type AchievementCategory = (typeof ACHIEVEMENT_CATEGORIES)[number];
|
|
926
|
+
interface AchievementDefinition {
|
|
927
|
+
id: string;
|
|
928
|
+
category: AchievementCategory;
|
|
929
|
+
threshold: number;
|
|
930
|
+
title: string;
|
|
931
|
+
description: string;
|
|
932
|
+
}
|
|
933
|
+
/** Stable milestone catalog shared by the writer and every presentation. */
|
|
934
|
+
declare const ACHIEVEMENT_DEFINITIONS: readonly AchievementDefinition[];
|
|
935
|
+
interface AchievementUnlockedEventPayload extends AchievementDefinition {
|
|
936
|
+
schemaVersion: 1;
|
|
937
|
+
backfilled: boolean;
|
|
938
|
+
}
|
|
939
|
+
interface StreakMilestoneEventPayload {
|
|
940
|
+
schemaVersion: 1;
|
|
941
|
+
achievementId: string;
|
|
942
|
+
streakDays: number;
|
|
943
|
+
backfilled: boolean;
|
|
944
|
+
}
|
|
945
|
+
interface EarnedAchievement extends AchievementDefinition {
|
|
946
|
+
eventId: string;
|
|
947
|
+
unlockedAt: IsoDateString;
|
|
948
|
+
sourceSessionId: string | null;
|
|
949
|
+
/** True when existing verified history was recognized after ACH-01 shipped. */
|
|
950
|
+
backfilled: boolean;
|
|
951
|
+
}
|
|
952
|
+
interface RenaissanceRankDefinition {
|
|
953
|
+
id: 'INITIATE' | 'APPRENTICE' | 'ARTISAN' | 'MAESTRO' | 'VIRTUOSO' | 'LAUREATE';
|
|
954
|
+
title: string;
|
|
955
|
+
description: string;
|
|
956
|
+
minimumSessions: number;
|
|
957
|
+
minimumActiveWeeks: number;
|
|
958
|
+
}
|
|
959
|
+
/**
|
|
960
|
+
* Stable rank ladder. Both requirements are intentionally based on attendance:
|
|
961
|
+
* completed sessions reward participation, while distinct active weeks reward
|
|
962
|
+
* consistency without encouraging consecutive-day training.
|
|
963
|
+
*/
|
|
964
|
+
declare const RENAISSANCE_RANK_DEFINITIONS: readonly [{
|
|
965
|
+
readonly id: "INITIATE";
|
|
966
|
+
readonly title: "Initiate";
|
|
967
|
+
readonly description: "Your place in the training ledger begins here.";
|
|
968
|
+
readonly minimumSessions: 0;
|
|
969
|
+
readonly minimumActiveWeeks: 0;
|
|
970
|
+
}, {
|
|
971
|
+
readonly id: "APPRENTICE";
|
|
972
|
+
readonly title: "Apprentice";
|
|
973
|
+
readonly description: "Learning the craft through regular practice.";
|
|
974
|
+
readonly minimumSessions: 5;
|
|
975
|
+
readonly minimumActiveWeeks: 3;
|
|
976
|
+
}, {
|
|
977
|
+
readonly id: "ARTISAN";
|
|
978
|
+
readonly title: "Artisan";
|
|
979
|
+
readonly description: "Building a dependable training practice.";
|
|
980
|
+
readonly minimumSessions: 15;
|
|
981
|
+
readonly minimumActiveWeeks: 8;
|
|
982
|
+
}, {
|
|
983
|
+
readonly id: "MAESTRO";
|
|
984
|
+
readonly title: "Maestro";
|
|
985
|
+
readonly description: "Sustaining purposeful work across many weeks.";
|
|
986
|
+
readonly minimumSessions: 30;
|
|
987
|
+
readonly minimumActiveWeeks: 16;
|
|
988
|
+
}, {
|
|
989
|
+
readonly id: "VIRTUOSO";
|
|
990
|
+
readonly title: "Virtuoso";
|
|
991
|
+
readonly description: "Showing enduring discipline through repeated seasons.";
|
|
992
|
+
readonly minimumSessions: 60;
|
|
993
|
+
readonly minimumActiveWeeks: 32;
|
|
994
|
+
}, {
|
|
995
|
+
readonly id: "LAUREATE";
|
|
996
|
+
readonly title: "Laureate";
|
|
997
|
+
readonly description: "A lasting training practice recorded in the ledger.";
|
|
998
|
+
readonly minimumSessions: 100;
|
|
999
|
+
readonly minimumActiveWeeks: 52;
|
|
1000
|
+
}];
|
|
1001
|
+
interface RenaissanceRankProgress {
|
|
1002
|
+
currentRank: RenaissanceRankDefinition;
|
|
1003
|
+
nextRank: RenaissanceRankDefinition | null;
|
|
1004
|
+
completedSessions: number;
|
|
1005
|
+
activeWeeks: number;
|
|
1006
|
+
sessionsRemaining: number;
|
|
1007
|
+
activeWeeksRemaining: number;
|
|
1008
|
+
}
|
|
1009
|
+
/** Stable successful response of GET /achievements. */
|
|
1010
|
+
interface AchievementsResponse {
|
|
1011
|
+
analyticsReady: boolean;
|
|
1012
|
+
earnedCount: number;
|
|
1013
|
+
availableCount: number;
|
|
1014
|
+
achievements: EarnedAchievement[];
|
|
1015
|
+
rank: RenaissanceRankProgress | null;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
924
1018
|
interface RoutineSet {
|
|
925
1019
|
setNumber: number;
|
|
926
1020
|
repType: RepType;
|
|
@@ -985,4 +1079,4 @@ interface CreateRoutineRequest {
|
|
|
985
1079
|
}
|
|
986
1080
|
type UpdateRoutineRequest = Partial<CreateRoutineRequest>;
|
|
987
1081
|
|
|
988
|
-
export { type Brand, type CreateRoutineDayInput, type CreateRoutineExerciseInput, type CreateRoutineRequest, type CreateSessionShareRequest, EXERCISE_EQUIPMENT, EXERCISE_MECHANICS, 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 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, 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 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, REP_TYPES, RESERVED_USERNAMES, type RecentActivityEntry, type RelationshipListKind, type RelationshipListQuery, type RelationshipListResponse, type RelationshipMember, 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, 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 StartWorkoutRequest, type StartWorkoutResponse, 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 };
|
|
1082
|
+
export { ACHIEVEMENT_CATEGORIES, ACHIEVEMENT_DEFINITIONS, type AchievementCategory, 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 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, 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 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, 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 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -326,7 +326,7 @@ interface WorkoutStatsResponse {
|
|
|
326
326
|
activeDaysThisWeek: number;
|
|
327
327
|
}
|
|
328
328
|
|
|
329
|
-
declare const TRAINING_EVENT_TYPES: readonly ["SESSION_COMPLETED", "PERSONAL_RECORD", "PROGRESSION_CHANGED"];
|
|
329
|
+
declare const TRAINING_EVENT_TYPES: readonly ["SESSION_COMPLETED", "PERSONAL_RECORD", "PROGRESSION_CHANGED", "STREAK_MILESTONE", "ACHIEVEMENT_UNLOCKED"];
|
|
330
330
|
type TrainingEventType = (typeof TRAINING_EVENT_TYPES)[number];
|
|
331
331
|
/** Stable successful response of GET /workouts/progress. */
|
|
332
332
|
interface WorkoutProgressQuery {
|
|
@@ -921,6 +921,100 @@ interface PersonalGoalsResponse {
|
|
|
921
921
|
goals: PersonalGoalProgress[];
|
|
922
922
|
}
|
|
923
923
|
|
|
924
|
+
declare const ACHIEVEMENT_CATEGORIES: readonly ["SESSIONS", "SETS", "VOLUME_KG", "RECORDS", "STREAK_DAYS"];
|
|
925
|
+
type AchievementCategory = (typeof ACHIEVEMENT_CATEGORIES)[number];
|
|
926
|
+
interface AchievementDefinition {
|
|
927
|
+
id: string;
|
|
928
|
+
category: AchievementCategory;
|
|
929
|
+
threshold: number;
|
|
930
|
+
title: string;
|
|
931
|
+
description: string;
|
|
932
|
+
}
|
|
933
|
+
/** Stable milestone catalog shared by the writer and every presentation. */
|
|
934
|
+
declare const ACHIEVEMENT_DEFINITIONS: readonly AchievementDefinition[];
|
|
935
|
+
interface AchievementUnlockedEventPayload extends AchievementDefinition {
|
|
936
|
+
schemaVersion: 1;
|
|
937
|
+
backfilled: boolean;
|
|
938
|
+
}
|
|
939
|
+
interface StreakMilestoneEventPayload {
|
|
940
|
+
schemaVersion: 1;
|
|
941
|
+
achievementId: string;
|
|
942
|
+
streakDays: number;
|
|
943
|
+
backfilled: boolean;
|
|
944
|
+
}
|
|
945
|
+
interface EarnedAchievement extends AchievementDefinition {
|
|
946
|
+
eventId: string;
|
|
947
|
+
unlockedAt: IsoDateString;
|
|
948
|
+
sourceSessionId: string | null;
|
|
949
|
+
/** True when existing verified history was recognized after ACH-01 shipped. */
|
|
950
|
+
backfilled: boolean;
|
|
951
|
+
}
|
|
952
|
+
interface RenaissanceRankDefinition {
|
|
953
|
+
id: 'INITIATE' | 'APPRENTICE' | 'ARTISAN' | 'MAESTRO' | 'VIRTUOSO' | 'LAUREATE';
|
|
954
|
+
title: string;
|
|
955
|
+
description: string;
|
|
956
|
+
minimumSessions: number;
|
|
957
|
+
minimumActiveWeeks: number;
|
|
958
|
+
}
|
|
959
|
+
/**
|
|
960
|
+
* Stable rank ladder. Both requirements are intentionally based on attendance:
|
|
961
|
+
* completed sessions reward participation, while distinct active weeks reward
|
|
962
|
+
* consistency without encouraging consecutive-day training.
|
|
963
|
+
*/
|
|
964
|
+
declare const RENAISSANCE_RANK_DEFINITIONS: readonly [{
|
|
965
|
+
readonly id: "INITIATE";
|
|
966
|
+
readonly title: "Initiate";
|
|
967
|
+
readonly description: "Your place in the training ledger begins here.";
|
|
968
|
+
readonly minimumSessions: 0;
|
|
969
|
+
readonly minimumActiveWeeks: 0;
|
|
970
|
+
}, {
|
|
971
|
+
readonly id: "APPRENTICE";
|
|
972
|
+
readonly title: "Apprentice";
|
|
973
|
+
readonly description: "Learning the craft through regular practice.";
|
|
974
|
+
readonly minimumSessions: 5;
|
|
975
|
+
readonly minimumActiveWeeks: 3;
|
|
976
|
+
}, {
|
|
977
|
+
readonly id: "ARTISAN";
|
|
978
|
+
readonly title: "Artisan";
|
|
979
|
+
readonly description: "Building a dependable training practice.";
|
|
980
|
+
readonly minimumSessions: 15;
|
|
981
|
+
readonly minimumActiveWeeks: 8;
|
|
982
|
+
}, {
|
|
983
|
+
readonly id: "MAESTRO";
|
|
984
|
+
readonly title: "Maestro";
|
|
985
|
+
readonly description: "Sustaining purposeful work across many weeks.";
|
|
986
|
+
readonly minimumSessions: 30;
|
|
987
|
+
readonly minimumActiveWeeks: 16;
|
|
988
|
+
}, {
|
|
989
|
+
readonly id: "VIRTUOSO";
|
|
990
|
+
readonly title: "Virtuoso";
|
|
991
|
+
readonly description: "Showing enduring discipline through repeated seasons.";
|
|
992
|
+
readonly minimumSessions: 60;
|
|
993
|
+
readonly minimumActiveWeeks: 32;
|
|
994
|
+
}, {
|
|
995
|
+
readonly id: "LAUREATE";
|
|
996
|
+
readonly title: "Laureate";
|
|
997
|
+
readonly description: "A lasting training practice recorded in the ledger.";
|
|
998
|
+
readonly minimumSessions: 100;
|
|
999
|
+
readonly minimumActiveWeeks: 52;
|
|
1000
|
+
}];
|
|
1001
|
+
interface RenaissanceRankProgress {
|
|
1002
|
+
currentRank: RenaissanceRankDefinition;
|
|
1003
|
+
nextRank: RenaissanceRankDefinition | null;
|
|
1004
|
+
completedSessions: number;
|
|
1005
|
+
activeWeeks: number;
|
|
1006
|
+
sessionsRemaining: number;
|
|
1007
|
+
activeWeeksRemaining: number;
|
|
1008
|
+
}
|
|
1009
|
+
/** Stable successful response of GET /achievements. */
|
|
1010
|
+
interface AchievementsResponse {
|
|
1011
|
+
analyticsReady: boolean;
|
|
1012
|
+
earnedCount: number;
|
|
1013
|
+
availableCount: number;
|
|
1014
|
+
achievements: EarnedAchievement[];
|
|
1015
|
+
rank: RenaissanceRankProgress | null;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
924
1018
|
interface RoutineSet {
|
|
925
1019
|
setNumber: number;
|
|
926
1020
|
repType: RepType;
|
|
@@ -985,4 +1079,4 @@ interface CreateRoutineRequest {
|
|
|
985
1079
|
}
|
|
986
1080
|
type UpdateRoutineRequest = Partial<CreateRoutineRequest>;
|
|
987
1081
|
|
|
988
|
-
export { type Brand, type CreateRoutineDayInput, type CreateRoutineExerciseInput, type CreateRoutineRequest, type CreateSessionShareRequest, EXERCISE_EQUIPMENT, EXERCISE_MECHANICS, 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 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, 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 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, REP_TYPES, RESERVED_USERNAMES, type RecentActivityEntry, type RelationshipListKind, type RelationshipListQuery, type RelationshipListResponse, type RelationshipMember, 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, 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 StartWorkoutRequest, type StartWorkoutResponse, 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 };
|
|
1082
|
+
export { ACHIEVEMENT_CATEGORIES, ACHIEVEMENT_DEFINITIONS, type AchievementCategory, 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 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, 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 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, 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 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 };
|
package/dist/index.js
CHANGED
|
@@ -175,6 +175,106 @@ var MEASURABLE_GOAL_TYPES = [
|
|
|
175
175
|
var MEASURABLE_GOAL_DIRECTIONS = ["AT_LEAST", "AT_MOST"];
|
|
176
176
|
var MEASURABLE_GOALS_MAX = 8;
|
|
177
177
|
|
|
178
|
+
// src/achievements.ts
|
|
179
|
+
var ACHIEVEMENT_CATEGORIES = [
|
|
180
|
+
"SESSIONS",
|
|
181
|
+
"SETS",
|
|
182
|
+
"VOLUME_KG",
|
|
183
|
+
"RECORDS",
|
|
184
|
+
"STREAK_DAYS"
|
|
185
|
+
];
|
|
186
|
+
var formatCount = (value) => value.toLocaleString("en-US");
|
|
187
|
+
function titleFor(category, threshold) {
|
|
188
|
+
const count = formatCount(threshold);
|
|
189
|
+
switch (category) {
|
|
190
|
+
case "SESSIONS":
|
|
191
|
+
return threshold === 1 ? "First Session" : `${count} Sessions`;
|
|
192
|
+
case "SETS":
|
|
193
|
+
return `${count} Sets Completed`;
|
|
194
|
+
case "VOLUME_KG":
|
|
195
|
+
return `${count} kg Moved`;
|
|
196
|
+
case "RECORDS":
|
|
197
|
+
return threshold === 1 ? "First Record" : `${count} Records`;
|
|
198
|
+
case "STREAK_DAYS":
|
|
199
|
+
return `${count}-Day Streak`;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function descriptionFor(category, threshold) {
|
|
203
|
+
const count = formatCount(threshold);
|
|
204
|
+
switch (category) {
|
|
205
|
+
case "SESSIONS":
|
|
206
|
+
return `Complete ${count} ${threshold === 1 ? "training session" : "training sessions"}.`;
|
|
207
|
+
case "SETS":
|
|
208
|
+
return `Complete ${count} logged sets.`;
|
|
209
|
+
case "VOLUME_KG":
|
|
210
|
+
return `Accumulate ${count} kg of external-load volume.`;
|
|
211
|
+
case "RECORDS":
|
|
212
|
+
return `Establish records for ${count} ${threshold === 1 ? "exercise" : "exercises"}.`;
|
|
213
|
+
case "STREAK_DAYS":
|
|
214
|
+
return `Build a ${count}-day training streak.`;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
var THRESHOLDS = {
|
|
218
|
+
SESSIONS: [1, 10, 25, 50, 100],
|
|
219
|
+
SETS: [10, 100, 250, 500, 1e3],
|
|
220
|
+
VOLUME_KG: [1e3, 1e4, 5e4, 1e5, 25e4],
|
|
221
|
+
RECORDS: [1, 5, 10, 25, 50],
|
|
222
|
+
STREAK_DAYS: [2, 3, 5, 10, 20]
|
|
223
|
+
};
|
|
224
|
+
var ACHIEVEMENT_DEFINITIONS = ACHIEVEMENT_CATEGORIES.flatMap(
|
|
225
|
+
(category) => THRESHOLDS[category].map((threshold) => ({
|
|
226
|
+
id: `${category.toLowerCase()}:${threshold}`,
|
|
227
|
+
category,
|
|
228
|
+
threshold,
|
|
229
|
+
title: titleFor(category, threshold),
|
|
230
|
+
description: descriptionFor(category, threshold)
|
|
231
|
+
}))
|
|
232
|
+
);
|
|
233
|
+
var RENAISSANCE_RANK_DEFINITIONS = [
|
|
234
|
+
{
|
|
235
|
+
id: "INITIATE",
|
|
236
|
+
title: "Initiate",
|
|
237
|
+
description: "Your place in the training ledger begins here.",
|
|
238
|
+
minimumSessions: 0,
|
|
239
|
+
minimumActiveWeeks: 0
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
id: "APPRENTICE",
|
|
243
|
+
title: "Apprentice",
|
|
244
|
+
description: "Learning the craft through regular practice.",
|
|
245
|
+
minimumSessions: 5,
|
|
246
|
+
minimumActiveWeeks: 3
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
id: "ARTISAN",
|
|
250
|
+
title: "Artisan",
|
|
251
|
+
description: "Building a dependable training practice.",
|
|
252
|
+
minimumSessions: 15,
|
|
253
|
+
minimumActiveWeeks: 8
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
id: "MAESTRO",
|
|
257
|
+
title: "Maestro",
|
|
258
|
+
description: "Sustaining purposeful work across many weeks.",
|
|
259
|
+
minimumSessions: 30,
|
|
260
|
+
minimumActiveWeeks: 16
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
id: "VIRTUOSO",
|
|
264
|
+
title: "Virtuoso",
|
|
265
|
+
description: "Showing enduring discipline through repeated seasons.",
|
|
266
|
+
minimumSessions: 60,
|
|
267
|
+
minimumActiveWeeks: 32
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
id: "LAUREATE",
|
|
271
|
+
title: "Laureate",
|
|
272
|
+
description: "A lasting training practice recorded in the ledger.",
|
|
273
|
+
minimumSessions: 100,
|
|
274
|
+
minimumActiveWeeks: 52
|
|
275
|
+
}
|
|
276
|
+
];
|
|
277
|
+
|
|
178
278
|
// src/workout.ts
|
|
179
279
|
var SESSION_SHARE_FIELDS = [
|
|
180
280
|
"duration",
|
|
@@ -196,13 +296,17 @@ var SESSION_SHARE_MAX_ACTIVE_LINKS = 10;
|
|
|
196
296
|
var TRAINING_EVENT_TYPES = [
|
|
197
297
|
"SESSION_COMPLETED",
|
|
198
298
|
"PERSONAL_RECORD",
|
|
199
|
-
"PROGRESSION_CHANGED"
|
|
299
|
+
"PROGRESSION_CHANGED",
|
|
300
|
+
"STREAK_MILESTONE",
|
|
301
|
+
"ACHIEVEMENT_UNLOCKED"
|
|
200
302
|
];
|
|
201
303
|
var PROGRESS_TIMELINE_EVENT_TYPES = [
|
|
202
304
|
"PERSONAL_RECORD",
|
|
203
305
|
"PROGRESSION_CHANGED"
|
|
204
306
|
];
|
|
205
307
|
export {
|
|
308
|
+
ACHIEVEMENT_CATEGORIES,
|
|
309
|
+
ACHIEVEMENT_DEFINITIONS,
|
|
206
310
|
EXERCISE_EQUIPMENT,
|
|
207
311
|
EXERCISE_MECHANICS,
|
|
208
312
|
FOLLOW_SUGGESTIONS_DEFAULT_LIMIT,
|
|
@@ -225,6 +329,7 @@ export {
|
|
|
225
329
|
RELATIONSHIP_LIST_DEFAULT_LIMIT,
|
|
226
330
|
RELATIONSHIP_LIST_KINDS,
|
|
227
331
|
RELATIONSHIP_LIST_MAX_LIMIT,
|
|
332
|
+
RENAISSANCE_RANK_DEFINITIONS,
|
|
228
333
|
REP_TYPES,
|
|
229
334
|
RESERVED_USERNAMES,
|
|
230
335
|
SESSION_SHARE_DEFAULT_FIELDS,
|