@nativesquare/soma 0.7.3 → 0.9.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/client/index.d.ts +17 -55
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +63 -13
- package/dist/client/index.js.map +1 -1
- package/dist/component/_generated/api.d.ts +80 -4
- package/dist/component/_generated/api.d.ts.map +1 -1
- package/dist/component/_generated/api.js.map +1 -1
- package/dist/component/_generated/component.d.ts +153 -120
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/garmin/private.d.ts +475 -0
- package/dist/component/garmin/private.d.ts.map +1 -0
- package/dist/component/garmin/private.js +1614 -0
- package/dist/component/garmin/private.js.map +1 -0
- package/dist/component/{garmin.d.ts → garmin/public.d.ts} +25 -52
- package/dist/component/garmin/public.d.ts.map +1 -0
- package/dist/component/{garmin.js → garmin/public.js} +301 -215
- package/dist/component/garmin/public.js.map +1 -0
- package/dist/component/garmin/schemas/activity.d.ts +94 -0
- package/dist/component/garmin/schemas/activity.d.ts.map +1 -0
- package/dist/component/garmin/schemas/activity.js +27 -0
- package/dist/component/garmin/schemas/activity.js.map +1 -0
- package/dist/component/garmin/schemas/activityDetails.d.ts +146 -0
- package/dist/component/garmin/schemas/activityDetails.d.ts.map +1 -0
- package/dist/component/garmin/schemas/activityDetails.js +27 -0
- package/dist/component/garmin/schemas/activityDetails.js.map +1 -0
- package/dist/component/garmin/schemas/bloodPressure.d.ts +38 -0
- package/dist/component/garmin/schemas/bloodPressure.d.ts.map +1 -0
- package/dist/component/garmin/schemas/bloodPressure.js +27 -0
- package/dist/component/garmin/schemas/bloodPressure.js.map +1 -0
- package/dist/component/garmin/schemas/bodyCompositions.d.ts +42 -0
- package/dist/component/garmin/schemas/bodyCompositions.d.ts.map +1 -0
- package/dist/component/garmin/schemas/bodyCompositions.js +27 -0
- package/dist/component/garmin/schemas/bodyCompositions.js.map +1 -0
- package/dist/component/garmin/schemas/dailies.d.ts +98 -0
- package/dist/component/garmin/schemas/dailies.d.ts.map +1 -0
- package/dist/component/garmin/schemas/dailies.js +27 -0
- package/dist/component/garmin/schemas/dailies.js.map +1 -0
- package/dist/component/garmin/schemas/epochs.d.ts +54 -0
- package/dist/component/garmin/schemas/epochs.d.ts.map +1 -0
- package/dist/component/garmin/schemas/epochs.js +27 -0
- package/dist/component/garmin/schemas/epochs.js.map +1 -0
- package/dist/component/garmin/schemas/healthSnapshot.d.ts +48 -0
- package/dist/component/garmin/schemas/healthSnapshot.d.ts.map +1 -0
- package/dist/component/garmin/schemas/healthSnapshot.js +27 -0
- package/dist/component/garmin/schemas/healthSnapshot.js.map +1 -0
- package/dist/component/garmin/schemas/hrvSummary.d.ts +40 -0
- package/dist/component/garmin/schemas/hrvSummary.d.ts.map +1 -0
- package/dist/component/garmin/schemas/hrvSummary.js +27 -0
- package/dist/component/garmin/schemas/hrvSummary.js.map +1 -0
- package/dist/component/garmin/schemas/manuallyUpdatedActivities.d.ts +94 -0
- package/dist/component/garmin/schemas/manuallyUpdatedActivities.d.ts.map +1 -0
- package/dist/component/garmin/schemas/manuallyUpdatedActivities.js +27 -0
- package/dist/component/garmin/schemas/manuallyUpdatedActivities.js.map +1 -0
- package/dist/component/garmin/schemas/menstrualCycleTracking.d.ts +100 -0
- package/dist/component/garmin/schemas/menstrualCycleTracking.d.ts.map +1 -0
- package/dist/component/garmin/schemas/menstrualCycleTracking.js +28 -0
- package/dist/component/garmin/schemas/menstrualCycleTracking.js.map +1 -0
- package/dist/component/garmin/schemas/moveIQ.d.ts +40 -0
- package/dist/component/garmin/schemas/moveIQ.d.ts.map +1 -0
- package/dist/component/garmin/schemas/moveIQ.js +27 -0
- package/dist/component/garmin/schemas/moveIQ.js.map +1 -0
- package/dist/component/garmin/schemas/pulseOx.d.ts +38 -0
- package/dist/component/garmin/schemas/pulseOx.d.ts.map +1 -0
- package/dist/component/garmin/schemas/pulseOx.js +28 -0
- package/dist/component/garmin/schemas/pulseOx.js.map +1 -0
- package/dist/component/garmin/schemas/respiration.d.ts +34 -0
- package/dist/component/garmin/schemas/respiration.d.ts.map +1 -0
- package/dist/component/garmin/schemas/respiration.js +28 -0
- package/dist/component/garmin/schemas/respiration.js.map +1 -0
- package/dist/component/garmin/schemas/skinTemperature.d.ts +36 -0
- package/dist/component/garmin/schemas/skinTemperature.d.ts.map +1 -0
- package/dist/component/garmin/schemas/skinTemperature.js +28 -0
- package/dist/component/garmin/schemas/skinTemperature.js.map +1 -0
- package/dist/component/garmin/schemas/sleeps.d.ts +88 -0
- package/dist/component/garmin/schemas/sleeps.d.ts.map +1 -0
- package/dist/component/garmin/schemas/sleeps.js +27 -0
- package/dist/component/garmin/schemas/sleeps.js.map +1 -0
- package/dist/component/garmin/schemas/stress.d.ts +70 -0
- package/dist/component/garmin/schemas/stress.d.ts.map +1 -0
- package/dist/component/garmin/schemas/stress.js +28 -0
- package/dist/component/garmin/schemas/stress.js.map +1 -0
- package/dist/component/garmin/schemas/userMetrics.d.ts +36 -0
- package/dist/component/garmin/schemas/userMetrics.d.ts.map +1 -0
- package/dist/component/garmin/schemas/userMetrics.js +28 -0
- package/dist/component/garmin/schemas/userMetrics.js.map +1 -0
- package/dist/component/garmin/transform/activity.d.ts +13 -0
- package/dist/component/garmin/transform/activity.d.ts.map +1 -0
- package/dist/component/garmin/transform/activity.js +111 -0
- package/dist/component/garmin/transform/activity.js.map +1 -0
- package/dist/component/garmin/transform/activityDetails.d.ts +13 -0
- package/dist/component/garmin/transform/activityDetails.d.ts.map +1 -0
- package/dist/component/garmin/transform/activityDetails.js +173 -0
- package/dist/component/garmin/transform/activityDetails.js.map +1 -0
- package/dist/component/garmin/transform/bloodPressure.d.ts +12 -0
- package/dist/component/garmin/transform/bloodPressure.d.ts.map +1 -0
- package/dist/component/garmin/transform/bloodPressure.js +33 -0
- package/dist/component/garmin/transform/bloodPressure.js.map +1 -0
- package/dist/component/garmin/transform/bodyCompositions.d.ts +12 -0
- package/dist/component/garmin/transform/bodyCompositions.d.ts.map +1 -0
- package/dist/component/garmin/transform/bodyCompositions.js +42 -0
- package/dist/component/garmin/transform/bodyCompositions.js.map +1 -0
- package/dist/component/garmin/transform/dailies.d.ts +12 -0
- package/dist/component/garmin/transform/dailies.d.ts.map +1 -0
- package/dist/component/garmin/transform/dailies.js +132 -0
- package/dist/component/garmin/transform/dailies.js.map +1 -0
- package/dist/component/garmin/transform/epochs.d.ts +13 -0
- package/dist/component/garmin/transform/epochs.d.ts.map +1 -0
- package/dist/component/garmin/transform/epochs.js +76 -0
- package/dist/component/garmin/transform/epochs.js.map +1 -0
- package/dist/component/garmin/transform/healthSnapshot.d.ts +12 -0
- package/dist/component/garmin/transform/healthSnapshot.d.ts.map +1 -0
- package/dist/component/garmin/transform/healthSnapshot.js +111 -0
- package/dist/component/garmin/transform/healthSnapshot.js.map +1 -0
- package/dist/component/garmin/transform/hrvSummary.d.ts +12 -0
- package/dist/component/garmin/transform/hrvSummary.d.ts.map +1 -0
- package/dist/component/garmin/transform/hrvSummary.js +45 -0
- package/dist/component/garmin/transform/hrvSummary.js.map +1 -0
- package/dist/component/garmin/transform/manuallyUpdatedActivities.d.ts +11 -0
- package/dist/component/garmin/transform/manuallyUpdatedActivities.d.ts.map +1 -0
- package/dist/component/garmin/transform/manuallyUpdatedActivities.js +20 -0
- package/dist/component/garmin/transform/manuallyUpdatedActivities.js.map +1 -0
- package/dist/component/garmin/transform/menstrualCycleTracking.d.ts +10 -0
- package/dist/component/garmin/transform/menstrualCycleTracking.d.ts.map +1 -0
- package/dist/component/garmin/transform/menstrualCycleTracking.js +43 -0
- package/dist/component/garmin/transform/menstrualCycleTracking.js.map +1 -0
- package/dist/component/garmin/transform/moveIQ.d.ts +17 -0
- package/dist/component/garmin/transform/moveIQ.d.ts.map +1 -0
- package/dist/component/garmin/transform/moveIQ.js +41 -0
- package/dist/component/garmin/transform/moveIQ.js.map +1 -0
- package/dist/component/garmin/transform/pulseOx.d.ts +12 -0
- package/dist/component/garmin/transform/pulseOx.d.ts.map +1 -0
- package/dist/component/garmin/transform/pulseOx.js +46 -0
- package/dist/component/garmin/transform/pulseOx.js.map +1 -0
- package/dist/component/garmin/transform/respiration.d.ts +12 -0
- package/dist/component/garmin/transform/respiration.d.ts.map +1 -0
- package/dist/component/garmin/transform/respiration.js +54 -0
- package/dist/component/garmin/transform/respiration.js.map +1 -0
- package/dist/component/garmin/transform/skinTemperature.d.ts +12 -0
- package/dist/component/garmin/transform/skinTemperature.d.ts.map +1 -0
- package/dist/component/garmin/transform/skinTemperature.js +38 -0
- package/dist/component/garmin/transform/skinTemperature.js.map +1 -0
- package/dist/component/garmin/transform/sleeps.d.ts +55 -0
- package/dist/component/garmin/transform/sleeps.d.ts.map +1 -0
- package/dist/component/garmin/transform/sleeps.js +120 -0
- package/dist/component/garmin/transform/sleeps.js.map +1 -0
- package/dist/component/garmin/transform/stress.d.ts +12 -0
- package/dist/component/garmin/transform/stress.d.ts.map +1 -0
- package/dist/component/garmin/transform/stress.js +56 -0
- package/dist/component/garmin/transform/stress.js.map +1 -0
- package/dist/component/garmin/transform/userMetrics.d.ts +12 -0
- package/dist/component/garmin/transform/userMetrics.d.ts.map +1 -0
- package/dist/component/garmin/transform/userMetrics.js +48 -0
- package/dist/component/garmin/transform/userMetrics.js.map +1 -0
- package/dist/component/garmin/types/garmin.d.ts +21 -0
- package/dist/component/garmin/types/garmin.d.ts.map +1 -0
- package/dist/component/garmin/types/garmin.js +6 -0
- package/dist/component/garmin/types/garmin.js.map +1 -0
- package/dist/component/garmin/types/zod/zod.gen.d.ts +1319 -0
- package/dist/component/garmin/types/zod/zod.gen.d.ts.map +1 -0
- package/dist/component/garmin/types/zod/zod.gen.js +784 -0
- package/dist/component/garmin/types/zod/zod.gen.js.map +1 -0
- package/dist/component/garmin/webhooks.d.ts +141 -0
- package/dist/component/garmin/webhooks.d.ts.map +1 -0
- package/dist/component/garmin/webhooks.js +766 -0
- package/dist/component/garmin/webhooks.js.map +1 -0
- package/dist/component/private.d.ts +20 -2
- package/dist/component/private.d.ts.map +1 -1
- package/dist/component/private.js +18 -0
- package/dist/component/private.js.map +1 -1
- package/dist/component/public.d.ts +433 -387
- package/dist/component/public.d.ts.map +1 -1
- package/dist/component/public.js +12 -2
- package/dist/component/public.js.map +1 -1
- package/dist/component/schema.d.ts +217 -162
- package/dist/component/schema.d.ts.map +1 -1
- package/dist/component/schema.js +2 -1
- package/dist/component/schema.js.map +1 -1
- package/dist/component/strava/private.d.ts +30 -0
- package/dist/component/strava/private.d.ts.map +1 -0
- package/dist/component/strava/private.js +71 -0
- package/dist/component/strava/private.js.map +1 -0
- package/dist/component/{strava.d.ts → strava/public.d.ts} +3 -31
- package/dist/component/strava/public.d.ts.map +1 -0
- package/dist/component/{strava.js → strava/public.js} +22 -101
- package/dist/component/strava/public.js.map +1 -0
- package/dist/component/validators/activity.d.ts +6 -0
- package/dist/component/validators/activity.d.ts.map +1 -1
- package/dist/component/validators/activity.js.map +1 -1
- package/dist/component/validators/body.d.ts +20 -14
- package/dist/component/validators/body.d.ts.map +1 -1
- package/dist/component/validators/body.js.map +1 -1
- package/dist/component/validators/connection.d.ts +1 -0
- package/dist/component/validators/connection.d.ts.map +1 -1
- package/dist/component/validators/connection.js +2 -0
- package/dist/component/validators/connection.js.map +1 -1
- package/dist/component/validators/daily.d.ts +46 -5
- package/dist/component/validators/daily.d.ts.map +1 -1
- package/dist/component/validators/daily.js +10 -1
- package/dist/component/validators/daily.js.map +1 -1
- package/dist/component/validators/enums.d.ts +2 -2
- package/dist/component/validators/menstruation.d.ts +5 -0
- package/dist/component/validators/menstruation.d.ts.map +1 -1
- package/dist/component/validators/menstruation.js.map +1 -1
- package/dist/component/validators/plannedWorkout.d.ts +5 -1
- package/dist/component/validators/plannedWorkout.d.ts.map +1 -1
- package/dist/component/validators/plannedWorkout.js +4 -0
- package/dist/component/validators/plannedWorkout.js.map +1 -1
- package/dist/component/validators/sleep.d.ts +8 -8
- package/dist/garmin/bloodPressure.d.ts +28 -0
- package/dist/garmin/bloodPressure.d.ts.map +1 -0
- package/dist/garmin/bloodPressure.js +34 -0
- package/dist/garmin/bloodPressure.js.map +1 -0
- package/dist/garmin/body.js +1 -1
- package/dist/garmin/body.js.map +1 -1
- package/dist/garmin/client.d.ts +117 -17
- package/dist/garmin/client.d.ts.map +1 -1
- package/dist/garmin/client.js +337 -43
- package/dist/garmin/client.js.map +1 -1
- package/dist/garmin/daily.d.ts.map +1 -1
- package/dist/garmin/daily.js +3 -3
- package/dist/garmin/daily.js.map +1 -1
- package/dist/garmin/hrv.d.ts +30 -0
- package/dist/garmin/hrv.d.ts.map +1 -0
- package/dist/garmin/hrv.js +45 -0
- package/dist/garmin/hrv.js.map +1 -0
- package/dist/garmin/index.d.ts +16 -4
- package/dist/garmin/index.d.ts.map +1 -1
- package/dist/garmin/index.js +8 -2
- package/dist/garmin/index.js.map +1 -1
- package/dist/garmin/maps/activity-type.d.ts +1 -2
- package/dist/garmin/maps/activity-type.d.ts.map +1 -1
- package/dist/garmin/maps/activity-type.js +1 -0
- package/dist/garmin/maps/activity-type.js.map +1 -1
- package/dist/garmin/menstruation.d.ts +6 -4
- package/dist/garmin/menstruation.d.ts.map +1 -1
- package/dist/garmin/menstruation.js +12 -8
- package/dist/garmin/menstruation.js.map +1 -1
- package/dist/garmin/pulseOx.d.ts +24 -0
- package/dist/garmin/pulseOx.d.ts.map +1 -0
- package/dist/garmin/pulseOx.js +33 -0
- package/dist/garmin/pulseOx.js.map +1 -0
- package/dist/garmin/respiration.d.ts +29 -0
- package/dist/garmin/respiration.d.ts.map +1 -0
- package/dist/garmin/respiration.js +42 -0
- package/dist/garmin/respiration.js.map +1 -0
- package/dist/garmin/skinTemp.d.ts +27 -0
- package/dist/garmin/skinTemp.d.ts.map +1 -0
- package/dist/garmin/skinTemp.js +35 -0
- package/dist/garmin/skinTemp.js.map +1 -0
- package/dist/garmin/sleep.d.ts +4 -4
- package/dist/garmin/sleep.d.ts.map +1 -1
- package/dist/garmin/sleep.js +15 -9
- package/dist/garmin/sleep.js.map +1 -1
- package/dist/garmin/stressDetails.d.ts +30 -0
- package/dist/garmin/stressDetails.d.ts.map +1 -0
- package/dist/garmin/stressDetails.js +49 -0
- package/dist/garmin/stressDetails.js.map +1 -0
- package/dist/garmin/sync.d.ts +14 -0
- package/dist/garmin/sync.d.ts.map +1 -1
- package/dist/garmin/sync.js +290 -7
- package/dist/garmin/sync.js.map +1 -1
- package/dist/garmin/types.d.ts +77 -186
- package/dist/garmin/types.d.ts.map +1 -1
- package/dist/garmin/types.js +4 -2
- package/dist/garmin/types.js.map +1 -1
- package/dist/garmin/userMetrics.d.ts +23 -0
- package/dist/garmin/userMetrics.d.ts.map +1 -0
- package/dist/garmin/userMetrics.js +41 -0
- package/dist/garmin/userMetrics.js.map +1 -0
- package/dist/validators.d.ts +138 -56
- package/dist/validators.d.ts.map +1 -1
- package/dist/validators.js +2 -2
- package/dist/validators.js.map +1 -1
- package/package.json +130 -124
- package/src/client/index.ts +86 -18
- package/src/component/_generated/api.ts +96 -4
- package/src/component/_generated/component.ts +271 -144
- package/src/{garmin → component/garmin}/auth.ts +8 -1
- package/src/component/garmin/client.ts +39 -0
- package/src/component/garmin/private.ts +1798 -0
- package/src/component/garmin/public.ts +938 -0
- package/src/component/garmin/schemas/activity.ts +40 -0
- package/src/component/garmin/schemas/activityDetails.ts +45 -0
- package/src/component/garmin/schemas/bloodPressure.ts +38 -0
- package/src/component/garmin/schemas/bodyCompositions.ts +38 -0
- package/src/component/garmin/schemas/dailies.ts +38 -0
- package/src/component/garmin/schemas/epochs.ts +38 -0
- package/src/component/garmin/schemas/healthSnapshot.ts +38 -0
- package/src/component/garmin/schemas/hrvSummary.ts +38 -0
- package/src/component/garmin/schemas/manuallyUpdatedActivities.ts +49 -0
- package/src/component/garmin/schemas/menstrualCycleTracking.ts +39 -0
- package/src/component/garmin/schemas/moveIQ.ts +38 -0
- package/src/component/garmin/schemas/pulseOx.ts +39 -0
- package/src/component/garmin/schemas/respiration.ts +39 -0
- package/src/component/garmin/schemas/skinTemperature.ts +39 -0
- package/src/component/garmin/schemas/sleeps.ts +38 -0
- package/src/component/garmin/schemas/stress.ts +43 -0
- package/src/component/garmin/schemas/userMetrics.ts +39 -0
- package/src/component/garmin/transform/activity.ts +143 -0
- package/src/component/garmin/transform/activityDetails.ts +236 -0
- package/src/component/garmin/transform/bloodPressure.ts +39 -0
- package/src/component/garmin/transform/bodyCompositions.ts +51 -0
- package/src/component/garmin/transform/dailies.ts +179 -0
- package/src/component/garmin/transform/epochs.ts +94 -0
- package/src/component/garmin/transform/healthSnapshot.ts +152 -0
- package/src/component/garmin/transform/hrvSummary.ts +56 -0
- package/src/component/garmin/transform/manuallyUpdatedActivities.ts +27 -0
- package/src/{garmin/maps/activity-type.ts → component/garmin/transform/maps/activityType.ts} +116 -116
- package/src/{garmin/maps/sleep-level.ts → component/garmin/transform/maps/sleepLevel.ts} +22 -22
- package/src/component/garmin/transform/menstrualCycleTracking.ts +48 -0
- package/src/component/garmin/transform/moveIQ.ts +48 -0
- package/src/{garmin → component/garmin/transform}/plannedWorkout.ts +328 -333
- package/src/component/garmin/transform/pulseOx.ts +64 -0
- package/src/component/garmin/transform/respiration.ts +73 -0
- package/src/component/garmin/transform/skinTemperature.ts +44 -0
- package/src/component/garmin/transform/sleeps.ts +159 -0
- package/src/component/garmin/transform/stress.ts +78 -0
- package/src/component/garmin/transform/userMetrics.ts +56 -0
- package/src/component/garmin/types/specs/training-api-workouts.json +699 -0
- package/src/component/garmin/types/specs/wellness-api.json +1 -0
- package/src/component/garmin/types/trainingApiWorkouts/client/client.gen.ts +290 -0
- package/src/component/garmin/types/trainingApiWorkouts/client/index.ts +25 -0
- package/src/component/garmin/types/trainingApiWorkouts/client/types.gen.ts +214 -0
- package/src/component/garmin/types/trainingApiWorkouts/client/utils.gen.ts +316 -0
- package/src/component/garmin/types/trainingApiWorkouts/client.gen.ts +16 -0
- package/src/component/garmin/types/trainingApiWorkouts/core/auth.gen.ts +41 -0
- package/src/component/garmin/types/trainingApiWorkouts/core/bodySerializer.gen.ts +82 -0
- package/src/component/garmin/types/trainingApiWorkouts/core/params.gen.ts +169 -0
- package/src/component/garmin/types/trainingApiWorkouts/core/pathSerializer.gen.ts +171 -0
- package/src/component/garmin/types/trainingApiWorkouts/core/queryKeySerializer.gen.ts +117 -0
- package/src/component/garmin/types/trainingApiWorkouts/core/serverSentEvents.gen.ts +243 -0
- package/src/component/garmin/types/trainingApiWorkouts/core/types.gen.ts +104 -0
- package/src/component/garmin/types/trainingApiWorkouts/core/utils.gen.ts +140 -0
- package/src/component/garmin/types/trainingApiWorkouts/index.ts +4 -0
- package/src/component/garmin/types/trainingApiWorkouts/sdk.gen.ts +126 -0
- package/src/component/garmin/types/trainingApiWorkouts/types.gen.ts +387 -0
- package/src/component/garmin/types/trainingApiWorkouts/zod.gen.ts +423 -0
- package/src/component/garmin/types/wellnessApi/client/client.gen.ts +290 -0
- package/src/component/garmin/types/wellnessApi/client/index.ts +25 -0
- package/src/component/garmin/types/wellnessApi/client/types.gen.ts +214 -0
- package/src/component/garmin/types/wellnessApi/client/utils.gen.ts +316 -0
- package/src/component/garmin/types/wellnessApi/client.gen.ts +16 -0
- package/src/component/garmin/types/wellnessApi/core/auth.gen.ts +41 -0
- package/src/component/garmin/types/wellnessApi/core/bodySerializer.gen.ts +82 -0
- package/src/component/garmin/types/wellnessApi/core/params.gen.ts +169 -0
- package/src/component/garmin/types/wellnessApi/core/pathSerializer.gen.ts +171 -0
- package/src/component/garmin/types/wellnessApi/core/queryKeySerializer.gen.ts +117 -0
- package/src/component/garmin/types/wellnessApi/core/serverSentEvents.gen.ts +243 -0
- package/src/component/garmin/types/wellnessApi/core/types.gen.ts +104 -0
- package/src/component/garmin/types/wellnessApi/core/utils.gen.ts +140 -0
- package/src/component/garmin/types/wellnessApi/index.ts +4 -0
- package/src/component/garmin/types/wellnessApi/sdk.gen.ts +207 -0
- package/src/component/garmin/types/wellnessApi/types.gen.ts +2942 -0
- package/src/component/garmin/types/wellnessApi/zod.gen.ts +878 -0
- package/src/component/garmin/utils.ts +25 -0
- package/src/component/garmin/webhooks.ts +852 -0
- package/src/component/private.ts +21 -0
- package/src/component/public.ts +11 -2
- package/src/component/schema.ts +2 -1
- package/src/component/strava/private.ts +89 -0
- package/src/component/{strava.ts → strava/public.ts} +341 -404
- package/src/component/validators/activity.ts +5 -0
- package/src/component/validators/body.ts +5 -0
- package/src/component/validators/connection.ts +2 -0
- package/src/component/validators/daily.ts +20 -0
- package/src/component/validators/menstruation.ts +5 -1
- package/src/component/validators/plannedWorkout.ts +9 -0
- package/src/validators.ts +12 -2
- package/dist/component/garmin.d.ts.map +0 -1
- package/dist/component/garmin.js.map +0 -1
- package/dist/component/strava.d.ts.map +0 -1
- package/dist/component/strava.js.map +0 -1
- package/dist/garmin/activity.d.ts +0 -101
- package/dist/garmin/activity.d.ts.map +0 -1
- package/dist/garmin/activity.js +0 -207
- package/dist/garmin/activity.js.map +0 -1
- package/src/component/garmin.ts +0 -850
- package/src/garmin/activity.test.ts +0 -178
- package/src/garmin/activity.ts +0 -272
- package/src/garmin/auth.test.ts +0 -103
- package/src/garmin/body.ts +0 -59
- package/src/garmin/client.ts +0 -407
- package/src/garmin/daily.ts +0 -211
- package/src/garmin/index.ts +0 -75
- package/src/garmin/maps/activity-type.test.ts +0 -78
- package/src/garmin/menstruation.ts +0 -42
- package/src/garmin/sleep.test.ts +0 -110
- package/src/garmin/sleep.ts +0 -170
- package/src/garmin/sync.ts +0 -223
- package/src/garmin/types.ts +0 -480
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
|
|
3
|
+
import { createSseClient } from '../core/serverSentEvents.gen';
|
|
4
|
+
import type { HttpMethod } from '../core/types.gen';
|
|
5
|
+
import { getValidRequestBody } from '../core/utils.gen';
|
|
6
|
+
import type { Client, Config, RequestOptions, ResolvedRequestOptions } from './types.gen';
|
|
7
|
+
import {
|
|
8
|
+
buildUrl,
|
|
9
|
+
createConfig,
|
|
10
|
+
createInterceptors,
|
|
11
|
+
getParseAs,
|
|
12
|
+
mergeConfigs,
|
|
13
|
+
mergeHeaders,
|
|
14
|
+
setAuthParams,
|
|
15
|
+
} from './utils.gen';
|
|
16
|
+
|
|
17
|
+
type ReqInit = Omit<RequestInit, 'body' | 'headers'> & {
|
|
18
|
+
body?: any;
|
|
19
|
+
headers: ReturnType<typeof mergeHeaders>;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const createClient = (config: Config = {}): Client => {
|
|
23
|
+
let _config = mergeConfigs(createConfig(), config);
|
|
24
|
+
|
|
25
|
+
const getConfig = (): Config => ({ ..._config });
|
|
26
|
+
|
|
27
|
+
const setConfig = (config: Config): Config => {
|
|
28
|
+
_config = mergeConfigs(_config, config);
|
|
29
|
+
return getConfig();
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const interceptors = createInterceptors<Request, Response, unknown, ResolvedRequestOptions>();
|
|
33
|
+
|
|
34
|
+
const beforeRequest = async (options: RequestOptions) => {
|
|
35
|
+
const opts = {
|
|
36
|
+
..._config,
|
|
37
|
+
...options,
|
|
38
|
+
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
39
|
+
headers: mergeHeaders(_config.headers, options.headers),
|
|
40
|
+
serializedBody: undefined as string | undefined,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
if (opts.security) {
|
|
44
|
+
await setAuthParams({
|
|
45
|
+
...opts,
|
|
46
|
+
security: opts.security,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (opts.requestValidator) {
|
|
51
|
+
await opts.requestValidator(opts);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (opts.body !== undefined && opts.bodySerializer) {
|
|
55
|
+
opts.serializedBody = opts.bodySerializer(opts.body) as string | undefined;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// remove Content-Type header if body is empty to avoid sending invalid requests
|
|
59
|
+
if (opts.body === undefined || opts.serializedBody === '') {
|
|
60
|
+
opts.headers.delete('Content-Type');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const url = buildUrl(opts);
|
|
64
|
+
|
|
65
|
+
return { opts, url };
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const request: Client['request'] = async (options) => {
|
|
69
|
+
// @ts-expect-error
|
|
70
|
+
const { opts, url } = await beforeRequest(options);
|
|
71
|
+
const requestInit: ReqInit = {
|
|
72
|
+
redirect: 'follow',
|
|
73
|
+
...opts,
|
|
74
|
+
body: getValidRequestBody(opts),
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
let request = new Request(url, requestInit);
|
|
78
|
+
|
|
79
|
+
for (const fn of interceptors.request.fns) {
|
|
80
|
+
if (fn) {
|
|
81
|
+
request = await fn(request, opts);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// fetch must be assigned here, otherwise it would throw the error:
|
|
86
|
+
// TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
|
|
87
|
+
const _fetch = opts.fetch!;
|
|
88
|
+
let response: Response;
|
|
89
|
+
|
|
90
|
+
try {
|
|
91
|
+
response = await _fetch(request);
|
|
92
|
+
} catch (error) {
|
|
93
|
+
// Handle fetch exceptions (AbortError, network errors, etc.)
|
|
94
|
+
let finalError = error;
|
|
95
|
+
|
|
96
|
+
for (const fn of interceptors.error.fns) {
|
|
97
|
+
if (fn) {
|
|
98
|
+
finalError = (await fn(error, undefined as any, request, opts)) as unknown;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
finalError = finalError || ({} as unknown);
|
|
103
|
+
|
|
104
|
+
if (opts.throwOnError) {
|
|
105
|
+
throw finalError;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Return error response
|
|
109
|
+
return opts.responseStyle === 'data'
|
|
110
|
+
? undefined
|
|
111
|
+
: {
|
|
112
|
+
error: finalError,
|
|
113
|
+
request,
|
|
114
|
+
response: undefined as any,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
for (const fn of interceptors.response.fns) {
|
|
119
|
+
if (fn) {
|
|
120
|
+
response = await fn(response, request, opts);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const result = {
|
|
125
|
+
request,
|
|
126
|
+
response,
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
if (response.ok) {
|
|
130
|
+
const parseAs =
|
|
131
|
+
(opts.parseAs === 'auto'
|
|
132
|
+
? getParseAs(response.headers.get('Content-Type'))
|
|
133
|
+
: opts.parseAs) ?? 'json';
|
|
134
|
+
|
|
135
|
+
if (response.status === 204 || response.headers.get('Content-Length') === '0') {
|
|
136
|
+
let emptyData: any;
|
|
137
|
+
switch (parseAs) {
|
|
138
|
+
case 'arrayBuffer':
|
|
139
|
+
case 'blob':
|
|
140
|
+
case 'text':
|
|
141
|
+
emptyData = await response[parseAs]();
|
|
142
|
+
break;
|
|
143
|
+
case 'formData':
|
|
144
|
+
emptyData = new FormData();
|
|
145
|
+
break;
|
|
146
|
+
case 'stream':
|
|
147
|
+
emptyData = response.body;
|
|
148
|
+
break;
|
|
149
|
+
case 'json':
|
|
150
|
+
default:
|
|
151
|
+
emptyData = {};
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
return opts.responseStyle === 'data'
|
|
155
|
+
? emptyData
|
|
156
|
+
: {
|
|
157
|
+
data: emptyData,
|
|
158
|
+
...result,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
let data: any;
|
|
163
|
+
switch (parseAs) {
|
|
164
|
+
case 'arrayBuffer':
|
|
165
|
+
case 'blob':
|
|
166
|
+
case 'formData':
|
|
167
|
+
case 'text':
|
|
168
|
+
data = await response[parseAs]();
|
|
169
|
+
break;
|
|
170
|
+
case 'json': {
|
|
171
|
+
// Some servers return 200 with no Content-Length and empty body.
|
|
172
|
+
// response.json() would throw; read as text and parse if non-empty.
|
|
173
|
+
const text = await response.text();
|
|
174
|
+
data = text ? JSON.parse(text) : {};
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
case 'stream':
|
|
178
|
+
return opts.responseStyle === 'data'
|
|
179
|
+
? response.body
|
|
180
|
+
: {
|
|
181
|
+
data: response.body,
|
|
182
|
+
...result,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (parseAs === 'json') {
|
|
187
|
+
if (opts.responseValidator) {
|
|
188
|
+
await opts.responseValidator(data);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (opts.responseTransformer) {
|
|
192
|
+
data = await opts.responseTransformer(data);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return opts.responseStyle === 'data'
|
|
197
|
+
? data
|
|
198
|
+
: {
|
|
199
|
+
data,
|
|
200
|
+
...result,
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const textError = await response.text();
|
|
205
|
+
let jsonError: unknown;
|
|
206
|
+
|
|
207
|
+
try {
|
|
208
|
+
jsonError = JSON.parse(textError);
|
|
209
|
+
} catch {
|
|
210
|
+
// noop
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const error = jsonError ?? textError;
|
|
214
|
+
let finalError = error;
|
|
215
|
+
|
|
216
|
+
for (const fn of interceptors.error.fns) {
|
|
217
|
+
if (fn) {
|
|
218
|
+
finalError = (await fn(error, response, request, opts)) as string;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
finalError = finalError || ({} as string);
|
|
223
|
+
|
|
224
|
+
if (opts.throwOnError) {
|
|
225
|
+
throw finalError;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// TODO: we probably want to return error and improve types
|
|
229
|
+
return opts.responseStyle === 'data'
|
|
230
|
+
? undefined
|
|
231
|
+
: {
|
|
232
|
+
error: finalError,
|
|
233
|
+
...result,
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
const makeMethodFn = (method: Uppercase<HttpMethod>) => (options: RequestOptions) =>
|
|
238
|
+
request({ ...options, method });
|
|
239
|
+
|
|
240
|
+
const makeSseFn = (method: Uppercase<HttpMethod>) => async (options: RequestOptions) => {
|
|
241
|
+
const { opts, url } = await beforeRequest(options);
|
|
242
|
+
return createSseClient({
|
|
243
|
+
...opts,
|
|
244
|
+
body: opts.body as BodyInit | null | undefined,
|
|
245
|
+
headers: opts.headers as unknown as Record<string, string>,
|
|
246
|
+
method,
|
|
247
|
+
onRequest: async (url, init) => {
|
|
248
|
+
let request = new Request(url, init);
|
|
249
|
+
for (const fn of interceptors.request.fns) {
|
|
250
|
+
if (fn) {
|
|
251
|
+
request = await fn(request, opts);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return request;
|
|
255
|
+
},
|
|
256
|
+
serializedBody: getValidRequestBody(opts) as BodyInit | null | undefined,
|
|
257
|
+
url,
|
|
258
|
+
});
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
const _buildUrl: Client['buildUrl'] = (options) => buildUrl({ ..._config, ...options });
|
|
262
|
+
|
|
263
|
+
return {
|
|
264
|
+
buildUrl: _buildUrl,
|
|
265
|
+
connect: makeMethodFn('CONNECT'),
|
|
266
|
+
delete: makeMethodFn('DELETE'),
|
|
267
|
+
get: makeMethodFn('GET'),
|
|
268
|
+
getConfig,
|
|
269
|
+
head: makeMethodFn('HEAD'),
|
|
270
|
+
interceptors,
|
|
271
|
+
options: makeMethodFn('OPTIONS'),
|
|
272
|
+
patch: makeMethodFn('PATCH'),
|
|
273
|
+
post: makeMethodFn('POST'),
|
|
274
|
+
put: makeMethodFn('PUT'),
|
|
275
|
+
request,
|
|
276
|
+
setConfig,
|
|
277
|
+
sse: {
|
|
278
|
+
connect: makeSseFn('CONNECT'),
|
|
279
|
+
delete: makeSseFn('DELETE'),
|
|
280
|
+
get: makeSseFn('GET'),
|
|
281
|
+
head: makeSseFn('HEAD'),
|
|
282
|
+
options: makeSseFn('OPTIONS'),
|
|
283
|
+
patch: makeSseFn('PATCH'),
|
|
284
|
+
post: makeSseFn('POST'),
|
|
285
|
+
put: makeSseFn('PUT'),
|
|
286
|
+
trace: makeSseFn('TRACE'),
|
|
287
|
+
},
|
|
288
|
+
trace: makeMethodFn('TRACE'),
|
|
289
|
+
} as Client;
|
|
290
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
|
|
3
|
+
export type { Auth } from '../core/auth.gen';
|
|
4
|
+
export type { QuerySerializerOptions } from '../core/bodySerializer.gen';
|
|
5
|
+
export {
|
|
6
|
+
formDataBodySerializer,
|
|
7
|
+
jsonBodySerializer,
|
|
8
|
+
urlSearchParamsBodySerializer,
|
|
9
|
+
} from '../core/bodySerializer.gen';
|
|
10
|
+
export { buildClientParams } from '../core/params.gen';
|
|
11
|
+
export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen';
|
|
12
|
+
export { createClient } from './client.gen';
|
|
13
|
+
export type {
|
|
14
|
+
Client,
|
|
15
|
+
ClientOptions,
|
|
16
|
+
Config,
|
|
17
|
+
CreateClientConfig,
|
|
18
|
+
Options,
|
|
19
|
+
RequestOptions,
|
|
20
|
+
RequestResult,
|
|
21
|
+
ResolvedRequestOptions,
|
|
22
|
+
ResponseStyle,
|
|
23
|
+
TDataShape,
|
|
24
|
+
} from './types.gen';
|
|
25
|
+
export { createConfig, mergeHeaders } from './utils.gen';
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
|
|
3
|
+
import type { Auth } from '../core/auth.gen';
|
|
4
|
+
import type {
|
|
5
|
+
ServerSentEventsOptions,
|
|
6
|
+
ServerSentEventsResult,
|
|
7
|
+
} from '../core/serverSentEvents.gen';
|
|
8
|
+
import type { Client as CoreClient, Config as CoreConfig } from '../core/types.gen';
|
|
9
|
+
import type { Middleware } from './utils.gen';
|
|
10
|
+
|
|
11
|
+
export type ResponseStyle = 'data' | 'fields';
|
|
12
|
+
|
|
13
|
+
export interface Config<T extends ClientOptions = ClientOptions>
|
|
14
|
+
extends Omit<RequestInit, 'body' | 'headers' | 'method'>, CoreConfig {
|
|
15
|
+
/**
|
|
16
|
+
* Base URL for all requests made by this client.
|
|
17
|
+
*/
|
|
18
|
+
baseUrl?: T['baseUrl'];
|
|
19
|
+
/**
|
|
20
|
+
* Fetch API implementation. You can use this option to provide a custom
|
|
21
|
+
* fetch instance.
|
|
22
|
+
*
|
|
23
|
+
* @default globalThis.fetch
|
|
24
|
+
*/
|
|
25
|
+
fetch?: typeof fetch;
|
|
26
|
+
/**
|
|
27
|
+
* Please don't use the Fetch client for Next.js applications. The `next`
|
|
28
|
+
* options won't have any effect.
|
|
29
|
+
*
|
|
30
|
+
* Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
|
|
31
|
+
*/
|
|
32
|
+
next?: never;
|
|
33
|
+
/**
|
|
34
|
+
* Return the response data parsed in a specified format. By default, `auto`
|
|
35
|
+
* will infer the appropriate method from the `Content-Type` response header.
|
|
36
|
+
* You can override this behavior with any of the {@link Body} methods.
|
|
37
|
+
* Select `stream` if you don't want to parse response data at all.
|
|
38
|
+
*
|
|
39
|
+
* @default 'auto'
|
|
40
|
+
*/
|
|
41
|
+
parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text';
|
|
42
|
+
/**
|
|
43
|
+
* Should we return only data or multiple fields (data, error, response, etc.)?
|
|
44
|
+
*
|
|
45
|
+
* @default 'fields'
|
|
46
|
+
*/
|
|
47
|
+
responseStyle?: ResponseStyle;
|
|
48
|
+
/**
|
|
49
|
+
* Throw an error instead of returning it in the response?
|
|
50
|
+
*
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
53
|
+
throwOnError?: T['throwOnError'];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface RequestOptions<
|
|
57
|
+
TData = unknown,
|
|
58
|
+
TResponseStyle extends ResponseStyle = 'fields',
|
|
59
|
+
ThrowOnError extends boolean = boolean,
|
|
60
|
+
Url extends string = string,
|
|
61
|
+
>
|
|
62
|
+
extends
|
|
63
|
+
Config<{
|
|
64
|
+
responseStyle: TResponseStyle;
|
|
65
|
+
throwOnError: ThrowOnError;
|
|
66
|
+
}>,
|
|
67
|
+
Pick<
|
|
68
|
+
ServerSentEventsOptions<TData>,
|
|
69
|
+
| 'onRequest'
|
|
70
|
+
| 'onSseError'
|
|
71
|
+
| 'onSseEvent'
|
|
72
|
+
| 'sseDefaultRetryDelay'
|
|
73
|
+
| 'sseMaxRetryAttempts'
|
|
74
|
+
| 'sseMaxRetryDelay'
|
|
75
|
+
> {
|
|
76
|
+
/**
|
|
77
|
+
* Any body that you want to add to your request.
|
|
78
|
+
*
|
|
79
|
+
* {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
|
|
80
|
+
*/
|
|
81
|
+
body?: unknown;
|
|
82
|
+
path?: Record<string, unknown>;
|
|
83
|
+
query?: Record<string, unknown>;
|
|
84
|
+
/**
|
|
85
|
+
* Security mechanism(s) to use for the request.
|
|
86
|
+
*/
|
|
87
|
+
security?: ReadonlyArray<Auth>;
|
|
88
|
+
url: Url;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface ResolvedRequestOptions<
|
|
92
|
+
TResponseStyle extends ResponseStyle = 'fields',
|
|
93
|
+
ThrowOnError extends boolean = boolean,
|
|
94
|
+
Url extends string = string,
|
|
95
|
+
> extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> {
|
|
96
|
+
serializedBody?: string;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export type RequestResult<
|
|
100
|
+
TData = unknown,
|
|
101
|
+
TError = unknown,
|
|
102
|
+
ThrowOnError extends boolean = boolean,
|
|
103
|
+
TResponseStyle extends ResponseStyle = 'fields',
|
|
104
|
+
> = ThrowOnError extends true
|
|
105
|
+
? Promise<
|
|
106
|
+
TResponseStyle extends 'data'
|
|
107
|
+
? TData extends Record<string, unknown>
|
|
108
|
+
? TData[keyof TData]
|
|
109
|
+
: TData
|
|
110
|
+
: {
|
|
111
|
+
data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
|
|
112
|
+
request: Request;
|
|
113
|
+
response: Response;
|
|
114
|
+
}
|
|
115
|
+
>
|
|
116
|
+
: Promise<
|
|
117
|
+
TResponseStyle extends 'data'
|
|
118
|
+
? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined
|
|
119
|
+
: (
|
|
120
|
+
| {
|
|
121
|
+
data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
|
|
122
|
+
error: undefined;
|
|
123
|
+
}
|
|
124
|
+
| {
|
|
125
|
+
data: undefined;
|
|
126
|
+
error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
|
|
127
|
+
}
|
|
128
|
+
) & {
|
|
129
|
+
request: Request;
|
|
130
|
+
response: Response;
|
|
131
|
+
}
|
|
132
|
+
>;
|
|
133
|
+
|
|
134
|
+
export interface ClientOptions {
|
|
135
|
+
baseUrl?: string;
|
|
136
|
+
responseStyle?: ResponseStyle;
|
|
137
|
+
throwOnError?: boolean;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
type MethodFn = <
|
|
141
|
+
TData = unknown,
|
|
142
|
+
TError = unknown,
|
|
143
|
+
ThrowOnError extends boolean = false,
|
|
144
|
+
TResponseStyle extends ResponseStyle = 'fields',
|
|
145
|
+
>(
|
|
146
|
+
options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>,
|
|
147
|
+
) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
|
148
|
+
|
|
149
|
+
type SseFn = <
|
|
150
|
+
TData = unknown,
|
|
151
|
+
TError = unknown,
|
|
152
|
+
ThrowOnError extends boolean = false,
|
|
153
|
+
TResponseStyle extends ResponseStyle = 'fields',
|
|
154
|
+
>(
|
|
155
|
+
options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>,
|
|
156
|
+
) => Promise<ServerSentEventsResult<TData, TError>>;
|
|
157
|
+
|
|
158
|
+
type RequestFn = <
|
|
159
|
+
TData = unknown,
|
|
160
|
+
TError = unknown,
|
|
161
|
+
ThrowOnError extends boolean = false,
|
|
162
|
+
TResponseStyle extends ResponseStyle = 'fields',
|
|
163
|
+
>(
|
|
164
|
+
options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'> &
|
|
165
|
+
Pick<Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, 'method'>,
|
|
166
|
+
) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
|
167
|
+
|
|
168
|
+
type BuildUrlFn = <
|
|
169
|
+
TData extends {
|
|
170
|
+
body?: unknown;
|
|
171
|
+
path?: Record<string, unknown>;
|
|
172
|
+
query?: Record<string, unknown>;
|
|
173
|
+
url: string;
|
|
174
|
+
},
|
|
175
|
+
>(
|
|
176
|
+
options: TData & Options<TData>,
|
|
177
|
+
) => string;
|
|
178
|
+
|
|
179
|
+
export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn, SseFn> & {
|
|
180
|
+
interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* The `createClientConfig()` function will be called on client initialization
|
|
185
|
+
* and the returned object will become the client's initial configuration.
|
|
186
|
+
*
|
|
187
|
+
* You may want to initialize your client this way instead of calling
|
|
188
|
+
* `setConfig()`. This is useful for example if you're using Next.js
|
|
189
|
+
* to ensure your client always has the correct values.
|
|
190
|
+
*/
|
|
191
|
+
export type CreateClientConfig<T extends ClientOptions = ClientOptions> = (
|
|
192
|
+
override?: Config<ClientOptions & T>,
|
|
193
|
+
) => Config<Required<ClientOptions> & T>;
|
|
194
|
+
|
|
195
|
+
export interface TDataShape {
|
|
196
|
+
body?: unknown;
|
|
197
|
+
headers?: unknown;
|
|
198
|
+
path?: unknown;
|
|
199
|
+
query?: unknown;
|
|
200
|
+
url: string;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
|
|
204
|
+
|
|
205
|
+
export type Options<
|
|
206
|
+
TData extends TDataShape = TDataShape,
|
|
207
|
+
ThrowOnError extends boolean = boolean,
|
|
208
|
+
TResponse = unknown,
|
|
209
|
+
TResponseStyle extends ResponseStyle = 'fields',
|
|
210
|
+
> = OmitKeys<
|
|
211
|
+
RequestOptions<TResponse, TResponseStyle, ThrowOnError>,
|
|
212
|
+
'body' | 'path' | 'query' | 'url'
|
|
213
|
+
> &
|
|
214
|
+
([TData] extends [never] ? unknown : Omit<TData, 'url'>);
|