@nativesquare/soma 0.14.1 → 0.16.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 +31 -0
- package/dist/client/garmin.d.ts.map +1 -1
- package/dist/client/garmin.js +34 -0
- package/dist/client/garmin.js.map +1 -1
- package/dist/client/healthkit.d.ts +267 -0
- package/dist/client/healthkit.d.ts.map +1 -0
- package/dist/client/healthkit.js +600 -0
- package/dist/client/healthkit.js.map +1 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +4 -0
- package/dist/client/index.js.map +1 -1
- package/dist/component/_generated/api.d.ts +26 -0
- package/dist/component/_generated/api.d.ts.map +1 -1
- package/dist/component/_generated/api.js.map +1 -1
- package/dist/component/healthkit/index.d.ts +14 -0
- package/dist/component/healthkit/index.d.ts.map +1 -0
- package/dist/{healthkit → component/healthkit}/index.js +11 -11
- package/dist/component/healthkit/index.js.map +1 -0
- package/dist/component/healthkit/transform/activity.d.ts +19 -0
- package/dist/component/healthkit/transform/activity.d.ts.map +1 -0
- package/dist/{healthkit → component/healthkit/transform}/activity.js +1 -1
- package/dist/component/healthkit/transform/activity.js.map +1 -0
- package/dist/{healthkit → component/healthkit/transform}/athlete.d.ts +3 -9
- package/dist/component/healthkit/transform/athlete.d.ts.map +1 -0
- package/dist/component/healthkit/transform/athlete.js.map +1 -0
- package/dist/component/healthkit/transform/body.d.ts +25 -0
- package/dist/component/healthkit/transform/body.d.ts.map +1 -0
- package/dist/component/healthkit/transform/body.js.map +1 -0
- package/dist/component/healthkit/transform/daily.d.ts +36 -0
- package/dist/component/healthkit/transform/daily.d.ts.map +1 -0
- package/dist/component/healthkit/transform/daily.js.map +1 -0
- package/dist/{healthkit/maps/activity-type.d.ts → component/healthkit/transform/maps/activityType.d.ts} +1 -1
- package/dist/component/healthkit/transform/maps/activityType.d.ts.map +1 -0
- package/dist/{healthkit/maps/activity-type.js → component/healthkit/transform/maps/activityType.js} +1 -1
- package/dist/component/healthkit/transform/maps/activityType.js.map +1 -0
- package/dist/{healthkit/maps/menstruation-flow.d.ts → component/healthkit/transform/maps/menstruationFlow.d.ts} +1 -1
- package/dist/component/healthkit/transform/maps/menstruationFlow.d.ts.map +1 -0
- package/dist/{healthkit/maps/menstruation-flow.js → component/healthkit/transform/maps/menstruationFlow.js} +2 -2
- package/dist/component/healthkit/transform/maps/menstruationFlow.js.map +1 -0
- package/dist/{healthkit/maps/sleep-level.d.ts → component/healthkit/transform/maps/sleepLevel.d.ts} +1 -1
- package/dist/component/healthkit/transform/maps/sleepLevel.d.ts.map +1 -0
- package/dist/{healthkit/maps/sleep-level.js → component/healthkit/transform/maps/sleepLevel.js} +2 -2
- package/dist/component/healthkit/transform/maps/sleepLevel.js.map +1 -0
- package/dist/{healthkit → component/healthkit/transform}/menstruation.d.ts +3 -17
- package/dist/component/healthkit/transform/menstruation.d.ts.map +1 -0
- package/dist/{healthkit → component/healthkit/transform}/menstruation.js +1 -1
- package/dist/component/healthkit/transform/menstruation.js.map +1 -0
- package/dist/component/healthkit/transform/nutrition.d.ts +25 -0
- package/dist/component/healthkit/transform/nutrition.d.ts.map +1 -0
- package/dist/component/healthkit/transform/nutrition.js.map +1 -0
- package/dist/component/healthkit/transform/sleep.d.ts +22 -0
- package/dist/component/healthkit/transform/sleep.d.ts.map +1 -0
- package/dist/{healthkit → component/healthkit/transform}/sleep.js +2 -2
- package/dist/component/healthkit/transform/sleep.js.map +1 -0
- package/dist/{healthkit → component/healthkit/transform}/utils.d.ts +1 -1
- package/dist/component/healthkit/transform/utils.d.ts.map +1 -0
- package/dist/component/healthkit/transform/utils.js.map +1 -0
- package/dist/component/healthkit/types.d.ts.map +1 -0
- package/dist/component/healthkit/types.js.map +1 -0
- package/package.json +3 -3
- package/src/client/garmin.ts +42 -0
- package/src/client/healthkit.ts +791 -0
- package/src/client/index.ts +4 -0
- package/src/component/_generated/api.ts +26 -0
- package/src/{healthkit → component/healthkit}/index.ts +46 -59
- package/src/component/healthkit/transform/activity.ts +115 -0
- package/src/{healthkit → component/healthkit/transform}/athlete.ts +4 -8
- package/src/{healthkit → component/healthkit/transform}/body.ts +3 -7
- package/src/{healthkit → component/healthkit/transform}/daily.ts +4 -10
- package/src/{healthkit/maps/menstruation-flow.ts → component/healthkit/transform/maps/menstruationFlow.ts} +1 -1
- package/src/{healthkit/maps/sleep-level.ts → component/healthkit/transform/maps/sleepLevel.ts} +1 -1
- package/src/{healthkit → component/healthkit/transform}/menstruation.ts +4 -8
- package/src/{healthkit → component/healthkit/transform}/nutrition.ts +3 -7
- package/src/{healthkit → component/healthkit/transform}/sleep.ts +5 -9
- package/src/{healthkit → component/healthkit/transform}/utils.ts +1 -1
- package/dist/healthkit/activity.d.ts +0 -75
- package/dist/healthkit/activity.d.ts.map +0 -1
- package/dist/healthkit/activity.js.map +0 -1
- package/dist/healthkit/athlete.d.ts.map +0 -1
- package/dist/healthkit/athlete.js.map +0 -1
- package/dist/healthkit/body.d.ts +0 -102
- package/dist/healthkit/body.d.ts.map +0 -1
- package/dist/healthkit/body.js.map +0 -1
- package/dist/healthkit/daily.d.ts +0 -119
- package/dist/healthkit/daily.d.ts.map +0 -1
- package/dist/healthkit/daily.js.map +0 -1
- package/dist/healthkit/index.d.ts +0 -21
- package/dist/healthkit/index.d.ts.map +0 -1
- package/dist/healthkit/index.js.map +0 -1
- package/dist/healthkit/maps/activity-type.d.ts.map +0 -1
- package/dist/healthkit/maps/activity-type.js.map +0 -1
- package/dist/healthkit/maps/menstruation-flow.d.ts.map +0 -1
- package/dist/healthkit/maps/menstruation-flow.js.map +0 -1
- package/dist/healthkit/maps/sleep-level.d.ts.map +0 -1
- package/dist/healthkit/maps/sleep-level.js.map +0 -1
- package/dist/healthkit/menstruation.d.ts.map +0 -1
- package/dist/healthkit/menstruation.js.map +0 -1
- package/dist/healthkit/nutrition.d.ts +0 -77
- package/dist/healthkit/nutrition.d.ts.map +0 -1
- package/dist/healthkit/nutrition.js.map +0 -1
- package/dist/healthkit/sleep.d.ts +0 -60
- package/dist/healthkit/sleep.d.ts.map +0 -1
- package/dist/healthkit/sleep.js.map +0 -1
- package/dist/healthkit/types.d.ts.map +0 -1
- package/dist/healthkit/types.js.map +0 -1
- package/dist/healthkit/utils.d.ts.map +0 -1
- package/dist/healthkit/utils.js.map +0 -1
- package/src/healthkit/activity.ts +0 -120
- /package/dist/{healthkit → component/healthkit/transform}/athlete.js +0 -0
- /package/dist/{healthkit → component/healthkit/transform}/body.js +0 -0
- /package/dist/{healthkit → component/healthkit/transform}/daily.js +0 -0
- /package/dist/{healthkit → component/healthkit/transform}/nutrition.js +0 -0
- /package/dist/{healthkit → component/healthkit/transform}/utils.js +0 -0
- /package/dist/{healthkit → component/healthkit}/types.d.ts +0 -0
- /package/dist/{healthkit → component/healthkit}/types.js +0 -0
- /package/src/{healthkit/maps/activity-type.ts → component/healthkit/transform/maps/activityType.ts} +0 -0
- /package/src/{healthkit → component/healthkit}/types.ts +0 -0
|
@@ -0,0 +1,600 @@
|
|
|
1
|
+
import { transformWorkout } from "../component/healthkit/transform/activity.js";
|
|
2
|
+
import { transformSleep } from "../component/healthkit/transform/sleep.js";
|
|
3
|
+
import { transformBody } from "../component/healthkit/transform/body.js";
|
|
4
|
+
import { transformDaily, transformDailyFromSummary, } from "../component/healthkit/transform/daily.js";
|
|
5
|
+
import { transformNutrition } from "../component/healthkit/transform/nutrition.js";
|
|
6
|
+
import { transformMenstruation } from "../component/healthkit/transform/menstruation.js";
|
|
7
|
+
import { transformAthlete } from "../component/healthkit/transform/athlete.js";
|
|
8
|
+
const PROVIDER = "APPLE";
|
|
9
|
+
/**
|
|
10
|
+
* Client class for Apple HealthKit integration with Soma.
|
|
11
|
+
*
|
|
12
|
+
* Unlike {@link import("./strava.js").SomaStrava | SomaStrava} and
|
|
13
|
+
* {@link import("./garmin.js").SomaGarmin | SomaGarmin}, HealthKit is an
|
|
14
|
+
* on-device provider — data is queried locally on iOS, not fetched from a
|
|
15
|
+
* cloud API. This class wraps the transform + ingest pipeline so the host
|
|
16
|
+
* app gets the same ergonomic interface as cloud providers.
|
|
17
|
+
*
|
|
18
|
+
* No configuration is required — HealthKit has no OAuth credentials.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* // Sync workouts received from the React Native client:
|
|
23
|
+
* const result = await soma.healthkit.syncActivities(ctx, {
|
|
24
|
+
* userId: "user_123",
|
|
25
|
+
* workouts: hkWorkouts,
|
|
26
|
+
* });
|
|
27
|
+
* // result: { data: { synced: { activities: 5 } }, errors: [] }
|
|
28
|
+
*
|
|
29
|
+
* // Or sync everything at once:
|
|
30
|
+
* await soma.healthkit.syncAll(ctx, {
|
|
31
|
+
* userId: "user_123",
|
|
32
|
+
* workouts: hkWorkouts,
|
|
33
|
+
* sleepSessions: [nightSamples],
|
|
34
|
+
* bodySamples: hkBodySamples,
|
|
35
|
+
* });
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export class SomaHealthKit {
|
|
39
|
+
component;
|
|
40
|
+
constructor(component) {
|
|
41
|
+
this.component = component;
|
|
42
|
+
}
|
|
43
|
+
// ─── Per-Type Sync Methods ─────────────────────────────────────────────
|
|
44
|
+
/**
|
|
45
|
+
* Sync workout activities from HealthKit.
|
|
46
|
+
*
|
|
47
|
+
* Transforms each `HKWorkout` into the Soma Activity schema and ingests it
|
|
48
|
+
* with automatic deduplication by `workout.uuid`.
|
|
49
|
+
*
|
|
50
|
+
* @param ctx - Mutation (or action) context from the host app
|
|
51
|
+
* @param args.userId - The host app's user identifier
|
|
52
|
+
* @param args.workouts - Array of HKWorkout objects from HealthKit
|
|
53
|
+
*/
|
|
54
|
+
async syncActivities(ctx, args) {
|
|
55
|
+
const connectionId = await this.resolveConnection(ctx, args.userId);
|
|
56
|
+
const errors = [];
|
|
57
|
+
let count = 0;
|
|
58
|
+
for (const workout of args.workouts) {
|
|
59
|
+
try {
|
|
60
|
+
const data = transformWorkout(workout);
|
|
61
|
+
await ctx.runMutation(this.component.public.ingestActivity, {
|
|
62
|
+
connectionId,
|
|
63
|
+
userId: args.userId,
|
|
64
|
+
...data,
|
|
65
|
+
});
|
|
66
|
+
count++;
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
errors.push({
|
|
70
|
+
type: "activity",
|
|
71
|
+
id: workout.uuid,
|
|
72
|
+
message: err instanceof Error ? err.message : String(err),
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
await this.updateLastDataUpdate(ctx, connectionId);
|
|
77
|
+
return { data: { synced: { activities: count } }, errors };
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Sync sleep sessions from HealthKit.
|
|
81
|
+
*
|
|
82
|
+
* Each inner array represents one sleep session (all `HKCategorySample`
|
|
83
|
+
* stage records for a single night). Each session is aggregated into a
|
|
84
|
+
* single Soma Sleep document.
|
|
85
|
+
*
|
|
86
|
+
* @param ctx - Mutation (or action) context from the host app
|
|
87
|
+
* @param args.userId - The host app's user identifier
|
|
88
|
+
* @param args.sessions - Array of sessions, each an array of sleep-stage samples
|
|
89
|
+
*/
|
|
90
|
+
async syncSleep(ctx, args) {
|
|
91
|
+
const connectionId = await this.resolveConnection(ctx, args.userId);
|
|
92
|
+
const errors = [];
|
|
93
|
+
let count = 0;
|
|
94
|
+
for (const session of args.sessions) {
|
|
95
|
+
const sessionId = session[0]?.uuid ?? "unknown";
|
|
96
|
+
try {
|
|
97
|
+
const data = transformSleep(session);
|
|
98
|
+
await ctx.runMutation(this.component.public.ingestSleep, {
|
|
99
|
+
connectionId,
|
|
100
|
+
userId: args.userId,
|
|
101
|
+
...data,
|
|
102
|
+
});
|
|
103
|
+
count++;
|
|
104
|
+
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
errors.push({
|
|
107
|
+
type: "sleep",
|
|
108
|
+
id: sessionId,
|
|
109
|
+
message: err instanceof Error ? err.message : String(err),
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
await this.updateLastDataUpdate(ctx, connectionId);
|
|
114
|
+
return { data: { synced: { sleep: count } }, errors };
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Sync body metrics from HealthKit.
|
|
118
|
+
*
|
|
119
|
+
* Accepts a mixed array of body-related quantity samples (heart rate, HRV,
|
|
120
|
+
* blood pressure, SpO2, weight, etc.) for a single time window and produces
|
|
121
|
+
* one Soma Body document.
|
|
122
|
+
*
|
|
123
|
+
* @param ctx - Mutation (or action) context from the host app
|
|
124
|
+
* @param args.userId - The host app's user identifier
|
|
125
|
+
* @param args.samples - Array of HKQuantitySample for the desired time range
|
|
126
|
+
* @param args.timeRange - Optional explicit time range; auto-detected from samples if omitted
|
|
127
|
+
*/
|
|
128
|
+
async syncBody(ctx, args) {
|
|
129
|
+
const connectionId = await this.resolveConnection(ctx, args.userId);
|
|
130
|
+
const errors = [];
|
|
131
|
+
let count = 0;
|
|
132
|
+
try {
|
|
133
|
+
const data = transformBody(args.samples, args.timeRange);
|
|
134
|
+
await ctx.runMutation(this.component.public.ingestBody, {
|
|
135
|
+
connectionId,
|
|
136
|
+
userId: args.userId,
|
|
137
|
+
...data,
|
|
138
|
+
});
|
|
139
|
+
count++;
|
|
140
|
+
}
|
|
141
|
+
catch (err) {
|
|
142
|
+
errors.push({
|
|
143
|
+
type: "body",
|
|
144
|
+
id: "transform",
|
|
145
|
+
message: err instanceof Error ? err.message : String(err),
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
await this.updateLastDataUpdate(ctx, connectionId);
|
|
149
|
+
return { data: { synced: { body: count } }, errors };
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Sync daily activity data from HealthKit quantity samples.
|
|
153
|
+
*
|
|
154
|
+
* Accepts samples for a single day (steps, distance, energy, exercise time,
|
|
155
|
+
* heart rate, etc.) and produces one Soma Daily document.
|
|
156
|
+
*
|
|
157
|
+
* @param ctx - Mutation (or action) context from the host app
|
|
158
|
+
* @param args.userId - The host app's user identifier
|
|
159
|
+
* @param args.samples - Array of HKQuantitySample for the desired day
|
|
160
|
+
* @param args.timeRange - Optional explicit time range; auto-detected from samples if omitted
|
|
161
|
+
*/
|
|
162
|
+
async syncDaily(ctx, args) {
|
|
163
|
+
const connectionId = await this.resolveConnection(ctx, args.userId);
|
|
164
|
+
const errors = [];
|
|
165
|
+
let count = 0;
|
|
166
|
+
try {
|
|
167
|
+
const data = transformDaily(args.samples, args.timeRange);
|
|
168
|
+
await ctx.runMutation(this.component.public.ingestDaily, {
|
|
169
|
+
connectionId,
|
|
170
|
+
userId: args.userId,
|
|
171
|
+
...data,
|
|
172
|
+
});
|
|
173
|
+
count++;
|
|
174
|
+
}
|
|
175
|
+
catch (err) {
|
|
176
|
+
errors.push({
|
|
177
|
+
type: "daily",
|
|
178
|
+
id: "transform",
|
|
179
|
+
message: err instanceof Error ? err.message : String(err),
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
await this.updateLastDataUpdate(ctx, connectionId);
|
|
183
|
+
return { data: { synced: { daily: count } }, errors };
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Sync daily activity data from HealthKit activity ring summaries.
|
|
187
|
+
*
|
|
188
|
+
* Each `HKActivitySummary` represents one day's activity rings (Move,
|
|
189
|
+
* Exercise, Stand). Each summary produces one Soma Daily document.
|
|
190
|
+
*
|
|
191
|
+
* @param ctx - Mutation (or action) context from the host app
|
|
192
|
+
* @param args.userId - The host app's user identifier
|
|
193
|
+
* @param args.summaries - Array of HKActivitySummary from HealthKit
|
|
194
|
+
*/
|
|
195
|
+
async syncDailyFromSummary(ctx, args) {
|
|
196
|
+
const connectionId = await this.resolveConnection(ctx, args.userId);
|
|
197
|
+
const errors = [];
|
|
198
|
+
let count = 0;
|
|
199
|
+
for (const summary of args.summaries) {
|
|
200
|
+
const { year, month, day } = summary.dateComponents;
|
|
201
|
+
const summaryId = `${year}-${String(month).padStart(2, "0")}-${String(day).padStart(2, "0")}`;
|
|
202
|
+
try {
|
|
203
|
+
const data = transformDailyFromSummary(summary);
|
|
204
|
+
await ctx.runMutation(this.component.public.ingestDaily, {
|
|
205
|
+
connectionId,
|
|
206
|
+
userId: args.userId,
|
|
207
|
+
...data,
|
|
208
|
+
});
|
|
209
|
+
count++;
|
|
210
|
+
}
|
|
211
|
+
catch (err) {
|
|
212
|
+
errors.push({
|
|
213
|
+
type: "daily",
|
|
214
|
+
id: summaryId,
|
|
215
|
+
message: err instanceof Error ? err.message : String(err),
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
await this.updateLastDataUpdate(ctx, connectionId);
|
|
220
|
+
return { data: { synced: { daily: count } }, errors };
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Sync nutrition data from HealthKit.
|
|
224
|
+
*
|
|
225
|
+
* Accepts dietary quantity samples for a single time window and produces
|
|
226
|
+
* one Soma Nutrition document with macros and micros.
|
|
227
|
+
*
|
|
228
|
+
* @param ctx - Mutation (or action) context from the host app
|
|
229
|
+
* @param args.userId - The host app's user identifier
|
|
230
|
+
* @param args.samples - Array of HKQuantitySample with dietary type identifiers
|
|
231
|
+
* @param args.timeRange - Optional explicit time range; auto-detected from samples if omitted
|
|
232
|
+
*/
|
|
233
|
+
async syncNutrition(ctx, args) {
|
|
234
|
+
const connectionId = await this.resolveConnection(ctx, args.userId);
|
|
235
|
+
const errors = [];
|
|
236
|
+
let count = 0;
|
|
237
|
+
try {
|
|
238
|
+
const data = transformNutrition(args.samples, args.timeRange);
|
|
239
|
+
await ctx.runMutation(this.component.public.ingestNutrition, {
|
|
240
|
+
connectionId,
|
|
241
|
+
userId: args.userId,
|
|
242
|
+
...data,
|
|
243
|
+
});
|
|
244
|
+
count++;
|
|
245
|
+
}
|
|
246
|
+
catch (err) {
|
|
247
|
+
errors.push({
|
|
248
|
+
type: "nutrition",
|
|
249
|
+
id: "transform",
|
|
250
|
+
message: err instanceof Error ? err.message : String(err),
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
await this.updateLastDataUpdate(ctx, connectionId);
|
|
254
|
+
return { data: { synced: { nutrition: count } }, errors };
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Sync menstruation data from HealthKit.
|
|
258
|
+
*
|
|
259
|
+
* Accepts menstrual flow category samples for a single time window and
|
|
260
|
+
* produces one Soma Menstruation document.
|
|
261
|
+
*
|
|
262
|
+
* @param ctx - Mutation (or action) context from the host app
|
|
263
|
+
* @param args.userId - The host app's user identifier
|
|
264
|
+
* @param args.samples - Array of HKCategorySample with menstrual flow values
|
|
265
|
+
* @param args.timeRange - Optional explicit time range; auto-detected from samples if omitted
|
|
266
|
+
*/
|
|
267
|
+
async syncMenstruation(ctx, args) {
|
|
268
|
+
const connectionId = await this.resolveConnection(ctx, args.userId);
|
|
269
|
+
const errors = [];
|
|
270
|
+
let count = 0;
|
|
271
|
+
try {
|
|
272
|
+
const data = transformMenstruation(args.samples, args.timeRange);
|
|
273
|
+
await ctx.runMutation(this.component.public.ingestMenstruation, {
|
|
274
|
+
connectionId,
|
|
275
|
+
userId: args.userId,
|
|
276
|
+
...data,
|
|
277
|
+
});
|
|
278
|
+
count++;
|
|
279
|
+
}
|
|
280
|
+
catch (err) {
|
|
281
|
+
errors.push({
|
|
282
|
+
type: "menstruation",
|
|
283
|
+
id: "transform",
|
|
284
|
+
message: err instanceof Error ? err.message : String(err),
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
await this.updateLastDataUpdate(ctx, connectionId);
|
|
288
|
+
return { data: { synced: { menstruation: count } }, errors };
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Sync athlete profile from HealthKit.
|
|
292
|
+
*
|
|
293
|
+
* HealthKit exposes limited profile data (biological sex, date of birth).
|
|
294
|
+
* Produces one Soma Athlete document per connection.
|
|
295
|
+
*
|
|
296
|
+
* @param ctx - Mutation (or action) context from the host app
|
|
297
|
+
* @param args.userId - The host app's user identifier
|
|
298
|
+
* @param args.characteristics - The HKCharacteristics from HealthKit
|
|
299
|
+
*/
|
|
300
|
+
async syncAthlete(ctx, args) {
|
|
301
|
+
const connectionId = await this.resolveConnection(ctx, args.userId);
|
|
302
|
+
const errors = [];
|
|
303
|
+
let count = 0;
|
|
304
|
+
try {
|
|
305
|
+
const data = transformAthlete(args.characteristics);
|
|
306
|
+
await ctx.runMutation(this.component.public.ingestAthlete, {
|
|
307
|
+
connectionId,
|
|
308
|
+
userId: args.userId,
|
|
309
|
+
...data,
|
|
310
|
+
});
|
|
311
|
+
count++;
|
|
312
|
+
}
|
|
313
|
+
catch (err) {
|
|
314
|
+
errors.push({
|
|
315
|
+
type: "athlete",
|
|
316
|
+
id: "transform",
|
|
317
|
+
message: err instanceof Error ? err.message : String(err),
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
await this.updateLastDataUpdate(ctx, connectionId);
|
|
321
|
+
return { data: { synced: { athletes: count } }, errors };
|
|
322
|
+
}
|
|
323
|
+
// ─── Orchestrator ────────────────────────────────────────────────────────
|
|
324
|
+
/**
|
|
325
|
+
* Sync all provided HealthKit data types in a single call.
|
|
326
|
+
*
|
|
327
|
+
* Only data types with values provided are synced. Errors from individual
|
|
328
|
+
* data types are collected — one failing type does not block others.
|
|
329
|
+
*
|
|
330
|
+
* @param ctx - Mutation (or action) context from the host app
|
|
331
|
+
* @param args.userId - The host app's user identifier
|
|
332
|
+
* @param args.workouts - Optional array of HKWorkout objects
|
|
333
|
+
* @param args.sleepSessions - Optional array of sleep sessions (each an array of stage samples)
|
|
334
|
+
* @param args.bodySamples - Optional body-related quantity samples
|
|
335
|
+
* @param args.dailySamples - Optional daily activity quantity samples
|
|
336
|
+
* @param args.dailySummaries - Optional daily activity ring summaries
|
|
337
|
+
* @param args.nutritionSamples - Optional dietary quantity samples
|
|
338
|
+
* @param args.menstruationSamples - Optional menstrual flow category samples
|
|
339
|
+
* @param args.characteristics - Optional user characteristics
|
|
340
|
+
*
|
|
341
|
+
* @example
|
|
342
|
+
* ```ts
|
|
343
|
+
* const result = await soma.healthkit.syncAll(ctx, {
|
|
344
|
+
* userId: "user_123",
|
|
345
|
+
* workouts: hkWorkouts,
|
|
346
|
+
* sleepSessions: [nightSamples],
|
|
347
|
+
* bodySamples: hkBodySamples,
|
|
348
|
+
* dailySummaries: hkSummaries,
|
|
349
|
+
* characteristics: hkCharacteristics,
|
|
350
|
+
* });
|
|
351
|
+
* ```
|
|
352
|
+
*/
|
|
353
|
+
async syncAll(ctx, args) {
|
|
354
|
+
// Resolve connection once, up front
|
|
355
|
+
const connectionId = await this.resolveConnection(ctx, args.userId);
|
|
356
|
+
const allErrors = [];
|
|
357
|
+
const synced = {};
|
|
358
|
+
const run = async (fn, fallbackType) => {
|
|
359
|
+
try {
|
|
360
|
+
const result = await fn();
|
|
361
|
+
Object.assign(synced, result.data.synced);
|
|
362
|
+
allErrors.push(...result.errors);
|
|
363
|
+
}
|
|
364
|
+
catch (err) {
|
|
365
|
+
allErrors.push({
|
|
366
|
+
type: fallbackType,
|
|
367
|
+
id: "sync",
|
|
368
|
+
message: err instanceof Error ? err.message : String(err),
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
if (args.workouts) {
|
|
373
|
+
await run(() => this.syncActivitiesInternal(ctx, connectionId, args.userId, args.workouts), "activity");
|
|
374
|
+
}
|
|
375
|
+
if (args.sleepSessions) {
|
|
376
|
+
await run(() => this.syncSleepInternal(ctx, connectionId, args.userId, args.sleepSessions), "sleep");
|
|
377
|
+
}
|
|
378
|
+
if (args.bodySamples) {
|
|
379
|
+
await run(() => this.syncBodyInternal(ctx, connectionId, args.userId, args.bodySamples, args.bodyTimeRange), "body");
|
|
380
|
+
}
|
|
381
|
+
if (args.dailySamples) {
|
|
382
|
+
await run(() => this.syncDailyInternal(ctx, connectionId, args.userId, args.dailySamples, args.dailyTimeRange), "daily");
|
|
383
|
+
}
|
|
384
|
+
if (args.dailySummaries) {
|
|
385
|
+
await run(() => this.syncDailyFromSummaryInternal(ctx, connectionId, args.userId, args.dailySummaries), "daily");
|
|
386
|
+
}
|
|
387
|
+
if (args.nutritionSamples) {
|
|
388
|
+
await run(() => this.syncNutritionInternal(ctx, connectionId, args.userId, args.nutritionSamples, args.nutritionTimeRange), "nutrition");
|
|
389
|
+
}
|
|
390
|
+
if (args.menstruationSamples) {
|
|
391
|
+
await run(() => this.syncMenstruationInternal(ctx, connectionId, args.userId, args.menstruationSamples, args.menstruationTimeRange), "menstruation");
|
|
392
|
+
}
|
|
393
|
+
if (args.characteristics) {
|
|
394
|
+
await run(() => this.syncAthleteInternal(ctx, connectionId, args.userId, args.characteristics), "athlete");
|
|
395
|
+
}
|
|
396
|
+
// Update lastDataUpdate once at the end
|
|
397
|
+
await this.updateLastDataUpdate(ctx, connectionId);
|
|
398
|
+
return { data: { synced }, errors: allErrors };
|
|
399
|
+
}
|
|
400
|
+
// ─── Private Helpers ───────────��─────────────────────────────────────────
|
|
401
|
+
/**
|
|
402
|
+
* Resolve or create the APPLE connection for a user.
|
|
403
|
+
*
|
|
404
|
+
* HealthKit permissions are managed on-device by the React Native library,
|
|
405
|
+
* so Soma auto-ensures the connection record exists. If the connection was
|
|
406
|
+
* previously disconnected it is re-activated automatically.
|
|
407
|
+
*/
|
|
408
|
+
async resolveConnection(ctx, userId) {
|
|
409
|
+
// `connect` is idempotent: creates if missing, re-activates if inactive.
|
|
410
|
+
return (await ctx.runMutation(this.component.public.connect, {
|
|
411
|
+
userId,
|
|
412
|
+
provider: PROVIDER,
|
|
413
|
+
}));
|
|
414
|
+
}
|
|
415
|
+
async updateLastDataUpdate(ctx, connectionId) {
|
|
416
|
+
await ctx.runMutation(this.component.public.updateConnection, {
|
|
417
|
+
connectionId,
|
|
418
|
+
lastDataUpdate: new Date().toISOString(),
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
// ─── Internal sync methods (skip connection resolution + lastDataUpdate) ─
|
|
422
|
+
async syncActivitiesInternal(ctx, connectionId, userId, workouts) {
|
|
423
|
+
const errors = [];
|
|
424
|
+
let count = 0;
|
|
425
|
+
for (const workout of workouts) {
|
|
426
|
+
try {
|
|
427
|
+
const data = transformWorkout(workout);
|
|
428
|
+
await ctx.runMutation(this.component.public.ingestActivity, {
|
|
429
|
+
connectionId,
|
|
430
|
+
userId,
|
|
431
|
+
...data,
|
|
432
|
+
});
|
|
433
|
+
count++;
|
|
434
|
+
}
|
|
435
|
+
catch (err) {
|
|
436
|
+
errors.push({
|
|
437
|
+
type: "activity",
|
|
438
|
+
id: workout.uuid,
|
|
439
|
+
message: err instanceof Error ? err.message : String(err),
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
return { data: { synced: { activities: count } }, errors };
|
|
444
|
+
}
|
|
445
|
+
async syncSleepInternal(ctx, connectionId, userId, sessions) {
|
|
446
|
+
const errors = [];
|
|
447
|
+
let count = 0;
|
|
448
|
+
for (const session of sessions) {
|
|
449
|
+
const sessionId = session[0]?.uuid ?? "unknown";
|
|
450
|
+
try {
|
|
451
|
+
const data = transformSleep(session);
|
|
452
|
+
await ctx.runMutation(this.component.public.ingestSleep, {
|
|
453
|
+
connectionId,
|
|
454
|
+
userId,
|
|
455
|
+
...data,
|
|
456
|
+
});
|
|
457
|
+
count++;
|
|
458
|
+
}
|
|
459
|
+
catch (err) {
|
|
460
|
+
errors.push({
|
|
461
|
+
type: "sleep",
|
|
462
|
+
id: sessionId,
|
|
463
|
+
message: err instanceof Error ? err.message : String(err),
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
return { data: { synced: { sleep: count } }, errors };
|
|
468
|
+
}
|
|
469
|
+
async syncBodyInternal(ctx, connectionId, userId, samples, timeRange) {
|
|
470
|
+
const errors = [];
|
|
471
|
+
let count = 0;
|
|
472
|
+
try {
|
|
473
|
+
const data = transformBody(samples, timeRange);
|
|
474
|
+
await ctx.runMutation(this.component.public.ingestBody, {
|
|
475
|
+
connectionId,
|
|
476
|
+
userId,
|
|
477
|
+
...data,
|
|
478
|
+
});
|
|
479
|
+
count++;
|
|
480
|
+
}
|
|
481
|
+
catch (err) {
|
|
482
|
+
errors.push({
|
|
483
|
+
type: "body",
|
|
484
|
+
id: "transform",
|
|
485
|
+
message: err instanceof Error ? err.message : String(err),
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
return { data: { synced: { body: count } }, errors };
|
|
489
|
+
}
|
|
490
|
+
async syncDailyInternal(ctx, connectionId, userId, samples, timeRange) {
|
|
491
|
+
const errors = [];
|
|
492
|
+
let count = 0;
|
|
493
|
+
try {
|
|
494
|
+
const data = transformDaily(samples, timeRange);
|
|
495
|
+
await ctx.runMutation(this.component.public.ingestDaily, {
|
|
496
|
+
connectionId,
|
|
497
|
+
userId,
|
|
498
|
+
...data,
|
|
499
|
+
});
|
|
500
|
+
count++;
|
|
501
|
+
}
|
|
502
|
+
catch (err) {
|
|
503
|
+
errors.push({
|
|
504
|
+
type: "daily",
|
|
505
|
+
id: "transform",
|
|
506
|
+
message: err instanceof Error ? err.message : String(err),
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
return { data: { synced: { daily: count } }, errors };
|
|
510
|
+
}
|
|
511
|
+
async syncDailyFromSummaryInternal(ctx, connectionId, userId, summaries) {
|
|
512
|
+
const errors = [];
|
|
513
|
+
let count = 0;
|
|
514
|
+
for (const summary of summaries) {
|
|
515
|
+
const { year, month, day } = summary.dateComponents;
|
|
516
|
+
const summaryId = `${year}-${String(month).padStart(2, "0")}-${String(day).padStart(2, "0")}`;
|
|
517
|
+
try {
|
|
518
|
+
const data = transformDailyFromSummary(summary);
|
|
519
|
+
await ctx.runMutation(this.component.public.ingestDaily, {
|
|
520
|
+
connectionId,
|
|
521
|
+
userId,
|
|
522
|
+
...data,
|
|
523
|
+
});
|
|
524
|
+
count++;
|
|
525
|
+
}
|
|
526
|
+
catch (err) {
|
|
527
|
+
errors.push({
|
|
528
|
+
type: "daily",
|
|
529
|
+
id: summaryId,
|
|
530
|
+
message: err instanceof Error ? err.message : String(err),
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
return { data: { synced: { daily: count } }, errors };
|
|
535
|
+
}
|
|
536
|
+
async syncNutritionInternal(ctx, connectionId, userId, samples, timeRange) {
|
|
537
|
+
const errors = [];
|
|
538
|
+
let count = 0;
|
|
539
|
+
try {
|
|
540
|
+
const data = transformNutrition(samples, timeRange);
|
|
541
|
+
await ctx.runMutation(this.component.public.ingestNutrition, {
|
|
542
|
+
connectionId,
|
|
543
|
+
userId,
|
|
544
|
+
...data,
|
|
545
|
+
});
|
|
546
|
+
count++;
|
|
547
|
+
}
|
|
548
|
+
catch (err) {
|
|
549
|
+
errors.push({
|
|
550
|
+
type: "nutrition",
|
|
551
|
+
id: "transform",
|
|
552
|
+
message: err instanceof Error ? err.message : String(err),
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
return { data: { synced: { nutrition: count } }, errors };
|
|
556
|
+
}
|
|
557
|
+
async syncMenstruationInternal(ctx, connectionId, userId, samples, timeRange) {
|
|
558
|
+
const errors = [];
|
|
559
|
+
let count = 0;
|
|
560
|
+
try {
|
|
561
|
+
const data = transformMenstruation(samples, timeRange);
|
|
562
|
+
await ctx.runMutation(this.component.public.ingestMenstruation, {
|
|
563
|
+
connectionId,
|
|
564
|
+
userId,
|
|
565
|
+
...data,
|
|
566
|
+
});
|
|
567
|
+
count++;
|
|
568
|
+
}
|
|
569
|
+
catch (err) {
|
|
570
|
+
errors.push({
|
|
571
|
+
type: "menstruation",
|
|
572
|
+
id: "transform",
|
|
573
|
+
message: err instanceof Error ? err.message : String(err),
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
return { data: { synced: { menstruation: count } }, errors };
|
|
577
|
+
}
|
|
578
|
+
async syncAthleteInternal(ctx, connectionId, userId, characteristics) {
|
|
579
|
+
const errors = [];
|
|
580
|
+
let count = 0;
|
|
581
|
+
try {
|
|
582
|
+
const data = transformAthlete(characteristics);
|
|
583
|
+
await ctx.runMutation(this.component.public.ingestAthlete, {
|
|
584
|
+
connectionId,
|
|
585
|
+
userId,
|
|
586
|
+
...data,
|
|
587
|
+
});
|
|
588
|
+
count++;
|
|
589
|
+
}
|
|
590
|
+
catch (err) {
|
|
591
|
+
errors.push({
|
|
592
|
+
type: "athlete",
|
|
593
|
+
id: "transform",
|
|
594
|
+
message: err instanceof Error ? err.message : String(err),
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
return { data: { synced: { athletes: count } }, errors };
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
//# sourceMappingURL=healthkit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"healthkit.js","sourceRoot":"","sources":["../../src/client/healthkit.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,EACL,cAAc,EACd,yBAAyB,GAC1B,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,kDAAkD,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAE/E,MAAM,QAAQ,GAAG,OAAO,CAAC;AAOzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,OAAO,aAAa;IACJ;IAApB,YAAoB,SAAwB;QAAxB,cAAS,GAAT,SAAS,CAAe;IAAI,CAAC;IAEjD,0EAA0E;IAE1E;;;;;;;;;OASG;IACH,KAAK,CAAC,cAAc,CAClB,GAAgB,EAChB,IAA+C;QAE/C,MAAM,YAAY,GAAG,MAAM,IAAI,CAA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AC,CAAC,MAAM,CAAC,GAAG,CAAC;aAC1D,CAAC,CAAC;QACL,CAAC;QAED,OAAO,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC;IAC3D,CAAC;CACF"}
|
package/dist/client/index.d.ts
CHANGED
|
@@ -3,8 +3,10 @@ import type { MutationCtx, QueryCtx, SomaStravaConfig, SomaGarminConfig, IngestA
|
|
|
3
3
|
export type { ActionCtx, SomaError, SomaErrorType, SomaResult, SomaStravaConfig, SomaGarminConfig, IngestArgs, TimeRangeArgs, ListTimeRangeArgs, PaginateTimeRangeArgs, StravaOAuthOptions, StravaConnectEvent, GarminConnectEvent, GarminWebhookActionArgs, GarminWebhookActionResult, GarminWebhookEvent, GarminOAuthOptions, GarminWebhookEventName, GarminWebhookHandler, GarminWebhookOptions, StravaWebhookActionArgs, StravaWebhookActionResult, StravaWebhookEvent, StravaWebhookEventName, StravaWebhookHandler, StravaWebhookItem, StravaWebhookOptions, RegisterRoutesOptions, } from "./types.js";
|
|
4
4
|
import type { HttpRouter } from "convex/server";
|
|
5
5
|
import { SomaGarmin } from "./garmin.js";
|
|
6
|
+
import { SomaHealthKit } from "./healthkit.js";
|
|
6
7
|
import { SomaStrava } from "./strava.js";
|
|
7
8
|
export { SomaGarmin } from "./garmin.js";
|
|
9
|
+
export { SomaHealthKit } from "./healthkit.js";
|
|
8
10
|
export { SomaStrava } from "./strava.js";
|
|
9
11
|
export { STRAVA_OAUTH_CALLBACK_PATH, STRAVA_WEBHOOK_BASE_PATH } from "./strava.js";
|
|
10
12
|
export { GARMIN_OAUTH_CALLBACK_PATH, GARMIN_WEBHOOK_BASE_PATH } from "./garmin.js";
|
|
@@ -50,6 +52,7 @@ export declare class Soma {
|
|
|
50
52
|
private stravaConfig?;
|
|
51
53
|
private garminConfig?;
|
|
52
54
|
readonly garmin: SomaGarmin;
|
|
55
|
+
readonly healthkit: SomaHealthKit;
|
|
53
56
|
readonly strava: SomaStrava;
|
|
54
57
|
constructor(component: SomaComponent, options?: {
|
|
55
58
|
strava?: SomaStravaConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,KAAK,EACV,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,SAAS,EACT,SAAS,EACT,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,yBAAyB,EACzB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,yBAAyB,EACzB,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACnF,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEnF,MAAM,MAAM,aAAa,GAAG,YAAY,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,qBAAa,IAAI;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,KAAK,EACV,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,SAAS,EACT,SAAS,EACT,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,yBAAyB,EACzB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,yBAAyB,EACzB,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACnF,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,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