@sunsteel/contracts 0.28.0 → 0.29.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 +63 -1
- package/dist/index.d.cts +38 -2
- package/dist/index.d.ts +38 -2
- package/dist/index.js +61 -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,
|
|
@@ -237,6 +239,62 @@ var MEASURABLE_GOAL_TYPES = [
|
|
|
237
239
|
var MEASURABLE_GOAL_DIRECTIONS = ["AT_LEAST", "AT_MOST"];
|
|
238
240
|
var MEASURABLE_GOALS_MAX = 8;
|
|
239
241
|
|
|
242
|
+
// src/achievements.ts
|
|
243
|
+
var ACHIEVEMENT_CATEGORIES = [
|
|
244
|
+
"SESSIONS",
|
|
245
|
+
"SETS",
|
|
246
|
+
"VOLUME_KG",
|
|
247
|
+
"RECORDS",
|
|
248
|
+
"STREAK_DAYS"
|
|
249
|
+
];
|
|
250
|
+
var formatCount = (value) => value.toLocaleString("en-US");
|
|
251
|
+
function titleFor(category, threshold) {
|
|
252
|
+
const count = formatCount(threshold);
|
|
253
|
+
switch (category) {
|
|
254
|
+
case "SESSIONS":
|
|
255
|
+
return threshold === 1 ? "First Session" : `${count} Sessions`;
|
|
256
|
+
case "SETS":
|
|
257
|
+
return `${count} Sets Completed`;
|
|
258
|
+
case "VOLUME_KG":
|
|
259
|
+
return `${count} kg Moved`;
|
|
260
|
+
case "RECORDS":
|
|
261
|
+
return threshold === 1 ? "First Record" : `${count} Records`;
|
|
262
|
+
case "STREAK_DAYS":
|
|
263
|
+
return `${count}-Day Streak`;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
function descriptionFor(category, threshold) {
|
|
267
|
+
const count = formatCount(threshold);
|
|
268
|
+
switch (category) {
|
|
269
|
+
case "SESSIONS":
|
|
270
|
+
return `Complete ${count} ${threshold === 1 ? "training session" : "training sessions"}.`;
|
|
271
|
+
case "SETS":
|
|
272
|
+
return `Complete ${count} logged sets.`;
|
|
273
|
+
case "VOLUME_KG":
|
|
274
|
+
return `Accumulate ${count} kg of external-load volume.`;
|
|
275
|
+
case "RECORDS":
|
|
276
|
+
return `Establish records for ${count} ${threshold === 1 ? "exercise" : "exercises"}.`;
|
|
277
|
+
case "STREAK_DAYS":
|
|
278
|
+
return `Build a ${count}-day training streak.`;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
var THRESHOLDS = {
|
|
282
|
+
SESSIONS: [1, 10, 25, 50, 100],
|
|
283
|
+
SETS: [10, 100, 250, 500, 1e3],
|
|
284
|
+
VOLUME_KG: [1e3, 1e4, 5e4, 1e5, 25e4],
|
|
285
|
+
RECORDS: [1, 5, 10, 25, 50],
|
|
286
|
+
STREAK_DAYS: [2, 3, 5, 10, 20]
|
|
287
|
+
};
|
|
288
|
+
var ACHIEVEMENT_DEFINITIONS = ACHIEVEMENT_CATEGORIES.flatMap(
|
|
289
|
+
(category) => THRESHOLDS[category].map((threshold) => ({
|
|
290
|
+
id: `${category.toLowerCase()}:${threshold}`,
|
|
291
|
+
category,
|
|
292
|
+
threshold,
|
|
293
|
+
title: titleFor(category, threshold),
|
|
294
|
+
description: descriptionFor(category, threshold)
|
|
295
|
+
}))
|
|
296
|
+
);
|
|
297
|
+
|
|
240
298
|
// src/workout.ts
|
|
241
299
|
var SESSION_SHARE_FIELDS = [
|
|
242
300
|
"duration",
|
|
@@ -258,7 +316,9 @@ var SESSION_SHARE_MAX_ACTIVE_LINKS = 10;
|
|
|
258
316
|
var TRAINING_EVENT_TYPES = [
|
|
259
317
|
"SESSION_COMPLETED",
|
|
260
318
|
"PERSONAL_RECORD",
|
|
261
|
-
"PROGRESSION_CHANGED"
|
|
319
|
+
"PROGRESSION_CHANGED",
|
|
320
|
+
"STREAK_MILESTONE",
|
|
321
|
+
"ACHIEVEMENT_UNLOCKED"
|
|
262
322
|
];
|
|
263
323
|
var PROGRESS_TIMELINE_EVENT_TYPES = [
|
|
264
324
|
"PERSONAL_RECORD",
|
|
@@ -266,6 +326,8 @@ var PROGRESS_TIMELINE_EVENT_TYPES = [
|
|
|
266
326
|
];
|
|
267
327
|
// Annotate the CommonJS export names for ESM import in node:
|
|
268
328
|
0 && (module.exports = {
|
|
329
|
+
ACHIEVEMENT_CATEGORIES,
|
|
330
|
+
ACHIEVEMENT_DEFINITIONS,
|
|
269
331
|
EXERCISE_EQUIPMENT,
|
|
270
332
|
EXERCISE_MECHANICS,
|
|
271
333
|
FOLLOW_SUGGESTIONS_DEFAULT_LIMIT,
|
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,42 @@ 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
|
+
/** Stable successful response of GET /achievements. */
|
|
953
|
+
interface AchievementsResponse {
|
|
954
|
+
analyticsReady: boolean;
|
|
955
|
+
earnedCount: number;
|
|
956
|
+
availableCount: number;
|
|
957
|
+
achievements: EarnedAchievement[];
|
|
958
|
+
}
|
|
959
|
+
|
|
924
960
|
interface RoutineSet {
|
|
925
961
|
setNumber: number;
|
|
926
962
|
repType: RepType;
|
|
@@ -985,4 +1021,4 @@ interface CreateRoutineRequest {
|
|
|
985
1021
|
}
|
|
986
1022
|
type UpdateRoutineRequest = Partial<CreateRoutineRequest>;
|
|
987
1023
|
|
|
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 };
|
|
1024
|
+
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, 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 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,42 @@ 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
|
+
/** Stable successful response of GET /achievements. */
|
|
953
|
+
interface AchievementsResponse {
|
|
954
|
+
analyticsReady: boolean;
|
|
955
|
+
earnedCount: number;
|
|
956
|
+
availableCount: number;
|
|
957
|
+
achievements: EarnedAchievement[];
|
|
958
|
+
}
|
|
959
|
+
|
|
924
960
|
interface RoutineSet {
|
|
925
961
|
setNumber: number;
|
|
926
962
|
repType: RepType;
|
|
@@ -985,4 +1021,4 @@ interface CreateRoutineRequest {
|
|
|
985
1021
|
}
|
|
986
1022
|
type UpdateRoutineRequest = Partial<CreateRoutineRequest>;
|
|
987
1023
|
|
|
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 };
|
|
1024
|
+
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, 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 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,62 @@ 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
|
+
|
|
178
234
|
// src/workout.ts
|
|
179
235
|
var SESSION_SHARE_FIELDS = [
|
|
180
236
|
"duration",
|
|
@@ -196,13 +252,17 @@ var SESSION_SHARE_MAX_ACTIVE_LINKS = 10;
|
|
|
196
252
|
var TRAINING_EVENT_TYPES = [
|
|
197
253
|
"SESSION_COMPLETED",
|
|
198
254
|
"PERSONAL_RECORD",
|
|
199
|
-
"PROGRESSION_CHANGED"
|
|
255
|
+
"PROGRESSION_CHANGED",
|
|
256
|
+
"STREAK_MILESTONE",
|
|
257
|
+
"ACHIEVEMENT_UNLOCKED"
|
|
200
258
|
];
|
|
201
259
|
var PROGRESS_TIMELINE_EVENT_TYPES = [
|
|
202
260
|
"PERSONAL_RECORD",
|
|
203
261
|
"PROGRESSION_CHANGED"
|
|
204
262
|
];
|
|
205
263
|
export {
|
|
264
|
+
ACHIEVEMENT_CATEGORIES,
|
|
265
|
+
ACHIEVEMENT_DEFINITIONS,
|
|
206
266
|
EXERCISE_EQUIPMENT,
|
|
207
267
|
EXERCISE_MECHANICS,
|
|
208
268
|
FOLLOW_SUGGESTIONS_DEFAULT_LIMIT,
|