@dgpholdings/greatoak-shared 1.2.79 → 1.2.82
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/README.md +1 -1
- package/dist/__mocks__/user.mock.js +1 -2
- package/dist/constants/AiExerciseVocabulary.d.ts +3 -0
- package/dist/constants/AiExerciseVocabulary.js +31 -1
- package/dist/types/TApiAiQuickStartWorkout.d.ts +29 -6
- package/dist/types/TApiAuth.d.ts +18 -31
- package/dist/types/TUserPreferences.d.ts +2 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ import { calculateExerciseScoreV2, calculateTotalVolume, isDefined, toError } fr
|
|
|
39
39
|
| `commonTypes.ts` | `TRecord`, `TExerciseConfig`, `TTemplateExercise`, `TGdprData`, `TDayKey` |
|
|
40
40
|
| `TApiExercise.ts` | `TExercise`, `TBodyPart`, `EBodyParts`, `TTrainingType`, `TTimingGuardrails` |
|
|
41
41
|
| `TApiUser.ts` | `TUserMetric`, `TFitnessGoal`, `TUserType`, `TSubscriptionStatus`, `TGender` |
|
|
42
|
-
| `TApiAuth.ts` |
|
|
42
|
+
| `TApiAuth.ts` | Signup/signin request & response types (`TApiSignupAnonymousReq`, `TSignInRes`, etc.) |
|
|
43
43
|
| `TApiExerciseRecord.ts` | Record save/fetch request & response types |
|
|
44
44
|
| `TApiTemplateData.ts` | `TTemplate`, `TTemplateDb`, `TTemplateData`, `TExerciseLatestRecord` |
|
|
45
45
|
| `TApiProPlan.ts` | `TProPlan`, pro plan CRUD request & response types |
|
|
@@ -3,10 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.mockUser = void 0;
|
|
4
4
|
exports.mockUser = {
|
|
5
5
|
// TUserPreferences fields (flat in TUserMetric)
|
|
6
|
-
trainingLocation: "gym",
|
|
7
6
|
preferredDurationMinutes: 45,
|
|
8
7
|
fitnessGoals: ["hypertrophy"],
|
|
9
|
-
preferredEquipment: ["
|
|
8
|
+
preferredEquipment: ["dumbbell", "barbell"],
|
|
10
9
|
preferCompoundMovements: true,
|
|
11
10
|
includeWarmup: "ai_decide",
|
|
12
11
|
includeCooldown: "ai_decide",
|
|
@@ -3,6 +3,9 @@ export type TAiFitnessGoal = (typeof AI_FITNESS_GOALS)[number];
|
|
|
3
3
|
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"];
|
|
4
4
|
export type TAiEquipmentType = (typeof AI_EQUIPMENT_TYPES)[number];
|
|
5
5
|
export declare const AI_HOME_EQUIPMENT: TAiEquipmentType[];
|
|
6
|
+
export declare const AI_QUICKSTART_EQUIPMENT_GROUPS_LIST: readonly ["gym_machines", "gym_equipment", "home_equipment", "no_equipment"];
|
|
7
|
+
export type TQuickStartEquipmentGroupExplicit = (typeof AI_QUICKSTART_EQUIPMENT_GROUPS_LIST)[number];
|
|
8
|
+
export declare const AI_QUICKSTART_EQUIPMENT_GROUPS: Record<TQuickStartEquipmentGroupExplicit, TAiEquipmentType[]>;
|
|
6
9
|
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"];
|
|
7
10
|
export type TAiMovementPattern = (typeof AI_MOVEMENT_PATTERNS)[number];
|
|
8
11
|
export declare const AI_PUSH_PATTERNS: TAiMovementPattern[];
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// Verified against 701 active exercises from exercises-v2_3_PURE.json
|
|
8
8
|
// Do not add values here without also ensuring they exist in the data.
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.AI_INTENT_CHIPS = exports.AI_ENERGY_LEVEL_OPTIONS = exports.AI_INJURY_DURATION_LABELS = exports.AI_INJURY_DURATION = exports.AI_INJURY_SEVERITY = exports.AI_POPULAR_THRESHOLD = exports.AI_BODY_ISSUE_TYPES = 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_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_GOALS = void 0;
|
|
10
|
+
exports.AI_INTENT_CHIPS = exports.AI_ENERGY_LEVEL_OPTIONS = exports.AI_INJURY_DURATION_LABELS = exports.AI_INJURY_DURATION = exports.AI_INJURY_SEVERITY = exports.AI_POPULAR_THRESHOLD = exports.AI_BODY_ISSUE_TYPES = 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_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_QUICKSTART_EQUIPMENT_GROUPS = exports.AI_QUICKSTART_EQUIPMENT_GROUPS_LIST = exports.AI_HOME_EQUIPMENT = exports.AI_EQUIPMENT_TYPES = exports.AI_FITNESS_GOALS = void 0;
|
|
11
11
|
exports.AI_FITNESS_GOALS = [
|
|
12
12
|
"strength",
|
|
13
13
|
"hypertrophy",
|
|
@@ -53,6 +53,36 @@ exports.AI_HOME_EQUIPMENT = [
|
|
|
53
53
|
"exercise_ball",
|
|
54
54
|
"jump_rope",
|
|
55
55
|
];
|
|
56
|
+
// Quick Start equipment groups
|
|
57
|
+
// Coarse buckets exposed in the Quick Start UI. Each maps to a set of
|
|
58
|
+
// TAiEquipmentType values that match Qdrant payload `equipment.primary`.
|
|
59
|
+
// "preferences" is modelled separately as the discriminated alternative
|
|
60
|
+
// (defer to user's saved preferredEquipment), so it is NOT in this map.
|
|
61
|
+
exports.AI_QUICKSTART_EQUIPMENT_GROUPS_LIST = [
|
|
62
|
+
"gym_machines",
|
|
63
|
+
"gym_equipment",
|
|
64
|
+
"home_equipment",
|
|
65
|
+
"no_equipment",
|
|
66
|
+
];
|
|
67
|
+
exports.AI_QUICKSTART_EQUIPMENT_GROUPS = {
|
|
68
|
+
gym_machines: [
|
|
69
|
+
"cable_machine",
|
|
70
|
+
"standard_machine",
|
|
71
|
+
"smith_machine",
|
|
72
|
+
"niche_machine",
|
|
73
|
+
"cardio_machine",
|
|
74
|
+
],
|
|
75
|
+
gym_equipment: [
|
|
76
|
+
"barbell",
|
|
77
|
+
"ez_bar",
|
|
78
|
+
"dumbbell",
|
|
79
|
+
"kettlebell",
|
|
80
|
+
"weight_plate",
|
|
81
|
+
"bench",
|
|
82
|
+
],
|
|
83
|
+
home_equipment: ["dumbbell", "kettlebell", "resistance_band", "bench"],
|
|
84
|
+
no_equipment: ["none"],
|
|
85
|
+
};
|
|
56
86
|
exports.AI_MOVEMENT_PATTERNS = [
|
|
57
87
|
"push_horizontal",
|
|
58
88
|
"push_vertical",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TAiEnergyLevel, TAiUserInjury } from "../constants/AiExerciseVocabulary";
|
|
1
|
+
import { TAiEnergyLevel, TAiUserInjury, TQuickStartEquipmentGroupExplicit } from "../constants/AiExerciseVocabulary";
|
|
2
2
|
import { TTemplate } from "./TApiTemplateData";
|
|
3
3
|
export type TApiAiQuickStartWorkoutReq = {
|
|
4
4
|
/**
|
|
@@ -21,11 +21,6 @@ export type TApiAiQuickStartWorkoutReq = {
|
|
|
21
21
|
* Crucial for correctly fetching "yesterday's" workout history from DynamoDB.
|
|
22
22
|
*/
|
|
23
23
|
timezone: string;
|
|
24
|
-
/**
|
|
25
|
-
* Whether the user intends to work out at home or at the gym today.
|
|
26
|
-
* If not provided, defaults to user's saved trainingLocation preference.
|
|
27
|
-
*/
|
|
28
|
-
workoutLocation: "home" | "gym";
|
|
29
24
|
/**
|
|
30
25
|
* The general time of day the user is working out.
|
|
31
26
|
* Can influence warm-up duration and intensity (e.g., morning stiffness vs. evening fatigue, Afternoon: (Peak Performance)).
|
|
@@ -47,6 +42,32 @@ export type TApiAiQuickStartWorkoutReq = {
|
|
|
47
42
|
* but the job creation and processing are not dependent on this sync succeeding.
|
|
48
43
|
*/
|
|
49
44
|
isOnPeriod?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Equipment selection for this workout session.
|
|
47
|
+
*
|
|
48
|
+
* Two mutually-exclusive modes (enforced by the discriminated union):
|
|
49
|
+
*
|
|
50
|
+
* 1. `{ type: "preferences" }`
|
|
51
|
+
* Defer to the user's saved `preferredEquipment` on their profile.
|
|
52
|
+
* Default selection in the frontend.
|
|
53
|
+
*
|
|
54
|
+
* 2. `{ type: "groups", groups: [...] }`
|
|
55
|
+
* Explicit session-level override. Each group maps to a set of
|
|
56
|
+
* `TAiEquipmentType` values via `AI_QUICKSTART_EQUIPMENT_GROUPS`.
|
|
57
|
+
* Multi-select; the backend takes the union of all groups' equipment.
|
|
58
|
+
* Must contain at least one group (enforced at API edge).
|
|
59
|
+
*
|
|
60
|
+
* Empty-result policy: if the resolved equipment set is empty (e.g. user
|
|
61
|
+
* picked "preferences" but profile has no preferredEquipment yet), the
|
|
62
|
+
* backend treats it as "no equipment filter" — i.e. all candidates eligible.
|
|
63
|
+
*/
|
|
64
|
+
equipmentSelectionOverride: TQuickStartEquipmentSelection;
|
|
65
|
+
};
|
|
66
|
+
export type TQuickStartEquipmentSelection = {
|
|
67
|
+
type: "preferences";
|
|
68
|
+
} | {
|
|
69
|
+
type: "groups";
|
|
70
|
+
groups: TQuickStartEquipmentGroupExplicit[];
|
|
50
71
|
};
|
|
51
72
|
export type TAiEnrichedContext = {
|
|
52
73
|
qdrantFilters: {
|
|
@@ -65,6 +86,8 @@ export type TAiEnrichedContext = {
|
|
|
65
86
|
activeInjuries: TAiUserInjury[];
|
|
66
87
|
avoidedAreas: string[];
|
|
67
88
|
yesterdaysExercises: string[];
|
|
89
|
+
isOnPeriod?: boolean;
|
|
90
|
+
availableTimeMinutes?: number;
|
|
68
91
|
};
|
|
69
92
|
};
|
|
70
93
|
/**
|
package/dist/types/TApiAuth.d.ts
CHANGED
|
@@ -1,48 +1,35 @@
|
|
|
1
|
-
import type { TAiFitnessGoal
|
|
1
|
+
import type { TAiFitnessGoal } from "../constants/AiExerciseVocabulary";
|
|
2
2
|
import { TAuthType, TGender, TProfessionalCategory, TUserMetric, TUserType, TInjuryInfo } from "./TApiUser";
|
|
3
|
-
import { TActivityLevel
|
|
3
|
+
import { TActivityLevel } from "./TUserPreferences";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Anonymous signup request.
|
|
6
|
+
*
|
|
7
|
+
* Only fields actually collected during onboarding are declared here.
|
|
8
|
+
* Workout preferences (preferredEquipment, preferredDurationMinutes, warmup
|
|
9
|
+
* style, etc.) are populated server-side with sensible defaults — see
|
|
10
|
+
* `loginAnonymousController` and `core/constants.ts` in the backend.
|
|
11
|
+
*
|
|
12
|
+
* Essential GDPR consent is implicit at anonymous signup (the user can't
|
|
13
|
+
* proceed without it), so it isn't part of the wire contract.
|
|
7
14
|
*/
|
|
8
|
-
export type
|
|
15
|
+
export type TApiSignupAnonymousReq = {
|
|
16
|
+
model: string;
|
|
17
|
+
deviceUniqueId: string;
|
|
18
|
+
appLanguage: string;
|
|
19
|
+
fullName?: string;
|
|
20
|
+
userType: TUserType;
|
|
21
|
+
professionType?: TProfessionalCategory;
|
|
9
22
|
weightKg: number;
|
|
10
23
|
heightCm: number;
|
|
11
24
|
dob: Date;
|
|
12
25
|
gender: TGender;
|
|
13
26
|
bodyFatPercentage: number;
|
|
14
27
|
metricSystem: "US" | "EU";
|
|
15
|
-
appLanguage: string;
|
|
16
28
|
fitnessGoals: TAiFitnessGoal[];
|
|
17
29
|
fitnessLevel: TActivityLevel;
|
|
18
|
-
avoidBodyAreas?: TAiBodyArea[];
|
|
19
30
|
injuryInfo?: TInjuryInfo;
|
|
20
|
-
gdprEssential?: boolean;
|
|
21
31
|
gdprAnalytics: boolean;
|
|
22
32
|
gdprMarketing: boolean;
|
|
23
|
-
userCode: string;
|
|
24
|
-
userType: TUserType;
|
|
25
|
-
professionType?: TProfessionalCategory;
|
|
26
|
-
email?: string;
|
|
27
|
-
fullName?: string;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Anonymous signup request
|
|
31
|
-
* = Core onboarding data + device info + OPTIONAL workout preferences
|
|
32
|
-
*/
|
|
33
|
-
export type TApiSignupAnonymousReq = Omit<TOnboardingData, "userCode"> & {
|
|
34
|
-
model: string;
|
|
35
|
-
deviceUniqueId: string;
|
|
36
|
-
trainingLocation?: TStablePreferences["trainingLocation"];
|
|
37
|
-
preferredDurationMinutes?: TStablePreferences["preferredDurationMinutes"];
|
|
38
|
-
preferredEquipment?: TStablePreferences["preferredEquipment"];
|
|
39
|
-
preferCompoundMovements?: TStablePreferences["preferCompoundMovements"];
|
|
40
|
-
includeWarmup?: TStablePreferences["includeWarmup"];
|
|
41
|
-
includeCooldown?: TStablePreferences["includeCooldown"];
|
|
42
|
-
warmupStyle?: TStablePreferences["warmupStyle"];
|
|
43
|
-
favouriteMuscleGroups?: TStablePreferences["favouriteMuscleGroups"];
|
|
44
|
-
blacklistedExerciseIds?: TStablePreferences["blacklistedExerciseIds"];
|
|
45
|
-
femaleHealth?: TFemaleHealthContext | null;
|
|
46
33
|
};
|
|
47
34
|
export type TApiSignupAnonymousRes = TSignInRes & {
|
|
48
35
|
authType: "anonymous";
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import { TAiFitnessGoal } from "../constants";
|
|
1
|
+
import { TAiEquipmentType, TAiFitnessGoal } from "../constants";
|
|
2
2
|
import { TBodyPart } from "./TApiExercise";
|
|
3
|
-
export type TTrainingLocation = "gym" | "home" | "both";
|
|
4
3
|
export type TPreferredDuration = 20 | 30 | 45 | 60 | 90 | 120;
|
|
5
4
|
export type TAIDecision = "yes" | "no" | "ai_decide";
|
|
6
5
|
export type TWarmupStyle = "dynamic_stretching" | "light_cardio";
|
|
7
|
-
export type TPreferredEquipment = "machines" | "weights" | "free_hand";
|
|
8
6
|
export type TStablePreferences = {
|
|
9
|
-
trainingLocation: TTrainingLocation;
|
|
10
7
|
preferredDurationMinutes: TPreferredDuration;
|
|
11
8
|
fitnessGoals: TAiFitnessGoal[];
|
|
12
|
-
preferredEquipment:
|
|
9
|
+
preferredEquipment: TAiEquipmentType[];
|
|
13
10
|
preferCompoundMovements: boolean;
|
|
14
11
|
includeWarmup: TAIDecision;
|
|
15
12
|
includeCooldown: TAIDecision;
|