@healthcloudai/hc-settings-connector 0.0.9 → 0.0.11

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/README.md CHANGED
@@ -7,16 +7,15 @@ It is built on top of the shared Healthcheck HTTP and Login connectors.
7
7
  ---
8
8
 
9
9
  ## Features
10
- 1. Retrieve the authenticated patient profile
11
- 2. Retrieve the authenticated patient dashboard
12
- 3. Generate canned upload URLs for selfie, ID, and insurance images
13
- 4. Capture selfie, identification, and insurance documents from uploaded file keys
14
- 5. Update or submit driving license data through the resolved EHR route
15
- 6. Submit patient insurance coverage details
16
- 7. Retrieve patient insurances through the resolved EHR route
17
- 8. Update the stored user image file reference
18
- 9. Deactivate the authenticated user
19
- 10. Built on the shared Healthcheck HttpClient and authentication layer
10
+ 1. Retrieve the authenticated patient dashboard
11
+ 2. Generate canned upload URLs for selfie, ID, and insurance images
12
+ 3. Submit uploaded identification and insurance file keys for capture
13
+ 4. Submit patient insurance coverage details
14
+ 5. Retrieve patient insurances
15
+ 6. Submit driving license data
16
+ 7. Update the stored user image file reference
17
+ 8. Deactivate the authenticated user
18
+ 9. Built on the shared Healthcheck HttpClient and authentication layer
20
19
 
21
20
  ---
22
21
 
@@ -59,79 +58,42 @@ const settingsClient = new HCSettingsClient(
59
58
 
60
59
  ---
61
60
 
62
- ## Methods
63
-
64
- ### Get User Info
65
61
 
66
- Public signature: `settingsClient.getUserInfo()`
62
+ ## API Key
67
63
 
68
- Returns the current authenticated patient profile.
64
+ Use `setApiKey(...)` to attach an API key header to requests from `HCSettingsClient`.
69
65
 
70
66
  ```ts
71
- const userInfo = await settingsClient.getUserInfo();
72
- ```
67
+ const apiKey = process.env.HEALTHCLOUD_API_KEY;
73
68
 
74
- #### Full API request
69
+ if (!apiKey) {
70
+ throw new Error("HEALTHCLOUD_API_KEY is required.");
71
+ }
75
72
 
76
- This method performs an authenticated request internally and does not send a request body.
73
+ settingsClient.setApiKey("x-api-key", apiKey);
74
+ ```
77
75
 
78
- #### API response
76
+ - Header name should be `x-api-key`.
79
77
 
80
- Status:
78
+ ## Methods
81
79
 
82
- ```txt
83
- 200
84
- ```
80
+ The Settings connector methods are grouped by the main usage flow:
85
81
 
86
- ```json
87
- {
88
- "Data": {
89
- "Record": {
90
- "ID": "record-id-example",
91
- "TenantID": "demo-tenant",
92
- "FirstName": "John",
93
- "LastName": "Doe",
94
- "Email": "john.doe@example.com",
95
- "Phone": null,
96
- "BirthDate": "0001-01-01T00:00:00",
97
- "HasInsurance": false,
98
- "HasIDCard": false,
99
- "HasSelfie": true,
100
- "Address": {
101
- "StreetAndNumber": null,
102
- "Extension": null,
103
- "City": null,
104
- "State": null,
105
- "PostalCode": null,
106
- "Country": null
107
- },
108
- "Attributes": {
109
- "FHIRPatientID": "patient-id-example",
110
- "CompositeID": "composite-id-example",
111
- "PatientImageURL": "https://storage.example.com/selfie_example.jpeg"
112
- },
113
- "CompositeID": "composite-id-example",
114
- "FHIRID": "fhir-id-example"
115
- },
116
- "Encounters": null,
117
- "EHR": "fhir",
118
- "PendingActions": [
119
- "ADD_ID",
120
- "IMPORT_VITALS"
121
- ]
122
- },
123
- "ErrorMessage": null,
124
- "IsOK": true
125
- }
126
- ```
82
+ 1. Dashboard
83
+ 2. Profile image upload and update
84
+ 3. ID document upload, capture, and submit
85
+ 4. Insurance upload, capture, submit, and retrieval
86
+ 5. Account actions
127
87
 
128
88
  ---
129
89
 
90
+ ## Dashboard methods
91
+
130
92
  ### Get Dashboard
131
93
 
132
94
  Public signature: `settingsClient.getDashboard()`
133
95
 
134
- Returns the current authenticated patient dashboard response.
96
+ Returns the authenticated patient dashboard.
135
97
 
136
98
  ```ts
137
99
  const dashboard = await settingsClient.getDashboard();
@@ -153,102 +115,78 @@ Status:
153
115
  {
154
116
  "Data": {
155
117
  "Record": {
156
- "ID": "record-id-example",
157
- "TenantID": "demo-tenant",
158
- "FirstName": "John",
159
- "LastName": "Doe",
160
- "Email": "john.doe@example.com",
161
- "HasInsurance": false,
162
- "HasIDCard": false,
118
+ "Status": 0,
119
+ "Sex": "Male",
120
+ "GenderIdentity": "Male",
121
+ "HasInsurance": true,
122
+ "HasIDCard": true,
163
123
  "HasSelfie": true,
164
- "Attributes": {
165
- "FHIRPatientID": "patient-id-example",
166
- "CompositeID": "composite-id-example",
167
- "PatientImageURL": "https://storage.example.com/selfie_example.jpeg"
124
+ "Flags": {
125
+ "IsVerified": "true",
126
+ "NeedsInsurance": "false"
168
127
  }
169
128
  },
170
- "Encounters": [],
171
- "EHR": "fhir",
129
+ "Encounters": [
130
+ {
131
+ "FHIRID": "test-fhir-id-001",
132
+ "AthenaID": "test-athena-id-001",
133
+ "Status": 0,
134
+ "Patient": null,
135
+ "EncounterClass": "ambulatory",
136
+ "EHR": "athena",
137
+ "EHRType": "Athena Health",
138
+ "EHRVisitName": "Office Visit",
139
+ "EHRAppointmentID": "test-appointment-id-001",
140
+ "EHRProviderID": "test-provider-id-001",
141
+ "EHRProviderName": "Test Provider",
142
+ "EHRDate": "04/22/2026",
143
+ "EHRStatus": "Finished",
144
+ "EHRStage": "completed"
145
+ }
146
+ ],
147
+ "EHR": "athena",
172
148
  "PendingActions": [
149
+ "ADD_INSURANCE",
173
150
  "ADD_ID",
174
151
  "IMPORT_VITALS"
175
152
  ]
176
153
  },
177
- "ErrorMessage": null,
178
- "IsOK": true
154
+ "IsOK": true,
155
+ "ErrorMessage": null
179
156
  }
180
157
  ```
181
158
 
182
159
  ---
183
160
 
184
- ### Submit Insurance
161
+ ## Upload and capture flow
185
162
 
186
- Public signature: `settingsClient.submitInsurance(payload)`
163
+ Image-related methods follow an upload-first flow. Profile image uses `updateUserImage(...)` after upload, while driver license and insurance use capture methods after upload.
187
164
 
188
- Submits patient insurance coverage details.
189
- The client forwards the provided payload into the backend `Data` wrapper.
165
+ 1. Request upload information by calling the matching canned URL method.
166
+ 2. Upload the file bytes to the returned upload URL outside this package.
167
+ 3. Include any signed headers required by the upload URL, such as `x-amz-acl: public-read` when provided.
168
+ 4. Submit the returned file name or file key through the matching capture or update method.
190
169
 
191
- ```ts
192
- await settingsClient.submitInsurance({
193
- InsurancePackageId: "693245",
194
- MemberId: "member-id-example",
195
- FirstName: "John",
196
- LastName: "Doe",
197
- Sex: "",
198
- Image: "insurancecard_example.jpeg"
199
- });
200
- ```
201
-
202
- #### Full API request
170
+ The connector does not upload file bytes. It requests upload information and then submits the uploaded file reference after the upload is complete.
203
171
 
204
- ```json
205
- {
206
- "Data": {
207
- "InsurancePackageId": "693245",
208
- "MemberId": "member-id-example",
209
- "FirstName": "John",
210
- "LastName": "Doe",
211
- "Sex": "",
212
- "Image": "insurancecard_example.jpeg"
213
- }
214
- }
215
- ```
172
+ ---
216
173
 
217
- #### API response
174
+ ## Profile image methods
218
175
 
219
- Status:
176
+ Profile image methods follow this flow:
220
177
 
221
- ```txt
222
- 200
223
- ```
224
-
225
- ```json
226
- {
227
- "Data": {
228
- "InsuranceId": "insurance-id-example",
229
- "InsurancePackageId": 693245,
230
- "InsurancePolicyHolder": "John Doe",
231
- "InsuranceType": "Insurance",
232
- "IssueDate": "01/01/2030",
233
- "MemberId": "member-id-example",
234
- "Image": "insurancecard_example.jpeg"
235
- },
236
- "ErrorMessage": null,
237
- "IsOK": true
238
- }
239
- ```
240
-
241
- ---
178
+ 1. Call `getUserImageCannedUrl(extension)` to request upload information.
179
+ 2. Upload the image file to the returned `ImageURL` outside this package.
180
+ 3. Include any signed headers required by the upload URL, such as `x-amz-acl: public-read` when provided.
181
+ 4. Call `updateUserImage(fileName)` using the returned `FileName`.
242
182
 
243
183
  ### Get User Image Canned URL
244
184
 
245
185
  Public signature: `settingsClient.getUserImageCannedUrl(extension)`
246
186
 
247
- Generates a canned upload URL for a user selfie file.
248
- The connector returns the raw backend response object for the generated file.
249
- The package does not upload the file bytes for you.
250
- When you upload to the returned S3 URL, you must preserve any signed headers that the URL expects.
251
- In live verification, uploads succeeded only when the S3 request included `x-amz-acl: public-read`.
187
+ Generates upload information for a user profile image.
188
+
189
+ Use the returned `ImageURL` to upload the image file outside this package. After upload, pass the returned `FileName` to `updateUserImage(...)`.
252
190
 
253
191
  ```ts
254
192
  const selfieUpload = await settingsClient.getUserImageCannedUrl("jpeg");
@@ -274,25 +212,28 @@ Status:
274
212
 
275
213
  ```json
276
214
  {
277
- "ImageURL": "https://storage.example.com/selfie_example.jpeg?signature=example",
278
- "FileName": "selfie_example.jpeg",
279
- "Extension": "jpeg"
215
+ "Data": {
216
+ "ImageURL": "https://storage.example.com/selfie_example.jpeg?signature=example",
217
+ "FileName": "selfie_example.jpeg",
218
+ "Extension": "jpeg"
219
+ },
220
+ "ErrorMessage": null,
221
+ "IsOK": true
280
222
  }
281
223
  ```
282
224
 
283
225
  ---
284
226
 
285
- ### Capture User Photo
227
+ ### Update User Image URL
228
+
229
+ Public signature: `settingsClient.updateUserImage(fileName)`
286
230
 
287
- Public signature: `settingsClient.captureUserPhoto(fileKey)`
231
+ Updates the stored user image reference using the `FileName` returned by `getUserImageCannedUrl(...)`.
288
232
 
289
- Convenience wrapper around the patient capture endpoint.
290
- The client sends `Type: "userphoto"` and the uploaded file key inside the backend `Data` wrapper.
291
- This method expects the file to have already been uploaded to the canned URL returned by `getUserImageCannedUrl(...)`.
292
- If the canned URL requires signed S3 headers, the upload must include them before capture can succeed.
233
+ Call this method after uploading the image file to the returned `ImageURL`.
293
234
 
294
235
  ```ts
295
- const capturedSelfie = await settingsClient.captureUserPhoto(
236
+ const updated = await settingsClient.updateUserImage(
296
237
  "selfie_example.jpeg"
297
238
  );
298
239
  ```
@@ -302,27 +243,34 @@ const capturedSelfie = await settingsClient.captureUserPhoto(
302
243
  ```json
303
244
  {
304
245
  "Data": {
305
- "Type": "userphoto",
306
- "FileID": "selfie_example.jpeg"
246
+ "FileName": "selfie_example.jpeg"
307
247
  }
308
248
  }
309
249
  ```
310
250
 
311
251
  #### API response
312
252
 
313
- Direct success response for a selfie image was not verified in the latest live run.
314
- The same upload prerequisite applies here as for the ID and insurance flows: the file must exist at the canned URL upload target, and any signed S3 headers such as `x-amz-acl: public-read` must be preserved during upload.
253
+ Status:
254
+
255
+ ```txt
256
+ 200
257
+ ```
258
+
259
+ ```json
260
+ true
261
+ ```
315
262
 
316
263
  ---
317
264
 
265
+ ## ID document methods
266
+
318
267
  ### Get Driving License Canned URL
319
268
 
320
269
  Public signature: `settingsClient.getDrivingLicenseCannedUrl(extension)`
321
270
 
322
- Generates a canned upload URL for a driving license or identification file.
323
- The package does not upload the file bytes for you.
324
- When you upload to the returned S3 URL, you must preserve any signed headers that the URL expects.
325
- In live verification, uploads succeeded only when the S3 request included `x-amz-acl: public-read`.
271
+ Generates upload information for an ID document image.
272
+
273
+ Use the returned upload information to upload the image file outside this package. If the upload URL requires signed headers, include them in the upload request.
326
274
 
327
275
  ```ts
328
276
  const idUpload = await settingsClient.getDrivingLicenseCannedUrl("jpeg");
@@ -348,9 +296,13 @@ Status:
348
296
 
349
297
  ```json
350
298
  {
351
- "ImageURL": "https://storage.example.com/idcard_example.jpeg?signature=example",
352
- "FileName": "idcard_example.jpeg",
353
- "Extension": "jpeg"
299
+ "Data": {
300
+ "ImageURL": "https://storage.example.com/idcard_example.jpeg?signature=example",
301
+ "FileName": "idcard_example.jpeg",
302
+ "Extension": "jpeg"
303
+ },
304
+ "ErrorMessage": null,
305
+ "IsOK": true
354
306
  }
355
307
  ```
356
308
 
@@ -360,9 +312,9 @@ Status:
360
312
 
361
313
  Public signature: `settingsClient.captureDrivingLicense(fileKey)`
362
314
 
363
- Convenience wrapper around the patient capture endpoint.
364
- The client sends `Type: "identification"` and the uploaded file key inside the backend `Data` wrapper.
365
- This method expects the file to have already been uploaded to the canned URL returned by `getDrivingLicenseCannedUrl(...)`.
315
+ Submits the uploaded ID document file key after the image has been uploaded.
316
+
317
+ This method should be called after uploading the file using the upload information returned by `getDrivingLicenseCannedUrl(...)`.
366
318
 
367
319
  ```ts
368
320
  const capturedLicense = await settingsClient.captureDrivingLicense(
@@ -414,15 +366,14 @@ Status:
414
366
 
415
367
  ---
416
368
 
417
- ### Update Driving License
369
+ ### Submit Driving License
418
370
 
419
- Public signature: `settingsClient.updateDrivingLicense(payload)`
371
+ Public signature: `settingsClient.submitDrivingLicense(payload)`
420
372
 
421
- Updates patient driving license data through the EHR-backed route.
422
- The client resolves the current `EHR` internally from `authClient.getUserInfo()` and sends the payload inside the backend `Data` wrapper.
373
+ Submits patient driving license data.
423
374
 
424
375
  ```ts
425
- const response = await settingsClient.updateDrivingLicense({
376
+ const response = await settingsClient.submitDrivingLicense({
426
377
  Image: "idcard_example.jpeg"
427
378
  });
428
379
  ```
@@ -453,23 +404,19 @@ Status:
453
404
  }
454
405
  ```
455
406
 
456
- `Data` was observed as the string `"true"` in the live test environment after a successful upload and capture flow.
457
-
458
- `submitDrivingLicense(payload)` is still available as a backward-compatible alias.
459
-
460
407
  ---
408
+ ## Insurance methods
461
409
 
462
- ### Submit Driving License
410
+ ### Get Insurance Canned URL
463
411
 
464
- Public signature: `settingsClient.submitDrivingLicense(payload)`
412
+ Public signature: `settingsClient.getInsuranceCannedUrl(extension)`
465
413
 
466
- Backward-compatible alias for `updateDrivingLicense(payload)`.
467
- It sends the same request payload and currently calls the same implementation internally.
414
+ Generates upload information for an insurance card image.
415
+
416
+ Use the returned upload information to upload the image file outside this package. If the upload URL requires signed headers, include them in the upload request.
468
417
 
469
418
  ```ts
470
- const response = await settingsClient.submitDrivingLicense({
471
- Image: "idcard_example.jpeg"
472
- });
419
+ const insuranceUpload = await settingsClient.getInsuranceCannedUrl("jpeg");
473
420
  ```
474
421
 
475
422
  #### Full API request
@@ -477,7 +424,7 @@ const response = await settingsClient.submitDrivingLicense({
477
424
  ```json
478
425
  {
479
426
  "Data": {
480
- "Image": "idcard_example.jpeg"
427
+ "Extension": "jpeg"
481
428
  }
482
429
  }
483
430
  ```
@@ -492,7 +439,11 @@ Status:
492
439
 
493
440
  ```json
494
441
  {
495
- "Data": "true",
442
+ "Data": {
443
+ "ImageURL": "https://storage.example.com/insurancecard_example.jpeg?signature=example",
444
+ "FileName": "insurancecard_example.jpeg",
445
+ "Extension": "jpeg"
446
+ },
496
447
  "ErrorMessage": null,
497
448
  "IsOK": true
498
449
  }
@@ -500,17 +451,18 @@ Status:
500
451
 
501
452
  ---
502
453
 
503
- ### Get Insurance Canned URL
454
+ ### Capture Insurance
504
455
 
505
- Public signature: `settingsClient.getInsuranceCannedUrl(extension)`
456
+ Public signature: `settingsClient.captureInsurance(fileKey)`
506
457
 
507
- Generates a canned upload URL for an insurance file.
508
- The package does not upload the file bytes for you.
509
- When you upload to the returned S3 URL, you must preserve any signed headers that the URL expects.
510
- In live verification, uploads succeeded only when the S3 request included `x-amz-acl: public-read`.
458
+ Submits the uploaded insurance file key after the image has been uploaded.
459
+
460
+ This method should be called after uploading the file using the upload information returned by `getInsuranceCannedUrl(...)`.
511
461
 
512
462
  ```ts
513
- const insuranceUpload = await settingsClient.getInsuranceCannedUrl("jpeg");
463
+ const capturedInsurance = await settingsClient.captureInsurance(
464
+ "insurancecard_example.jpeg"
465
+ );
514
466
  ```
515
467
 
516
468
  #### Full API request
@@ -518,7 +470,8 @@ const insuranceUpload = await settingsClient.getInsuranceCannedUrl("jpeg");
518
470
  ```json
519
471
  {
520
472
  "Data": {
521
- "Extension": "jpeg"
473
+ "Type": "healthinsurance",
474
+ "FileID": "insurancecard_example.jpeg"
522
475
  }
523
476
  }
524
477
  ```
@@ -533,26 +486,43 @@ Status:
533
486
 
534
487
  ```json
535
488
  {
536
- "ImageURL": "https://storage.example.com/insurancecard_example.jpeg?signature=example",
537
- "FileName": "insurancecard_example.jpeg",
538
- "Extension": "jpeg"
489
+ "Data": {
490
+ "CapturedData": {
491
+ "FirstName": "John",
492
+ "LastName": "Doe",
493
+ "MemberId": "member-id-example",
494
+ "GroupNumber": "group-number-example",
495
+ "EffectiveDate": "",
496
+ "RxBIN": "",
497
+ "RxPCN": "",
498
+ "RxGRP": "",
499
+ "Carrier": "Carrier Example"
500
+ },
501
+ "IsCaptured": true,
502
+ "InsurancePackages": null
503
+ },
504
+ "ErrorMessage": null,
505
+ "IsOK": true
539
506
  }
540
507
  ```
541
508
 
542
509
  ---
543
510
 
544
- ### Capture Insurance
511
+ ### Submit Insurance
545
512
 
546
- Public signature: `settingsClient.captureInsurance(fileKey)`
513
+ Public signature: `settingsClient.submitInsurance(payload)`
547
514
 
548
- Convenience wrapper around the patient capture endpoint.
549
- The client sends `Type: "healthinsurance"` and the uploaded file key inside the backend `Data` wrapper.
550
- This method expects the file to have already been uploaded to the canned URL returned by `getInsuranceCannedUrl(...)`.
515
+ Submits patient insurance coverage details.
551
516
 
552
517
  ```ts
553
- const capturedInsurance = await settingsClient.captureInsurance(
554
- "insurancecard_example.jpeg"
555
- );
518
+ await settingsClient.submitInsurance({
519
+ InsurancePackageId: "693245",
520
+ MemberId: "member-id-example",
521
+ FirstName: "John",
522
+ LastName: "Doe",
523
+ Sex: "",
524
+ Image: "insurancecard_example.jpeg"
525
+ });
556
526
  ```
557
527
 
558
528
  #### Full API request
@@ -560,8 +530,12 @@ const capturedInsurance = await settingsClient.captureInsurance(
560
530
  ```json
561
531
  {
562
532
  "Data": {
563
- "Type": "healthinsurance",
564
- "FileID": "insurancecard_example.jpeg"
533
+ "InsurancePackageId": "693245",
534
+ "MemberId": "member-id-example",
535
+ "FirstName": "John",
536
+ "LastName": "Doe",
537
+ "Sex": "",
538
+ "Image": "insurancecard_example.jpeg"
565
539
  }
566
540
  }
567
541
  ```
@@ -577,19 +551,13 @@ Status:
577
551
  ```json
578
552
  {
579
553
  "Data": {
580
- "CapturedData": {
581
- "FirstName": "John",
582
- "LastName": "Doe",
583
- "MemberId": "member-id-example",
584
- "GroupNumber": "group-number-example",
585
- "EffectiveDate": "",
586
- "RxBIN": "",
587
- "RxPCN": "",
588
- "RxGRP": "",
589
- "Carrier": "Carrier Example"
590
- },
591
- "IsCaptured": true,
592
- "InsurancePackages": null
554
+ "InsuranceId": "insurance-id-example",
555
+ "InsurancePackageId": 693245,
556
+ "InsurancePolicyHolder": "John Doe",
557
+ "InsuranceType": "Insurance",
558
+ "IssueDate": "01/01/2030",
559
+ "MemberId": "member-id-example",
560
+ "Image": "insurancecard_example.jpeg"
593
561
  },
594
562
  "ErrorMessage": null,
595
563
  "IsOK": true
@@ -602,8 +570,7 @@ Status:
602
570
 
603
571
  Public signature: `settingsClient.getInsurances()`
604
572
 
605
- Returns patient insurances through the EHR-backed route.
606
- The client resolves the current `EHR` internally from `authClient.getUserInfo()`.
573
+ Returns patient insurances.
607
574
 
608
575
  ```ts
609
576
  const insurances = await settingsClient.getInsurances();
@@ -645,41 +612,7 @@ Status:
645
612
 
646
613
  ---
647
614
 
648
- ### Update User Image URL
649
-
650
- Public signature: `settingsClient.updateUserImage(fileName)`
651
-
652
- Updates the stored user image file reference using a file name returned from `getUserImageCannedUrl(...)`.
653
-
654
- ```ts
655
- const updated = await settingsClient.updateUserImage(
656
- "selfie_example.jpeg"
657
- );
658
- ```
659
-
660
- #### Full API request
661
-
662
- ```json
663
- {
664
- "Data": {
665
- "FileName": "selfie_example.jpeg"
666
- }
667
- }
668
- ```
669
-
670
- #### API response
671
-
672
- Status:
673
-
674
- ```txt
675
- 200
676
- ```
677
-
678
- ```json
679
- true
680
- ```
681
-
682
- ---
615
+ ## Account methods
683
616
 
684
617
  ### Deactivate User
685
618
 
@@ -701,43 +634,36 @@ await settingsClient.deactivateUser();
701
634
 
702
635
  #### API response
703
636
 
704
- This method was not directly verified in the live environment because it would deactivate the authenticated test user.
705
- The client returns the raw backend response from the authenticated `PUT` request.
637
+ The client returns the backend response from the authenticated request.
638
+
639
+ ```json
640
+ {
641
+ "Data": true,
642
+ "ErrorMessage": null,
643
+ "IsOK": true
644
+ }
645
+ ```
706
646
 
707
647
  ---
708
648
 
709
649
  ## How It Works
710
650
 
711
651
  - `HCLoginClient` handles tenant configuration, authentication, and authenticated headers.
712
- - `HCSettingsClient` uses the authenticated login client to call patient settings and profile-related endpoints.
713
- - Canned URL methods return a backend-generated upload URL and file name, but the caller is responsible for uploading the file bytes and preserving any signed S3 headers required by that URL.
714
- - Capture, insurance, and EHR-backed settings methods all use the authenticated patient context from the shared login client.
715
- - `getInsurances()`, `updateDrivingLicense()`, and `submitDrivingLicense()` resolve the active patient's `EHR` internally before building the final route.
652
+ - `HCSettingsClient` uses the authenticated login client for the base API URL and authenticated request headers.
653
+ - If configured through `setApiKey(...)`, `HCSettingsClient` also includes its configured API key header with Settings connector requests.
654
+ - Profile image methods use `getUserImageCannedUrl(...)` to request upload information and `updateUserImage(...)` to store the uploaded image reference.
655
+ - Upload URL methods return generated upload information. The caller is responsible for uploading the actual file bytes outside this package.
656
+ - Driver license and insurance capture methods submit the uploaded file key after the file has already been uploaded.
716
657
 
717
658
  ---
718
659
 
719
660
  ## Notes
720
661
 
721
- - `HCLoginClient` must be configured and logged in before calling settings methods.
722
- - `getUserImageCannedUrl()`, `getDrivingLicenseCannedUrl()`, and `getInsuranceCannedUrl()` return the backend canned URL response and do not upload the file contents.
723
- - After requesting a canned URL, the file must be uploaded outside this package before capture methods can succeed.
724
- - Live verification showed that the S3 upload must preserve signed headers from the canned URL; when `x-amz-acl` was signed, uploads succeeded with `x-amz-acl: public-read`.
725
- - `captureUserPhoto()` sends `Type: "userphoto"` and `FileID` to the patient capture endpoint.
726
- - `captureDrivingLicense()` sends `Type: "identification"` and `FileID` to the patient capture endpoint.
727
- - `captureInsurance()` sends `Type: "healthinsurance"` and `FileID` to the patient capture endpoint.
728
- - `updateDrivingLicense()` and `submitDrivingLicense()` send `{ "Data": { "Image": "..." } }` to the resolved EHR patient route.
729
- - `submitDrivingLicense()` is a backward-compatible alias of `updateDrivingLicense()`.
730
- - `getInsurances()`, `updateDrivingLicense()`, and `submitDrivingLicense()` internally resolve the current patient's `EHR`.
731
-
732
-
733
- ## API Key
734
-
735
- Use `setApiKey(...)` to attach an API key header to requests from `HCSettingsClient`.
736
-
737
- ```ts
738
- const apiKey = process.env.HEALTHCLOUD_API_KEY;
739
- settingsClient.setApiKey("x-api-key", apiKey);
740
- ```
741
-
742
- - Header name should be `x-api-key`.
743
- - The API key is also included on the internal patient header lookup used to resolve the active `EHR`.
662
+ - `HCLoginClient` must be configured and logged in before calling Settings connector methods.
663
+ - Canned URL methods return the backend response containing upload information in `Data`.
664
+ - Profile image upload uses `getUserImageCannedUrl(...)` followed by `updateUserImage(...)`.
665
+ - After requesting upload information, the file must be uploaded outside this package before capture methods can succeed.
666
+ - When uploading to the returned storage URL, include any signed headers required by that URL, such as `x-amz-acl: public-read` when provided.
667
+ - `captureDrivingLicense()` sends the ID document file key using `Type: "identification"` and `FileID` inside the request body.
668
+ - `captureInsurance()` sends `Type: "healthinsurance"` and `FileID` inside the request body.
669
+ - `submitDrivingLicense()` submits the driving license data payload.
package/dist/index.cjs CHANGED
@@ -27,22 +27,44 @@ __export(index_exports, {
27
27
  });
28
28
  module.exports = __toCommonJS(index_exports);
29
29
 
30
+ // src/errors.ts
31
+ var ConfigError = class extends Error {
32
+ constructor(message) {
33
+ super(message);
34
+ this.name = "ConfigError";
35
+ }
36
+ };
37
+ var AuthError = class extends Error {
38
+ constructor(message) {
39
+ super(message);
40
+ this.name = "AuthError";
41
+ }
42
+ };
43
+ var HttpError = class extends Error {
44
+ constructor(status, message) {
45
+ super(message);
46
+ this.name = "HttpError";
47
+ this.status = status;
48
+ }
49
+ };
50
+
30
51
  // src/client.ts
31
52
  var HCSettingsClient = class {
32
53
  constructor(httpClient, authClient) {
33
- this.resolvedEhr = null;
34
54
  this.http = httpClient;
35
55
  this.auth = authClient;
36
56
  }
37
57
  setApiKey(headerName, value) {
38
- this.apiKeyHeaderName = headerName;
39
- this.apiKeyValue = value;
40
- }
41
- async getUserInfo() {
42
- return this.http.get(
43
- `${this.getBaseUrl()}/patient/header`,
44
- this.getAuthHeaders()
45
- );
58
+ const trimmedHeaderName = headerName == null ? void 0 : headerName.trim();
59
+ const trimmedValue = value == null ? void 0 : value.trim();
60
+ if (!trimmedHeaderName) {
61
+ throw new ConfigError("API key header name is required.");
62
+ }
63
+ if (!trimmedValue) {
64
+ throw new ConfigError("API key value is required.");
65
+ }
66
+ this.apiKeyHeaderName = trimmedHeaderName;
67
+ this.apiKeyValue = trimmedValue;
46
68
  }
47
69
  async getDashboard() {
48
70
  return this.http.get(
@@ -51,59 +73,40 @@ var HCSettingsClient = class {
51
73
  );
52
74
  }
53
75
  async getUserImageCannedUrl(extension) {
54
- var _a;
55
76
  const payload = {
56
77
  Data: {
57
78
  Extension: extension
58
79
  }
59
80
  };
60
- const response = await this.http.put(
81
+ return this.http.put(
61
82
  `${this.getBaseUrl()}/patient/image/cannedurl`,
62
83
  payload,
63
84
  this.getJsonHeaders()
64
85
  );
65
- return (_a = response.Data) != null ? _a : response;
66
86
  }
67
87
  async getDrivingLicenseCannedUrl(extension) {
68
- var _a;
69
88
  const payload = {
70
89
  Data: {
71
90
  Extension: extension
72
91
  }
73
92
  };
74
- const response = await this.http.put(
93
+ return this.http.put(
75
94
  `${this.getBaseUrl()}/patient/id/cannedurl`,
76
95
  payload,
77
96
  this.getJsonHeaders()
78
97
  );
79
- return (_a = response.Data) != null ? _a : response;
80
98
  }
81
99
  async getInsuranceCannedUrl(extension) {
82
- var _a;
83
100
  const payload = {
84
101
  Data: {
85
102
  Extension: extension
86
103
  }
87
104
  };
88
- const response = await this.http.put(
105
+ return this.http.put(
89
106
  `${this.getBaseUrl()}/patient/insurance/cannedurl`,
90
107
  payload,
91
108
  this.getJsonHeaders()
92
109
  );
93
- return (_a = response.Data) != null ? _a : response;
94
- }
95
- async captureUserPhoto(fileKey) {
96
- const payload = {
97
- Data: {
98
- Type: "userphoto",
99
- FileID: fileKey
100
- }
101
- };
102
- return this.http.post(
103
- `${this.getBaseUrl()}/patient/capture`,
104
- payload,
105
- this.getJsonHeaders()
106
- );
107
110
  }
108
111
  async captureDrivingLicense(fileKey) {
109
112
  const payload = {
@@ -143,36 +146,31 @@ var HCSettingsClient = class {
143
146
  }
144
147
  async getInsurances() {
145
148
  return this.http.get(
146
- await this.buildEhrPatientUrl("insurances"),
149
+ `${this.getBaseUrl()}/ehr/patient/insurances`,
147
150
  this.getAuthHeaders()
148
151
  );
149
152
  }
150
- async updateDrivingLicense(payload) {
153
+ async submitDrivingLicense(payload) {
151
154
  const requestPayload = {
152
155
  Data: payload
153
156
  };
154
157
  return this.http.put(
155
- await this.buildEhrPatientUrl("drivinglicense"),
158
+ `${this.getBaseUrl()}/ehr/patient/drivinglicense`,
156
159
  requestPayload,
157
160
  this.getJsonHeaders()
158
161
  );
159
162
  }
160
- async submitDrivingLicense(payload) {
161
- return this.updateDrivingLicense(payload);
162
- }
163
163
  async updateUserImage(fileName) {
164
- var _a;
165
164
  const payload = {
166
165
  Data: {
167
166
  FileName: fileName
168
167
  }
169
168
  };
170
- const response = await this.http.put(
169
+ return this.http.put(
171
170
  `${this.getBaseUrl()}/patient/image/url`,
172
171
  payload,
173
172
  this.getJsonHeaders()
174
173
  );
175
- return (_a = response.Data) != null ? _a : response;
176
174
  }
177
175
  async deactivateUser() {
178
176
  const payload = {
@@ -184,26 +182,6 @@ var HCSettingsClient = class {
184
182
  this.getJsonHeaders()
185
183
  );
186
184
  }
187
- async buildEhrPatientUrl(path) {
188
- const ehr = await this.getResolvedEhr();
189
- return `${this.getBaseUrl()}/ehr/${ehr}/patient/${path}`;
190
- }
191
- async getResolvedEhr() {
192
- var _a, _b, _c;
193
- if (this.resolvedEhr) {
194
- return this.resolvedEhr;
195
- }
196
- const userInfo = await this.http.get(
197
- `${this.getBaseUrl()}/patient/header`,
198
- this.getAuthHeaders()
199
- );
200
- const ehr = ((_b = (_a = userInfo == null ? void 0 : userInfo.Data) == null ? void 0 : _a.EHR) == null ? void 0 : _b.trim()) || ((_c = userInfo == null ? void 0 : userInfo.EHR) == null ? void 0 : _c.trim());
201
- if (!ehr) {
202
- throw new Error("Could not resolve EHR from patient header response.");
203
- }
204
- this.resolvedEhr = ehr;
205
- return ehr;
206
- }
207
185
  getBaseUrl() {
208
186
  return this.auth.getBaseUrl();
209
187
  }
@@ -224,31 +202,10 @@ var HCSettingsClient = class {
224
202
  return {};
225
203
  }
226
204
  return {
227
- "x-api-key": this.apiKeyValue
205
+ [this.apiKeyHeaderName]: this.apiKeyValue
228
206
  };
229
207
  }
230
208
  };
231
-
232
- // src/errors.ts
233
- var ConfigError = class extends Error {
234
- constructor(message) {
235
- super(message);
236
- this.name = "ConfigError";
237
- }
238
- };
239
- var AuthError = class extends Error {
240
- constructor(message) {
241
- super(message);
242
- this.name = "AuthError";
243
- }
244
- };
245
- var HttpError = class extends Error {
246
- constructor(status, message) {
247
- super(message);
248
- this.name = "HttpError";
249
- this.status = status;
250
- }
251
- };
252
209
  // Annotate the CommonJS export names for ESM import in node:
253
210
  0 && (module.exports = {
254
211
  AuthError,
package/dist/index.d.cts CHANGED
@@ -10,21 +10,6 @@ interface UserImage {
10
10
  fileName?: string;
11
11
  extension?: string;
12
12
  }
13
- interface UserInfo {
14
- ID?: string;
15
- Email?: string;
16
- TenantID?: string;
17
- HasInsurance?: boolean;
18
- HasIDCard?: boolean;
19
- HasSelfie?: boolean;
20
- Attributes?: Record<string, any>;
21
- }
22
- interface UserInfoResponse {
23
- Data?: {
24
- EHR?: string;
25
- };
26
- EHR?: string;
27
- }
28
13
  interface APIRequest<T> {
29
14
  Data: T;
30
15
  }
@@ -42,7 +27,7 @@ interface CoverageRequest {
42
27
  Image: string;
43
28
  }
44
29
  type CoveragePayload = APIRequest<CoverageRequest>;
45
- type CaptureType = "identification" | "healthinsurance" | "userphoto";
30
+ type CaptureType = "identification" | "healthinsurance";
46
31
  interface CaptureData {
47
32
  Type: CaptureType;
48
33
  FileID: string;
@@ -63,32 +48,25 @@ interface DrivingLicenseData {
63
48
  type DrivingLicenseRequest = APIRequest<DrivingLicenseData>;
64
49
  type DrivingLicenseResponse = APIResponse<string>;
65
50
  type HCUserImage = UserImage;
66
- type HCUserInfo = UserInfo;
67
51
 
68
52
  declare class HCSettingsClient {
69
53
  private http;
70
54
  private auth;
71
- private resolvedEhr;
72
55
  private apiKeyHeaderName?;
73
56
  private apiKeyValue?;
74
57
  constructor(httpClient: HttpClient, authClient: HCLoginClient);
75
58
  setApiKey(headerName: string, value: string): void;
76
- getUserInfo(): Promise<any>;
77
59
  getDashboard(): Promise<any>;
78
60
  getUserImageCannedUrl(extension: string): Promise<UserImage>;
79
61
  getDrivingLicenseCannedUrl(extension: string): Promise<UserImage>;
80
62
  getInsuranceCannedUrl(extension: string): Promise<UserImage>;
81
- captureUserPhoto(fileKey: string): Promise<any>;
82
63
  captureDrivingLicense(fileKey: string): Promise<any>;
83
64
  captureInsurance(fileKey: string): Promise<any>;
84
65
  submitInsurance(payload: CoverageRequest): Promise<any>;
85
66
  getInsurances(): Promise<any>;
86
- updateDrivingLicense(payload: DrivingLicenseData): Promise<DrivingLicenseResponse>;
87
67
  submitDrivingLicense(payload: DrivingLicenseData): Promise<DrivingLicenseResponse>;
88
68
  updateUserImage(fileName: string): Promise<any>;
89
69
  deactivateUser(): Promise<any>;
90
- private buildEhrPatientUrl;
91
- private getResolvedEhr;
92
70
  private getBaseUrl;
93
71
  private getAuthHeaders;
94
72
  private getJsonHeaders;
@@ -106,4 +84,4 @@ declare class HttpError extends Error {
106
84
  constructor(status: number, message: string);
107
85
  }
108
86
 
109
- export { type APIRequest, type APIResponse, AuthError, type CaptureData, type CaptureRequest, type CaptureType, ConfigError, type CoveragePayload, type CoverageRequest, type DrivingLicenseData, type DrivingLicenseRequest, type DrivingLicenseResponse, type EmptyRequest, type Environment, HCSettingsClient, type HCUserImage, type HCUserInfo, HttpError, type UpdateImageData, type UpdateImageRequest, type UploadImageData, type UploadImageRequest, type UserImage, type UserInfo, type UserInfoResponse };
87
+ export { type APIRequest, type APIResponse, AuthError, type CaptureData, type CaptureRequest, type CaptureType, ConfigError, type CoveragePayload, type CoverageRequest, type DrivingLicenseData, type DrivingLicenseRequest, type DrivingLicenseResponse, type EmptyRequest, type Environment, HCSettingsClient, type HCUserImage, HttpError, type UpdateImageData, type UpdateImageRequest, type UploadImageData, type UploadImageRequest, type UserImage };
package/dist/index.d.ts CHANGED
@@ -10,21 +10,6 @@ interface UserImage {
10
10
  fileName?: string;
11
11
  extension?: string;
12
12
  }
13
- interface UserInfo {
14
- ID?: string;
15
- Email?: string;
16
- TenantID?: string;
17
- HasInsurance?: boolean;
18
- HasIDCard?: boolean;
19
- HasSelfie?: boolean;
20
- Attributes?: Record<string, any>;
21
- }
22
- interface UserInfoResponse {
23
- Data?: {
24
- EHR?: string;
25
- };
26
- EHR?: string;
27
- }
28
13
  interface APIRequest<T> {
29
14
  Data: T;
30
15
  }
@@ -42,7 +27,7 @@ interface CoverageRequest {
42
27
  Image: string;
43
28
  }
44
29
  type CoveragePayload = APIRequest<CoverageRequest>;
45
- type CaptureType = "identification" | "healthinsurance" | "userphoto";
30
+ type CaptureType = "identification" | "healthinsurance";
46
31
  interface CaptureData {
47
32
  Type: CaptureType;
48
33
  FileID: string;
@@ -63,32 +48,25 @@ interface DrivingLicenseData {
63
48
  type DrivingLicenseRequest = APIRequest<DrivingLicenseData>;
64
49
  type DrivingLicenseResponse = APIResponse<string>;
65
50
  type HCUserImage = UserImage;
66
- type HCUserInfo = UserInfo;
67
51
 
68
52
  declare class HCSettingsClient {
69
53
  private http;
70
54
  private auth;
71
- private resolvedEhr;
72
55
  private apiKeyHeaderName?;
73
56
  private apiKeyValue?;
74
57
  constructor(httpClient: HttpClient, authClient: HCLoginClient);
75
58
  setApiKey(headerName: string, value: string): void;
76
- getUserInfo(): Promise<any>;
77
59
  getDashboard(): Promise<any>;
78
60
  getUserImageCannedUrl(extension: string): Promise<UserImage>;
79
61
  getDrivingLicenseCannedUrl(extension: string): Promise<UserImage>;
80
62
  getInsuranceCannedUrl(extension: string): Promise<UserImage>;
81
- captureUserPhoto(fileKey: string): Promise<any>;
82
63
  captureDrivingLicense(fileKey: string): Promise<any>;
83
64
  captureInsurance(fileKey: string): Promise<any>;
84
65
  submitInsurance(payload: CoverageRequest): Promise<any>;
85
66
  getInsurances(): Promise<any>;
86
- updateDrivingLicense(payload: DrivingLicenseData): Promise<DrivingLicenseResponse>;
87
67
  submitDrivingLicense(payload: DrivingLicenseData): Promise<DrivingLicenseResponse>;
88
68
  updateUserImage(fileName: string): Promise<any>;
89
69
  deactivateUser(): Promise<any>;
90
- private buildEhrPatientUrl;
91
- private getResolvedEhr;
92
70
  private getBaseUrl;
93
71
  private getAuthHeaders;
94
72
  private getJsonHeaders;
@@ -106,4 +84,4 @@ declare class HttpError extends Error {
106
84
  constructor(status: number, message: string);
107
85
  }
108
86
 
109
- export { type APIRequest, type APIResponse, AuthError, type CaptureData, type CaptureRequest, type CaptureType, ConfigError, type CoveragePayload, type CoverageRequest, type DrivingLicenseData, type DrivingLicenseRequest, type DrivingLicenseResponse, type EmptyRequest, type Environment, HCSettingsClient, type HCUserImage, type HCUserInfo, HttpError, type UpdateImageData, type UpdateImageRequest, type UploadImageData, type UploadImageRequest, type UserImage, type UserInfo, type UserInfoResponse };
87
+ export { type APIRequest, type APIResponse, AuthError, type CaptureData, type CaptureRequest, type CaptureType, ConfigError, type CoveragePayload, type CoverageRequest, type DrivingLicenseData, type DrivingLicenseRequest, type DrivingLicenseResponse, type EmptyRequest, type Environment, HCSettingsClient, type HCUserImage, HttpError, type UpdateImageData, type UpdateImageRequest, type UploadImageData, type UploadImageRequest, type UserImage };
package/dist/index.js CHANGED
@@ -1,19 +1,41 @@
1
+ // src/errors.ts
2
+ var ConfigError = class extends Error {
3
+ constructor(message) {
4
+ super(message);
5
+ this.name = "ConfigError";
6
+ }
7
+ };
8
+ var AuthError = class extends Error {
9
+ constructor(message) {
10
+ super(message);
11
+ this.name = "AuthError";
12
+ }
13
+ };
14
+ var HttpError = class extends Error {
15
+ constructor(status, message) {
16
+ super(message);
17
+ this.name = "HttpError";
18
+ this.status = status;
19
+ }
20
+ };
21
+
1
22
  // src/client.ts
2
23
  var HCSettingsClient = class {
3
24
  constructor(httpClient, authClient) {
4
- this.resolvedEhr = null;
5
25
  this.http = httpClient;
6
26
  this.auth = authClient;
7
27
  }
8
28
  setApiKey(headerName, value) {
9
- this.apiKeyHeaderName = headerName;
10
- this.apiKeyValue = value;
11
- }
12
- async getUserInfo() {
13
- return this.http.get(
14
- `${this.getBaseUrl()}/patient/header`,
15
- this.getAuthHeaders()
16
- );
29
+ const trimmedHeaderName = headerName == null ? void 0 : headerName.trim();
30
+ const trimmedValue = value == null ? void 0 : value.trim();
31
+ if (!trimmedHeaderName) {
32
+ throw new ConfigError("API key header name is required.");
33
+ }
34
+ if (!trimmedValue) {
35
+ throw new ConfigError("API key value is required.");
36
+ }
37
+ this.apiKeyHeaderName = trimmedHeaderName;
38
+ this.apiKeyValue = trimmedValue;
17
39
  }
18
40
  async getDashboard() {
19
41
  return this.http.get(
@@ -22,59 +44,40 @@ var HCSettingsClient = class {
22
44
  );
23
45
  }
24
46
  async getUserImageCannedUrl(extension) {
25
- var _a;
26
47
  const payload = {
27
48
  Data: {
28
49
  Extension: extension
29
50
  }
30
51
  };
31
- const response = await this.http.put(
52
+ return this.http.put(
32
53
  `${this.getBaseUrl()}/patient/image/cannedurl`,
33
54
  payload,
34
55
  this.getJsonHeaders()
35
56
  );
36
- return (_a = response.Data) != null ? _a : response;
37
57
  }
38
58
  async getDrivingLicenseCannedUrl(extension) {
39
- var _a;
40
59
  const payload = {
41
60
  Data: {
42
61
  Extension: extension
43
62
  }
44
63
  };
45
- const response = await this.http.put(
64
+ return this.http.put(
46
65
  `${this.getBaseUrl()}/patient/id/cannedurl`,
47
66
  payload,
48
67
  this.getJsonHeaders()
49
68
  );
50
- return (_a = response.Data) != null ? _a : response;
51
69
  }
52
70
  async getInsuranceCannedUrl(extension) {
53
- var _a;
54
71
  const payload = {
55
72
  Data: {
56
73
  Extension: extension
57
74
  }
58
75
  };
59
- const response = await this.http.put(
76
+ return this.http.put(
60
77
  `${this.getBaseUrl()}/patient/insurance/cannedurl`,
61
78
  payload,
62
79
  this.getJsonHeaders()
63
80
  );
64
- return (_a = response.Data) != null ? _a : response;
65
- }
66
- async captureUserPhoto(fileKey) {
67
- const payload = {
68
- Data: {
69
- Type: "userphoto",
70
- FileID: fileKey
71
- }
72
- };
73
- return this.http.post(
74
- `${this.getBaseUrl()}/patient/capture`,
75
- payload,
76
- this.getJsonHeaders()
77
- );
78
81
  }
79
82
  async captureDrivingLicense(fileKey) {
80
83
  const payload = {
@@ -114,36 +117,31 @@ var HCSettingsClient = class {
114
117
  }
115
118
  async getInsurances() {
116
119
  return this.http.get(
117
- await this.buildEhrPatientUrl("insurances"),
120
+ `${this.getBaseUrl()}/ehr/patient/insurances`,
118
121
  this.getAuthHeaders()
119
122
  );
120
123
  }
121
- async updateDrivingLicense(payload) {
124
+ async submitDrivingLicense(payload) {
122
125
  const requestPayload = {
123
126
  Data: payload
124
127
  };
125
128
  return this.http.put(
126
- await this.buildEhrPatientUrl("drivinglicense"),
129
+ `${this.getBaseUrl()}/ehr/patient/drivinglicense`,
127
130
  requestPayload,
128
131
  this.getJsonHeaders()
129
132
  );
130
133
  }
131
- async submitDrivingLicense(payload) {
132
- return this.updateDrivingLicense(payload);
133
- }
134
134
  async updateUserImage(fileName) {
135
- var _a;
136
135
  const payload = {
137
136
  Data: {
138
137
  FileName: fileName
139
138
  }
140
139
  };
141
- const response = await this.http.put(
140
+ return this.http.put(
142
141
  `${this.getBaseUrl()}/patient/image/url`,
143
142
  payload,
144
143
  this.getJsonHeaders()
145
144
  );
146
- return (_a = response.Data) != null ? _a : response;
147
145
  }
148
146
  async deactivateUser() {
149
147
  const payload = {
@@ -155,26 +153,6 @@ var HCSettingsClient = class {
155
153
  this.getJsonHeaders()
156
154
  );
157
155
  }
158
- async buildEhrPatientUrl(path) {
159
- const ehr = await this.getResolvedEhr();
160
- return `${this.getBaseUrl()}/ehr/${ehr}/patient/${path}`;
161
- }
162
- async getResolvedEhr() {
163
- var _a, _b, _c;
164
- if (this.resolvedEhr) {
165
- return this.resolvedEhr;
166
- }
167
- const userInfo = await this.http.get(
168
- `${this.getBaseUrl()}/patient/header`,
169
- this.getAuthHeaders()
170
- );
171
- const ehr = ((_b = (_a = userInfo == null ? void 0 : userInfo.Data) == null ? void 0 : _a.EHR) == null ? void 0 : _b.trim()) || ((_c = userInfo == null ? void 0 : userInfo.EHR) == null ? void 0 : _c.trim());
172
- if (!ehr) {
173
- throw new Error("Could not resolve EHR from patient header response.");
174
- }
175
- this.resolvedEhr = ehr;
176
- return ehr;
177
- }
178
156
  getBaseUrl() {
179
157
  return this.auth.getBaseUrl();
180
158
  }
@@ -195,31 +173,10 @@ var HCSettingsClient = class {
195
173
  return {};
196
174
  }
197
175
  return {
198
- "x-api-key": this.apiKeyValue
176
+ [this.apiKeyHeaderName]: this.apiKeyValue
199
177
  };
200
178
  }
201
179
  };
202
-
203
- // src/errors.ts
204
- var ConfigError = class extends Error {
205
- constructor(message) {
206
- super(message);
207
- this.name = "ConfigError";
208
- }
209
- };
210
- var AuthError = class extends Error {
211
- constructor(message) {
212
- super(message);
213
- this.name = "AuthError";
214
- }
215
- };
216
- var HttpError = class extends Error {
217
- constructor(status, message) {
218
- super(message);
219
- this.name = "HttpError";
220
- this.status = status;
221
- }
222
- };
223
180
  export {
224
181
  AuthError,
225
182
  ConfigError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@healthcloudai/hc-settings-connector",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "Healthcheck Settings SDK with TypeScript",
5
5
  "author": "Healthcheck Systems Inc",
6
6
  "license": "MIT",