@nativesquare/soma 0.10.2 → 0.12.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/garmin.d.ts +287 -0
- package/dist/client/garmin.d.ts.map +1 -0
- package/dist/client/garmin.js +345 -0
- package/dist/client/garmin.js.map +1 -0
- package/dist/client/index.d.ts +27 -467
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +33 -385
- package/dist/client/index.js.map +1 -1
- package/dist/client/strava.d.ts +92 -0
- package/dist/client/strava.d.ts.map +1 -0
- package/dist/client/strava.js +96 -0
- package/dist/client/strava.js.map +1 -0
- package/dist/client/types.d.ts +165 -0
- package/dist/client/types.d.ts.map +1 -1
- package/dist/component/_generated/component.d.ts +17 -12
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/garmin/public.d.ts +18 -84
- package/dist/component/garmin/public.d.ts.map +1 -1
- package/dist/component/garmin/public.js +147 -539
- package/dist/component/garmin/public.js.map +1 -1
- package/package.json +1 -1
- package/src/client/garmin.ts +487 -0
- package/src/client/index.ts +69 -711
- package/src/client/strava.ts +108 -0
- package/src/client/types.ts +215 -18
- package/src/component/_generated/component.ts +29 -18
- package/src/component/garmin/public.ts +1049 -1406
- package/src/component/garmin/webhooks.ts +857 -857
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import type { Id } from "../_generated/dataModel";
|
|
2
|
-
/**
|
|
3
|
-
* Generate a Garmin OAuth 2.0 authorization URL with PKCE.
|
|
4
|
-
*
|
|
5
|
-
* The PKCE code verifier and state are stored in the component's
|
|
6
|
-
* `pendingOAuth` table so that `completeGarminOAuth` can look them up
|
|
7
|
-
* automatically when the callback fires via `registerRoutes`.
|
|
8
|
-
*/
|
|
9
2
|
export declare const getGarminAuthUrl: import("convex/server").RegisteredAction<"public", {
|
|
10
3
|
redirectUri?: string | undefined;
|
|
11
4
|
userId: string;
|
|
@@ -15,17 +8,6 @@ export declare const getGarminAuthUrl: import("convex/server").RegisteredAction<
|
|
|
15
8
|
state: string;
|
|
16
9
|
codeVerifier: string;
|
|
17
10
|
}>>;
|
|
18
|
-
/**
|
|
19
|
-
* Complete a Garmin OAuth 2.0 flow using stored pending state.
|
|
20
|
-
*
|
|
21
|
-
* Called internally by `registerRoutes` — the callback handler calls
|
|
22
|
-
* this with the `code` and `state` from the redirect. The action looks
|
|
23
|
-
* up the pending state (codeVerifier, userId) stored during
|
|
24
|
-
* `getGarminAuthUrl`, exchanges for tokens, creates the connection,
|
|
25
|
-
* stores tokens, and cleans up the pending entry.
|
|
26
|
-
*
|
|
27
|
-
* The host app is responsible for calling `syncGarmin` afterwards.
|
|
28
|
-
*/
|
|
29
11
|
export declare const completeGarminOAuth: import("convex/server").RegisteredAction<"public", {
|
|
30
12
|
redirectUri?: string | undefined;
|
|
31
13
|
state: string;
|
|
@@ -36,12 +18,6 @@ export declare const completeGarminOAuth: import("convex/server").RegisteredActi
|
|
|
36
18
|
connectionId: Id<"connections">;
|
|
37
19
|
userId: string;
|
|
38
20
|
}>>;
|
|
39
|
-
/**
|
|
40
|
-
* Disconnect a user from Garmin.
|
|
41
|
-
*
|
|
42
|
-
* Deregisters the user via the Garmin API (best-effort), deletes stored
|
|
43
|
-
* tokens, and sets the connection to inactive.
|
|
44
|
-
*/
|
|
45
21
|
export declare const disconnectGarmin: import("convex/server").RegisteredAction<"public", {
|
|
46
22
|
userId: string;
|
|
47
23
|
}, Promise<null>>;
|
|
@@ -251,76 +227,34 @@ export declare const pullAll: import("convex/server").RegisteredAction<"public",
|
|
|
251
227
|
error: string;
|
|
252
228
|
}[];
|
|
253
229
|
}>>;
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
*
|
|
257
|
-
* Looks up the stored tokens, refreshes if expired, and syncs all data
|
|
258
|
-
* types for the specified time range (defaults to last 30 days).
|
|
259
|
-
*/
|
|
260
|
-
export declare const syncGarmin: import("convex/server").RegisteredAction<"public", {
|
|
261
|
-
endTimeInSeconds?: number | undefined;
|
|
262
|
-
startTimeInSeconds?: number | undefined;
|
|
230
|
+
export declare const pushWorkout: import("convex/server").RegisteredAction<"public", {
|
|
231
|
+
workoutProvider?: string | undefined;
|
|
263
232
|
userId: string;
|
|
264
233
|
clientId: string;
|
|
265
234
|
clientSecret: string;
|
|
235
|
+
plannedWorkoutId: string;
|
|
266
236
|
}, Promise<{
|
|
267
|
-
|
|
268
|
-
errors: Array<{
|
|
269
|
-
type: string;
|
|
270
|
-
id: string;
|
|
271
|
-
error: string;
|
|
272
|
-
}>;
|
|
237
|
+
garminWorkoutId: number;
|
|
273
238
|
}>>;
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
*
|
|
277
|
-
* Called by syncGarmin after obtaining a valid access token.
|
|
278
|
-
* after obtaining a valid access token.
|
|
279
|
-
*/
|
|
280
|
-
export declare const syncAllTypes: import("convex/server").RegisteredAction<"public", {
|
|
281
|
-
connectionId: import("convex/values").GenericId<"connections">;
|
|
239
|
+
export declare const pushSchedule: import("convex/server").RegisteredAction<"public", {
|
|
240
|
+
date?: string | undefined;
|
|
282
241
|
userId: string;
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
242
|
+
clientId: string;
|
|
243
|
+
clientSecret: string;
|
|
244
|
+
plannedWorkoutId: string;
|
|
286
245
|
}, Promise<{
|
|
287
|
-
|
|
288
|
-
activities: number;
|
|
289
|
-
dailies: number;
|
|
290
|
-
sleep: number;
|
|
291
|
-
body: number;
|
|
292
|
-
menstruation: number;
|
|
293
|
-
bloodPressures: number;
|
|
294
|
-
skinTemp: number;
|
|
295
|
-
userMetrics: number;
|
|
296
|
-
hrv: number;
|
|
297
|
-
stressDetails: number;
|
|
298
|
-
pulseOx: number;
|
|
299
|
-
respiration: number;
|
|
300
|
-
};
|
|
301
|
-
errors: {
|
|
302
|
-
type: string;
|
|
303
|
-
id: string;
|
|
304
|
-
error: string;
|
|
305
|
-
}[];
|
|
246
|
+
garminScheduleId: number;
|
|
306
247
|
}>>;
|
|
307
|
-
|
|
308
|
-
* Push a planned workout from Soma's DB to Garmin Connect.
|
|
309
|
-
*
|
|
310
|
-
* Reads the planned workout document, transforms it to Garmin Training API V2
|
|
311
|
-
* format, creates the workout at Garmin, and optionally schedules it if a
|
|
312
|
-
* `planned_date` is set in the metadata.
|
|
313
|
-
*
|
|
314
|
-
* Returns the Garmin workout ID and schedule ID (if scheduled).
|
|
315
|
-
*/
|
|
316
|
-
export declare const pushPlannedWorkout: import("convex/server").RegisteredAction<"public", {
|
|
317
|
-
workoutProvider?: string | undefined;
|
|
248
|
+
export declare const deleteWorkout: import("convex/server").RegisteredAction<"public", {
|
|
318
249
|
userId: string;
|
|
319
250
|
clientId: string;
|
|
320
251
|
clientSecret: string;
|
|
321
252
|
plannedWorkoutId: string;
|
|
322
|
-
}, Promise<
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
253
|
+
}, Promise<null>>;
|
|
254
|
+
export declare const deleteSchedule: import("convex/server").RegisteredAction<"public", {
|
|
255
|
+
userId: string;
|
|
256
|
+
clientId: string;
|
|
257
|
+
clientSecret: string;
|
|
258
|
+
plannedWorkoutId: string;
|
|
259
|
+
}, Promise<null>>;
|
|
326
260
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/component/garmin/public.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAO,EAAE,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/component/garmin/public.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAO,EAAE,EAAE,MAAM,yBAAyB,CAAC;AAuDvD,eAAO,MAAM,gBAAgB;;;;;;;;GA2B3B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;kBASd,EAAE,CAAC,aAAa,CAAC;YACvB,MAAM;GA4DhB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;iB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