@modelhealth/modelhealth 0.1.17

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.
@@ -0,0 +1,702 @@
1
+ /**
2
+ * Model Health SDK Client
3
+ *
4
+ * TypeScript/JavaScript client for the Model Health biomechanics SDK.
5
+ * Provides a clean, typed API over the WASM bindings.
6
+ *
7
+ * @packageDocumentation
8
+ *
9
+ * @example Basic usage
10
+ * ```typescript
11
+ * import { ModelHealthService } from '@modelhealth/modelhealth';
12
+ *
13
+ * // Create and initialize client with API key
14
+ * const client = new ModelHealthService({ apiKey: "your-api-key-here" });
15
+ * await client.init();
16
+ *
17
+ * // Authenticate (optional - API key already provides authentication)
18
+ * const result = await client.login("user@example.com", "password");
19
+ * if (result === "verification_required") {
20
+ * await client.verify("123456", true);
21
+ * }
22
+ *
23
+ * // Get sessions
24
+ * const sessions = await client.sessionList();
25
+ * ```
26
+ */
27
+ import type { CheckerboardDetails, Session, Subject, SubjectParameters, Activity, ActivitySort, ActivityTag, VideoVersion, ResultDataType, ResultData, AnalysisResultDataType, AnalysisResultData, AnalysisType, AnalysisTask, AnalysisTaskStatus, ActivityProcessingStatus, CalibrationStatus } from "./types.js";
28
+ /**
29
+ * Configuration options for the Model Health client.
30
+ */
31
+ export interface ModelHealthConfig {
32
+ /**
33
+ * Your ModelHealth API key for authentication.
34
+ *
35
+ * This is required to use the SDK. Get your API key from the
36
+ * ModelHealth dashboard.
37
+ *
38
+ * @required
39
+ */
40
+ apiKey: string;
41
+ /**
42
+ * Automatically initialize WASM on construction.
43
+ *
44
+ * When false, you must manually call `init()` before using the client.
45
+ *
46
+ * @default true
47
+ */
48
+ autoInit?: boolean;
49
+ }
50
+ /**
51
+ * Model Health SDK Client for biomechanical analysis.
52
+ *
53
+ * Main entry point for interacting with the Model Health SDK.
54
+ * Provides authentication, session management, data download,
55
+ * and analysis capabilities.
56
+ *
57
+ * @example Create with API key
58
+ * ```typescript
59
+ * const client = new ModelHealthService({
60
+ * apiKey: "your-api-key-here"
61
+ * });
62
+ * await client.init();
63
+ *
64
+ * // SDK is ready to use
65
+ * const sessions = await client.sessionList();
66
+ * ```
67
+ *
68
+ * @example With custom configuration
69
+ * ```typescript
70
+ * const client = new ModelHealthService({
71
+ * apiKey: "your-api-key"
72
+ * });
73
+ * await client.init();
74
+ * ```
75
+ */
76
+ export declare class ModelHealthService {
77
+ private wasmClient;
78
+ private config;
79
+ private initialized;
80
+ /**
81
+ * Create a new Model Health client.
82
+ *
83
+ * @param config Configuration options including API key
84
+ * @throws If API key is not provided
85
+ *
86
+ * @example Default configuration
87
+ * ```typescript
88
+ * const client = new ModelHealthService({
89
+ * apiKey: "your-api-key-here"
90
+ * });
91
+ * ```
92
+ *
93
+ * @example Custom configuration
94
+ * ```typescript
95
+ * const client = new ModelHealthService({
96
+ * apiKey: "your-api-key",
97
+ * autoInit: false
98
+ * });
99
+ * ```
100
+ */
101
+ constructor(config: ModelHealthConfig);
102
+ /**
103
+ * Initialize the WASM module and client.
104
+ *
105
+ * Must be called before using any other methods if `autoInit: false`
106
+ * was specified in the configuration. Safe to call multiple times.
107
+ *
108
+ * @throws If WASM initialization fails
109
+ *
110
+ * @example
111
+ * ```typescript
112
+ * const client = new ModelHealthService({
113
+ * apiKey: "your-key",
114
+ * autoInit: false
115
+ * });
116
+ * await client.init();
117
+ * ```
118
+ */
119
+ init(): Promise<void>;
120
+ /**
121
+ * Ensure the client is initialized.
122
+ *
123
+ * @private
124
+ * @throws If client is not initialized
125
+ */
126
+ private ensureInitialized;
127
+ /**
128
+ * Checks if a user is currently authenticated.
129
+ *
130
+ * @returns `true` if authenticated, `false` otherwise
131
+ *
132
+ * @example
133
+ * ```typescript
134
+ * if (await client.isAuthenticated()) {
135
+ * // Proceed with authenticated operations
136
+ * const sessions = await client.sessionList();
137
+ * } else {
138
+ * // Show login screen
139
+ * }
140
+ * ```
141
+ */
142
+ isAuthenticated(): Promise<boolean>;
143
+ /**
144
+ * Retrieves all sessions for the authenticated user.
145
+ *
146
+ * @returns An array of `Session` objects. Returns an empty array if no sessions exist.
147
+ * @throws If the request fails due to network issues, authentication problems,
148
+ * or server errors.
149
+ *
150
+ * @example
151
+ * ```typescript
152
+ * try {
153
+ * const sessions = await client.sessionList();
154
+ * console.log(`Found ${sessions.length} sessions`);
155
+ * for (const session of sessions) {
156
+ * console.log(`Session: ${session.id}`);
157
+ * }
158
+ * } catch (error) {
159
+ * console.log(`Failed to fetch sessions: ${error}`);
160
+ * }
161
+ * ```
162
+ */
163
+ sessionList(): Promise<Session[]>;
164
+ /**
165
+ * Retrieve a specific session by ID with all activities populated.
166
+ *
167
+ * @param sessionId Unique session identifier
168
+ * @returns The requested session with complete activity data
169
+ * @throws If the session doesn't exist, user lacks access, or request fails
170
+ *
171
+ * @example
172
+ * ```typescript
173
+ * const session = await client.getSession("session-abc123");
174
+ * console.log(`Session has ${session.activities.length} activities`);
175
+ * ```
176
+ */
177
+ getSession(sessionId: string): Promise<Session>;
178
+ /**
179
+ * Creates a new session.
180
+ *
181
+ * A session is required before performing camera calibration. It represents
182
+ * a single calibration workflow and groups multiple cameras together.
183
+ *
184
+ * After creating a session, use camera calibration methods to calibrate your cameras.
185
+ *
186
+ * @returns A `Session` object with a unique identifier
187
+ * @throws If session creation fails
188
+ *
189
+ * @example
190
+ * ```typescript
191
+ * // Create session
192
+ * const session = await client.createSession();
193
+ *
194
+ * // Proceed with calibration
195
+ * const details = {
196
+ * rows: 4,
197
+ * columns: 5,
198
+ * square_size: 35,
199
+ * placement: "perpendicular"
200
+ * };
201
+ * // await client.calibrateCamera(session, details, (status) => { ... });
202
+ * ```
203
+ */
204
+ createSession(): Promise<Session>;
205
+ /**
206
+ * Calibrates a camera using a checkerboard pattern.
207
+ *
208
+ * **Requirements:**
209
+ * - A printed checkerboard pattern
210
+ * - Accurate measurement of square size in millimeters
211
+ * - Multiple views of the checkerboard from different angles
212
+ *
213
+ * The calibration is automated and typically completes in a few seconds
214
+ *
215
+ * @param session The session created with `createSession()`
216
+ * @param checkerboardDetails Configuration of the calibration checkerboard
217
+ * @param statusCallback Callback function called with calibration progress updates
218
+ * @throws If calibration fails (insufficient views, pattern not detected, etc.)
219
+ *
220
+ * @example
221
+ * ```typescript
222
+ * const session = await client.createSession();
223
+ *
224
+ * const details = {
225
+ * rows: 4, // Internal corners, not squares (for 5×6 board)
226
+ * columns: 5, // Internal corners, not squares (for 5×6 board)
227
+ * square_size: 35, // Measured in millimeters
228
+ * placement: "perpendicular"
229
+ * };
230
+ *
231
+ * await client.calibrateCamera(session, details, (status) => {
232
+ * console.log("Calibration status:", status);
233
+ * });
234
+ * // Calibration complete, proceed to neutral pose
235
+ * ```
236
+ */
237
+ calibrateCamera(session: Session, checkerboardDetails: CheckerboardDetails, statusCallback: (status: CalibrationStatus) => void): Promise<void>;
238
+ /**
239
+ * Captures the subject's neutral standing pose for model scaling.
240
+ *
241
+ * This step is required after camera calibration and before recording movement activities.
242
+ * It takes a quick video of the subject standing in a neutral position, which is
243
+ * used to scale the biomechanical model to match the subject's dimensions.
244
+ *
245
+ * **Instructions for subject:**
246
+ * - Stand upright in a relaxed, natural position
247
+ * - Face forward with arms spread slightly at sides
248
+ * - Remain still for a few seconds
249
+ *
250
+ * @param subject The subject to calibrate the neutral pose for
251
+ * @param session The session to perform calibration in
252
+ * @param statusCallback Callback function called with calibration progress updates
253
+ * @throws If pose capture fails (subject not detected, poor lighting, etc.)
254
+ *
255
+ * @example
256
+ * ```typescript
257
+ * // After successful camera calibration
258
+ * await client.calibrateNeutralPose(subject, session, (status) => {
259
+ * console.log("Neutral pose status:", status);
260
+ * });
261
+ * // Model now scaled, ready to record movement activities
262
+ * ```
263
+ */
264
+ calibrateNeutralPose(subject: Subject, session: Session, statusCallback: (status: CalibrationStatus) => void): Promise<void>;
265
+ /**
266
+ * Retrieves all subjects associated with the authenticated account.
267
+ *
268
+ * Subjects represent individuals being monitored or assessed. Each subject
269
+ * contains demographic information, physical measurements, and categorization tags.
270
+ *
271
+ * @returns An array of `Subject` objects
272
+ * @throws If the request fails or authentication has expired
273
+ *
274
+ * @example
275
+ * ```typescript
276
+ * const subjects = await client.subjectList();
277
+ * for (const subject of subjects) {
278
+ * console.log(`${subject.name}: ${subject.height ?? 0}cm, ${subject.weight ?? 0}kg`);
279
+ * }
280
+ *
281
+ * // Filter by tags
282
+ * const athletes = subjects.filter(s => s.subject_tags.includes("athlete"));
283
+ * ```
284
+ */
285
+ subjectList(): Promise<Subject[]>;
286
+ /**
287
+ * Creates a new subject in the system.
288
+ *
289
+ * Subjects represent individuals being monitored or assessed. After creating
290
+ * a subject, they can be associated with sessions for neutral pose calibration
291
+ * and movement activities.
292
+ *
293
+ * @param parameters Subject details including name, measurements, and tags
294
+ * @returns The newly created `Subject` with its assigned ID
295
+ * @throws If creation fails (validation errors, duplicate name, etc.)
296
+ *
297
+ * @example
298
+ * ```typescript
299
+ * const params = {
300
+ * name: "John Doe",
301
+ * weight: 75.0, // kilograms
302
+ * height: 180.0, // centimeters
303
+ * birth_year: 1990,
304
+ * gender: "man",
305
+ * sex_at_birth: "man",
306
+ * characteristics: "Regular training schedule",
307
+ * subject_tags: ["athlete"],
308
+ * terms: true
309
+ * };
310
+ *
311
+ * const subject = await client.createSubject(params);
312
+ * console.log(`Created subject with ID: ${subject.id}`);
313
+ *
314
+ * // Use the subject for calibration
315
+ * // await client.calibrateNeutralPose(subject, session, (status) => { ... });
316
+ * ```
317
+ */
318
+ createSubject(parameters: SubjectParameters): Promise<Subject>;
319
+ /**
320
+ * Retrieves activities for a specific subject with pagination and sorting.
321
+ *
322
+ * This method allows you to fetch activities associated with a particular subject,
323
+ * with control over pagination and sort order. This is useful for displaying
324
+ * activity history or implementing infinite scroll interfaces.
325
+ *
326
+ * @param subjectId The ID of the subject whose activities to retrieve
327
+ * @param startIndex Zero-based index to start from (for pagination). Use 0 for first page.
328
+ * @param count Number of activities to retrieve per request
329
+ * @param sort Sort order for the results (e.g., "updated_at" for most recent first)
330
+ * @returns An array of activities for the specified subject
331
+ * @throws If the request fails or authentication has expired
332
+ *
333
+ * @example
334
+ * ```typescript
335
+ * // Get the 20 most recent activities for a subject
336
+ * const recentActivities = await client.getActivitiesForSubject(
337
+ * "subject-123",
338
+ * 0,
339
+ * 20,
340
+ * "updated_at"
341
+ * );
342
+ *
343
+ * // Pagination - get the next 20 activities
344
+ * const nextPage = await client.getActivitiesForSubject(
345
+ * "subject-123",
346
+ * 20,
347
+ * 20,
348
+ * "updated_at"
349
+ * );
350
+ * ```
351
+ */
352
+ getActivitiesForSubject(subjectId: string, startIndex: number, count: number, sort: ActivitySort): Promise<Activity[]>;
353
+ /**
354
+ * Retrieves a specific activity by its ID.
355
+ *
356
+ * Use this method to fetch the complete details of an activity, including
357
+ * its videos, results, and current processing status.
358
+ *
359
+ * @param activityId The unique identifier of the activity
360
+ * @returns The requested activity with all its details
361
+ * @throws If the activity doesn't exist, or if authentication has expired
362
+ *
363
+ * @example
364
+ * ```typescript
365
+ * const activity = await client.getActivity("abc123");
366
+ * console.log(`Activity: ${activity.name ?? "Unnamed"}`);
367
+ * console.log(`Status: ${activity.status}`);
368
+ * console.log(`Videos: ${activity.videos.length}`);
369
+ * ```
370
+ */
371
+ getActivity(activityId: string): Promise<Activity>;
372
+ /**
373
+ * Updates an existing activity.
374
+ *
375
+ * Use this method to modify activity properties such as the name.
376
+ * The activity is updated on the server and the updated version is returned.
377
+ *
378
+ * @param activity The activity to update (with modified properties)
379
+ * @returns The updated activity as stored on the server
380
+ * @throws If the update fails or authentication has expired
381
+ *
382
+ * @example
383
+ * ```typescript
384
+ * let activity = await client.getActivity("abc123");
385
+ * // Modify the activity name
386
+ * activity.name = "CMJ Baseline Test";
387
+ * const updated = await client.updateActivity(activity);
388
+ * console.log(`Updated: ${updated.name ?? ""}`);
389
+ * ```
390
+ *
391
+ * @note Not all activity properties can be modified. Only mutable fields
392
+ * (such as `name`) will be updated on the server.
393
+ */
394
+ updateActivity(activity: Activity): Promise<Activity>;
395
+ /**
396
+ * Deletes an activity from the system.
397
+ *
398
+ * This permanently removes the activity and all its associated data,
399
+ * including videos and analysis results. This action cannot be undone.
400
+ *
401
+ * @param activity The activity to delete
402
+ * @throws If the deletion fails or authentication has expired
403
+ *
404
+ * @example
405
+ * ```typescript
406
+ * const activity = await client.getActivity("abc123");
407
+ * await client.deleteActivity(activity);
408
+ * // Activity and all associated data are now permanently deleted
409
+ * ```
410
+ *
411
+ * @warning This operation is irreversible. All videos, analysis results,
412
+ * and metadata associated with this activity will be permanently lost.
413
+ */
414
+ deleteActivity(activity: Activity): Promise<void>;
415
+ /**
416
+ * Retrieves all available activity tags.
417
+ *
418
+ * Activity tags provide a way to categorize and filter activities.
419
+ * This method returns all tags configured in the system, which can be
420
+ * used for filtering or organizing activities in your application.
421
+ *
422
+ * @returns An array of available activity tags
423
+ * @throws If the request fails or authentication has expired
424
+ *
425
+ * @example
426
+ * ```typescript
427
+ * const tags = await client.getActivityTags();
428
+ * for (const tag of tags) {
429
+ * console.log(`${tag.label}: ${tag.value}`);
430
+ * }
431
+ *
432
+ * // Use tags for filtering or categorization
433
+ * const cmjTag = tags.find(t => t.value === "cmj");
434
+ * ```
435
+ */
436
+ getActivityTags(): Promise<ActivityTag[]>;
437
+ /**
438
+ * Retrieves all movement activities associated with the authenticated account.
439
+ *
440
+ * Activities represent individual recording sessions and contain references to
441
+ * captured videos and analysis results. Use this to review past data or
442
+ * fetch analysis for completed activities.
443
+ *
444
+ * @param sessionId Session identifier
445
+ * @returns An array of `Activity` objects
446
+ * @throws If the request fails or authentication has expired
447
+ *
448
+ * @example
449
+ * ```typescript
450
+ * const activities = await client.activityList(session.id);
451
+ *
452
+ * // Find completed activities ready for analysis
453
+ * const completed = activities.filter(t => t.status === "completed");
454
+ *
455
+ * // Access videos and results
456
+ * for (const activity of completed) {
457
+ * console.log(`Activity: ${activity.name ?? activity.id}`);
458
+ * console.log(`Videos: ${activity.videos.length}`);
459
+ * console.log(`Results: ${activity.results.length}`);
460
+ * }
461
+ * ```
462
+ */
463
+ activityList(sessionId: string): Promise<Activity[]>;
464
+ /**
465
+ * Download video data for a specific activity.
466
+ *
467
+ * Asynchronously fetches all videos associated with a given activity that match the specified type.
468
+ * Videos with invalid URLs or failed downloads are silently excluded from the result.
469
+ *
470
+ * @param activity The activity whose videos should be downloaded
471
+ * @param version The version type of videos to download (default: "synced")
472
+ * @returns An array of video data as Uint8Array. The array may be empty if no valid
473
+ * videos are available or all downloads fail.
474
+ *
475
+ * @example
476
+ * ```typescript
477
+ * const activity = // ... obtained activity
478
+ * const videoData = await client.downloadActivityVideos(activity, "raw");
479
+ *
480
+ * for (const data of videoData) {
481
+ * // Process video data
482
+ * }
483
+ * ```
484
+ *
485
+ * @note This method performs concurrent downloads for optimal performance. Individual download
486
+ * failures do not affect other requests.
487
+ */
488
+ downloadActivityVideos(activity: Activity, version?: VideoVersion): Promise<Uint8Array[]>;
489
+ /**
490
+ * Downloads result data files from a processed activity.
491
+ *
492
+ * After an activity completes processing, various result files become available for download.
493
+ * Use this method to retrieve specific types of data (kinematic measurements, visualizations)
494
+ * in their native file formats (JSON, CSV).
495
+ *
496
+ * This method is useful when you need access to raw analysis data rather than the
497
+ * structured metrics provided by analysis result methods.
498
+ *
499
+ * @param activity The completed activity to download data from
500
+ * @param dataTypes The types of result data to download
501
+ * @returns An array of result data, one entry per requested type. Returns an empty array if no
502
+ * results are available or all downloads fail.
503
+ *
504
+ * @example
505
+ * ```typescript
506
+ * // Download kinematics in MOT format
507
+ * const results = await client.downloadActivityResultData(activity, ["kinematics_mot"]);
508
+ *
509
+ * for (const result of results) {
510
+ * switch (result.result_data_type) {
511
+ * case "kinematics_mot":
512
+ * // Use result.data directly as a .mot file
513
+ * break;
514
+ * }
515
+ * }
516
+ *
517
+ * // Download multiple types in one call
518
+ * const allData = await client.downloadActivityResultData(
519
+ * activity,
520
+ * ["kinematics_mot", "animation"]
521
+ * );
522
+ * console.log(`Downloaded ${allData.length} result files`);
523
+ * ```
524
+ *
525
+ * @note This method performs concurrent downloads for optimal performance.
526
+ * Individual download failures do not affect other requests and failed downloads
527
+ * are silently excluded from results.
528
+ */
529
+ downloadActivityResultData(activity: Activity, dataTypes: ResultDataType[]): Promise<ResultData[]>;
530
+ /**
531
+ * Downloads analysis result data for a completed activity.
532
+ *
533
+ * @param activity The activity that has completed analysis
534
+ * @param dataTypes The types of analysis result data to download
535
+ * @returns An array of analysis result data, one entry per requested type. Returns an empty
536
+ * array if no results are available or all downloads fail.
537
+ *
538
+ * @example
539
+ * ```typescript
540
+ * const results = await client.downloadActivityAnalysisResultData(
541
+ * activity,
542
+ * ["metrics", "report"]
543
+ * );
544
+ *
545
+ * for (const result of results) {
546
+ * switch (result.result_data_type) {
547
+ * case "metrics":
548
+ * const json = JSON.parse(new TextDecoder().decode(result.data));
549
+ * break;
550
+ * case "report":
551
+ * // Use result.data directly as a PDF
552
+ * break;
553
+ * case "data":
554
+ * // Use result.data directly as a ZIP file
555
+ * break;
556
+ * }
557
+ * }
558
+ * ```
559
+ *
560
+ * @note Individual download failures are silently excluded from results.
561
+ */
562
+ downloadActivityAnalysisResultData(activity: Activity, dataTypes: AnalysisResultDataType[]): Promise<AnalysisResultData[]>;
563
+ /**
564
+ * Starts recording a dynamic movement activity.
565
+ *
566
+ * After completing calibration steps (camera calibration and neutral pose),
567
+ * use this method to begin recording an activity.
568
+ *
569
+ * @param activityName A descriptive name for this activity (e.g., "cmj-test")
570
+ * @param session The session this activity is associated with
571
+ * @returns The newly created activity
572
+ * @throws If recording cannot start (session not calibrated, camera issues, etc.)
573
+ *
574
+ * @example
575
+ * ```typescript
576
+ * // Record a CMJ session
577
+ * const activity = await client.record("cmj-2024", session);
578
+ * // Subject performs CMJ while cameras record
579
+ *
580
+ * // When complete, stop recording
581
+ * await client.stopRecording(session);
582
+ * ```
583
+ */
584
+ record(activityName: string, session: Session): Promise<Activity>;
585
+ /**
586
+ * Stops recording of a dynamic movement activity in a session.
587
+ *
588
+ * Call this method when the subject has completed the movement activity.
589
+ *
590
+ * @param session The session to stop recording in
591
+ * @throws If the activity cannot be stopped (invalid session ID, already stopped, etc.)
592
+ *
593
+ * @example
594
+ * ```typescript
595
+ * // After recording is complete
596
+ * await client.stopRecording(session);
597
+ * ```
598
+ */
599
+ stopRecording(session: Session): Promise<void>;
600
+ /**
601
+ * Retrieves the current processing status of an activity.
602
+ *
603
+ * Poll this method to determine when an activity is ready for analysis.
604
+ * Activities must complete video upload and processing before analysis can begin.
605
+ *
606
+ * @param activity A completed activity
607
+ * @returns The current processing status
608
+ * @throws Network or authentication errors
609
+ *
610
+ * @example
611
+ * ```typescript
612
+ * const status = await client.getStatus(activity);
613
+ *
614
+ * switch (status.type) {
615
+ * case "ready":
616
+ * console.log("Activity ready for analysis");
617
+ * break;
618
+ * case "processing":
619
+ * console.log("Still processing...");
620
+ * break;
621
+ * case "uploading":
622
+ * console.log(`Uploaded ${status.uploaded}/${status.total} videos`);
623
+ * break;
624
+ * case "failed":
625
+ * console.log("Processing failed");
626
+ * break;
627
+ * }
628
+ * ```
629
+ */
630
+ getStatus(activity: Activity): Promise<ActivityProcessingStatus>;
631
+ /**
632
+ * Starts an analysis task for a completed activity.
633
+ *
634
+ * The activity must have completed processing (status `.ready`) before analysis can begin.
635
+ * Use the returned `AnalysisTask` to poll for completion.
636
+ *
637
+ * @param analysisType The type of analysis to perform, Gait, Squats, etc
638
+ * @param activity The activity to analyze
639
+ * @param session The session containing the activity
640
+ * @returns An analysis task for tracking completion
641
+ * @throws Network or authentication errors
642
+ *
643
+ * @example
644
+ * ```typescript
645
+ * const task = await client.startAnalysis(
646
+ * "counterMovementJump",
647
+ * activity,
648
+ * session
649
+ * );
650
+ *
651
+ * // Poll for completion
652
+ * const status = await client.getAnalysisStatus(task);
653
+ * ```
654
+ */
655
+ startAnalysis(analysisType: AnalysisType, activity: Activity, session: Session): Promise<AnalysisTask>;
656
+ /**
657
+ * Retrieves the current status of an analysis task.
658
+ *
659
+ * Poll this method to monitor analysis progress. When status is `.completed`,
660
+ * use `downloadActivityAnalysisResultData` to fetch metrics, report, or raw data.
661
+ *
662
+ * @param task The task returned from `startAnalysis`
663
+ * @returns The current analysis status
664
+ * @throws Network or authentication errors
665
+ *
666
+ * @example
667
+ * ```typescript
668
+ * const status = await client.getAnalysisStatus(task);
669
+ *
670
+ * switch (status.type) {
671
+ * case "processing":
672
+ * console.log("Analysis running...");
673
+ * break;
674
+ * case "completed":
675
+ * const results = await client.downloadActivityAnalysisResultData(
676
+ * activity,
677
+ * ["metrics", "report"]
678
+ * );
679
+ * const metricsEntry = results.find((r) => r.result_data_type === "metrics");
680
+ * if (metricsEntry?.data) {
681
+ * const metrics = JSON.parse(new TextDecoder().decode(metricsEntry.data));
682
+ * console.log("Metrics:", metrics);
683
+ * }
684
+ * break;
685
+ * case "failed":
686
+ * console.log("Analysis failed");
687
+ * break;
688
+ * }
689
+ * ```
690
+ */
691
+ getAnalysisStatus(task: AnalysisTask): Promise<AnalysisTaskStatus>;
692
+ /**
693
+ * Parse JSON response from WASM.
694
+ *
695
+ * @private
696
+ * @param value Value from WASM (may be string or object)
697
+ * @returns Parsed TypeScript object
698
+ */
699
+ private parseResponse;
700
+ }
701
+ export * from "./types.js";
702
+ //# sourceMappingURL=index.d.ts.map