@plus45/types 1.1.23 → 1.1.25

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,23 +1,23 @@
1
- # Plus45-Types
2
-
3
- This is a type library so that common types may be shared and maintained between the frontend and backend. The types are stored in the `/types` directory.
4
-
5
- # Publishing
6
-
7
- After updating types, you can push the changes by first going to `package.json` and incrementing the version number. Then, in the `plus45-types` directory, run this command:
8
-
9
- ```bash
10
- npm publish
11
- ```
12
-
13
- Make sure to push changes to the plus45-types directory to main when updating.
14
-
15
- \*\*If you get an error that says "This command requires you to be logged in," you must be a member of the Plus45 organization. You can sign into your npm account by typing `npm login`, press enter, then follow the steps to log in. You should now be able to publish.
16
-
17
- # Updating Packages
18
-
19
- If a new update is published for the @plus45/types package, you must manually update and install the new packages. You can do so by entering this in the `root` directory (you may also filter this to the frontend or backend):
20
-
21
- ```bash
22
- pnpm update-types
23
- ```
1
+ # Plus45-Types
2
+
3
+ This is a type library so that common types may be shared and maintained between the frontend and backend. The types are stored in the `/types` directory.
4
+
5
+ # Publishing
6
+
7
+ After updating types, you can push the changes by first going to `package.json` and incrementing the version number. Then, in the `plus45-types` directory, run this command:
8
+
9
+ ```bash
10
+ npm publish
11
+ ```
12
+
13
+ Make sure to push changes to the plus45-types directory to main when updating.
14
+
15
+ \*\*If you get an error that says "This command requires you to be logged in," you must be a member of the Plus45 organization. You can sign into your npm account by typing `npm login`, press enter, then follow the steps to log in. You should now be able to publish.
16
+
17
+ # Updating Packages
18
+
19
+ If a new update is published for the @plus45/types package, you must manually update and install the new packages. You can do so by entering this in the `root` directory (you may also filter this to the frontend or backend):
20
+
21
+ ```bash
22
+ pnpm update-types
23
+ ```
package/index.ts CHANGED
@@ -1,42 +1,44 @@
1
- import { Exercise } from "./types/exercise/exercise";
2
- import ExerciseType from "./types/exercise/exercise_types";
3
- import { AccessToken } from "./types/user/access_token";
4
- import { User } from "./types/user/user";
5
- import {
6
- DistanceUnits,
7
- ExerciseUnit,
8
- TimeUnits,
9
- WeightUnits
10
- } from "./types/exercise/exercise_units";
11
- import { Workout } from "./types/workout/workout";
12
- import { Schedule } from "./types/schedule/schedule";
13
- import { ScheduleDay } from "./types/schedule/schedule_days";
14
- import { ScheduleRecurrence } from "./types/schedule/schedule_recurrence";
15
- import { UserSessionInfo } from "./types/user/session_info";
16
-
17
- export {
18
- // User Type Structures
19
- type User,
20
- type UserSessionInfo,
21
-
22
- // Exercise Type Structures
23
- type Exercise,
24
- type AccessToken,
25
-
26
- // Workout Type Structures
27
- type Workout,
28
-
29
- // Schedule Type Structures
30
- type Schedule,
31
-
32
- // Enums
33
- ExerciseType,
34
- ExerciseUnit,
35
- ScheduleDay,
36
- ScheduleRecurrence,
37
-
38
- // Collections
39
- WeightUnits,
40
- DistanceUnits,
41
- TimeUnits
42
- };
1
+ import { Exercise } from "./types/exercise/exercise";
2
+ import ExerciseType from "./types/exercise/exercise_types";
3
+ import { AccessToken } from "./types/user/access_token";
4
+ import { User } from "./types/user/user";
5
+ import {
6
+ DistanceUnits,
7
+ ExerciseUnit,
8
+ TimeUnits,
9
+ WeightUnits
10
+ } from "./types/exercise/exercise_units";
11
+ import { Workout } from "./types/workout/workout";
12
+ import { Schedule } from "./types/schedule/schedule";
13
+ import { ScheduleDay } from "./types/schedule/schedule_days";
14
+ import { ScheduleRecurrence } from "./types/schedule/schedule_recurrence";
15
+ import { UserSessionInfo } from "./types/user/session_info";
16
+ import { ExerciseExecution } from "./types/exercise-executions/exercise_execution";
17
+
18
+ export {
19
+ // User Type Structures
20
+ type User,
21
+ type UserSessionInfo,
22
+ type AccessToken,
23
+
24
+ // Exercise Type Structures
25
+ type Exercise,
26
+ type ExerciseExecution,
27
+
28
+ // Workout Type Structures
29
+ type Workout,
30
+
31
+ // Schedule Type Structures
32
+ type Schedule,
33
+
34
+ // Enums
35
+ ExerciseType,
36
+ ExerciseUnit,
37
+ ScheduleDay,
38
+ ScheduleRecurrence,
39
+
40
+ // Collections
41
+ WeightUnits,
42
+ DistanceUnits,
43
+ TimeUnits
44
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
- {
2
- "name": "@plus45/types",
3
- "version": "1.1.23",
4
- "main": "index.ts",
5
- "types": "index.ts"
6
- }
1
+ {
2
+ "name": "@plus45/types",
3
+ "version": "1.1.25",
4
+ "main": "index.ts",
5
+ "types": "index.ts"
6
+ }
@@ -1,16 +1,16 @@
1
- import ExerciseType from "./exercise_types";
2
- import { ExerciseUnit } from "./exercise_units";
3
-
4
- export type Exercise = {
5
- id: string;
6
- name: string;
7
- created_by: string;
8
- type: ExerciseType;
9
- description?: string;
10
- sets?: number;
11
- reps?: number;
12
- value?: number;
13
- value_unit?: ExerciseUnit;
14
- created_at: Date;
15
- deleted?: boolean;
16
- };
1
+ import ExerciseType from "./exercise_types";
2
+ import { ExerciseUnit } from "./exercise_units";
3
+
4
+ export type Exercise = {
5
+ id: string;
6
+ name: string;
7
+ created_by: string;
8
+ type: ExerciseType;
9
+ description?: string;
10
+ sets?: number;
11
+ reps?: number;
12
+ value?: number;
13
+ value_unit?: ExerciseUnit;
14
+ created_at: Date;
15
+ deleted?: boolean;
16
+ };
@@ -1,26 +1,26 @@
1
- /**
2
- * Enum for different types of exercises.
3
- */
4
- enum ExerciseType {
5
- /**
6
- * Sets-Reps based exercise (e.g. 3x10)
7
- */
8
- STRENGTH = "STRENGTH",
9
-
10
- /**
11
- * Time based exercise (e.g. 3x30s)
12
- */
13
- TIME = "TIME",
14
-
15
- /**
16
- * Distance based exercise (e.g. 3x400m)
17
- */
18
- DISTANCE = "DISTANCE",
19
-
20
- /**
21
- * Custom exercise (uses string as data)
22
- */
23
- CUSTOM = "CUSTOM"
24
- }
25
-
26
- export default ExerciseType;
1
+ /**
2
+ * Enum for different types of exercises.
3
+ */
4
+ enum ExerciseType {
5
+ /**
6
+ * Sets-Reps based exercise (e.g. 3x10)
7
+ */
8
+ STRENGTH = "STRENGTH",
9
+
10
+ /**
11
+ * Time based exercise (e.g. 3x30s)
12
+ */
13
+ TIME = "TIME",
14
+
15
+ /**
16
+ * Distance based exercise (e.g. 3x400m)
17
+ */
18
+ DISTANCE = "DISTANCE",
19
+
20
+ /**
21
+ * Custom exercise (uses string as data)
22
+ */
23
+ CUSTOM = "CUSTOM"
24
+ }
25
+
26
+ export default ExerciseType;
@@ -1,28 +1,28 @@
1
- export enum ExerciseUnit {
2
- // Time
3
- seconds = "SECONDS",
4
- minutes = "MINUTES",
5
-
6
- // Weight
7
- pounds = "POUNDS",
8
- kilograms = "KILOGRAMS",
9
-
10
- // Distance
11
- miles = "MILES",
12
- kilometers = "KILOMETERS",
13
- yards = "YARDS",
14
- feet = "FEET",
15
- meters = "METERS"
16
- }
17
-
18
- export const WeightUnits = [ExerciseUnit.pounds, ExerciseUnit.kilograms];
19
-
20
- export const TimeUnits = [ExerciseUnit.seconds, ExerciseUnit.minutes];
21
-
22
- export const DistanceUnits = [
23
- ExerciseUnit.miles,
24
- ExerciseUnit.kilometers,
25
- ExerciseUnit.yards,
26
- ExerciseUnit.feet,
27
- ExerciseUnit.meters
28
- ];
1
+ export enum ExerciseUnit {
2
+ // Time
3
+ seconds = "SECONDS",
4
+ minutes = "MINUTES",
5
+
6
+ // Weight
7
+ pounds = "POUNDS",
8
+ kilograms = "KILOGRAMS",
9
+
10
+ // Distance
11
+ miles = "MILES",
12
+ kilometers = "KILOMETERS",
13
+ yards = "YARDS",
14
+ feet = "FEET",
15
+ meters = "METERS"
16
+ }
17
+
18
+ export const WeightUnits = [ExerciseUnit.pounds, ExerciseUnit.kilograms];
19
+
20
+ export const TimeUnits = [ExerciseUnit.seconds, ExerciseUnit.minutes];
21
+
22
+ export const DistanceUnits = [
23
+ ExerciseUnit.miles,
24
+ ExerciseUnit.kilometers,
25
+ ExerciseUnit.yards,
26
+ ExerciseUnit.feet,
27
+ ExerciseUnit.meters
28
+ ];
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../exercise/exercise";
2
+ import { ExerciseUnit } from "../exercise/exercise_units";
3
+
4
+ export type ExerciseExecution = {
5
+ completed?: boolean;
6
+ submittedValue?: number;
7
+ submittedUnit?: ExerciseUnit;
8
+ executedBy?: string; // User ID
9
+ } & Exercise;
@@ -1,11 +1,11 @@
1
- export type Schedule = {
2
- id: string;
3
- user_id: string;
4
- workout_id: string;
5
- days_of_week: number[];
6
- start_time: string | null;
7
- recurrence: number;
8
- created_at: string;
9
- start_week: number;
10
- start_year: number;
11
- };
1
+ export type Schedule = {
2
+ id: string;
3
+ user_id: string;
4
+ workout_id: string;
5
+ days_of_week: number[];
6
+ start_time: string | null;
7
+ recurrence: number;
8
+ created_at: string;
9
+ start_week: number;
10
+ start_year: number;
11
+ };
@@ -1,9 +1,9 @@
1
- export enum ScheduleDay {
2
- "SUNDAY" = 0,
3
- "MONDAY" = 1,
4
- "TUESDAY" = 2,
5
- "WEDNESDAY" = 3,
6
- "THURSDAY" = 4,
7
- "FRIDAY" = 5,
8
- "SATURDAY" = 6
9
- }
1
+ export enum ScheduleDay {
2
+ "SUNDAY" = 0,
3
+ "MONDAY" = 1,
4
+ "TUESDAY" = 2,
5
+ "WEDNESDAY" = 3,
6
+ "THURSDAY" = 4,
7
+ "FRIDAY" = 5,
8
+ "SATURDAY" = 6
9
+ }
@@ -1,4 +1,4 @@
1
- export enum ScheduleRecurrence {
2
- Weekly = "WEEKLY",
3
- BIWEEKLY = "BIWEEKLY"
4
- }
1
+ export enum ScheduleRecurrence {
2
+ Weekly = "WEEKLY",
3
+ BIWEEKLY = "BIWEEKLY"
4
+ }
@@ -1,12 +1,12 @@
1
- export type AccessToken = {
2
- id: string;
3
- user_id: string;
4
- hashed_token: string;
5
- expires_at: Date;
6
- user_agent: string;
7
- ip_address: string;
8
- platform?: string;
9
- language?: string;
10
- location?: string;
11
- created_at: Date;
12
- };
1
+ export type AccessToken = {
2
+ id: string;
3
+ user_id: string;
4
+ hashed_token: string;
5
+ expires_at: Date;
6
+ user_agent: string;
7
+ ip_address: string;
8
+ platform?: string;
9
+ language?: string;
10
+ location?: string;
11
+ created_at: Date;
12
+ };
@@ -1,6 +1,6 @@
1
- export type UserSessionInfo = {
2
- userAgent: string;
3
- platform: string;
4
- language: string;
5
- ipAddress?: string;
6
- };
1
+ export type UserSessionInfo = {
2
+ userAgent: string;
3
+ platform: string;
4
+ language: string;
5
+ ipAddress?: string;
6
+ };
@@ -1,11 +1,11 @@
1
- export type User = {
2
- id: string;
3
- first_name: string;
4
- last_name: string;
5
- username: string;
6
- email: string;
7
- lang: string;
8
- created_at: string;
9
- theme_mode: string;
10
- theme_color: "light" | "dark";
11
- };
1
+ export type User = {
2
+ id: string;
3
+ first_name: string;
4
+ last_name: string;
5
+ username: string;
6
+ email: string;
7
+ lang: string;
8
+ created_at: string;
9
+ theme_mode: string;
10
+ theme_color: "light" | "dark";
11
+ };
@@ -1,9 +1,9 @@
1
- import { Exercise } from "../exercise/exercise";
2
-
3
- export type Workout = {
4
- id: string;
5
- name: string;
6
- created_by: string;
7
- exercises: Exercise[];
8
- created_at: Date;
9
- };
1
+ import { type Exercise } from "../exercise/exercise";
2
+
3
+ export type Workout = {
4
+ id: string;
5
+ name: string;
6
+ created_by: string;
7
+ exercises: Exercise[];
8
+ created_at: Date;
9
+ };