@dgpholdings/greatoak-shared 1.1.18 → 1.1.20

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.
@@ -5,4 +5,9 @@ export type TApiUserUpdateReq = {
5
5
  emailAddress?: string;
6
6
  gender: "male" | "female" | "unmentioned";
7
7
  };
8
- export type TApiUserUpdateRes = TApiUserUpdateReq;
8
+ export type TApiUserUpdateRes = {
9
+ status: 400;
10
+ } | {
11
+ status: 200;
12
+ user: TApiUserUpdateReq;
13
+ };
@@ -1,4 +1,4 @@
1
- export type TRecordType = "weight-reps" | "duration" | "body-weight";
1
+ import { TRecord } from "../types";
2
2
  export interface TUserProfile {
3
3
  age?: number;
4
4
  gender?: "male" | "female" | "non-binary" | "unspecified";
@@ -13,4 +13,4 @@ export interface TRecordInput {
13
13
  rir?: number;
14
14
  auxWeightKg?: number;
15
15
  }
16
- export declare function computeScoreFromRecord(record: TRecordInput, recordType: TRecordType, userProfile?: TUserProfile): number;
16
+ export declare const computeScoreFromRecord: (record: TRecordInput, recordType: TRecord["type"], userProfile?: TUserProfile) => number;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.computeScoreFromRecord = computeScoreFromRecord;
3
+ exports.computeScoreFromRecord = void 0;
4
4
  const time_util_1 = require("./time.util");
5
- function computeScoreFromRecord(record, recordType, userProfile) {
5
+ const computeScoreFromRecord = (record, recordType, userProfile) => {
6
6
  var _a, _b, _c, _d, _e, _f, _g, _h;
7
7
  if (!record.isDone)
8
8
  return 0;
@@ -32,7 +32,7 @@ function computeScoreFromRecord(record, recordType, userProfile) {
32
32
  load = auxWeight > 0 ? auxWeight * durationSecs : durationSecs;
33
33
  break;
34
34
  }
35
- case "body-weight": {
35
+ case "reps-only": {
36
36
  const reps = (_g = record.reps) !== null && _g !== void 0 ? _g : 0;
37
37
  const auxWeight = (_h = record.auxWeightKg) !== null && _h !== void 0 ? _h : 0;
38
38
  load = auxWeight > 0 ? auxWeight * reps : reps;
@@ -42,8 +42,9 @@ function computeScoreFromRecord(record, recordType, userProfile) {
42
42
  return 0;
43
43
  }
44
44
  return computeFinalScore(load, effortFactor, userProfile);
45
- }
46
- function computeFinalScore(load, effortFactor, userProfile) {
45
+ };
46
+ exports.computeScoreFromRecord = computeScoreFromRecord;
47
+ const computeFinalScore = (load, effortFactor, userProfile) => {
47
48
  const base = Math.log10(1 + Math.max(0, load));
48
49
  const effortBoost = 1 + Math.min(effortFactor, 10) * 0.05;
49
50
  // Optional scaling
@@ -57,4 +58,4 @@ function computeFinalScore(load, effortFactor, userProfile) {
57
58
  adjustment *= normalizedWeight / userProfile.weightKg;
58
59
  }
59
60
  return base * effortBoost * adjustment;
60
- }
61
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dgpholdings/greatoak-shared",
3
- "version": "1.1.18",
3
+ "version": "1.1.20",
4
4
  "description": "Shared TypeScript types and utilities for @dgpholdings projects",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",