@dgpholdings/greatoak-shared 1.1.20 → 1.1.22

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.
@@ -38,7 +38,7 @@ export type TExercise = {
38
38
  primaryMuscles: TBodyPartKeys;
39
39
  secondaryMuscles: TBodyPartKeys;
40
40
  trainingTypes: TTrainingType[];
41
- isCompoundExercise: boolean;
41
+ avgSetDurationInSecs?: number;
42
42
  difficultyLevel: number;
43
43
  hypertrophyLevel: number;
44
44
  strengthGainLevel: number;
@@ -29,11 +29,11 @@ export type TRecordBodyWeight = Extract<TRecord, {
29
29
  }>;
30
30
  export type TRecordConfig = {
31
31
  enableAuxWeight?: boolean;
32
- enableRestTime?: boolean;
33
32
  enableRir?: boolean;
34
33
  enableRpe?: boolean;
35
34
  enableSetNote?: boolean;
36
35
  enableExerciseNote?: boolean;
36
+ enableRestTime?: boolean;
37
37
  };
38
38
  export type TApiExerciseRecordUpdateReq = {
39
39
  templateId: string;
@@ -42,6 +42,7 @@ export type TApiExerciseRecordUpdateReq = {
42
42
  exerciseId: string;
43
43
  config: TRecordConfig;
44
44
  exerciseNote: string;
45
+ restTimeSecs?: number;
45
46
  record: TRecord[];
46
47
  }[];
47
48
  };
@@ -40,6 +40,7 @@ export type TApiTemplateUpdateRes = {
40
40
  export type TExerciseLatestRecord = {
41
41
  recordDate: Date;
42
42
  exerciseNote?: string;
43
+ restTimeSecs?: number;
43
44
  score: number;
44
45
  records: {
45
46
  kg?: Extract<TRecord, {
@@ -1,16 +1,19 @@
1
- import { TRecord } from "../types";
2
- export interface TUserProfile {
1
+ import { TRefinedRecord } from "./record.utils";
2
+ type TUserProfile = {
3
3
  age?: number;
4
4
  gender?: "male" | "female" | "non-binary" | "unspecified";
5
5
  weightKg?: number;
6
- }
7
- export interface TRecordInput {
8
- isDone: boolean;
9
- kg?: number;
10
- reps?: number;
11
- durationSecs?: string;
12
- rpe?: number;
13
- rir?: number;
14
- auxWeightKg?: number;
15
- }
16
- export declare const computeScoreFromRecord: (record: TRecordInput, recordType: TRecord["type"], userProfile?: TUserProfile) => number;
6
+ };
7
+ /**
8
+ * The score represents the training stimulus or workload stress generated by a specific set of exercise inputs.
9
+ * in short: Training Stress Score (TSS)
10
+ * We can use the score for:
11
+ 1.Tracking session intensity or set difficulty over time
12
+ 2. Deciding muscle recovery readiness
13
+ 3. Creating training summaries, like:
14
+ - Daily workload
15
+ - Volume comparisons
16
+ - Weekly fatigue trends
17
+ */
18
+ export declare const computeScoreFromRecord: (record: TRefinedRecord, userProfile?: TUserProfile) => number;
19
+ export {};
@@ -2,8 +2,19 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.computeScoreFromRecord = void 0;
4
4
  const time_util_1 = require("./time.util");
5
- const computeScoreFromRecord = (record, recordType, userProfile) => {
6
- var _a, _b, _c, _d, _e, _f, _g, _h;
5
+ /**
6
+ * The score represents the training stimulus or workload stress generated by a specific set of exercise inputs.
7
+ * in short: Training Stress Score (TSS)
8
+ * We can use the score for:
9
+ 1.Tracking session intensity or set difficulty over time
10
+ 2. Deciding muscle recovery readiness
11
+ 3. Creating training summaries, like:
12
+ - Daily workload
13
+ - Volume comparisons
14
+ - Weekly fatigue trends
15
+ */
16
+ const computeScoreFromRecord = (record, userProfile) => {
17
+ var _a, _b, _c, _d, _e, _f;
7
18
  if (!record.isDone)
8
19
  return 0;
9
20
  // Determine load and effortFactor from record based on type
@@ -19,22 +30,20 @@ const computeScoreFromRecord = (record, recordType, userProfile) => {
19
30
  effortFactor = 10 - rir; // lower RIR means more effort
20
31
  }
21
32
  // Step 2: Determine load
22
- switch (recordType) {
33
+ switch (record.type) {
23
34
  case "weight-reps": {
24
- const kg = (_c = record.kg) !== null && _c !== void 0 ? _c : 0;
25
- const reps = (_d = record.reps) !== null && _d !== void 0 ? _d : 0;
26
- load = kg * reps;
35
+ load = record.kg * record.reps;
27
36
  break;
28
37
  }
29
38
  case "duration": {
30
- const durationSecs = (0, time_util_1.mmssToSecs)((_e = record.durationSecs) !== null && _e !== void 0 ? _e : "00:00");
31
- const auxWeight = (_f = record.auxWeightKg) !== null && _f !== void 0 ? _f : 0;
39
+ const durationSecs = (0, time_util_1.mmssToSecs)((_c = record.durationSecs) !== null && _c !== void 0 ? _c : "00:00");
40
+ const auxWeight = (_d = record.auxWeightKg) !== null && _d !== void 0 ? _d : 0;
32
41
  load = auxWeight > 0 ? auxWeight * durationSecs : durationSecs;
33
42
  break;
34
43
  }
35
44
  case "reps-only": {
36
- const reps = (_g = record.reps) !== null && _g !== void 0 ? _g : 0;
37
- const auxWeight = (_h = record.auxWeightKg) !== null && _h !== void 0 ? _h : 0;
45
+ const reps = (_e = record.reps) !== null && _e !== void 0 ? _e : 0;
46
+ const auxWeight = (_f = record.auxWeightKg) !== null && _f !== void 0 ? _f : 0;
38
47
  load = auxWeight > 0 ? auxWeight * reps : reps;
39
48
  break;
40
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dgpholdings/greatoak-shared",
3
- "version": "1.1.20",
3
+ "version": "1.1.22",
4
4
  "description": "Shared TypeScript types and utilities for @dgpholdings projects",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",