@dgpholdings/greatoak-shared 1.2.29 → 1.2.30

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 CHANGED
@@ -1,93 +1,118 @@
1
- # Shared
1
+ # @dgpholdings/greatoak-shared
2
2
 
3
+ The shared library for the Fitfrix ecosystem. Contains all types, utilities, and the scoring engine used across:
3
4
 
5
+ - `v2/fitfrix` — the mobile app (React Native / Expo)
6
+ - `backend/api-service` — the NestJS backend
7
+ - `fitfrix.com` — the web/landing (Vite + React)
4
8
 
5
- ## Getting started
9
+ Any type, constant, or utility that is used by more than one package lives here. If you're about to define a type locally in a consuming app — check here first.
6
10
 
7
- To make it easy for you to get started with GitLab, here's a list of recommended next steps.
11
+ ---
8
12
 
9
- Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
13
+ ## Install / Import
10
14
 
11
- ## Add your files
15
+ ```ts
16
+ // Types
17
+ import type { TExercise, TRecord, TUserMetric } from '@dgpholdings/greatoak-shared';
12
18
 
13
- - [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
14
- - [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
15
-
16
- ```
17
- cd existing_repo
18
- git remote add origin https://gitlab.com/greatoak/shared.git
19
- git branch -M main
20
- git push -uf origin main
19
+ // Utils
20
+ import { calculateExerciseScoreV2, calculateTotalVolume, isDefined, toError } from '@dgpholdings/greatoak-shared';
21
21
  ```
22
22
 
23
- ## Integrate with your tools
24
-
25
- - [ ] [Set up project integrations](https://gitlab.com/greatoak/shared/-/settings/integrations)
26
-
27
- ## Collaborate with your team
28
-
29
- - [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
30
- - [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
31
- - [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
32
- - [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
33
- - [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
34
-
35
- ## Test and Deploy
36
-
37
- Use the built-in continuous integration in GitLab.
38
-
39
- - [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
40
- - [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
41
- - [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
42
- - [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
43
- - [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
44
-
45
- ***
46
-
47
- # Editing this README
48
-
49
- When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
50
-
51
- ## Suggestions for a good README
52
-
53
- Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
23
+ ---
24
+
25
+ ## What's Inside
26
+
27
+ | Category | Location | Doc |
28
+ |---|---|---|
29
+ | **Types** | `src/types/` | [docs/types.md](docs/types.md) |
30
+ | **Utils** | `src/utils/` | [docs/utils.md](docs/utils.md) |
31
+ | **Scoring Engine** | `src/utils/scoring/` | [docs/scoring.md](docs/scoring.md) |
32
+
33
+ ---
34
+
35
+ ## Types Quick Reference
36
+
37
+ | File | What it defines |
38
+ |---|---|
39
+ | `commonTypes.ts` | `TRecord`, `TExerciseConfig`, `TTemplateExercise`, `TGdprData`, `TDayKey` |
40
+ | `TApiExercise.ts` | `TExercise`, `TBodyPart`, `EBodyParts`, `TTrainingType`, `TTimingGuardrails` |
41
+ | `TApiUser.ts` | `TUserMetric`, `TFitnessGoal`, `TUserType`, `TSubscriptionStatus`, `TGender` |
42
+ | `TApiAuth.ts` | `TOnboardingData`, signup/signin request & response types |
43
+ | `TApiExerciseRecord.ts` | Record save/fetch request & response types |
44
+ | `TApiTemplateData.ts` | `TTemplate`, `TTemplateDb`, `TTemplateData`, `TExerciseLatestRecord` |
45
+ | `TApiProPlan.ts` | `TProPlan`, pro plan CRUD request & response types |
46
+ | `TApiTemplateShop.ts` | `TTemplateShopDb`, shop CRUD & shared plan types |
47
+ | `TApiBillingPlan.ts` | `TBillingPlan`, `TBillingCountries`, billing API types |
48
+ | `TApiRevenueCat.ts` | `TApiRevenueCatWebhookReq`, RevenueCat event types |
49
+ | `TApiClientProgress.ts` | `TClientWorkoutHistory`, trainer dashboard types |
50
+
51
+ ---
52
+
53
+ ## Utils Quick Reference
54
+
55
+ | Export | What it does |
56
+ |---|---|
57
+ | `calculateExerciseScoreV2` | Full exercise scoring → `{ score, muscleScores }` |
58
+ | `calculateTotalVolume` | Total workout volume for charts |
59
+ | `isDefined` / `isDefinedNumber` | Null/undefined type guards |
60
+ | `toError` | Converts unknown catch values to `Error` |
61
+ | `toNumber` | Safe string/number → `number \| undefined` |
62
+ | `mmssToSecs` | `"MM:SS"` → seconds |
63
+ | `getDaysAndHoursDifference` | Date diff → `{ days, hours }` |
64
+ | `isUserAllowedToUpdate` | Profile update rate-limit guard |
65
+ | `countryToCurrencyCode` | Country code → ISO currency string |
66
+ | `slugifyText` | Text → URL-safe slug |
67
+ | `generatePlanCode` | Generates a unique 9-char Crockford Base32 plan code |
68
+ | `maskEmail` / `isEmail` / `isAnonymousEmail` | Email utilities |
69
+ | `NOOP` | Empty function `() => {}` |
70
+
71
+ ---
72
+
73
+ ## Source Structure
54
74
 
55
- ## Name
56
- Choose a self-explaining name for your project.
57
-
58
- ## Description
59
- Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
60
-
61
- ## Badges
62
- On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
63
-
64
- ## Visuals
65
- Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
66
-
67
- ## Installation
68
- Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
69
-
70
- ## Usage
71
- Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
72
-
73
- ## Support
74
- Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
75
-
76
- ## Roadmap
77
- If you have ideas for releases in the future, it is a good idea to list them in the README.
78
-
79
- ## Contributing
80
- State if you are open to contributions and what your requirements are for accepting them.
81
-
82
- For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
83
-
84
- You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
75
+ ```
76
+ shared/
77
+ ├── src/
78
+ │ ├── types/
79
+ │ │ ├── index.ts # Re-exports all types
80
+ │ │ ├── commonTypes.ts # TRecord, TExerciseConfig, TTemplateExercise, TGdprData, TDayKey
81
+ │ │ ├── TApiExercise.ts # TExercise and related
82
+ │ │ ├── TApiUser.ts # TUserMetric and related
83
+ │ │ ├── TApiAuth.ts # Auth flows
84
+ │ │ ├── TApiExerciseRecord.ts # Workout record save/fetch
85
+ │ │ ├── TApiTemplateData.ts # User workout templates
86
+ │ │ ├── TApiProPlan.ts # Pro/trainer plans
87
+ │ │ ├── TApiTemplateShop.ts # Template shop (legacy, see TApiProPlan)
88
+ │ │ ├── TApiBillingPlan.ts # Billing plans
89
+ │ │ ├── TApiRevenueCat.ts # In-app purchase webhooks
90
+ │ │ └── TApiClientProgress.ts # Trainer client tracking
91
+ │ └── utils/
92
+ │ ├── index.ts # Re-exports all utils
93
+ │ ├── billing.utils.ts
94
+ │ ├── email.utils.ts
95
+ │ ├── isDefined.utils.ts
96
+ │ ├── noop.utils.ts
97
+ │ ├── number.util.ts
98
+ │ ├── planCode.util.ts
99
+ │ ├── slugify.util.ts
100
+ │ ├── time.util.ts
101
+ │ ├── toError.util.ts
102
+ │ └── scoring/ # Exercise scoring engine
103
+ │ └── README.md # Full scoring documentation
104
+ ├── docs/
105
+ │ ├── types.md # All types documented in detail
106
+ │ ├── utils.md # All utils documented with examples
107
+ │ └── scoring.md # Scoring system overview
108
+ └── README.md # This file
109
+ ```
85
110
 
86
- ## Authors and acknowledgment
87
- Show your appreciation to those who have contributed to the project.
111
+ ---
88
112
 
89
- ## License
90
- For open source projects, say how it is licensed.
113
+ ## Key Design Rules
91
114
 
92
- ## Project status
93
- If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
115
+ - **No local duplication** — if a type or utility is needed by ≥2 packages, it belongs here
116
+ - **No framework code** this package must stay framework-agnostic (no React, no NestJS decorators)
117
+ - **Strict types** — no `any`. Use generics, discriminated unions, or `unknown`
118
+ - **Scoring is the business core** — the scoring engine drives the muscle fatigue diagram and progress charts. Read [docs/scoring.md](docs/scoring.md) before touching it
@@ -122,6 +122,7 @@ export type TExercise = {
122
122
  popularityIndex: number;
123
123
  isFavorite?: boolean;
124
124
  scoringSpecialHandling?: "plyometric" | "stretch-mobility" | "continuous-duration" | "loaded-carry";
125
+ isFlaggedCorrection?: boolean;
125
126
  };
126
127
  export type TBodyPartExercises = Record<TBodyPart, TExercise[]>;
127
128
  export type TApiCreateOrUpdateExerciseReq = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dgpholdings/greatoak-shared",
3
- "version": "1.2.29",
3
+ "version": "1.2.30",
4
4
  "description": "Shared TypeScript types and utilities for @dgpholdings projects",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",