@dlwiest/ts-tonal-client 0.2.0 → 0.3.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.
Files changed (49) hide show
  1. package/README.md +40 -1
  2. package/dist/{index.js → index.cjs} +140 -72
  3. package/dist/index.d.ts +13 -7
  4. package/dist/index.esm.js +140 -72
  5. package/package.json +6 -5
  6. package/dist/examples/create-workout.d.ts +0 -1
  7. package/dist/examples/debug-daily-lifts.d.ts +0 -1
  8. package/dist/examples/delete-workout.d.ts +0 -1
  9. package/dist/examples/edit-workout.d.ts +0 -1
  10. package/dist/examples/estimate-workout.d.ts +0 -1
  11. package/dist/examples/get-achievement-stats.d.ts +0 -2
  12. package/dist/examples/get-achievements.d.ts +0 -2
  13. package/dist/examples/get-activity-summaries.d.ts +0 -2
  14. package/dist/examples/get-current-streak.d.ts +0 -1
  15. package/dist/examples/get-daily-lifts.d.ts +0 -1
  16. package/dist/examples/get-daily-metrics.d.ts +0 -1
  17. package/dist/examples/get-goal-metrics.d.ts +0 -1
  18. package/dist/examples/get-goals.d.ts +0 -1
  19. package/dist/examples/get-home-calendar.d.ts +0 -2
  20. package/dist/examples/get-metric-scores.d.ts +0 -1
  21. package/dist/examples/get-movements.d.ts +0 -1
  22. package/dist/examples/get-muscle-readiness.d.ts +0 -1
  23. package/dist/examples/get-program-by-id.d.ts +0 -1
  24. package/dist/examples/get-target-scores.d.ts +0 -1
  25. package/dist/examples/get-training-effect-goals.d.ts +0 -1
  26. package/dist/examples/get-training-types.d.ts +0 -1
  27. package/dist/examples/get-user-info.d.ts +0 -1
  28. package/dist/examples/get-user-settings.d.ts +0 -1
  29. package/dist/examples/get-user-statistics.d.ts +0 -2
  30. package/dist/examples/get-user-workouts.d.ts +0 -1
  31. package/dist/examples/get-workout-by-id.d.ts +0 -1
  32. package/dist/examples/get-workout-by-share-url.d.ts +0 -1
  33. package/dist/examples/raw-daily-lifts-test.d.ts +0 -1
  34. package/dist/src/auth/auth-manager.d.ts +0 -15
  35. package/dist/src/client.d.ts +0 -40
  36. package/dist/src/http/http-client.d.ts +0 -12
  37. package/dist/src/index.d.ts +0 -4
  38. package/dist/src/services/movement-service.d.ts +0 -9
  39. package/dist/src/services/user-service.d.ts +0 -51
  40. package/dist/src/services/workout-service.d.ts +0 -14
  41. package/dist/src/types/auth.d.ts +0 -18
  42. package/dist/src/types/common.d.ts +0 -1
  43. package/dist/src/types/index.d.ts +0 -6
  44. package/dist/src/types/movements.d.ts +0 -30
  45. package/dist/src/types/programs.d.ts +0 -46
  46. package/dist/src/types/users.d.ts +0 -418
  47. package/dist/src/types/workouts.d.ts +0 -120
  48. package/dist/src/types.d.ts +0 -125
  49. package/dist/src/utils/cache-manager.d.ts +0 -11
@@ -1,120 +0,0 @@
1
- import { MuscleGroup } from './common';
2
- export type WorkoutPublishState = 'published' | 'archived' | string;
3
- export interface WorkoutSet {
4
- id: string;
5
- workoutId: string;
6
- blockStart: boolean;
7
- movementId: string;
8
- prescribedReps: number;
9
- repetition: number;
10
- repetitionTotal: number;
11
- blockNumber: number;
12
- burnout: boolean;
13
- spotter: boolean;
14
- eccentric: boolean;
15
- chains: boolean;
16
- skipSetup: boolean;
17
- skipDemo: boolean;
18
- finalSet: boolean;
19
- calibration: boolean;
20
- practice: boolean;
21
- flex: boolean;
22
- progressive: boolean;
23
- weightPercentage: number;
24
- warmUp: boolean;
25
- durationBasedRepGoal: number;
26
- setGroup: number;
27
- round: number;
28
- description: string;
29
- dropSet: boolean;
30
- omitempty?: unknown;
31
- }
32
- export interface TonalWorkout {
33
- id: string;
34
- createdAt: string;
35
- title: string;
36
- shortDescription: string;
37
- description: string;
38
- productionCode: string;
39
- assetId: string;
40
- coachId: string;
41
- sets: WorkoutSet[];
42
- duration: number;
43
- publishState: WorkoutPublishState;
44
- programId: string | null;
45
- level: string;
46
- groupIds: string[];
47
- targetArea: string;
48
- tags: string[] | null;
49
- bodyRegions: MuscleGroup[];
50
- goalIds: string[] | null;
51
- trainingEffectGoals: string[];
52
- disableModification: boolean;
53
- publishedAt: string;
54
- localPublishedAt: string;
55
- type: string;
56
- userId: string;
57
- style: string;
58
- trainingType: string;
59
- trainingTypeIds: string[] | null;
60
- mobileFriendly: boolean;
61
- live: boolean;
62
- recoveryWeight: boolean;
63
- supportedDevices: string[] | null;
64
- featureGroupIds: string[] | null;
65
- movementIds: string[];
66
- accessories?: string[];
67
- muscleGroupsForExclusion: MuscleGroup[] | null;
68
- playbackType: string;
69
- isImported: boolean;
70
- createdSource?: unknown | null;
71
- }
72
- export interface TonalSharedWorkout {
73
- id: string;
74
- sharerUserId: string;
75
- parentWorkoutId: string;
76
- workoutSnapshotId: string;
77
- workoutSnapshotHash: string;
78
- deepLinkUrl: string;
79
- workoutSnapshot: TonalWorkout;
80
- }
81
- export interface TonalWorkoutEstimateSet {
82
- blockStart: boolean;
83
- movementId: string;
84
- prescribedReps?: number;
85
- prescribedDuration?: number;
86
- dropSet: boolean;
87
- repetition: number;
88
- repetitionTotal: number;
89
- blockNumber: number;
90
- burnout: boolean;
91
- spotter: boolean;
92
- eccentric: boolean;
93
- chains: boolean;
94
- flex: boolean;
95
- warmUp: boolean;
96
- weightPercentage: number;
97
- setGroup: number;
98
- round: number;
99
- description: string;
100
- }
101
- export interface TonalWorkoutEstimateResponse {
102
- duration: number;
103
- }
104
- export interface TonalWorkoutCreateRequest {
105
- title: string;
106
- sets: TonalWorkoutEstimateSet[];
107
- createdSource?: 'WorkoutBuilder' | 'FreeLift' | 'SharedWorkout' | 'DailyLift' | 'TonalWorkout' | 'WorkoutGenerator' | 'ActivityFeed';
108
- shortDescription?: string;
109
- description?: string;
110
- }
111
- export interface TonalWorkoutUpdateRequest {
112
- id: string;
113
- title: string;
114
- description?: string;
115
- coachId: string;
116
- sets: TonalWorkoutEstimateSet[];
117
- level?: string;
118
- assetId: string;
119
- createdSource?: 'WorkoutBuilder' | 'FreeLift' | 'SharedWorkout' | 'DailyLift' | 'TonalWorkout' | 'WorkoutGenerator' | 'ActivityFeed';
120
- }
@@ -1,125 +0,0 @@
1
- export interface TonalApiError {
2
- error: string;
3
- error_description?: string;
4
- statusCode?: number;
5
- }
6
- export declare class TonalClientError extends Error {
7
- readonly statusCode?: number;
8
- readonly originalError?: unknown;
9
- constructor(message: string, statusCode?: number, originalError?: unknown);
10
- }
11
- export interface OAuthTokenResponse {
12
- access_token: string;
13
- id_token: string;
14
- refresh_token: string;
15
- scope: string;
16
- token_type: string;
17
- expires_in: number;
18
- }
19
- export type MuscleGroup = 'Obliques' | 'Abs' | 'Shoulders' | 'Glutes' | 'Back' | 'Biceps' | 'Quads' | 'Triceps' | 'Chest' | 'Hamstrings' | 'Calves' | 'Forearms';
20
- export interface TonalMovement {
21
- id: string;
22
- createdAt: string;
23
- updatedAt: string;
24
- name: string;
25
- shortName: string;
26
- muscleGroups: MuscleGroup[];
27
- bodyRegion: string;
28
- bodyRegionDisplay: string;
29
- baseOfSupport: string;
30
- pushPull: string;
31
- family: string;
32
- familyDisplay: string;
33
- inFreeLift: boolean;
34
- onMachine: boolean;
35
- countReps: boolean;
36
- isTwoSided: boolean;
37
- isBilateral: boolean;
38
- isAlternating: boolean;
39
- offMachineAccessory: string;
40
- descriptionHow: string;
41
- descriptionWhy: string;
42
- sortOrder: number;
43
- imageAssetId: string;
44
- skillLevel: number;
45
- active: boolean;
46
- featureGroupIds: null | string[];
47
- isGeneric: boolean;
48
- }
49
- export interface TonalWorkout {
50
- id: string;
51
- createdAt: string;
52
- title: string;
53
- shortDescription: string;
54
- description: string;
55
- productionCode: string;
56
- assetId: string;
57
- coachId: string;
58
- sets: WorkoutSet[];
59
- duration: number;
60
- publishState: string;
61
- programId: string | null;
62
- level: string;
63
- groupIds: string[];
64
- targetArea: string;
65
- tags: string[] | null;
66
- bodyRegions: MuscleGroup[];
67
- goalIds: string[] | null;
68
- trainingEffectGoals: string[];
69
- disableModification: boolean;
70
- publishedAt: string;
71
- localPublishedAt: string;
72
- type: string;
73
- userId: string;
74
- style: string;
75
- trainingType: string;
76
- trainingTypeIds: string[] | null;
77
- mobileFriendly: boolean;
78
- live: boolean;
79
- recoveryWeight: boolean;
80
- supportedDevices: string[] | null;
81
- featureGroupIds: string[] | null;
82
- movementIds: string[];
83
- muscleGroupsForExclusion: MuscleGroup[] | null;
84
- playbackType: string;
85
- isImported: boolean;
86
- }
87
- interface WorkoutSet {
88
- id: string;
89
- workoutId: string;
90
- blockStart: boolean;
91
- movementId: string;
92
- prescribedReps: number;
93
- repetition: number;
94
- repetitionTotal: number;
95
- blockNumber: number;
96
- burnout: boolean;
97
- spotter: boolean;
98
- eccentric: boolean;
99
- chains: boolean;
100
- skipSetup: boolean;
101
- skipDemo: boolean;
102
- finalSet: boolean;
103
- calibration: boolean;
104
- practice: boolean;
105
- flex: boolean;
106
- progressive: boolean;
107
- weightPercentage: number;
108
- warmUp: boolean;
109
- durationBasedRepGoal: number;
110
- setGroup: number;
111
- round: number;
112
- description: string;
113
- dropSet: boolean;
114
- omitempty?: unknown;
115
- }
116
- export interface TonalSharedWorkout {
117
- id: string;
118
- sharerUserId: string;
119
- parentWorkoutId: string;
120
- workoutSnapshotId: string;
121
- workoutSnapshotHash: string;
122
- deepLinkUrl: string;
123
- workoutSnapshot: TonalWorkout;
124
- }
125
- export {};
@@ -1,11 +0,0 @@
1
- export declare class CacheManager {
2
- private cacheDir;
3
- private defaultTTL;
4
- constructor(cacheDir?: string, defaultTTL?: number);
5
- private ensureCacheDir;
6
- private getCachePath;
7
- get<T>(key: string): Promise<T | null>;
8
- set<T>(key: string, data: T, ttl?: number): Promise<void>;
9
- invalidate(key: string): Promise<void>;
10
- clear(): Promise<void>;
11
- }