@dgpholdings/greatoak-shared 1.2.64 → 1.2.65

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.
@@ -0,0 +1,61 @@
1
+ export declare const AI_FITNESS_GOALS: readonly ["strength", "hypertrophy", "fat_loss", "endurance", "mobility", "rehabilitation", "sport_performance", "general_fitness", "core_strength"];
2
+ export type TAiFitnessGoal = typeof AI_FITNESS_GOALS[number];
3
+ export declare const AI_FITNESS_GOAL_LABELS: Record<TAiFitnessGoal, string>;
4
+ export declare const AI_EQUIPMENT_TYPES: readonly ["none", "dumbbell", "barbell", "resistance_band", "cable_machine", "standard_machine", "suspension_trainer", "pull_up_bar", "bench", "kettlebell", "niche_machine", "exercise_ball", "ez_bar", "cardio_machine", "smith_machine", "weight_plate", "jump_rope", "battle_ropes", "medicine_ball", "ab_wheel", "plyo_box", "parallel_bars"];
5
+ export type TAiEquipmentType = typeof AI_EQUIPMENT_TYPES[number];
6
+ export declare const AI_HOME_EQUIPMENT: TAiEquipmentType[];
7
+ export declare const AI_MOVEMENT_PATTERNS: readonly ["push_horizontal", "push_vertical", "pull_horizontal", "pull_vertical", "squat", "hinge", "lunge", "rotation", "carry", "isolation", "plyo", "cardio", "mobility", "balance", "core_stability"];
8
+ export type TAiMovementPattern = typeof AI_MOVEMENT_PATTERNS[number];
9
+ export declare const AI_PUSH_PATTERNS: TAiMovementPattern[];
10
+ export declare const AI_PULL_PATTERNS: TAiMovementPattern[];
11
+ export declare const AI_LEG_PATTERNS: TAiMovementPattern[];
12
+ export declare const AI_CORE_PATTERNS: TAiMovementPattern[];
13
+ export declare const AI_WORKOUT_PLACEMENTS: readonly ["primary_compound", "secondary_compound", "accessory", "finisher", "warmup", "cooldown"];
14
+ export type TAiWorkoutPlacement = typeof AI_WORKOUT_PLACEMENTS[number];
15
+ export declare const AI_SESSION_ORDER: TAiWorkoutPlacement[];
16
+ export declare const AI_DIFFICULTY_LEVELS: readonly ["beginner", "intermediate", "advanced", "expert"];
17
+ export type TAiDifficultyLevel = typeof AI_DIFFICULTY_LEVELS[number];
18
+ export declare const AI_FITNESS_LEVELS: readonly ["beginner", "intermediate", "advanced"];
19
+ export type TAiFitnessLevel = typeof AI_FITNESS_LEVELS[number];
20
+ export declare const AI_DIFFICULTY_FILTER: Record<TAiFitnessLevel, TAiDifficultyLevel[]>;
21
+ export declare const AI_INTENSITY_LEVELS: readonly ["low", "moderate", "high"];
22
+ export type TAiIntensityLevel = typeof AI_INTENSITY_LEVELS[number];
23
+ export declare const AI_SLEEP_TO_MAX_CNS: Record<'good' | 'disturbed' | 'poor', TAiIntensityLevel>;
24
+ export declare const AI_MET_THRESHOLDS: {
25
+ readonly low: 3;
26
+ readonly moderate: 6;
27
+ readonly high: 6;
28
+ };
29
+ export declare const AI_BODY_AREAS: readonly ["lower back", "upper back", "shoulders", "neck", "elbows", "wrists", "hips", "hip flexors", "knees", "ankles", "hamstrings", "achilles tendon", "forearms", "groin", "calf muscles", "chest", "core"];
30
+ export type TAiBodyArea = typeof AI_BODY_AREAS[number];
31
+ export declare const AI_BODY_AREA_LABELS: Record<TAiBodyArea, string>;
32
+ export declare const AI_BODY_ISSUE_TYPES: readonly ["general_soreness", "joint_pain", "old_injury", "diagnosed_condition"];
33
+ export type TAiBodyIssueType = typeof AI_BODY_ISSUE_TYPES[number];
34
+ export declare const AI_BODY_ISSUE_LABELS: Record<TAiBodyIssueType, string>;
35
+ export declare const AI_POPULAR_THRESHOLD = 75;
36
+ export interface TAiUserInjury {
37
+ bodyArea: TAiBodyArea;
38
+ issueType: TAiBodyIssueType;
39
+ note?: string;
40
+ isActive: boolean;
41
+ }
42
+ export interface TAiUserProfile {
43
+ userId: string;
44
+ height: number;
45
+ weight: number;
46
+ bodyFatPercent?: number;
47
+ age: number;
48
+ primaryGoal: TAiFitnessGoal;
49
+ fitnessLevel: TAiFitnessLevel;
50
+ availableEquipment: TAiEquipmentType[];
51
+ trainsAtHome: boolean;
52
+ injuries: TAiUserInjury[];
53
+ avoidBodyAreas: TAiBodyArea[];
54
+ onboardingCompletedAt: string;
55
+ onboardingVersion: string;
56
+ }
57
+ export declare const AI_SLEEP_QUALITY_OPTIONS: readonly ["good", "disturbed", "poor"];
58
+ export type TAiSleepQuality = typeof AI_SLEEP_QUALITY_OPTIONS[number];
59
+ export declare const AI_SLEEP_QUALITY_LABELS: Record<TAiSleepQuality, string>;
60
+ export declare const AI_INTENT_CHIPS: readonly ["Leg day", "Upper body", "Full body", "Push day", "Pull day", "Core & abs", "Something light", "Surprise me"];
61
+ export type TAiIntentChip = typeof AI_INTENT_CHIPS[number];
@@ -0,0 +1,209 @@
1
+ "use strict";
2
+ // shared/src/constants/AiExerciseVocabulary.ts
3
+ //
4
+ // Single source of truth for all fitness domain vocabulary used by the AI engine.
5
+ // Every value here exists in the Qdrant exercises collection payload.
6
+ //
7
+ // Verified against 701 active exercises from exercises-v2_3_PURE.json
8
+ // Do not add values here without also ensuring they exist in the data.
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.AI_INTENT_CHIPS = exports.AI_SLEEP_QUALITY_LABELS = exports.AI_SLEEP_QUALITY_OPTIONS = exports.AI_POPULAR_THRESHOLD = exports.AI_BODY_ISSUE_LABELS = exports.AI_BODY_ISSUE_TYPES = exports.AI_BODY_AREA_LABELS = exports.AI_BODY_AREAS = exports.AI_MET_THRESHOLDS = exports.AI_SLEEP_TO_MAX_CNS = exports.AI_INTENSITY_LEVELS = exports.AI_DIFFICULTY_FILTER = exports.AI_FITNESS_LEVELS = exports.AI_DIFFICULTY_LEVELS = exports.AI_SESSION_ORDER = exports.AI_WORKOUT_PLACEMENTS = exports.AI_CORE_PATTERNS = exports.AI_LEG_PATTERNS = exports.AI_PULL_PATTERNS = exports.AI_PUSH_PATTERNS = exports.AI_MOVEMENT_PATTERNS = exports.AI_HOME_EQUIPMENT = exports.AI_EQUIPMENT_TYPES = exports.AI_FITNESS_GOAL_LABELS = exports.AI_FITNESS_GOALS = void 0;
11
+ // ── FITNESS GOALS ────────────────────────────────────────────────────────────
12
+ exports.AI_FITNESS_GOALS = [
13
+ 'strength',
14
+ 'hypertrophy',
15
+ 'fat_loss',
16
+ 'endurance',
17
+ 'mobility',
18
+ 'rehabilitation',
19
+ 'sport_performance',
20
+ 'general_fitness',
21
+ 'core_strength',
22
+ ];
23
+ exports.AI_FITNESS_GOAL_LABELS = {
24
+ strength: 'Get stronger',
25
+ hypertrophy: 'Build muscle',
26
+ fat_loss: 'Lose fat',
27
+ endurance: 'Improve endurance',
28
+ mobility: 'Improve flexibility & mobility',
29
+ rehabilitation: 'Recover from injury',
30
+ sport_performance: 'Sport performance',
31
+ general_fitness: 'General fitness',
32
+ core_strength: 'Build core strength',
33
+ };
34
+ // ── EQUIPMENT TYPES ──────────────────────────────────────────────────────────
35
+ exports.AI_EQUIPMENT_TYPES = [
36
+ 'none',
37
+ 'dumbbell',
38
+ 'barbell',
39
+ 'resistance_band',
40
+ 'cable_machine',
41
+ 'standard_machine',
42
+ 'suspension_trainer',
43
+ 'pull_up_bar',
44
+ 'bench',
45
+ 'kettlebell',
46
+ 'niche_machine',
47
+ 'exercise_ball',
48
+ 'ez_bar',
49
+ 'cardio_machine',
50
+ 'smith_machine',
51
+ 'weight_plate',
52
+ 'jump_rope',
53
+ 'battle_ropes',
54
+ 'medicine_ball',
55
+ 'ab_wheel',
56
+ 'plyo_box',
57
+ 'parallel_bars',
58
+ ];
59
+ exports.AI_HOME_EQUIPMENT = [
60
+ 'none',
61
+ 'dumbbell',
62
+ 'resistance_band',
63
+ 'pull_up_bar',
64
+ 'bench',
65
+ 'kettlebell',
66
+ 'exercise_ball',
67
+ 'jump_rope',
68
+ ];
69
+ // ── MOVEMENT PATTERNS ────────────────────────────────────────────────────────
70
+ exports.AI_MOVEMENT_PATTERNS = [
71
+ 'push_horizontal',
72
+ 'push_vertical',
73
+ 'pull_horizontal',
74
+ 'pull_vertical',
75
+ 'squat',
76
+ 'hinge',
77
+ 'lunge',
78
+ 'rotation',
79
+ 'carry',
80
+ 'isolation',
81
+ 'plyo',
82
+ 'cardio',
83
+ 'mobility',
84
+ 'balance',
85
+ 'core_stability',
86
+ ];
87
+ exports.AI_PUSH_PATTERNS = ['push_horizontal', 'push_vertical'];
88
+ exports.AI_PULL_PATTERNS = ['pull_horizontal', 'pull_vertical'];
89
+ exports.AI_LEG_PATTERNS = ['squat', 'hinge', 'lunge'];
90
+ exports.AI_CORE_PATTERNS = ['core_stability', 'rotation'];
91
+ // ── WORKOUT PLACEMENT ────────────────────────────────────────────────────────
92
+ exports.AI_WORKOUT_PLACEMENTS = [
93
+ 'primary_compound',
94
+ 'secondary_compound',
95
+ 'accessory',
96
+ 'finisher',
97
+ 'warmup',
98
+ 'cooldown',
99
+ ];
100
+ exports.AI_SESSION_ORDER = [
101
+ 'warmup',
102
+ 'primary_compound',
103
+ 'secondary_compound',
104
+ 'accessory',
105
+ 'finisher',
106
+ 'cooldown',
107
+ ];
108
+ // ── DIFFICULTY LEVELS ────────────────────────────────────────────────────────
109
+ exports.AI_DIFFICULTY_LEVELS = [
110
+ 'beginner',
111
+ 'intermediate',
112
+ 'advanced',
113
+ 'expert',
114
+ ];
115
+ exports.AI_FITNESS_LEVELS = [
116
+ 'beginner',
117
+ 'intermediate',
118
+ 'advanced',
119
+ ];
120
+ exports.AI_DIFFICULTY_FILTER = {
121
+ beginner: ['beginner'],
122
+ intermediate: ['beginner', 'intermediate'],
123
+ advanced: ['beginner', 'intermediate', 'advanced', 'expert'],
124
+ };
125
+ // ── INTENSITY LEVELS ─────────────────────────────────────────────────────────
126
+ exports.AI_INTENSITY_LEVELS = ['low', 'moderate', 'high'];
127
+ exports.AI_SLEEP_TO_MAX_CNS = {
128
+ good: 'high',
129
+ disturbed: 'moderate',
130
+ poor: 'low',
131
+ };
132
+ // ── MET VALUES ───────────────────────────────────────────────────────────────
133
+ exports.AI_MET_THRESHOLDS = {
134
+ low: 3,
135
+ moderate: 6,
136
+ high: 6,
137
+ };
138
+ // ── BODY AREAS ───────────────────────────────────────────────────────────────
139
+ exports.AI_BODY_AREAS = [
140
+ 'lower back',
141
+ 'upper back',
142
+ 'shoulders',
143
+ 'neck',
144
+ 'elbows',
145
+ 'wrists',
146
+ 'hips',
147
+ 'hip flexors',
148
+ 'knees',
149
+ 'ankles',
150
+ 'hamstrings',
151
+ 'achilles tendon',
152
+ 'forearms',
153
+ 'groin',
154
+ 'calf muscles',
155
+ 'chest',
156
+ 'core',
157
+ ];
158
+ exports.AI_BODY_AREA_LABELS = {
159
+ 'lower back': 'Lower back',
160
+ 'upper back': 'Upper back',
161
+ 'shoulders': 'Shoulder',
162
+ 'neck': 'Neck',
163
+ 'elbows': 'Elbow',
164
+ 'wrists': 'Wrist',
165
+ 'hips': 'Hip',
166
+ 'hip flexors': 'Hip flexor',
167
+ 'knees': 'Knee',
168
+ 'ankles': 'Ankle',
169
+ 'hamstrings': 'Hamstring',
170
+ 'achilles tendon': 'Achilles / calf',
171
+ 'forearms': 'Forearm',
172
+ 'groin': 'Groin',
173
+ 'calf muscles': 'Calf',
174
+ 'chest': 'Chest',
175
+ 'core': 'Core / abdomen',
176
+ };
177
+ // ── BODY ISSUE TYPES ─────────────────────────────────────────────────────────
178
+ exports.AI_BODY_ISSUE_TYPES = [
179
+ 'general_soreness',
180
+ 'joint_pain',
181
+ 'old_injury',
182
+ 'diagnosed_condition',
183
+ ];
184
+ exports.AI_BODY_ISSUE_LABELS = {
185
+ general_soreness: 'General soreness or tightness',
186
+ joint_pain: 'Joint pain or clicking',
187
+ old_injury: 'Old / healed injury (just to note)',
188
+ diagnosed_condition: 'Doctor-diagnosed condition',
189
+ };
190
+ // ── POPULARITY ───────────────────────────────────────────────────────────────
191
+ exports.AI_POPULAR_THRESHOLD = 75;
192
+ // ── SLEEP QUALITY ────────────────────────────────────────────────────────────
193
+ exports.AI_SLEEP_QUALITY_OPTIONS = ['good', 'disturbed', 'poor'];
194
+ exports.AI_SLEEP_QUALITY_LABELS = {
195
+ good: 'Slept well',
196
+ disturbed: 'Lightly disturbed',
197
+ poor: 'Poor sleep',
198
+ };
199
+ // ── USER INTENT CHIPS ────────────────────────────────────────────────────────
200
+ exports.AI_INTENT_CHIPS = [
201
+ 'Leg day',
202
+ 'Upper body',
203
+ 'Full body',
204
+ 'Push day',
205
+ 'Pull day',
206
+ 'Core & abs',
207
+ 'Something light',
208
+ 'Surprise me',
209
+ ];
@@ -1 +1,2 @@
1
1
  export * from "./BodyCategories";
2
+ export * from "./AiExerciseVocabulary";
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./BodyCategories"), exports);
18
+ __exportStar(require("./AiExerciseVocabulary"), exports);
@@ -1,4 +1,5 @@
1
- import { TAuthType, TFitnessGoal, TGender, TProfessionalCategory, TUserMetric, TUserType, TActivityLevel } from "./TApiUser";
1
+ import type { TAiFitnessGoal } from "../constants/AiExerciseVocabulary";
2
+ import { TAuthType, TGender, TProfessionalCategory, TUserMetric, TUserType, TActivityLevel } from "./TApiUser";
2
3
  export type TOnboardingData = {
3
4
  userWeightKg: number;
4
5
  dob: Date;
@@ -6,7 +7,7 @@ export type TOnboardingData = {
6
7
  userHeightCm: number;
7
8
  metricSystem: "US" | "EU";
8
9
  bodyFatPercentage: number;
9
- fitnessGoal: TFitnessGoal;
10
+ fitnessGoal: TAiFitnessGoal;
10
11
  fitnessLevel: TActivityLevel;
11
12
  gdprEssential: boolean;
12
13
  gdprAnalytics: boolean;
@@ -1,10 +1,12 @@
1
+ import type { TAiFitnessGoal } from "../constants/AiExerciseVocabulary";
1
2
  import { TGdprData } from "./commonTypes";
2
3
  export type TAuthType = "email" | "apple" | "anonymous" | "token";
3
4
  export type TGender = "male" | "female" | "unmentioned";
4
5
  export type TUserType = "regular" | "professional";
5
6
  export type TProfessionalCategory = "fitness" | "wellness" | "medical" | "sports" | "other";
6
7
  export type TUserTrainerType = "personal_trainer" | "strength_conditioning_coach" | "gym_instructor" | "fitness_coach" | "bodybuilding_coach" | "crossfit_coach" | "functional_training_specialist" | "calisthenics_trainer" | "yoga_instructor" | "pilates_instructor" | "meditation_coach" | "mindfulness_practitioner" | "breathwork_coach" | "physiotherapist" | "sports_physiotherapist" | "rehabilitation_specialist" | "chiropractor" | "orthopedic_doctor" | "sports_medicine_doctor" | "general_practitioner" | "occupational_therapist" | "kinesiologist" | "sports_coach" | "running_coach" | "cycling_coach" | "swimming_coach" | "athletic_trainer" | "performance_specialist" | "nutritionist" | "dietitian" | "health_coach" | "wellness_consultant" | "lifestyle_medicine_practitioner" | "physical_education_teacher" | "fitness_influencer" | "exercise_scientist" | "student_professional" | "other";
7
- export type TFitnessGoal = "strength" | "hypertrophy" | "endurance" | "general" | "fat_burn" | "flexibility";
8
+ /** @deprecated Use TAiFitnessGoal instead */
9
+ export type TFitnessGoal = TAiFitnessGoal;
8
10
  export type TSubscriptionStatus = "active" | "cancelled" | "expired" | "trial" | "grace" | "none";
9
11
  export type TSubscriptionType = "monthly" | "yearly" | "trial";
10
12
  export type TSubscriptionTier = "enthusiast" | "pro" | "none";
@@ -60,9 +60,12 @@ function calculateQualityScore(parsedSets, rawRecords, timingGuardrails, isStric
60
60
  strength: { completion: 0.15, consistency: 0.25, effortAdequacy: 0.45, restDiscipline: 0.15 },
61
61
  hypertrophy: { completion: 0.20, consistency: 0.35, effortAdequacy: 0.30, restDiscipline: 0.15 },
62
62
  endurance: { completion: 0.25, consistency: 0.40, effortAdequacy: 0.20, restDiscipline: 0.15 },
63
- fat_burn: { completion: 0.30, consistency: 0.30, effortAdequacy: 0.25, restDiscipline: 0.15 },
64
- flexibility: { completion: 0.40, consistency: 0.35, effortAdequacy: 0.10, restDiscipline: 0.15 },
65
- general: { completion: 0.20, consistency: 0.35, effortAdequacy: 0.30, restDiscipline: 0.15 },
63
+ fat_loss: { completion: 0.30, consistency: 0.30, effortAdequacy: 0.25, restDiscipline: 0.15 },
64
+ mobility: { completion: 0.40, consistency: 0.35, effortAdequacy: 0.10, restDiscipline: 0.15 },
65
+ general_fitness: { completion: 0.20, consistency: 0.35, effortAdequacy: 0.30, restDiscipline: 0.15 },
66
+ rehabilitation: { completion: 0.40, consistency: 0.40, effortAdequacy: 0.10, restDiscipline: 0.10 },
67
+ sport_performance: { completion: 0.20, consistency: 0.30, effortAdequacy: 0.35, restDiscipline: 0.15 },
68
+ core_strength: { completion: 0.25, consistency: 0.35, effortAdequacy: 0.25, restDiscipline: 0.15 },
66
69
  };
67
70
  const weights = (_a = goalWeights[userContext.fitnessGoal]) !== null && _a !== void 0 ? _a : constants_1.QUALITY_WEIGHTS;
68
71
  const score = Math.round(completion * weights.completion +
@@ -228,7 +228,7 @@ function extractUserContext(user) {
228
228
  gender: user.gender || "unmentioned",
229
229
  age,
230
230
  fitnessLevel: (_a = user.fitnessLevel) !== null && _a !== void 0 ? _a : "moderately-active",
231
- fitnessGoal: (_b = user.fitnessGoal) !== null && _b !== void 0 ? _b : "general",
231
+ fitnessGoal: (_b = user.fitnessGoal) !== null && _b !== void 0 ? _b : "general_fitness",
232
232
  bodyFatPercentage: (_c = user.bodyFatPercentage) !== null && _c !== void 0 ? _c : 20,
233
233
  };
234
234
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dgpholdings/greatoak-shared",
3
- "version": "1.2.64",
3
+ "version": "1.2.65",
4
4
  "description": "Shared TypeScript types and utilities for @dgpholdings projects",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",