@dgpholdings/greatoak-shared 1.2.77 → 1.2.81
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/__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 +46 -5
- package/dist/types/TApiAuth.d.ts +0 -1
- package/dist/types/TUserPreferences.d.ts +2 -5
- package/dist/utils/time.util.js +2 -10
- package/package.json +1 -1
|
@@ -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
|
/**
|
|
@@ -13,6 +13,7 @@ export type TApiAiQuickStartWorkoutReq = {
|
|
|
13
13
|
/**
|
|
14
14
|
* Optional: How much time the user has for the workout.
|
|
15
15
|
* Helps the AI determine the number of exercises and sets.
|
|
16
|
+
* If not provided, defaults to user's saved preferredDurationMinutes preference.
|
|
16
17
|
*/
|
|
17
18
|
availableTimeMinutes?: number;
|
|
18
19
|
/**
|
|
@@ -20,15 +21,53 @@ export type TApiAiQuickStartWorkoutReq = {
|
|
|
20
21
|
* Crucial for correctly fetching "yesterday's" workout history from DynamoDB.
|
|
21
22
|
*/
|
|
22
23
|
timezone: string;
|
|
23
|
-
/**
|
|
24
|
-
* Whether the user intends to work out at home or at the gym today.
|
|
25
|
-
*/
|
|
26
|
-
workoutLocation: "home" | "gym";
|
|
27
24
|
/**
|
|
28
25
|
* The general time of day the user is working out.
|
|
29
26
|
* Can influence warm-up duration and intensity (e.g., morning stiffness vs. evening fatigue, Afternoon: (Peak Performance)).
|
|
30
27
|
*/
|
|
31
28
|
workoutTime: "morning" | "afternoon" | "evening" | "night";
|
|
29
|
+
/**
|
|
30
|
+
* Optional: Female health context override for this specific workout.
|
|
31
|
+
* Indicates if the user is on their period today, which helps the AI:
|
|
32
|
+
* - Adjust workout intensity and volume appropriately
|
|
33
|
+
* - Include more stretching and mobility work
|
|
34
|
+
* - Avoid high-impact movements if needed
|
|
35
|
+
* - Consider energy levels more conservatively
|
|
36
|
+
*
|
|
37
|
+
* If provided, this overrides the user's saved femaleHealth.isOnPeriod preference for this workout only.
|
|
38
|
+
* If not provided, the worker will use the value from the user's profile.
|
|
39
|
+
*
|
|
40
|
+
* Note: This is a session-level override. The createJobController will optionally sync this
|
|
41
|
+
* value back to the user's profile asynchronously (fire-and-forget) to keep preferences in sync,
|
|
42
|
+
* but the job creation and processing are not dependent on this sync succeeding.
|
|
43
|
+
*/
|
|
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[];
|
|
32
71
|
};
|
|
33
72
|
export type TAiEnrichedContext = {
|
|
34
73
|
qdrantFilters: {
|
|
@@ -47,6 +86,8 @@ export type TAiEnrichedContext = {
|
|
|
47
86
|
activeInjuries: TAiUserInjury[];
|
|
48
87
|
avoidedAreas: string[];
|
|
49
88
|
yesterdaysExercises: string[];
|
|
89
|
+
isOnPeriod?: boolean;
|
|
90
|
+
availableTimeMinutes?: number;
|
|
50
91
|
};
|
|
51
92
|
};
|
|
52
93
|
/**
|
package/dist/types/TApiAuth.d.ts
CHANGED
|
@@ -33,7 +33,6 @@ export type TOnboardingData = {
|
|
|
33
33
|
export type TApiSignupAnonymousReq = Omit<TOnboardingData, "userCode"> & {
|
|
34
34
|
model: string;
|
|
35
35
|
deviceUniqueId: string;
|
|
36
|
-
trainingLocation?: TStablePreferences["trainingLocation"];
|
|
37
36
|
preferredDurationMinutes?: TStablePreferences["preferredDurationMinutes"];
|
|
38
37
|
preferredEquipment?: TStablePreferences["preferredEquipment"];
|
|
39
38
|
preferCompoundMovements?: TStablePreferences["preferCompoundMovements"];
|
|
@@ -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;
|
package/dist/utils/time.util.js
CHANGED
|
@@ -25,15 +25,7 @@ const getDaysAndHoursDifference = ({ oldDate, newDate, }) => {
|
|
|
25
25
|
};
|
|
26
26
|
exports.getDaysAndHoursDifference = getDaysAndHoursDifference;
|
|
27
27
|
const isUserAllowedToUpdate = ({ createdAt, updatedAt }) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
oldDate: updatedAt,
|
|
31
|
-
newDate: now,
|
|
32
|
-
});
|
|
33
|
-
const diffUserCreationAndLastUpdate = (0, exports.getDaysAndHoursDifference)({
|
|
34
|
-
oldDate: createdAt,
|
|
35
|
-
newDate: updatedAt,
|
|
36
|
-
});
|
|
37
|
-
return diffUserCreationAndLastUpdate.hours <= 1 || sinceLastUpdated.hours > 8;
|
|
28
|
+
// Time restriction removed - users can always update their profile
|
|
29
|
+
return true;
|
|
38
30
|
};
|
|
39
31
|
exports.isUserAllowedToUpdate = isUserAllowedToUpdate;
|