@krampa/common 0.3.3 → 0.4.0
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 +1 -1
- package/dist/goal-types.d.ts +2 -2
- package/dist/goal-types.js +2 -2
- package/dist/goal-value-types.d.ts +59 -0
- package/dist/goal-value-types.js +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ npm install @krampa/common
|
|
|
20
20
|
import { GOAL_TYPES, GOAL_TYPE_VALUES, GoalType } from "@krampa/common";
|
|
21
21
|
|
|
22
22
|
// Use constants
|
|
23
|
-
const goalType = GOAL_TYPES.
|
|
23
|
+
const goalType = GOAL_TYPES.WORKOUT_STRENGTH; // "workout/strength"
|
|
24
24
|
|
|
25
25
|
// Use in TypeScript types
|
|
26
26
|
const myGoal: GoalType = "weight/loss";
|
package/dist/goal-types.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare const GOAL_TYPES: {
|
|
|
6
6
|
readonly WEIGHT_LOSS: "weight/loss";
|
|
7
7
|
readonly WEIGHT_GAIN: "weight/gain";
|
|
8
8
|
readonly WEIGHT_MAINTAIN: "weight/maintain";
|
|
9
|
-
readonly
|
|
9
|
+
readonly WORKOUT_STRENGTH: "workout/strength";
|
|
10
10
|
readonly WORKOUT_CARDIO: "workout/cardio";
|
|
11
11
|
readonly WORKOUT_OTHER: "workout/other";
|
|
12
12
|
readonly ACHIEVEMENT_PR: "achievement/pr";
|
|
@@ -14,5 +14,5 @@ export declare const GOAL_TYPES: {
|
|
|
14
14
|
readonly MEASUREMENT_BODY: "measurement/body";
|
|
15
15
|
readonly CUSTOM_OTHER: "custom/other";
|
|
16
16
|
};
|
|
17
|
-
export declare const GOAL_TYPE_VALUES: readonly ["weight/loss", "weight/gain", "weight/maintain", "workout/
|
|
17
|
+
export declare const GOAL_TYPE_VALUES: readonly ["weight/loss", "weight/gain", "weight/maintain", "workout/strength", "workout/cardio", "workout/other", "achievement/pr", "steps/daily", "measurement/body", "custom/other"];
|
|
18
18
|
export type GoalType = (typeof GOAL_TYPE_VALUES)[number];
|
package/dist/goal-types.js
CHANGED
|
@@ -12,7 +12,7 @@ exports.GOAL_TYPES = {
|
|
|
12
12
|
WEIGHT_GAIN: "weight/gain",
|
|
13
13
|
WEIGHT_MAINTAIN: "weight/maintain",
|
|
14
14
|
// Workout goals (distance/time embedded in cardio)
|
|
15
|
-
|
|
15
|
+
WORKOUT_STRENGTH: "workout/strength",
|
|
16
16
|
WORKOUT_CARDIO: "workout/cardio",
|
|
17
17
|
WORKOUT_OTHER: "workout/other",
|
|
18
18
|
// Achievement goals
|
|
@@ -27,7 +27,7 @@ exports.GOAL_TYPE_VALUES = [
|
|
|
27
27
|
exports.GOAL_TYPES.WEIGHT_LOSS,
|
|
28
28
|
exports.GOAL_TYPES.WEIGHT_GAIN,
|
|
29
29
|
exports.GOAL_TYPES.WEIGHT_MAINTAIN,
|
|
30
|
-
exports.GOAL_TYPES.
|
|
30
|
+
exports.GOAL_TYPES.WORKOUT_STRENGTH,
|
|
31
31
|
exports.GOAL_TYPES.WORKOUT_CARDIO,
|
|
32
32
|
exports.GOAL_TYPES.WORKOUT_OTHER,
|
|
33
33
|
exports.GOAL_TYPES.ACHIEVEMENT_PR,
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Goal value type definitions
|
|
3
|
+
* Shared between frontend and backend for type safety
|
|
4
|
+
*/
|
|
5
|
+
export type WeightChange = {
|
|
6
|
+
startWeight: number;
|
|
7
|
+
targetWeight: number;
|
|
8
|
+
};
|
|
9
|
+
export type WeightMaintain = {
|
|
10
|
+
targetWeight: number;
|
|
11
|
+
};
|
|
12
|
+
export type WorkoutCardioValue = {
|
|
13
|
+
activityName: string;
|
|
14
|
+
weeklyTarget: number;
|
|
15
|
+
weeklyDistance?: number;
|
|
16
|
+
weeklyTime?: number;
|
|
17
|
+
};
|
|
18
|
+
export type WorkoutOtherValue = {
|
|
19
|
+
activityName: string;
|
|
20
|
+
weeklyTarget: number;
|
|
21
|
+
};
|
|
22
|
+
export type WorkoutStrengthValue = {
|
|
23
|
+
weeklyTarget: number;
|
|
24
|
+
workoutTypes: string[];
|
|
25
|
+
};
|
|
26
|
+
export type StepsGoalValue = {
|
|
27
|
+
targetSteps: number;
|
|
28
|
+
};
|
|
29
|
+
type BaseGoal = {};
|
|
30
|
+
export type WeightLossGoal = BaseGoal & {
|
|
31
|
+
type: "weight/loss";
|
|
32
|
+
value: WeightChange;
|
|
33
|
+
};
|
|
34
|
+
export type WeightGainGoal = BaseGoal & {
|
|
35
|
+
type: "weight/gain";
|
|
36
|
+
value: WeightChange;
|
|
37
|
+
};
|
|
38
|
+
export type WeightMaintainGoal = BaseGoal & {
|
|
39
|
+
type: "weight/maintain";
|
|
40
|
+
value: WeightMaintain;
|
|
41
|
+
};
|
|
42
|
+
export type WorkoutStrengthGoal = BaseGoal & {
|
|
43
|
+
type: "workout/strength";
|
|
44
|
+
value: WorkoutStrengthValue;
|
|
45
|
+
};
|
|
46
|
+
export type WorkoutCardioGoal = BaseGoal & {
|
|
47
|
+
type: "workout/cardio";
|
|
48
|
+
value: WorkoutCardioValue;
|
|
49
|
+
};
|
|
50
|
+
export type WorkoutOtherGoal = BaseGoal & {
|
|
51
|
+
type: "workout/other";
|
|
52
|
+
value: WorkoutOtherValue;
|
|
53
|
+
};
|
|
54
|
+
export type StepsGoal = BaseGoal & {
|
|
55
|
+
type: "steps/daily";
|
|
56
|
+
value: StepsGoalValue;
|
|
57
|
+
};
|
|
58
|
+
export type Goal = WeightLossGoal | WeightGainGoal | WeightMaintainGoal | WorkoutStrengthGoal | WorkoutCardioGoal | WorkoutOtherGoal | StepsGoal;
|
|
59
|
+
export {};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -19,5 +19,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
__exportStar(require("./goal-types"), exports);
|
|
22
|
+
__exportStar(require("./goal-value-types"), exports);
|
|
22
23
|
__exportStar(require("./invite-status"), exports);
|
|
23
24
|
__exportStar(require("./challenge-status"), exports);
|