@plus45/types 1.1.47 → 1.1.48
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/package.json +6 -3
- package/index.ts +0 -55
- package/tsconfig.json +0 -13
- package/types/authorization/authorization.ts +0 -4
- package/types/exercise/exercise.ts +0 -18
- package/types/exercise/exercise_types.ts +0 -26
- package/types/exercise/exercise_units.ts +0 -27
- package/types/generics/week_layout.ts +0 -65
- package/types/schedule/schedule.ts +0 -20
- package/types/schedule/schedule_days.ts +0 -10
- package/types/schedule/schedule_recurrence.ts +0 -6
- package/types/user/access_token.ts +0 -12
- package/types/user/session_info.ts +0 -6
- package/types/user/user.ts +0 -11
- package/types/workout/workout.ts +0 -9
- package/types/workout/workout_execution.ts +0 -20
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plus45/types",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"main": "index.js",
|
|
5
|
-
"types": "index.d.ts",
|
|
3
|
+
"version": "1.1.48",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
6
9
|
"scripts": {
|
|
7
10
|
"build": "tsc",
|
|
8
11
|
"pb": "tsc && npm publish"
|
package/index.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { ExerciseType } from "./types/exercise/exercise_types";
|
|
2
|
-
import { AccessToken } from "./types/user/access_token";
|
|
3
|
-
import { User } from "./types/user/user";
|
|
4
|
-
import {
|
|
5
|
-
DistanceUnits,
|
|
6
|
-
ExerciseUnit,
|
|
7
|
-
TimeUnits,
|
|
8
|
-
WeightUnits
|
|
9
|
-
} from "./types/exercise/exercise_units";
|
|
10
|
-
import { Workout } from "./types/workout/workout";
|
|
11
|
-
import { AssignedSchedule, Schedule } from "./types/schedule/schedule";
|
|
12
|
-
import { ScheduleDay } from "./types/schedule/schedule_days";
|
|
13
|
-
import { ScheduleRecurrence } from "./types/schedule/schedule_recurrence";
|
|
14
|
-
import { UserSessionInfo } from "./types/user/session_info";
|
|
15
|
-
import {
|
|
16
|
-
CompletedExercise,
|
|
17
|
-
WorkoutExecution
|
|
18
|
-
} from "./types/workout/workout_execution";
|
|
19
|
-
import { WeekLayout } from "./types/generics/week_layout";
|
|
20
|
-
import { AuthType } from "./types/authorization/authorization";
|
|
21
|
-
import Exercise from "./types/exercise/exercise";
|
|
22
|
-
|
|
23
|
-
export {
|
|
24
|
-
// User Type Structures
|
|
25
|
-
type User,
|
|
26
|
-
type UserSessionInfo,
|
|
27
|
-
type AccessToken,
|
|
28
|
-
|
|
29
|
-
// Exercise Type Structures
|
|
30
|
-
type Exercise,
|
|
31
|
-
type CompletedExercise,
|
|
32
|
-
|
|
33
|
-
// Workout Type Structures
|
|
34
|
-
type Workout,
|
|
35
|
-
type WorkoutExecution,
|
|
36
|
-
|
|
37
|
-
// Schedule Type Structures
|
|
38
|
-
type Schedule,
|
|
39
|
-
type AssignedSchedule,
|
|
40
|
-
|
|
41
|
-
// Generics
|
|
42
|
-
WeekLayout,
|
|
43
|
-
|
|
44
|
-
// Enums
|
|
45
|
-
ExerciseType,
|
|
46
|
-
ExerciseUnit,
|
|
47
|
-
ScheduleDay,
|
|
48
|
-
ScheduleRecurrence,
|
|
49
|
-
AuthType,
|
|
50
|
-
|
|
51
|
-
// Collections
|
|
52
|
-
WeightUnits,
|
|
53
|
-
DistanceUnits,
|
|
54
|
-
TimeUnits
|
|
55
|
-
};
|
package/tsconfig.json
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"declaration": true,
|
|
4
|
-
"emitDeclarationOnly": false,
|
|
5
|
-
"outDir": "dist",
|
|
6
|
-
"module": "ESNext",
|
|
7
|
-
"target": "ESNext",
|
|
8
|
-
"esModuleInterop": true,
|
|
9
|
-
"skipLibCheck": true,
|
|
10
|
-
"forceConsistentCasingInFileNames": true
|
|
11
|
-
},
|
|
12
|
-
"include": ["index.ts", "types/**/*.ts"]
|
|
13
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ExerciseType } from "./exercise_types";
|
|
2
|
-
import { ExerciseUnit } from "./exercise_units";
|
|
3
|
-
|
|
4
|
-
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
|
-
};
|
|
17
|
-
|
|
18
|
-
export default Exercise;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Object for different types of exercises.
|
|
3
|
-
*/
|
|
4
|
-
export const 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
|
-
} as const;
|
|
25
|
-
|
|
26
|
-
export type ExerciseType = (typeof ExerciseType)[keyof typeof ExerciseType];
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export const 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
|
-
} as const;
|
|
17
|
-
export type ExerciseUnit = (typeof ExerciseUnit)[keyof typeof ExerciseUnit];
|
|
18
|
-
|
|
19
|
-
export const WeightUnits = [ExerciseUnit.pounds, ExerciseUnit.kilograms];
|
|
20
|
-
export const TimeUnits = [ExerciseUnit.seconds, ExerciseUnit.minutes];
|
|
21
|
-
export const DistanceUnits = [
|
|
22
|
-
ExerciseUnit.miles,
|
|
23
|
-
ExerciseUnit.kilometers,
|
|
24
|
-
ExerciseUnit.yards,
|
|
25
|
-
ExerciseUnit.feet,
|
|
26
|
-
ExerciseUnit.meters
|
|
27
|
-
];
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
export class WeekLayout<T> {
|
|
2
|
-
Sunday: Array<T>;
|
|
3
|
-
Monday: Array<T>;
|
|
4
|
-
Tuesday: Array<T>;
|
|
5
|
-
Wednesday: Array<T>;
|
|
6
|
-
Thursday: Array<T>;
|
|
7
|
-
Friday: Array<T>;
|
|
8
|
-
Saturday: Array<T>;
|
|
9
|
-
|
|
10
|
-
constructor(
|
|
11
|
-
Sunday?: Array<T>,
|
|
12
|
-
Monday?: Array<T>,
|
|
13
|
-
Tuesday?: Array<T>,
|
|
14
|
-
Wednesday?: Array<T>,
|
|
15
|
-
Thursday?: Array<T>,
|
|
16
|
-
Friday?: Array<T>,
|
|
17
|
-
Saturday?: Array<T>
|
|
18
|
-
) {
|
|
19
|
-
this.Sunday = Sunday ?? [];
|
|
20
|
-
this.Monday = Monday ?? [];
|
|
21
|
-
this.Tuesday = Tuesday ?? [];
|
|
22
|
-
this.Wednesday = Wednesday ?? [];
|
|
23
|
-
this.Thursday = Thursday ?? [];
|
|
24
|
-
this.Friday = Friday ?? [];
|
|
25
|
-
this.Saturday = Saturday ?? [];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
private getDayFromIndex = [
|
|
29
|
-
"Sunday",
|
|
30
|
-
"Monday",
|
|
31
|
-
"Tuesday",
|
|
32
|
-
"Wednesday",
|
|
33
|
-
"Thursday",
|
|
34
|
-
"Friday",
|
|
35
|
-
"Saturday"
|
|
36
|
-
];
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* 0 = Sunday, 6 = Saturday
|
|
40
|
-
*/
|
|
41
|
-
public setDay(index: number, value: T[]) {
|
|
42
|
-
const day = this.getDayFromIndex[index] as keyof WeekLayout<T>;
|
|
43
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
44
|
-
(this as any)[day] = value;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* 0 = Sunday, 6 = Saturday
|
|
49
|
-
*/
|
|
50
|
-
public addToDay(index: number, value: T) {
|
|
51
|
-
const day = this.getDayFromIndex[index] as keyof WeekLayout<T>;
|
|
52
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
53
|
-
const toAddTo = (this as any)[day] as T[];
|
|
54
|
-
toAddTo.push(value);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* 0 = Sunday, 6 = Saturday
|
|
59
|
-
*/
|
|
60
|
-
public getDay(index: number) {
|
|
61
|
-
return (this as any)[
|
|
62
|
-
this.getDayFromIndex[index] as keyof WeekLayout<T>
|
|
63
|
-
] as T[];
|
|
64
|
-
}
|
|
65
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Workout } from "../workout/workout";
|
|
2
|
-
|
|
3
|
-
export type Schedule = {
|
|
4
|
-
id: string;
|
|
5
|
-
user_id: string;
|
|
6
|
-
workout_id: string;
|
|
7
|
-
workout?: Workout;
|
|
8
|
-
days_of_week: number[];
|
|
9
|
-
created_at: string;
|
|
10
|
-
start_time: string;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export type AssignedSchedule = {
|
|
14
|
-
schedule_id: string;
|
|
15
|
-
schedule: Schedule;
|
|
16
|
-
user_id: string;
|
|
17
|
-
start_week: number;
|
|
18
|
-
start_year: number;
|
|
19
|
-
recurrence: number;
|
|
20
|
-
};
|
package/types/user/user.ts
DELETED
package/types/workout/workout.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { ExerciseUnit } from "../exercise/exercise_units";
|
|
2
|
-
import { Workout } from "./workout";
|
|
3
|
-
|
|
4
|
-
export type WorkoutExecution = {
|
|
5
|
-
assigned_to_user: string;
|
|
6
|
-
workout_id: string;
|
|
7
|
-
current_index: number;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Completions are a record that point the exercise id (as the key) to the completion containing the value entered as well as the unit.
|
|
11
|
-
*/
|
|
12
|
-
completions: Record<number, CompletedExercise>;
|
|
13
|
-
completed?: boolean;
|
|
14
|
-
} & Workout;
|
|
15
|
-
|
|
16
|
-
export type CompletedExercise = {
|
|
17
|
-
id: string;
|
|
18
|
-
value?: number;
|
|
19
|
-
unit?: ExerciseUnit;
|
|
20
|
-
};
|