@dlwiest/ts-tonal-client 0.5.0 → 0.6.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/dist/index.d.ts CHANGED
@@ -19,242 +19,6 @@ interface OAuthTokenResponse {
19
19
 
20
20
  type MuscleGroup = 'Obliques' | 'Abs' | 'Shoulders' | 'Glutes' | 'Back' | 'Biceps' | 'Quads' | 'Triceps' | 'Chest' | 'Hamstrings' | 'Calves' | 'Forearms';
21
21
 
22
- interface TonalMovement {
23
- id: string;
24
- createdAt: string;
25
- updatedAt: string;
26
- name: string;
27
- shortName: string;
28
- muscleGroups: MuscleGroup[];
29
- bodyRegion: string;
30
- bodyRegionDisplay: string;
31
- baseOfSupport: string;
32
- pushPull: string;
33
- family: string;
34
- familyDisplay: string;
35
- inFreeLift: boolean;
36
- onMachine: boolean;
37
- countReps: boolean;
38
- isTwoSided: boolean;
39
- isBilateral: boolean;
40
- isAlternating: boolean;
41
- offMachineAccessory: string;
42
- descriptionHow: string;
43
- descriptionWhy: string;
44
- sortOrder: number;
45
- imageAssetId: string;
46
- skillLevel: number;
47
- active: boolean;
48
- featureGroupIds: null | string[];
49
- isGeneric: boolean;
50
- }
51
-
52
- type WorkoutPublishState = 'published' | 'archived' | string;
53
- interface WorkoutSet {
54
- id: string;
55
- workoutId: string;
56
- blockStart: boolean;
57
- movementId: string;
58
- prescribedReps?: number;
59
- prescribedDuration?: number;
60
- repetition: number;
61
- repetitionTotal: number;
62
- blockNumber: number;
63
- burnout: boolean;
64
- spotter: boolean;
65
- eccentric: boolean;
66
- chains: boolean;
67
- skipSetup: boolean;
68
- skipDemo: boolean;
69
- finalSet: boolean;
70
- calibration: boolean;
71
- practice: boolean;
72
- flex: boolean;
73
- progressive: boolean;
74
- weightPercentage: number;
75
- warmUp: boolean;
76
- durationBasedRepGoal: number;
77
- setGroup: number;
78
- round: number;
79
- description: string;
80
- dropSet: boolean;
81
- omitempty?: unknown;
82
- }
83
- interface TonalWorkout {
84
- id: string;
85
- createdAt: string;
86
- title: string;
87
- shortDescription: string;
88
- description: string;
89
- productionCode: string;
90
- assetId: string;
91
- coachId: string;
92
- sets: WorkoutSet[] | null;
93
- duration: number;
94
- publishState: WorkoutPublishState;
95
- programId: string | null;
96
- level: string;
97
- groupIds: string[];
98
- targetArea: string;
99
- tags: string[] | null;
100
- bodyRegions: MuscleGroup[] | null;
101
- goalIds: string[] | null;
102
- trainingEffectGoals: string[];
103
- disableModification: boolean;
104
- publishedAt: string;
105
- localPublishedAt: string;
106
- type: string;
107
- userId: string;
108
- style: string;
109
- trainingType: string;
110
- trainingTypeIds: string[] | null;
111
- mobileFriendly: boolean;
112
- live: boolean;
113
- recoveryWeight: boolean;
114
- supportedDevices: string[] | null;
115
- featureGroupIds: string[] | null;
116
- movementIds: string[] | null;
117
- accessories?: string[];
118
- muscleGroupsForExclusion: MuscleGroup[] | null;
119
- playbackType: string;
120
- isImported: boolean;
121
- createdSource?: unknown | null;
122
- }
123
- interface TonalWorkoutSetActivity {
124
- movementId: string;
125
- prescribedReps?: number | null;
126
- repetition?: number | null;
127
- repetitionTotal?: number | null;
128
- weightPercentage?: number | null;
129
- baseWeight?: number | null;
130
- eccentricWeight?: number | null;
131
- chainsWeight?: number | null;
132
- blockNumber?: number | null;
133
- blockStart?: boolean | null;
134
- sideNumber?: number | null;
135
- setId?: string | null;
136
- spotter?: boolean | null;
137
- }
138
- interface TonalWorkoutActivity {
139
- id: string;
140
- userId: string;
141
- workoutId: string;
142
- workoutType?: string | null;
143
- beginTime: string;
144
- endTime?: string | null;
145
- totalDuration: number;
146
- activeDuration?: number | null;
147
- restDuration?: number | null;
148
- totalMovements?: number | null;
149
- totalSets: number;
150
- totalReps: number;
151
- totalVolume: number;
152
- totalConcentricWork?: number | null;
153
- percentCompleted?: number | null;
154
- completed?: boolean | null;
155
- workoutSetActivity: TonalWorkoutSetActivity[];
156
- contentCard?: unknown;
157
- deviceId?: string | null;
158
- timezone?: string | null;
159
- appVersion?: string | null;
160
- }
161
- interface TonalSharedWorkout {
162
- id: string;
163
- sharerUserId: string;
164
- parentWorkoutId: string;
165
- workoutSnapshotId: string;
166
- workoutSnapshotHash: string;
167
- deepLinkUrl: string;
168
- workoutSnapshot: TonalWorkout;
169
- }
170
- interface TonalWorkoutEstimateSet {
171
- blockStart: boolean;
172
- movementId: string;
173
- prescribedReps?: number;
174
- prescribedDuration?: number;
175
- dropSet: boolean;
176
- repetition: number;
177
- repetitionTotal: number;
178
- blockNumber: number;
179
- burnout: boolean;
180
- spotter: boolean;
181
- eccentric: boolean;
182
- chains: boolean;
183
- flex: boolean;
184
- warmUp: boolean;
185
- weightPercentage: number;
186
- setGroup: number;
187
- round: number;
188
- description: string;
189
- }
190
- interface TonalWorkoutEstimateResponse {
191
- duration: number;
192
- }
193
- interface TonalWorkoutCreateRequest {
194
- title: string;
195
- sets: TonalWorkoutEstimateSet[];
196
- createdSource?: 'WorkoutBuilder' | 'FreeLift' | 'SharedWorkout' | 'DailyLift' | 'TonalWorkout' | 'WorkoutGenerator' | 'ActivityFeed';
197
- shortDescription?: string;
198
- description?: string;
199
- }
200
- interface TonalWorkoutUpdateRequest {
201
- id: string;
202
- title: string;
203
- shortDescription?: string;
204
- description?: string;
205
- coachId: string;
206
- sets: TonalWorkoutEstimateSet[];
207
- level?: string;
208
- assetId: string;
209
- createdSource?: 'WorkoutBuilder' | 'FreeLift' | 'SharedWorkout' | 'DailyLift' | 'TonalWorkout' | 'WorkoutGenerator' | 'ActivityFeed';
210
- }
211
-
212
- interface TonalProgramWorkout {
213
- id: string;
214
- programId: string;
215
- workoutId: string;
216
- level: string;
217
- workoutNumber: number;
218
- workoutTitle: string;
219
- programWeek: number;
220
- programDay: number;
221
- duration: number;
222
- }
223
- interface TonalProgramTrainingEffectGoal {
224
- goalID: string;
225
- score: number;
226
- goalMet: boolean;
227
- }
228
- interface TonalProgram {
229
- id: string;
230
- createdAt: string;
231
- name: string;
232
- description: string;
233
- productionCode: string;
234
- workoutsPerWeek: number;
235
- cadence: boolean[];
236
- weeks: number;
237
- publishState: string;
238
- publishedAt: string;
239
- level: string;
240
- workouts: TonalWorkout[];
241
- assetId: string;
242
- goalIds: string[];
243
- groupIds: string[];
244
- coachId: string;
245
- coachIds: string[];
246
- trainingTypeIds: string[];
247
- isAdjustable: boolean;
248
- programWorkoutIds: string[];
249
- programWorkouts: TonalProgramWorkout[];
250
- nonComparableWorkouts: boolean;
251
- mobileFriendly: boolean;
252
- supportedDevices: string[] | null;
253
- featureGroupIds: string[] | null;
254
- excludeFromCoachHighlights: boolean;
255
- trainingEffectGoals: TonalProgramTrainingEffectGoal[];
256
- }
257
-
258
22
  interface TonalUserDevice {
259
23
  deviceId: string;
260
24
  tonalDeviceId: string;
@@ -412,6 +176,17 @@ interface TonalCurrentStreak {
412
176
  updatedByActivityId: string;
413
177
  }
414
178
  type TonalStrengthBodyRegion = 'Upper Body' | 'Core' | 'Lower Body' | 'Overall' | string;
179
+ interface TonalStrengthFamilyScore {
180
+ id: string;
181
+ createdAt: string;
182
+ updatedAt: string;
183
+ userId: string;
184
+ workoutActivityId: string;
185
+ strengthFamily: string;
186
+ strengthBodyRegion: string;
187
+ score: number;
188
+ current: boolean;
189
+ }
415
190
  interface TonalStrengthScore {
416
191
  id: string;
417
192
  createdAt: string;
@@ -422,7 +197,7 @@ interface TonalStrengthScore {
422
197
  bodyRegionDisplay: string;
423
198
  score: number;
424
199
  current: boolean;
425
- familyActivity?: unknown[];
200
+ familyActivity?: TonalStrengthFamilyScore[];
426
201
  }
427
202
  interface TonalStrengthScoreHistoryEntry {
428
203
  id: string;
@@ -698,18 +473,504 @@ interface TonalUserInfo {
698
473
  primaryDeviceType: 'Classic' | string;
699
474
  }
700
475
 
701
- declare class TonalClient {
702
- private authManager;
703
- private httpClient;
704
- private workoutService;
705
- private movementService;
706
- private userService;
707
- private userInfo?;
708
- private userInfoPromise?;
709
- private constructor();
710
- static create(credentials: {
711
- username: string;
712
- password: string;
476
+ interface TonalMovement {
477
+ id: string;
478
+ createdAt: string;
479
+ updatedAt: string;
480
+ name: string;
481
+ shortName: string;
482
+ muscleGroups: MuscleGroup[];
483
+ bodyRegion: string;
484
+ bodyRegionDisplay: string;
485
+ baseOfSupport: string;
486
+ pushPull: string;
487
+ family: string;
488
+ familyDisplay: string;
489
+ inFreeLift: boolean;
490
+ onMachine: boolean;
491
+ countReps: boolean;
492
+ isTwoSided: boolean;
493
+ isBilateral: boolean;
494
+ isAlternating: boolean;
495
+ offMachineAccessory: string;
496
+ descriptionHow: string;
497
+ descriptionWhy: string;
498
+ sortOrder: number;
499
+ imageAssetId: string;
500
+ skillLevel: number;
501
+ active: boolean;
502
+ featureGroupIds: null | string[];
503
+ isGeneric: boolean;
504
+ onMachineInfo?: {
505
+ accessory: string;
506
+ resistanceType: string;
507
+ spotterDisabled: boolean;
508
+ eccentricDisabled: boolean;
509
+ chainsDisabled: boolean;
510
+ burnoutDisabled: boolean;
511
+ };
512
+ }
513
+
514
+ type WorkoutPublishState = 'published' | 'archived' | string;
515
+ interface WorkoutSet {
516
+ id: string;
517
+ workoutId: string;
518
+ blockStart: boolean;
519
+ movementId: string;
520
+ prescribedReps?: number;
521
+ prescribedDuration?: number;
522
+ repetition: number;
523
+ repetitionTotal: number;
524
+ blockNumber: number;
525
+ burnout: boolean;
526
+ spotter: boolean;
527
+ eccentric: boolean;
528
+ chains: boolean;
529
+ skipSetup: boolean;
530
+ skipDemo: boolean;
531
+ finalSet: boolean;
532
+ calibration: boolean;
533
+ practice: boolean;
534
+ flex: boolean;
535
+ progressive: boolean;
536
+ weightPercentage: number;
537
+ warmUp: boolean;
538
+ durationBasedRepGoal: number;
539
+ setGroup: number;
540
+ round: number;
541
+ description: string;
542
+ dropSet: boolean;
543
+ omitempty?: unknown;
544
+ }
545
+ interface TonalWorkout {
546
+ id: string;
547
+ createdAt: string;
548
+ title: string;
549
+ shortDescription: string;
550
+ description: string;
551
+ productionCode: string;
552
+ assetId: string;
553
+ coachId: string;
554
+ sets: WorkoutSet[] | null;
555
+ duration: number;
556
+ publishState: WorkoutPublishState;
557
+ programId: string | null;
558
+ level: string;
559
+ groupIds: string[];
560
+ targetArea: string;
561
+ tags: string[] | null;
562
+ bodyRegions: MuscleGroup[] | null;
563
+ goalIds: string[] | null;
564
+ trainingEffectGoals: string[];
565
+ disableModification: boolean;
566
+ publishedAt: string;
567
+ localPublishedAt: string;
568
+ type: string;
569
+ userId: string;
570
+ style: string;
571
+ trainingType: string;
572
+ trainingTypeIds: string[] | null;
573
+ mobileFriendly: boolean;
574
+ live: boolean;
575
+ recoveryWeight: boolean;
576
+ supportedDevices: string[] | null;
577
+ featureGroupIds: string[] | null;
578
+ movementIds: string[] | null;
579
+ accessories?: string[];
580
+ muscleGroupsForExclusion: MuscleGroup[] | null;
581
+ playbackType: string;
582
+ isImported: boolean;
583
+ createdSource?: unknown | null;
584
+ }
585
+ /**
586
+ * A performed set returned as part of a completed workout activity.
587
+ *
588
+ * The history and single-activity endpoints expose different subsets. Fields
589
+ * beyond movementId are therefore optional, and values that Tonal may return
590
+ * as null remain nullable.
591
+ */
592
+ interface TonalWorkoutSetActivity {
593
+ id?: string;
594
+ userId?: string;
595
+ workoutId?: string;
596
+ workoutActivityID?: string;
597
+ movementId: string;
598
+ prescribedReps?: number | null;
599
+ prescribedDuration?: number;
600
+ repetition?: number | null;
601
+ repetitionTotal?: number | null;
602
+ blockNumber?: number | null;
603
+ blockStart?: boolean | null;
604
+ burnout?: boolean;
605
+ calibration?: boolean;
606
+ chains?: boolean;
607
+ dropSet?: boolean;
608
+ eccentric?: boolean;
609
+ finalSet?: boolean;
610
+ flex?: boolean;
611
+ practice?: boolean;
612
+ progressive?: boolean;
613
+ skipDemo?: boolean;
614
+ skipSetup?: boolean;
615
+ spotter?: boolean | null;
616
+ warmUp?: boolean;
617
+ beginTime?: string;
618
+ endTime?: string;
619
+ beginTimeMCB?: number;
620
+ endTimeMCB?: number;
621
+ duration?: number;
622
+ durationBasedRepGoal?: number;
623
+ sideNumber?: number | null;
624
+ movementSide?: string;
625
+ setGroup?: number;
626
+ setId?: string | null;
627
+ round?: number;
628
+ sortOrder?: number;
629
+ weightPercentage?: number | null;
630
+ avgWeight?: number;
631
+ baseWeight?: number | null;
632
+ minWeight?: number;
633
+ maxWeight?: number;
634
+ suggestedWeight?: number;
635
+ suggestedWeightChange?: number;
636
+ eccentricWeight?: number | null;
637
+ eccentricWeightFrac?: number;
638
+ chainsWeight?: number | null;
639
+ chainsWeightFrac?: number;
640
+ romWeight?: number;
641
+ romWeightFrac?: number;
642
+ romWeightMode?: number;
643
+ offMachineModifiedWeight?: number;
644
+ maxSpottedWeight?: number;
645
+ weightControlMode?: number | null;
646
+ volume?: number;
647
+ totalVolume?: number;
648
+ totalOnMachineVolume?: number;
649
+ userWeightPounds?: number;
650
+ repCount?: number;
651
+ cvRepCount?: number;
652
+ repsInReserve?: number;
653
+ reps?: unknown[] | null;
654
+ dualMotorReps?: unknown[] | null;
655
+ oneRepMax?: number;
656
+ avgRom?: number;
657
+ rom?: number;
658
+ romLengthIn?: number;
659
+ meanMaxPos?: number;
660
+ avgVelocity?: number;
661
+ isoModeSpeed?: number;
662
+ concentricWork?: number;
663
+ totalConcentricWork?: number;
664
+ totalConDuration?: number;
665
+ maxConPower?: number;
666
+ velAtMaxConPower?: number;
667
+ weightAtMaxConPower?: number;
668
+ inconsistencyScore?: number;
669
+ strugglingScore?: number;
670
+ durationInconsistencyScore?: number;
671
+ durationStrugglingScore?: number;
672
+ maxVelInconsistencyScore?: number;
673
+ maxVelStrugglingScore?: number;
674
+ romInconsistencyScore?: number;
675
+ romStrugglingScore?: number;
676
+ inchesUpdated?: boolean;
677
+ powerUpdated?: boolean;
678
+ prs?: unknown[];
679
+ spotterMode?: string;
680
+ triggeredFeedback?: unknown | null;
681
+ }
682
+ /**
683
+ * Detailed completed workout data returned by
684
+ * GET /users/{userId}/workout-activities/{activityId}.
685
+ */
686
+ interface TonalWorkoutActivity {
687
+ id: string;
688
+ userId: string;
689
+ workoutId: string;
690
+ subscriptionId?: string;
691
+ workoutType?: string | null;
692
+ beginTime: string;
693
+ endTime?: string | null;
694
+ totalDuration: number;
695
+ activeDuration?: number | null;
696
+ restDuration?: number | null;
697
+ totalMovements?: number | null;
698
+ totalSets: number;
699
+ totalReps: number;
700
+ totalVolume: number;
701
+ totalConcentricWork?: number | null;
702
+ percentCompleted?: number | null;
703
+ completed?: boolean | null;
704
+ recoveryWeight?: boolean;
705
+ hasAppleWatch?: boolean;
706
+ isFirstWorkoutOfDay?: boolean;
707
+ isSmartViewActivated?: boolean;
708
+ workoutSetActivity: TonalWorkoutSetActivity[];
709
+ contentCard?: unknown;
710
+ deletedAt?: string | null;
711
+ partnerActivityId?: string | null;
712
+ programEnrollmentId?: string;
713
+ programId?: string;
714
+ deviceId?: string | null;
715
+ timezone?: string | null;
716
+ appVersion?: string | null;
717
+ mcbServiceVersion?: string;
718
+ }
719
+ /**
720
+ * Workout summary returned by
721
+ * GET /users/{userId}/workout-summaries/{activityId}.
722
+ */
723
+ interface TonalFormattedWorkoutSummary {
724
+ id: string;
725
+ deletedAt: string | null;
726
+ userId: string;
727
+ name: string;
728
+ workoutId: string;
729
+ isInProgram: boolean;
730
+ isGuidedWorkout: boolean;
731
+ isBaselineWorkout: boolean;
732
+ timestamp: string;
733
+ UTCTimestamp: string;
734
+ localTimestamp: string;
735
+ endTime: string;
736
+ timeZone: string;
737
+ assetID?: string | null;
738
+ targetArea: string;
739
+ duration: number;
740
+ }
741
+ interface TonalSharedWorkout {
742
+ id: string;
743
+ sharerUserId: string;
744
+ parentWorkoutId: string;
745
+ workoutSnapshotId: string;
746
+ workoutSnapshotHash: string;
747
+ deepLinkUrl: string;
748
+ workoutSnapshot: TonalWorkout;
749
+ }
750
+ interface TonalWorkoutEstimateSet {
751
+ blockStart: boolean;
752
+ movementId: string;
753
+ prescribedReps?: number;
754
+ prescribedDuration?: number;
755
+ dropSet: boolean;
756
+ repetition: number;
757
+ repetitionTotal: number;
758
+ blockNumber: number;
759
+ burnout: boolean;
760
+ spotter: boolean;
761
+ eccentric: boolean;
762
+ chains: boolean;
763
+ flex: boolean;
764
+ warmUp: boolean;
765
+ weightPercentage: number;
766
+ setGroup: number;
767
+ round: number;
768
+ description: string;
769
+ }
770
+ interface TonalWorkoutEstimateResponse {
771
+ duration: number;
772
+ }
773
+ interface TonalWorkoutCreateRequest {
774
+ title: string;
775
+ sets: TonalWorkoutEstimateSet[];
776
+ createdSource?: 'WorkoutBuilder' | 'FreeLift' | 'SharedWorkout' | 'DailyLift' | 'TonalWorkout' | 'WorkoutGenerator' | 'ActivityFeed';
777
+ shortDescription?: string;
778
+ description?: string;
779
+ }
780
+ interface TonalWorkoutUpdateRequest {
781
+ id: string;
782
+ title: string;
783
+ shortDescription?: string;
784
+ description?: string;
785
+ coachId: string;
786
+ sets: TonalWorkoutEstimateSet[];
787
+ level?: string;
788
+ assetId: string;
789
+ createdSource?: 'WorkoutBuilder' | 'FreeLift' | 'SharedWorkout' | 'DailyLift' | 'TonalWorkout' | 'WorkoutGenerator' | 'ActivityFeed';
790
+ }
791
+
792
+ interface TonalHealthExportOptions {
793
+ /** Include activities on or after this ISO-8601 date or timestamp. */
794
+ startDate?: string | Date;
795
+ /** Include activities on or before this ISO-8601 date or timestamp. */
796
+ endDate?: string | Date;
797
+ /** Maximum number of activities to include, newest first. */
798
+ limit?: number;
799
+ /** Include current muscle readiness. Defaults to true. */
800
+ includeMuscleReadiness?: boolean;
801
+ /** Include aggregate lifetime statistics. Defaults to true. */
802
+ includeLifetimeStatistics?: boolean;
803
+ /**
804
+ * Include activities imported into Tonal from another service.
805
+ * Defaults to false so the export contains Tonal workouts without duplicating
806
+ * data that may already be present in Apple Health or another health source.
807
+ */
808
+ includeExternalActivities?: boolean;
809
+ /**
810
+ * Fetch performed set, rep, and weight details for exported activities.
811
+ * Defaults to false. Details are fetched from paginated workout activity data.
812
+ */
813
+ includeSetDetails?: boolean;
814
+ }
815
+ interface TonalHealthExportSetEstimates {
816
+ /**
817
+ * Estimated total resistance across active cables, calculated as Tonal's
818
+ * reported total on-machine volume divided by completed reps.
819
+ */
820
+ averageResistancePounds?: number;
821
+ /**
822
+ * Estimated total one-rep max, scaled from Tonal's reported per-cable
823
+ * one-rep max by the estimated total resistance.
824
+ */
825
+ oneRepMaxPounds?: number;
826
+ }
827
+ interface TonalHealthExportSet {
828
+ setActivityId?: string;
829
+ movementId: string;
830
+ movementName?: string;
831
+ muscleGroups?: string[];
832
+ accessory?: string;
833
+ bilateral?: boolean;
834
+ twoSided?: boolean;
835
+ beginTime?: string;
836
+ endTime?: string;
837
+ durationSeconds?: number;
838
+ prescribedReps?: number;
839
+ prescribedDurationSeconds?: number;
840
+ completedReps?: number;
841
+ repsInReserve?: number;
842
+ repetition?: number;
843
+ repetitionTotal?: number;
844
+ sideNumber?: number;
845
+ movementSide?: string;
846
+ averageResistancePerCablePounds?: number;
847
+ baseResistancePerCablePounds?: number;
848
+ minimumResistancePerCablePounds?: number;
849
+ maximumResistancePerCablePounds?: number;
850
+ totalVolumePounds?: number;
851
+ estimatedOneRepMaxPerCablePounds?: number;
852
+ derivedEstimates?: TonalHealthExportSetEstimates;
853
+ rangeOfMotionInches?: number;
854
+ maxConcentricPowerWatts?: number;
855
+ warmUp?: boolean;
856
+ spotter?: boolean;
857
+ eccentric?: boolean;
858
+ chains?: boolean;
859
+ flex?: boolean;
860
+ }
861
+ interface TonalHealthExportActivity {
862
+ activityId: string;
863
+ workoutId: string;
864
+ source: 'tonal' | 'external';
865
+ name: string;
866
+ timestamp: string;
867
+ localTimestamp: string;
868
+ timeZone: string;
869
+ targetArea: string;
870
+ workoutType: string;
871
+ level: string;
872
+ durationSeconds: number;
873
+ timeUnderTensionSeconds: number;
874
+ totalReps: number;
875
+ totalVolumePounds: number;
876
+ totalWorkKilojoules: number;
877
+ completed: boolean;
878
+ guided: boolean;
879
+ inProgram: boolean;
880
+ baselineWorkout: boolean;
881
+ totalSets?: number;
882
+ activeDurationSeconds?: number;
883
+ restDurationSeconds?: number;
884
+ percentCompleted?: number;
885
+ sets?: TonalHealthExportSet[];
886
+ }
887
+ interface TonalHealthExportSummary {
888
+ workoutCount: number;
889
+ completedWorkoutCount: number;
890
+ totalDurationSeconds: number;
891
+ totalTimeUnderTensionSeconds: number;
892
+ totalReps: number;
893
+ totalVolumePounds: number;
894
+ totalWorkKilojoules: number;
895
+ }
896
+ interface TonalHealthExport {
897
+ schemaVersion: 1;
898
+ exportedAt: string;
899
+ period: {
900
+ start: string | null;
901
+ end: string | null;
902
+ };
903
+ summary: TonalHealthExportSummary;
904
+ activities: TonalHealthExportActivity[];
905
+ muscleReadiness?: TonalMuscleReadiness;
906
+ lifetimeStatistics?: TonalUserStatistics;
907
+ }
908
+ interface TonalHealthExportSource {
909
+ activities: TonalActivitySummary[];
910
+ muscleReadiness?: TonalMuscleReadiness;
911
+ lifetimeStatistics?: TonalUserStatistics;
912
+ activityDetails?: TonalWorkoutActivity[];
913
+ movements?: TonalMovement[];
914
+ }
915
+
916
+ interface TonalProgramWorkout {
917
+ id: string;
918
+ programId: string;
919
+ workoutId: string;
920
+ level: string;
921
+ workoutNumber: number;
922
+ workoutTitle: string;
923
+ programWeek: number;
924
+ programDay: number;
925
+ duration: number;
926
+ }
927
+ interface TonalProgramTrainingEffectGoal {
928
+ goalID: string;
929
+ score: number;
930
+ goalMet: boolean;
931
+ }
932
+ interface TonalProgram {
933
+ id: string;
934
+ createdAt: string;
935
+ name: string;
936
+ description: string;
937
+ productionCode: string;
938
+ workoutsPerWeek: number;
939
+ cadence: boolean[];
940
+ weeks: number;
941
+ publishState: string;
942
+ publishedAt: string;
943
+ level: string;
944
+ workouts: TonalWorkout[];
945
+ assetId: string;
946
+ goalIds: string[];
947
+ groupIds: string[];
948
+ coachId: string;
949
+ coachIds: string[];
950
+ trainingTypeIds: string[];
951
+ isAdjustable: boolean;
952
+ programWorkoutIds: string[];
953
+ programWorkouts: TonalProgramWorkout[];
954
+ nonComparableWorkouts: boolean;
955
+ mobileFriendly: boolean;
956
+ supportedDevices: string[] | null;
957
+ featureGroupIds: string[] | null;
958
+ excludeFromCoachHighlights: boolean;
959
+ trainingEffectGoals: TonalProgramTrainingEffectGoal[];
960
+ }
961
+
962
+ declare class TonalClient {
963
+ private authManager;
964
+ private httpClient;
965
+ private workoutService;
966
+ private movementService;
967
+ private userService;
968
+ private userInfo?;
969
+ private userInfoPromise?;
970
+ private constructor();
971
+ static create(credentials: {
972
+ username: string;
973
+ password: string;
713
974
  cacheDir?: string;
714
975
  }): Promise<TonalClient>;
715
976
  getMovements(useCache?: boolean): Promise<TonalMovement[]>;
@@ -727,6 +988,14 @@ declare class TonalClient {
727
988
  getStrengthScoreHistory(days?: TonalStrengthScoreHistoryLookback): Promise<TonalStrengthScoreHistoryEntry[]>;
728
989
  getWorkoutActivityById(activityId: string, useCache?: boolean): Promise<TonalWorkoutActivity>;
729
990
  getActivitySummaries(): Promise<TonalActivitySummary[]>;
991
+ /**
992
+ * Get a page of completed workout activities including performed set data.
993
+ */
994
+ getWorkoutActivities(offset?: number, limit?: number): Promise<TonalWorkoutActivity[]>;
995
+ /** Get every completed Tonal workout activity using paginated requests. */
996
+ getAllWorkoutActivities(pageSize?: number): Promise<TonalWorkoutActivity[]>;
997
+ getFormattedWorkoutSummary(activityId: string): Promise<TonalFormattedWorkoutSummary>;
998
+ getFormattedWorkoutSummaries(activityIds: string[], batchSize?: number): Promise<TonalFormattedWorkoutSummary[]>;
730
999
  getUserStatistics(): Promise<TonalUserStatistics>;
731
1000
  getAchievementStats(): Promise<TonalAchievementStats>;
732
1001
  getAchievements(): Promise<TonalEarnedAchievement[]>;
@@ -735,6 +1004,16 @@ declare class TonalClient {
735
1004
  getProgramById(programId: string): Promise<TonalProgram>;
736
1005
  getTargetScores(): Promise<TonalTargetScoresResponse>;
737
1006
  getMetricScores(startWeek?: number): Promise<TonalMetricScoresResponse>;
1007
+ /**
1008
+ * Create a compact export intended for health analysis and data portability.
1009
+ *
1010
+ * The export excludes profile, device, and authentication details. Activities
1011
+ * can be filtered by date and limited, and optional readiness and lifetime
1012
+ * statistics can be omitted when a smaller data set is preferred.
1013
+ */
1014
+ getHealthExport(options?: TonalHealthExportOptions): Promise<TonalHealthExport>;
1015
+ private paginateWorkoutActivities;
1016
+ private getWorkoutActivityDetails;
738
1017
  getUserWorkouts(offset?: number, limit?: number): Promise<TonalWorkout[]>;
739
1018
  getDailyLifts(timeZone?: string): Promise<TonalWorkout[]>;
740
1019
  getWorkoutById(workoutId: string): Promise<TonalWorkout>;
@@ -745,4 +1024,12 @@ declare class TonalClient {
745
1024
  deleteWorkout(workoutId: string): Promise<void>;
746
1025
  }
747
1026
 
748
- export { MuscleGroup, OAuthTokenResponse, TonalAchievementCategory, TonalAchievementDefinition, TonalAchievementMilestone, TonalAchievementStats, TonalActivitySummary, TonalApiError, TonalCalendarTile, TonalClient, TonalClientError, TonalCompatibilityStatus, TonalCurrentStreak, TonalDailyMetrics, TonalDailySchedule, TonalDeviceRegistration, TonalEarnedAchievement, TonalGoal, TonalGoalMetric, TonalHomeCalendar, TonalMetricScore, TonalMetricScoresResponse, TonalMovement, TonalMuscleReadiness, TonalMuscleUtilization, TonalProgram, TonalProgramTrainingEffectGoal, TonalProgramWorkout, TonalSharedWorkout, TonalStrengthBodyRegion, TonalStrengthScore, TonalStrengthScoreHistoryEntry, TonalStrengthScoreHistoryLookback, TonalTargetScore, TonalTargetScoresResponse, TonalTrainingEffectGoal, TonalTrainingEffectGoalRelation, TonalTrainingEffectGoalsResponse, TonalTrainingType, TonalUserDevice, TonalUserGoal, TonalUserInfo, TonalUserPermissions, TonalUserSettings, TonalUserStatistics, TonalWorkout, TonalWorkoutActivity, TonalWorkoutCreateRequest, TonalWorkoutEstimateResponse, TonalWorkoutEstimateSet, TonalWorkoutSetActivity, TonalWorkoutSummaryData, TonalWorkoutUpdateRequest, WorkoutPublishState, WorkoutSet, TonalClient as default };
1027
+ /**
1028
+ * Build a compact, privacy-conscious health export from Tonal API data.
1029
+ *
1030
+ * The export intentionally excludes profile details, account identifiers,
1031
+ * device identifiers, application versions, and authentication data.
1032
+ */
1033
+ declare function buildHealthExport(source: TonalHealthExportSource, options?: TonalHealthExportOptions, exportedAt?: Date): TonalHealthExport;
1034
+
1035
+ export { MuscleGroup, OAuthTokenResponse, TonalAchievementCategory, TonalAchievementDefinition, TonalAchievementMilestone, TonalAchievementStats, TonalActivitySummary, TonalApiError, TonalCalendarTile, TonalClient, TonalClientError, TonalCompatibilityStatus, TonalCurrentStreak, TonalDailyMetrics, TonalDailySchedule, TonalDeviceRegistration, TonalEarnedAchievement, TonalFormattedWorkoutSummary, TonalGoal, TonalGoalMetric, TonalHealthExport, TonalHealthExportActivity, TonalHealthExportOptions, TonalHealthExportSet, TonalHealthExportSetEstimates, TonalHealthExportSource, TonalHealthExportSummary, TonalHomeCalendar, TonalMetricScore, TonalMetricScoresResponse, TonalMovement, TonalMuscleReadiness, TonalMuscleUtilization, TonalProgram, TonalProgramTrainingEffectGoal, TonalProgramWorkout, TonalSharedWorkout, TonalStrengthBodyRegion, TonalStrengthFamilyScore, TonalStrengthScore, TonalStrengthScoreHistoryEntry, TonalStrengthScoreHistoryLookback, TonalTargetScore, TonalTargetScoresResponse, TonalTrainingEffectGoal, TonalTrainingEffectGoalRelation, TonalTrainingEffectGoalsResponse, TonalTrainingType, TonalUserDevice, TonalUserGoal, TonalUserInfo, TonalUserPermissions, TonalUserSettings, TonalUserStatistics, TonalWorkout, TonalWorkoutActivity, TonalWorkoutCreateRequest, TonalWorkoutEstimateResponse, TonalWorkoutEstimateSet, TonalWorkoutSetActivity, TonalWorkoutSummaryData, TonalWorkoutUpdateRequest, WorkoutPublishState, WorkoutSet, buildHealthExport, TonalClient as default };