@clipin/convex-wearables 0.0.1

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 (143) hide show
  1. package/LICENSE +203 -0
  2. package/README.md +616 -0
  3. package/dist/client/_generated/_ignore.d.ts +1 -0
  4. package/dist/client/_generated/_ignore.d.ts.map +1 -0
  5. package/dist/client/_generated/_ignore.js +4 -0
  6. package/dist/client/_generated/_ignore.js.map +1 -0
  7. package/dist/client/index.d.ts +244 -0
  8. package/dist/client/index.d.ts.map +1 -0
  9. package/dist/client/index.js +555 -0
  10. package/dist/client/index.js.map +1 -0
  11. package/dist/client/types.d.ts +689 -0
  12. package/dist/client/types.d.ts.map +1 -0
  13. package/dist/client/types.js +112 -0
  14. package/dist/client/types.js.map +1 -0
  15. package/dist/component/_generated/_ignore.d.ts +1 -0
  16. package/dist/component/_generated/_ignore.d.ts.map +1 -0
  17. package/dist/component/_generated/_ignore.js +4 -0
  18. package/dist/component/_generated/_ignore.js.map +1 -0
  19. package/dist/component/_generated/api.d.ts +13 -0
  20. package/dist/component/_generated/api.d.ts.map +1 -0
  21. package/dist/component/_generated/api.js +14 -0
  22. package/dist/component/_generated/api.js.map +1 -0
  23. package/dist/component/_generated/dataModel.d.ts +28 -0
  24. package/dist/component/_generated/dataModel.d.ts.map +1 -0
  25. package/dist/component/_generated/dataModel.js +11 -0
  26. package/dist/component/_generated/dataModel.js.map +1 -0
  27. package/dist/component/_generated/server.d.ts +23 -0
  28. package/dist/component/_generated/server.d.ts.map +1 -0
  29. package/dist/component/_generated/server.js +18 -0
  30. package/dist/component/_generated/server.js.map +1 -0
  31. package/dist/component/backfillJobs.d.ts +121 -0
  32. package/dist/component/backfillJobs.d.ts.map +1 -0
  33. package/dist/component/backfillJobs.js +233 -0
  34. package/dist/component/backfillJobs.js.map +1 -0
  35. package/dist/component/connections.d.ts +159 -0
  36. package/dist/component/connections.d.ts.map +1 -0
  37. package/dist/component/connections.js +288 -0
  38. package/dist/component/connections.js.map +1 -0
  39. package/dist/component/convex.config.d.ts +3 -0
  40. package/dist/component/convex.config.d.ts.map +1 -0
  41. package/dist/component/convex.config.js +6 -0
  42. package/dist/component/convex.config.js.map +1 -0
  43. package/dist/component/dataPoints.d.ts +81 -0
  44. package/dist/component/dataPoints.d.ts.map +1 -0
  45. package/dist/component/dataPoints.js +258 -0
  46. package/dist/component/dataPoints.js.map +1 -0
  47. package/dist/component/dataSources.d.ts +56 -0
  48. package/dist/component/dataSources.d.ts.map +1 -0
  49. package/dist/component/dataSources.js +95 -0
  50. package/dist/component/dataSources.js.map +1 -0
  51. package/dist/component/events.d.ts +203 -0
  52. package/dist/component/events.d.ts.map +1 -0
  53. package/dist/component/events.js +251 -0
  54. package/dist/component/events.js.map +1 -0
  55. package/dist/component/garminBackfill.d.ts +40 -0
  56. package/dist/component/garminBackfill.d.ts.map +1 -0
  57. package/dist/component/garminBackfill.js +296 -0
  58. package/dist/component/garminBackfill.js.map +1 -0
  59. package/dist/component/garminWebhooks.d.ts +17 -0
  60. package/dist/component/garminWebhooks.d.ts.map +1 -0
  61. package/dist/component/garminWebhooks.js +505 -0
  62. package/dist/component/garminWebhooks.js.map +1 -0
  63. package/dist/component/httpHandlers.d.ts +32 -0
  64. package/dist/component/httpHandlers.d.ts.map +1 -0
  65. package/dist/component/httpHandlers.js +131 -0
  66. package/dist/component/httpHandlers.js.map +1 -0
  67. package/dist/component/lifecycle.d.ts +12 -0
  68. package/dist/component/lifecycle.d.ts.map +1 -0
  69. package/dist/component/lifecycle.js +79 -0
  70. package/dist/component/lifecycle.js.map +1 -0
  71. package/dist/component/menstrualCycles.d.ts +98 -0
  72. package/dist/component/menstrualCycles.d.ts.map +1 -0
  73. package/dist/component/menstrualCycles.js +112 -0
  74. package/dist/component/menstrualCycles.js.map +1 -0
  75. package/dist/component/oauthActions.d.ts +52 -0
  76. package/dist/component/oauthActions.d.ts.map +1 -0
  77. package/dist/component/oauthActions.js +208 -0
  78. package/dist/component/oauthActions.js.map +1 -0
  79. package/dist/component/oauthStates.d.ts +47 -0
  80. package/dist/component/oauthStates.d.ts.map +1 -0
  81. package/dist/component/oauthStates.js +77 -0
  82. package/dist/component/oauthStates.js.map +1 -0
  83. package/dist/component/providerSettings.d.ts +15 -0
  84. package/dist/component/providerSettings.d.ts.map +1 -0
  85. package/dist/component/providerSettings.js +57 -0
  86. package/dist/component/providerSettings.js.map +1 -0
  87. package/dist/component/providers/garmin.d.ts +306 -0
  88. package/dist/component/providers/garmin.d.ts.map +1 -0
  89. package/dist/component/providers/garmin.js +675 -0
  90. package/dist/component/providers/garmin.js.map +1 -0
  91. package/dist/component/providers/oauth.d.ts +42 -0
  92. package/dist/component/providers/oauth.d.ts.map +1 -0
  93. package/dist/component/providers/oauth.js +181 -0
  94. package/dist/component/providers/oauth.js.map +1 -0
  95. package/dist/component/providers/polar.d.ts +6 -0
  96. package/dist/component/providers/polar.d.ts.map +1 -0
  97. package/dist/component/providers/polar.js +175 -0
  98. package/dist/component/providers/polar.js.map +1 -0
  99. package/dist/component/providers/registry.d.ts +14 -0
  100. package/dist/component/providers/registry.d.ts.map +1 -0
  101. package/dist/component/providers/registry.js +32 -0
  102. package/dist/component/providers/registry.js.map +1 -0
  103. package/dist/component/providers/strava.d.ts +45 -0
  104. package/dist/component/providers/strava.d.ts.map +1 -0
  105. package/dist/component/providers/strava.js +182 -0
  106. package/dist/component/providers/strava.js.map +1 -0
  107. package/dist/component/providers/suunto.d.ts +5 -0
  108. package/dist/component/providers/suunto.d.ts.map +1 -0
  109. package/dist/component/providers/suunto.js +502 -0
  110. package/dist/component/providers/suunto.js.map +1 -0
  111. package/dist/component/providers/types.d.ts +139 -0
  112. package/dist/component/providers/types.d.ts.map +1 -0
  113. package/dist/component/providers/types.js +5 -0
  114. package/dist/component/providers/types.js.map +1 -0
  115. package/dist/component/providers/whoop.d.ts +4 -0
  116. package/dist/component/providers/whoop.d.ts.map +1 -0
  117. package/dist/component/providers/whoop.js +439 -0
  118. package/dist/component/providers/whoop.js.map +1 -0
  119. package/dist/component/schema.d.ts +429 -0
  120. package/dist/component/schema.d.ts.map +1 -0
  121. package/dist/component/schema.js +282 -0
  122. package/dist/component/schema.js.map +1 -0
  123. package/dist/component/sdkPush.d.ts +143 -0
  124. package/dist/component/sdkPush.d.ts.map +1 -0
  125. package/dist/component/sdkPush.js +338 -0
  126. package/dist/component/sdkPush.js.map +1 -0
  127. package/dist/component/summaries.d.ts +129 -0
  128. package/dist/component/summaries.d.ts.map +1 -0
  129. package/dist/component/summaries.js +129 -0
  130. package/dist/component/summaries.js.map +1 -0
  131. package/dist/component/syncJobs.d.ts +142 -0
  132. package/dist/component/syncJobs.d.ts.map +1 -0
  133. package/dist/component/syncJobs.js +136 -0
  134. package/dist/component/syncJobs.js.map +1 -0
  135. package/dist/component/syncWorkflow.d.ts +99 -0
  136. package/dist/component/syncWorkflow.d.ts.map +1 -0
  137. package/dist/component/syncWorkflow.js +579 -0
  138. package/dist/component/syncWorkflow.js.map +1 -0
  139. package/dist/component/workflowManager.d.ts +3 -0
  140. package/dist/component/workflowManager.d.ts.map +1 -0
  141. package/dist/component/workflowManager.js +17 -0
  142. package/dist/component/workflowManager.js.map +1 -0
  143. package/package.json +84 -0
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Shared types for @clipin/convex-wearables.
3
+ *
4
+ * These types are used by both the component internals and the host app.
5
+ */
6
+ // ---------------------------------------------------------------------------
7
+ // Series type definitions — all 48 pre-defined metric types
8
+ // ---------------------------------------------------------------------------
9
+ export const SERIES_TYPES = {
10
+ // Heart & Cardiovascular
11
+ heart_rate: { id: 1, unit: "bpm" },
12
+ resting_heart_rate: { id: 2, unit: "bpm" },
13
+ heart_rate_variability_sdnn: { id: 3, unit: "ms" },
14
+ heart_rate_recovery_one_minute: { id: 4, unit: "bpm" },
15
+ walking_heart_rate_average: { id: 5, unit: "bpm" },
16
+ recovery_score: { id: 6, unit: "score" },
17
+ heart_rate_variability_rmssd: { id: 7, unit: "ms" },
18
+ // Blood & Respiratory
19
+ oxygen_saturation: { id: 20, unit: "percent" },
20
+ blood_glucose: { id: 21, unit: "mg_dl" },
21
+ blood_pressure_systolic: { id: 22, unit: "mmHg" },
22
+ blood_pressure_diastolic: { id: 23, unit: "mmHg" },
23
+ respiratory_rate: { id: 24, unit: "brpm" },
24
+ sleeping_breathing_disturbances: { id: 25, unit: "count" },
25
+ blood_alcohol_content: { id: 26, unit: "mg_dl" },
26
+ peripheral_perfusion_index: { id: 27, unit: "score" },
27
+ forced_vital_capacity: { id: 28, unit: "liters" },
28
+ forced_expiratory_volume_1: { id: 29, unit: "liters" },
29
+ peak_expiratory_flow_rate: { id: 30, unit: "liters" },
30
+ // Body Composition
31
+ height: { id: 40, unit: "cm" },
32
+ weight: { id: 41, unit: "kg" },
33
+ body_fat_percentage: { id: 42, unit: "percent" },
34
+ body_mass_index: { id: 43, unit: "kg_m2" },
35
+ lean_body_mass: { id: 44, unit: "kg" },
36
+ body_temperature: { id: 45, unit: "celsius" },
37
+ skin_temperature: { id: 46, unit: "celsius" },
38
+ waist_circumference: { id: 47, unit: "cm" },
39
+ body_fat_mass: { id: 48, unit: "kg" },
40
+ skeletal_muscle_mass: { id: 49, unit: "kg" },
41
+ // Fitness
42
+ vo2_max: { id: 60, unit: "ml_kg_min" },
43
+ six_minute_walk_test_distance: { id: 61, unit: "meters" },
44
+ // Activity — Basic
45
+ steps: { id: 80, unit: "count" },
46
+ energy: { id: 81, unit: "kcal" },
47
+ basal_energy: { id: 82, unit: "kcal" },
48
+ total_calories: { id: 88, unit: "kcal" },
49
+ active_calories: { id: 89, unit: "kcal" },
50
+ stand_time: { id: 83, unit: "minutes" },
51
+ exercise_time: { id: 84, unit: "minutes" },
52
+ physical_effort: { id: 85, unit: "score" },
53
+ flights_climbed: { id: 86, unit: "count" },
54
+ floors_climbed: { id: 90, unit: "count" },
55
+ average_met: { id: 87, unit: "met" },
56
+ // Activity — Distance
57
+ distance: { id: 99, unit: "meters" },
58
+ distance_walking_running: { id: 100, unit: "meters" },
59
+ distance_cycling: { id: 101, unit: "meters" },
60
+ distance_swimming: { id: 102, unit: "meters" },
61
+ distance_downhill_snow_sports: { id: 103, unit: "meters" },
62
+ distance_other: { id: 104, unit: "meters" },
63
+ elevation_gain: { id: 105, unit: "meters" },
64
+ // Activity — Walking
65
+ walking_step_length: { id: 120, unit: "cm" },
66
+ walking_speed: { id: 121, unit: "m_per_s" },
67
+ walking_double_support_percentage: { id: 122, unit: "percent" },
68
+ walking_asymmetry_percentage: { id: 123, unit: "percent" },
69
+ walking_steadiness: { id: 124, unit: "percent" },
70
+ stair_descent_speed: { id: 125, unit: "m_per_s" },
71
+ stair_ascent_speed: { id: 126, unit: "m_per_s" },
72
+ // Activity — Running
73
+ running_power: { id: 140, unit: "watts" },
74
+ running_speed: { id: 141, unit: "m_per_s" },
75
+ running_vertical_oscillation: { id: 142, unit: "cm" },
76
+ running_ground_contact_time: { id: 143, unit: "ms" },
77
+ running_stride_length: { id: 144, unit: "cm" },
78
+ // Activity — Swimming
79
+ swimming_stroke_count: { id: 160, unit: "count" },
80
+ underwater_depth: { id: 161, unit: "meters" },
81
+ // Activity — Generic
82
+ cadence: { id: 180, unit: "rpm" },
83
+ power: { id: 181, unit: "watts" },
84
+ speed: { id: 182, unit: "m_per_s" },
85
+ workout_effort_score: { id: 183, unit: "score" },
86
+ estimated_workout_effort_score: { id: 184, unit: "score" },
87
+ // Environmental
88
+ environmental_audio_exposure: { id: 200, unit: "dB" },
89
+ headphone_audio_exposure: { id: 201, unit: "dB" },
90
+ environmental_sound_reduction: { id: 202, unit: "dB" },
91
+ time_in_daylight: { id: 203, unit: "minutes" },
92
+ water_temperature: { id: 204, unit: "celsius" },
93
+ uv_exposure: { id: 205, unit: "count" },
94
+ inhaler_usage: { id: 206, unit: "count" },
95
+ weather_temperature: { id: 207, unit: "celsius" },
96
+ weather_humidity: { id: 208, unit: "percent" },
97
+ // Garmin-Specific
98
+ garmin_stress_level: { id: 220, unit: "score" },
99
+ garmin_skin_temperature: { id: 221, unit: "celsius" },
100
+ garmin_fitness_age: { id: 222, unit: "years" },
101
+ garmin_body_battery: { id: 223, unit: "percent" },
102
+ // Other
103
+ electrodermal_activity: { id: 500, unit: "count" },
104
+ push_count: { id: 501, unit: "count" },
105
+ atrial_fibrillation_burden: { id: 502, unit: "count" },
106
+ insulin_delivery: { id: 503, unit: "count" },
107
+ number_of_times_fallen: { id: 504, unit: "count" },
108
+ number_of_alcoholic_beverages: { id: 505, unit: "count" },
109
+ nike_fuel: { id: 506, unit: "count" },
110
+ hydration: { id: 507, unit: "mL" },
111
+ };
112
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAwZH,8EAA8E;AAC9E,4DAA4D;AAC5D,8EAA8E;AAE9E,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,yBAAyB;IACzB,UAAU,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE;IAClC,kBAAkB,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE;IAC1C,2BAA2B,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE;IAClD,8BAA8B,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE;IACtD,0BAA0B,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE;IAClD,cAAc,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE;IACxC,4BAA4B,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE;IAEnD,sBAAsB;IACtB,iBAAiB,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;IAC9C,aAAa,EAAE,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 @@
1
+ {"version":3,"file":"_ignore.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/_ignore.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ // This file exists so that the _generated directory is tracked by git.
3
+ // The actual generated files are created by `npx convex dev` or `npx convex codegen`.
4
+ //# sourceMappingURL=_ignore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_ignore.js","sourceRoot":"","sources":["../../../src/component/_generated/_ignore.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,sFAAsF"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Generated API.
3
+ *
4
+ * THIS CODE IS AUTOMATICALLY GENERATED.
5
+ *
6
+ * To regenerate, run `npx convex dev`.
7
+ * @module
8
+ */
9
+ import type { AnyApi, AnyComponents } from "convex/server";
10
+ export declare const api: AnyApi;
11
+ export declare const internal: AnyApi;
12
+ export declare const components: AnyComponents;
13
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/api.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG3D,eAAO,MAAM,GAAG,EAAE,MAAe,CAAC;AAClC,eAAO,MAAM,QAAQ,EAAE,MAAe,CAAC;AACvC,eAAO,MAAM,UAAU,EAAE,aAAmC,CAAC"}
@@ -0,0 +1,14 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * Generated API.
4
+ *
5
+ * THIS CODE IS AUTOMATICALLY GENERATED.
6
+ *
7
+ * To regenerate, run `npx convex dev`.
8
+ * @module
9
+ */
10
+ import { anyApi, componentsGeneric } from "convex/server";
11
+ export const api = anyApi;
12
+ export const internal = anyApi;
13
+ export const components = componentsGeneric();
14
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/component/_generated/api.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG;AAGH,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,CAAC,MAAM,GAAG,GAAW,MAAM,CAAC;AAClC,MAAM,CAAC,MAAM,QAAQ,GAAW,MAAM,CAAC;AACvC,MAAM,CAAC,MAAM,UAAU,GAAkB,iBAAiB,EAAE,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Generated data model types.
3
+ *
4
+ * THIS CODE IS AUTOMATICALLY GENERATED.
5
+ *
6
+ * To regenerate, run `npx convex dev`.
7
+ * @module
8
+ */
9
+ import type { DataModelFromSchemaDefinition, DocumentByName, TableNamesInDataModel } from "convex/server";
10
+ import type { GenericId } from "convex/values";
11
+ import schema from "../schema.js";
12
+ /**
13
+ * The names of all of your Convex tables.
14
+ */
15
+ export type TableNames = TableNamesInDataModel<DataModel>;
16
+ /**
17
+ * The type of a document stored in Convex.
18
+ */
19
+ export type Doc<TableName extends TableNames> = DocumentByName<DataModel, TableName>;
20
+ /**
21
+ * An identifier for a document in Convex.
22
+ */
23
+ export type Id<TableName extends TableNames> = GenericId<TableName>;
24
+ /**
25
+ * A type describing your Convex data model.
26
+ */
27
+ export type DataModel = DataModelFromSchemaDefinition<typeof schema>;
28
+ //# sourceMappingURL=dataModel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataModel.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/dataModel.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,6BAA6B,EAC7B,cAAc,EACd,qBAAqB,EACtB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC;AAE1D;;GAEG;AACH,MAAM,MAAM,GAAG,CAAC,SAAS,SAAS,UAAU,IAAI,cAAc,CAC5D,SAAS,EACT,SAAS,CACV,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,EAAE,CAAC,SAAS,SAAS,UAAU,IAAI,SAAS,CAAC,SAAS,CAAC,CAAC;AAEpE;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,6BAA6B,CAAC,OAAO,MAAM,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * Generated data model types.
4
+ *
5
+ * THIS CODE IS AUTOMATICALLY GENERATED.
6
+ *
7
+ * To regenerate, run `npx convex dev`.
8
+ * @module
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=dataModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataModel.js","sourceRoot":"","sources":["../../../src/component/_generated/dataModel.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Generated utilities for implementing server-side Convex query and mutation functions.
3
+ *
4
+ * THIS CODE IS AUTOMATICALLY GENERATED.
5
+ *
6
+ * To regenerate, run `npx convex dev`.
7
+ * @module
8
+ */
9
+ import type { ActionBuilder, HttpActionBuilder, MutationBuilder, QueryBuilder, GenericActionCtx, GenericMutationCtx, GenericQueryCtx, GenericDatabaseReader, GenericDatabaseWriter } from "convex/server";
10
+ import type { DataModel } from "./dataModel.js";
11
+ export declare const query: QueryBuilder<DataModel, "public">;
12
+ export declare const internalQuery: QueryBuilder<DataModel, "internal">;
13
+ export declare const mutation: MutationBuilder<DataModel, "public">;
14
+ export declare const internalMutation: MutationBuilder<DataModel, "internal">;
15
+ export declare const action: ActionBuilder<DataModel, "public">;
16
+ export declare const internalAction: ActionBuilder<DataModel, "internal">;
17
+ export declare const httpAction: HttpActionBuilder;
18
+ export type QueryCtx = GenericQueryCtx<DataModel>;
19
+ export type MutationCtx = GenericMutationCtx<DataModel>;
20
+ export type ActionCtx = GenericActionCtx<DataModel>;
21
+ export type DatabaseReader = GenericDatabaseReader<DataModel>;
22
+ export type DatabaseWriter = GenericDatabaseWriter<DataModel>;
23
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/server.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,eAAe,CAAC;AAUvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,eAAO,MAAM,KAAK,EAAE,YAAY,CAAC,SAAS,EAAE,QAAQ,CAAgB,CAAC;AACrE,eAAO,MAAM,aAAa,EAAE,YAAY,CAAC,SAAS,EAAE,UAAU,CACxC,CAAC;AACvB,eAAO,MAAM,QAAQ,EAAE,eAAe,CAAC,SAAS,EAAE,QAAQ,CAAmB,CAAC;AAC9E,eAAO,MAAM,gBAAgB,EAAE,eAAe,CAAC,SAAS,EAAE,UAAU,CAC3C,CAAC;AAC1B,eAAO,MAAM,MAAM,EAAE,aAAa,CAAC,SAAS,EAAE,QAAQ,CAAiB,CAAC;AACxE,eAAO,MAAM,cAAc,EAAE,aAAa,CAAC,SAAS,EAAE,UAAU,CACzC,CAAC;AACxB,eAAO,MAAM,UAAU,EAAE,iBAAqC,CAAC;AAE/D,MAAM,MAAM,QAAQ,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;AAClD,MAAM,MAAM,WAAW,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;AACxD,MAAM,MAAM,SAAS,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;AACpD,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC;AAC9D,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * Generated utilities for implementing server-side Convex query and mutation functions.
4
+ *
5
+ * THIS CODE IS AUTOMATICALLY GENERATED.
6
+ *
7
+ * To regenerate, run `npx convex dev`.
8
+ * @module
9
+ */
10
+ import { actionGeneric, httpActionGeneric, queryGeneric, mutationGeneric, internalActionGeneric, internalMutationGeneric, internalQueryGeneric, } from "convex/server";
11
+ export const query = queryGeneric;
12
+ export const internalQuery = internalQueryGeneric;
13
+ export const mutation = mutationGeneric;
14
+ export const internalMutation = internalMutationGeneric;
15
+ export const action = actionGeneric;
16
+ export const internalAction = internalActionGeneric;
17
+ export const httpAction = httpActionGeneric;
18
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/component/_generated/server.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG;AAaH,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,eAAe,CAAC;AAGvB,MAAM,CAAC,MAAM,KAAK,GAAsC,YAAY,CAAC;AACrE,MAAM,CAAC,MAAM,aAAa,GACxB,oBAAoB,CAAC;AACvB,MAAM,CAAC,MAAM,QAAQ,GAAyC,eAAe,CAAC;AAC9E,MAAM,CAAC,MAAM,gBAAgB,GAC3B,uBAAuB,CAAC;AAC1B,MAAM,CAAC,MAAM,MAAM,GAAuC,aAAa,CAAC;AACxE,MAAM,CAAC,MAAM,cAAc,GACzB,qBAAqB,CAAC;AACxB,MAAM,CAAC,MAAM,UAAU,GAAsB,iBAAiB,CAAC"}
@@ -0,0 +1,121 @@
1
+ export declare const backfillSignal: import("convex/values").VObject<{
2
+ itemCount?: number | undefined;
3
+ dataType: string;
4
+ kind: "webhook" | "timeout";
5
+ }, {
6
+ kind: import("convex/values").VUnion<"webhook" | "timeout", [import("convex/values").VLiteral<"webhook", "required">, import("convex/values").VLiteral<"timeout", "required">], "required", never>;
7
+ dataType: import("convex/values").VString<string, "required">;
8
+ itemCount: import("convex/values").VFloat64<number | undefined, "optional">;
9
+ }, "required", "dataType" | "kind" | "itemCount">;
10
+ export declare const getActiveByConnection: import("convex/server").RegisteredQuery<"internal", {
11
+ connectionId: import("convex/values").GenericId<"connections">;
12
+ }, Promise<{
13
+ _id: import("convex/values").GenericId<"backfillJobs">;
14
+ _creationTime: number;
15
+ error?: string | undefined;
16
+ completedAt?: number | undefined;
17
+ workflowId?: string | undefined;
18
+ windowStart?: number | undefined;
19
+ windowEnd?: number | undefined;
20
+ lastHeartbeatAt?: number | undefined;
21
+ currentDataType?: string | undefined;
22
+ currentAttempt?: number | undefined;
23
+ currentEventId?: string | undefined;
24
+ completedDataTypes?: string[] | undefined;
25
+ provider: "garmin" | "suunto" | "polar" | "whoop" | "strava" | "apple" | "samsung" | "google";
26
+ status: "queued" | "running" | "completed" | "failed" | "canceled";
27
+ userId: string;
28
+ connectionId: import("convex/values").GenericId<"connections">;
29
+ startedAt: number;
30
+ dataType: string;
31
+ } | null>>;
32
+ export declare const getById: import("convex/server").RegisteredQuery<"internal", {
33
+ backfillJobId: import("convex/values").GenericId<"backfillJobs">;
34
+ }, Promise<{
35
+ _id: import("convex/values").GenericId<"backfillJobs">;
36
+ _creationTime: number;
37
+ error?: string | undefined;
38
+ completedAt?: number | undefined;
39
+ workflowId?: string | undefined;
40
+ windowStart?: number | undefined;
41
+ windowEnd?: number | undefined;
42
+ lastHeartbeatAt?: number | undefined;
43
+ currentDataType?: string | undefined;
44
+ currentAttempt?: number | undefined;
45
+ currentEventId?: string | undefined;
46
+ completedDataTypes?: string[] | undefined;
47
+ provider: "garmin" | "suunto" | "polar" | "whoop" | "strava" | "apple" | "samsung" | "google";
48
+ status: "queued" | "running" | "completed" | "failed" | "canceled";
49
+ userId: string;
50
+ connectionId: import("convex/values").GenericId<"connections">;
51
+ startedAt: number;
52
+ dataType: string;
53
+ } | null>>;
54
+ export declare const getLatestByConnection: import("convex/server").RegisteredQuery<"public", {
55
+ connectionId: import("convex/values").GenericId<"connections">;
56
+ }, Promise<{
57
+ _id: import("convex/values").GenericId<"backfillJobs">;
58
+ _creationTime: number;
59
+ error?: string | undefined;
60
+ completedAt?: number | undefined;
61
+ workflowId?: string | undefined;
62
+ windowStart?: number | undefined;
63
+ windowEnd?: number | undefined;
64
+ lastHeartbeatAt?: number | undefined;
65
+ currentDataType?: string | undefined;
66
+ currentAttempt?: number | undefined;
67
+ currentEventId?: string | undefined;
68
+ completedDataTypes?: string[] | undefined;
69
+ provider: "garmin" | "suunto" | "polar" | "whoop" | "strava" | "apple" | "samsung" | "google";
70
+ status: "queued" | "running" | "completed" | "failed" | "canceled";
71
+ userId: string;
72
+ connectionId: import("convex/values").GenericId<"connections">;
73
+ startedAt: number;
74
+ dataType: string;
75
+ } | null>>;
76
+ export declare const create: import("convex/server").RegisteredMutation<"internal", {
77
+ provider: "garmin" | "suunto" | "polar" | "whoop" | "strava" | "apple" | "samsung" | "google";
78
+ userId: string;
79
+ connectionId: import("convex/values").GenericId<"connections">;
80
+ windowStart: number;
81
+ windowEnd: number;
82
+ dataType: string;
83
+ }, Promise<import("convex/values").GenericId<"backfillJobs">>>;
84
+ export declare const updateStatus: import("convex/server").RegisteredMutation<"internal", {
85
+ error?: string | undefined;
86
+ workflowId?: string | undefined;
87
+ lastHeartbeatAt?: number | undefined;
88
+ currentDataType?: string | undefined;
89
+ currentAttempt?: number | undefined;
90
+ currentEventId?: string | undefined;
91
+ completedDataTypes?: string[] | undefined;
92
+ status: "queued" | "running" | "completed" | "failed" | "canceled";
93
+ backfillJobId: import("convex/values").GenericId<"backfillJobs">;
94
+ }, Promise<void>>;
95
+ export declare const beginAwaitingType: import("convex/server").RegisteredMutation<"internal", {
96
+ workflowId: string;
97
+ attempt: number;
98
+ dataType: string;
99
+ backfillJobId: import("convex/values").GenericId<"backfillJobs">;
100
+ }, Promise<import("@convex-dev/workflow").EventId<`garmin-backfill:${string}:${number}`>>>;
101
+ export declare const markTypeCompleted: import("convex/server").RegisteredMutation<"internal", {
102
+ dataType: string;
103
+ backfillJobId: import("convex/values").GenericId<"backfillJobs">;
104
+ }, Promise<void>>;
105
+ export declare const scheduleTimeout: import("convex/server").RegisteredMutation<"internal", {
106
+ dataType: string;
107
+ eventId: string;
108
+ backfillJobId: import("convex/values").GenericId<"backfillJobs">;
109
+ delayMs: number;
110
+ }, Promise<void>>;
111
+ export declare const emitTimeout: import("convex/server").RegisteredMutation<"internal", {
112
+ dataType: string;
113
+ eventId: string;
114
+ backfillJobId: import("convex/values").GenericId<"backfillJobs">;
115
+ }, Promise<void>>;
116
+ export declare const signalWebhookData: import("convex/server").RegisteredMutation<"internal", {
117
+ itemCount?: number | undefined;
118
+ connectionId: import("convex/values").GenericId<"connections">;
119
+ dataType: string;
120
+ }, Promise<void>>;
121
+ //# sourceMappingURL=backfillJobs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backfillJobs.d.ts","sourceRoot":"","sources":["../../src/component/backfillJobs.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc;;;;;;;;iDAIzB,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;UAchC,CAAC;AAEH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;UAQlB,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;UAYhC,CAAC;AAEH,eAAO,MAAM,MAAM;;;;;;;8DAwBjB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;iBA6BvB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;0FAwB5B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;iBAoB5B,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;iBAc1B,CAAC;AAEH,eAAO,MAAM,WAAW;;;;iBA8BtB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;iBAuC5B,CAAC"}
@@ -0,0 +1,233 @@
1
+ import { v } from "convex/values";
2
+ import { internal } from "./_generated/api";
3
+ import { internalMutation, internalQuery, query } from "./_generated/server";
4
+ import { backfillStatus, providerName } from "./schema";
5
+ import { durableWorkflow } from "./workflowManager";
6
+ export const backfillSignal = v.object({
7
+ kind: v.union(v.literal("webhook"), v.literal("timeout")),
8
+ dataType: v.string(),
9
+ itemCount: v.optional(v.number()),
10
+ });
11
+ export const getActiveByConnection = internalQuery({
12
+ args: {
13
+ connectionId: v.id("connections"),
14
+ },
15
+ returns: v.union(v.any(), v.null()),
16
+ handler: async (ctx, args) => {
17
+ const jobs = await ctx.db
18
+ .query("backfillJobs")
19
+ .withIndex("by_connection", (idx) => idx.eq("connectionId", args.connectionId))
20
+ .order("desc")
21
+ .take(10);
22
+ return jobs.find((job) => job.status === "queued" || job.status === "running") ?? null;
23
+ },
24
+ });
25
+ export const getById = internalQuery({
26
+ args: {
27
+ backfillJobId: v.id("backfillJobs"),
28
+ },
29
+ returns: v.union(v.any(), v.null()),
30
+ handler: async (ctx, args) => {
31
+ return await ctx.db.get(args.backfillJobId);
32
+ },
33
+ });
34
+ export const getLatestByConnection = query({
35
+ args: {
36
+ connectionId: v.id("connections"),
37
+ },
38
+ returns: v.union(v.any(), v.null()),
39
+ handler: async (ctx, args) => {
40
+ return await ctx.db
41
+ .query("backfillJobs")
42
+ .withIndex("by_connection", (idx) => idx.eq("connectionId", args.connectionId))
43
+ .order("desc")
44
+ .first();
45
+ },
46
+ });
47
+ export const create = internalMutation({
48
+ args: {
49
+ connectionId: v.id("connections"),
50
+ userId: v.string(),
51
+ provider: providerName,
52
+ dataType: v.string(),
53
+ windowStart: v.number(),
54
+ windowEnd: v.number(),
55
+ },
56
+ returns: v.id("backfillJobs"),
57
+ handler: async (ctx, args) => {
58
+ return await ctx.db.insert("backfillJobs", {
59
+ connectionId: args.connectionId,
60
+ userId: args.userId,
61
+ provider: args.provider,
62
+ dataType: args.dataType,
63
+ status: "queued",
64
+ startedAt: Date.now(),
65
+ windowStart: args.windowStart,
66
+ windowEnd: args.windowEnd,
67
+ completedDataTypes: [],
68
+ currentAttempt: 0,
69
+ });
70
+ },
71
+ });
72
+ export const updateStatus = internalMutation({
73
+ args: {
74
+ backfillJobId: v.id("backfillJobs"),
75
+ status: backfillStatus,
76
+ workflowId: v.optional(v.string()),
77
+ error: v.optional(v.string()),
78
+ currentDataType: v.optional(v.string()),
79
+ currentAttempt: v.optional(v.number()),
80
+ currentEventId: v.optional(v.string()),
81
+ completedDataTypes: v.optional(v.array(v.string())),
82
+ lastHeartbeatAt: v.optional(v.number()),
83
+ },
84
+ handler: async (ctx, args) => {
85
+ const updates = {
86
+ status: args.status,
87
+ };
88
+ if (args.workflowId !== undefined)
89
+ updates.workflowId = args.workflowId;
90
+ if (args.error !== undefined)
91
+ updates.error = args.error;
92
+ if (args.currentDataType !== undefined)
93
+ updates.currentDataType = args.currentDataType;
94
+ if (args.currentAttempt !== undefined)
95
+ updates.currentAttempt = args.currentAttempt;
96
+ if (args.currentEventId !== undefined)
97
+ updates.currentEventId = args.currentEventId;
98
+ if (args.completedDataTypes !== undefined)
99
+ updates.completedDataTypes = args.completedDataTypes;
100
+ if (args.lastHeartbeatAt !== undefined)
101
+ updates.lastHeartbeatAt = args.lastHeartbeatAt;
102
+ if (args.status === "completed" || args.status === "failed" || args.status === "canceled") {
103
+ updates.completedAt = Date.now();
104
+ updates.currentEventId = undefined;
105
+ }
106
+ await ctx.db.patch(args.backfillJobId, updates);
107
+ },
108
+ });
109
+ export const beginAwaitingType = internalMutation({
110
+ args: {
111
+ backfillJobId: v.id("backfillJobs"),
112
+ workflowId: v.string(),
113
+ dataType: v.string(),
114
+ attempt: v.number(),
115
+ },
116
+ returns: v.string(),
117
+ handler: async (ctx, args) => {
118
+ const eventId = await durableWorkflow.createEvent(ctx, {
119
+ workflowId: args.workflowId,
120
+ name: `garmin-backfill:${args.dataType}:${args.attempt}`,
121
+ });
122
+ await ctx.db.patch(args.backfillJobId, {
123
+ status: "running",
124
+ currentDataType: args.dataType,
125
+ currentAttempt: args.attempt,
126
+ currentEventId: eventId,
127
+ lastHeartbeatAt: Date.now(),
128
+ });
129
+ return eventId;
130
+ },
131
+ });
132
+ export const markTypeCompleted = internalMutation({
133
+ args: {
134
+ backfillJobId: v.id("backfillJobs"),
135
+ dataType: v.string(),
136
+ },
137
+ handler: async (ctx, args) => {
138
+ const job = await ctx.db.get(args.backfillJobId);
139
+ if (!job)
140
+ return;
141
+ const completed = new Set(job.completedDataTypes ?? []);
142
+ completed.add(args.dataType);
143
+ await ctx.db.patch(args.backfillJobId, {
144
+ completedDataTypes: Array.from(completed),
145
+ currentDataType: undefined,
146
+ currentAttempt: undefined,
147
+ currentEventId: undefined,
148
+ lastHeartbeatAt: Date.now(),
149
+ });
150
+ },
151
+ });
152
+ export const scheduleTimeout = internalMutation({
153
+ args: {
154
+ backfillJobId: v.id("backfillJobs"),
155
+ eventId: v.string(),
156
+ dataType: v.string(),
157
+ delayMs: v.number(),
158
+ },
159
+ handler: async (ctx, args) => {
160
+ await ctx.scheduler.runAfter(args.delayMs, internal.backfillJobs.emitTimeout, {
161
+ backfillJobId: args.backfillJobId,
162
+ eventId: args.eventId,
163
+ dataType: args.dataType,
164
+ });
165
+ },
166
+ });
167
+ export const emitTimeout = internalMutation({
168
+ args: {
169
+ backfillJobId: v.id("backfillJobs"),
170
+ eventId: v.string(),
171
+ dataType: v.string(),
172
+ },
173
+ handler: async (ctx, args) => {
174
+ const job = await ctx.db.get(args.backfillJobId);
175
+ if (!job ||
176
+ job.status !== "running" ||
177
+ job.currentEventId !== args.eventId ||
178
+ job.currentDataType !== args.dataType) {
179
+ return;
180
+ }
181
+ try {
182
+ await durableWorkflow.sendEvent(ctx, {
183
+ id: args.eventId,
184
+ value: {
185
+ kind: "timeout",
186
+ dataType: args.dataType,
187
+ },
188
+ });
189
+ }
190
+ catch {
191
+ // Timeout events are best-effort. If the workflow already moved on,
192
+ // duplicate or stale sends should not fail the scheduler.
193
+ }
194
+ },
195
+ });
196
+ export const signalWebhookData = internalMutation({
197
+ args: {
198
+ connectionId: v.id("connections"),
199
+ dataType: v.string(),
200
+ itemCount: v.optional(v.number()),
201
+ },
202
+ handler: async (ctx, args) => {
203
+ const activeJob = await ctx.db
204
+ .query("backfillJobs")
205
+ .withIndex("by_connection", (idx) => idx.eq("connectionId", args.connectionId))
206
+ .order("desc")
207
+ .first();
208
+ if (!activeJob ||
209
+ activeJob.status !== "running" ||
210
+ activeJob.currentDataType !== args.dataType ||
211
+ !activeJob.currentEventId) {
212
+ return;
213
+ }
214
+ try {
215
+ await durableWorkflow.sendEvent(ctx, {
216
+ id: activeJob.currentEventId,
217
+ value: {
218
+ kind: "webhook",
219
+ dataType: args.dataType,
220
+ itemCount: args.itemCount,
221
+ },
222
+ });
223
+ await ctx.db.patch(activeJob._id, {
224
+ currentEventId: undefined,
225
+ lastHeartbeatAt: Date.now(),
226
+ });
227
+ }
228
+ catch {
229
+ // Duplicate Garmin webhook pushes should not fail ingestion.
230
+ }
231
+ },
232
+ });
233
+ //# sourceMappingURL=backfillJobs.js.map