@healthcloudai/hc-sdk 0.8.3 → 0.8.7
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 +32 -2
- package/dist/index.cjs +93 -81
- package/dist/index.d.cts +199 -65
- package/dist/index.d.ts +199 -65
- package/dist/index.js +93 -81
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -125,7 +125,7 @@ sdk.ehr // connect + low-level request escape hatch
|
|
|
125
125
|
sdk.appointments // connect + low-level request escape hatch
|
|
126
126
|
sdk.rppg // connect + low-level request escape hatch
|
|
127
127
|
sdk.session // connect + low-level request escape hatch
|
|
128
|
-
sdk.telehealth // connect
|
|
128
|
+
sdk.telehealth // connect, createChannel, createPatientToken, createProviderToken, fetchRtcToken
|
|
129
129
|
sdk.fieldAgent // connect, register/login/resetPassword/verifyEmail/verifySms,
|
|
130
130
|
// getAgent/updateAgent, getDashboard, photo, listPatients, listEncounters
|
|
131
131
|
sdk.mcp // connect + JSON-RPC proxy (patient/fieldAgent tool calls)
|
|
@@ -143,6 +143,35 @@ instances.
|
|
|
143
143
|
|
|
144
144
|
All groups share one HTTP client, one token store, one error handler, the same URL resolver, query serialiser, and path-param interpolator.
|
|
145
145
|
|
|
146
|
+
### Telehealth helpers
|
|
147
|
+
|
|
148
|
+
The telehealth client exposes the backend's channel and RTC-token routes:
|
|
149
|
+
|
|
150
|
+
```ts
|
|
151
|
+
const sdk = new HCSDK({
|
|
152
|
+
environment: "dev",
|
|
153
|
+
accessToken: "patient-or-provider-token",
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
const channel = await sdk.telehealth.createChannel();
|
|
157
|
+
|
|
158
|
+
const patientToken = await sdk.telehealth.createPatientToken({
|
|
159
|
+
channel_id: channel.channel_id,
|
|
160
|
+
uid: 101,
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
const providerToken = await sdk.telehealth.createProviderToken({
|
|
164
|
+
channel_id: channel.channel_id,
|
|
165
|
+
uid: 202,
|
|
166
|
+
});
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Authentication notes:
|
|
170
|
+
- `createPatientToken()` requires a patient-scoped bearer token and is intended for patient-side video sessions.
|
|
171
|
+
- `createProviderToken()` requires a provider-scoped bearer token and is intended for clinician-side video sessions.
|
|
172
|
+
- `createChannel()` and `fetchRtcToken()` do not require the same role-specific token semantics as the minting methods, but they still use the shared SDK auth flow.
|
|
173
|
+
- If you are using a legacy integration, `fetchRtcToken()` accepts the older `{ channel_name, uid, role }` payload and returns the compatibility response.
|
|
174
|
+
|
|
146
175
|
---
|
|
147
176
|
|
|
148
177
|
## Connectors (`sdk.connectors`)
|
|
@@ -1217,7 +1246,8 @@ const agent = await sdk.fieldAgent.getAgent(cognitoSub);
|
|
|
1217
1246
|
"tenant_id": "cdcprotect", "email": "agent@example.com",
|
|
1218
1247
|
"first_name": "Field", "last_name": "Agent", "title": null, "phone": null,
|
|
1219
1248
|
"badge_number": "FA-001", "license_number": null, "department": "QA",
|
|
1220
|
-
"organization": null,
|
|
1249
|
+
"organization": null,
|
|
1250
|
+
"addresses": [],
|
|
1221
1251
|
"status": "active"
|
|
1222
1252
|
}
|
|
1223
1253
|
```
|
package/dist/index.cjs
CHANGED
|
@@ -484,7 +484,7 @@ var FieldAgentClient = class extends BaseServiceClient {
|
|
|
484
484
|
}
|
|
485
485
|
register(request) {
|
|
486
486
|
return this.send("POST", "/auth/register", {
|
|
487
|
-
body: withTenantId(request, this.getTenantId()),
|
|
487
|
+
body: withTenantId({ ...request, person_type: "field_agent" }, this.getTenantId()),
|
|
488
488
|
auth: false
|
|
489
489
|
});
|
|
490
490
|
}
|
|
@@ -526,37 +526,37 @@ var FieldAgentClient = class extends BaseServiceClient {
|
|
|
526
526
|
auth: false
|
|
527
527
|
});
|
|
528
528
|
}
|
|
529
|
-
getAgent(
|
|
530
|
-
return this.send("GET", "/agents/{
|
|
531
|
-
pathParams: {
|
|
529
|
+
getAgent(fhirPersonId) {
|
|
530
|
+
return this.send("GET", "/agents/{fhir_person_id}", {
|
|
531
|
+
pathParams: { fhir_person_id: fhirPersonId }
|
|
532
532
|
});
|
|
533
533
|
}
|
|
534
|
-
updateAgent(
|
|
535
|
-
return this.send("PATCH", "/agents/{
|
|
536
|
-
pathParams: {
|
|
534
|
+
updateAgent(fhirPersonId, request) {
|
|
535
|
+
return this.send("PATCH", "/agents/{fhir_person_id}", {
|
|
536
|
+
pathParams: { fhir_person_id: fhirPersonId },
|
|
537
537
|
body: request
|
|
538
538
|
});
|
|
539
539
|
}
|
|
540
|
-
getDashboard(
|
|
541
|
-
return this.send("GET", "/agents/{
|
|
542
|
-
pathParams: {
|
|
540
|
+
getDashboard(fhirPersonId, query) {
|
|
541
|
+
return this.send("GET", "/agents/{fhir_person_id}/dashboard", {
|
|
542
|
+
pathParams: { fhir_person_id: fhirPersonId },
|
|
543
543
|
query
|
|
544
544
|
});
|
|
545
545
|
}
|
|
546
|
-
getPhotoUploadUrl(
|
|
547
|
-
return this.send("GET", "/agents/{
|
|
548
|
-
pathParams: {
|
|
546
|
+
getPhotoUploadUrl(fhirPersonId) {
|
|
547
|
+
return this.send("GET", "/agents/{fhir_person_id}/photo/upload-url", {
|
|
548
|
+
pathParams: { fhir_person_id: fhirPersonId }
|
|
549
549
|
});
|
|
550
550
|
}
|
|
551
|
-
uploadPhoto(
|
|
552
|
-
return this.send("POST", "/agents/{
|
|
553
|
-
pathParams: {
|
|
551
|
+
uploadPhoto(fhirPersonId, request) {
|
|
552
|
+
return this.send("POST", "/agents/{fhir_person_id}/photo", {
|
|
553
|
+
pathParams: { fhir_person_id: fhirPersonId },
|
|
554
554
|
body: request
|
|
555
555
|
});
|
|
556
556
|
}
|
|
557
|
-
getPhoto(
|
|
558
|
-
return this.send("GET", "/agents/{
|
|
559
|
-
pathParams: {
|
|
557
|
+
getPhoto(fhirPersonId, query) {
|
|
558
|
+
return this.send("GET", "/agents/{fhir_person_id}/photo", {
|
|
559
|
+
pathParams: { fhir_person_id: fhirPersonId },
|
|
560
560
|
query
|
|
561
561
|
});
|
|
562
562
|
}
|
|
@@ -594,101 +594,101 @@ var PatientClient = class extends BaseServiceClient {
|
|
|
594
594
|
connect() {
|
|
595
595
|
return this.connectService();
|
|
596
596
|
}
|
|
597
|
-
updatePhone(
|
|
597
|
+
updatePhone(fhirPatientId, request) {
|
|
598
598
|
return this.send("POST", "/patients/{id}/phone", {
|
|
599
|
-
pathParams: { id:
|
|
599
|
+
pathParams: { id: fhirPatientId },
|
|
600
600
|
body: request
|
|
601
601
|
});
|
|
602
602
|
}
|
|
603
|
-
verifySms(
|
|
603
|
+
verifySms(fhirPatientId, request) {
|
|
604
604
|
return this.send("POST", "/patients/{id}/verify-sms", {
|
|
605
|
-
pathParams: { id:
|
|
605
|
+
pathParams: { id: fhirPatientId },
|
|
606
606
|
body: request
|
|
607
607
|
});
|
|
608
608
|
}
|
|
609
|
-
updateAddress(
|
|
609
|
+
updateAddress(fhirPatientId, request) {
|
|
610
610
|
return this.send("PUT", "/patients/{id}/address", {
|
|
611
|
-
pathParams: { id:
|
|
611
|
+
pathParams: { id: fhirPatientId },
|
|
612
612
|
body: request
|
|
613
613
|
});
|
|
614
614
|
}
|
|
615
|
-
updateRace(
|
|
615
|
+
updateRace(fhirPatientId, request) {
|
|
616
616
|
return this.send("PUT", "/patients/{id}/race", {
|
|
617
|
-
pathParams: { id:
|
|
617
|
+
pathParams: { id: fhirPatientId },
|
|
618
618
|
body: request
|
|
619
619
|
});
|
|
620
620
|
}
|
|
621
|
-
getProfile(
|
|
621
|
+
getProfile(fhirPatientId) {
|
|
622
622
|
return this.send("GET", "/patients/{id}", {
|
|
623
|
-
pathParams: { id:
|
|
623
|
+
pathParams: { id: fhirPatientId }
|
|
624
624
|
});
|
|
625
625
|
}
|
|
626
|
-
getDashboard(
|
|
626
|
+
getDashboard(fhirPatientId) {
|
|
627
627
|
return this.send("GET", "/patients/{id}/dashboard", {
|
|
628
|
-
pathParams: { id:
|
|
628
|
+
pathParams: { id: fhirPatientId }
|
|
629
629
|
});
|
|
630
630
|
}
|
|
631
|
-
uploadPhoto(
|
|
631
|
+
uploadPhoto(fhirPatientId, request) {
|
|
632
632
|
return this.send("POST", "/patients/{id}/photo", {
|
|
633
|
-
pathParams: { id:
|
|
633
|
+
pathParams: { id: fhirPatientId },
|
|
634
634
|
body: request
|
|
635
635
|
});
|
|
636
636
|
}
|
|
637
|
-
getPhoto(
|
|
637
|
+
getPhoto(fhirPatientId, query) {
|
|
638
638
|
return this.send("GET", "/patients/{id}/photo", {
|
|
639
|
-
pathParams: { id:
|
|
639
|
+
pathParams: { id: fhirPatientId },
|
|
640
640
|
query
|
|
641
641
|
});
|
|
642
642
|
}
|
|
643
|
-
getPhotoUploadUrl(
|
|
643
|
+
getPhotoUploadUrl(fhirPatientId) {
|
|
644
644
|
return this.send("GET", "/patients/{id}/photo/upload-url", {
|
|
645
|
-
pathParams: { id:
|
|
645
|
+
pathParams: { id: fhirPatientId }
|
|
646
646
|
});
|
|
647
647
|
}
|
|
648
|
-
compareFaceMatch(
|
|
648
|
+
compareFaceMatch(fhirPatientId, request) {
|
|
649
649
|
return this.send("POST", "/patients/{id}/face-match", {
|
|
650
|
-
pathParams: { id:
|
|
650
|
+
pathParams: { id: fhirPatientId },
|
|
651
651
|
body: request
|
|
652
652
|
});
|
|
653
653
|
}
|
|
654
|
-
scanIdentityDocument(
|
|
654
|
+
scanIdentityDocument(fhirPatientId, request) {
|
|
655
655
|
return this.send("POST", "/patients/{id}/identity-document", {
|
|
656
|
-
pathParams: { id:
|
|
656
|
+
pathParams: { id: fhirPatientId },
|
|
657
657
|
body: request
|
|
658
658
|
});
|
|
659
659
|
}
|
|
660
|
-
updateDemographics(
|
|
660
|
+
updateDemographics(fhirPatientId, request) {
|
|
661
661
|
return this.send("PUT", "/patients/{id}/demographics", {
|
|
662
|
-
pathParams: { id:
|
|
662
|
+
pathParams: { id: fhirPatientId },
|
|
663
663
|
body: request
|
|
664
664
|
});
|
|
665
665
|
}
|
|
666
|
-
createInsurance(
|
|
666
|
+
createInsurance(fhirPatientId, request) {
|
|
667
667
|
return this.send("POST", "/patients/{id}/insurance", {
|
|
668
|
-
pathParams: { id:
|
|
668
|
+
pathParams: { id: fhirPatientId },
|
|
669
669
|
body: request
|
|
670
670
|
});
|
|
671
671
|
}
|
|
672
|
-
createMedication(
|
|
672
|
+
createMedication(fhirPatientId, request) {
|
|
673
673
|
return this.send("POST", "/patients/{id}/medications", {
|
|
674
|
-
pathParams: { id:
|
|
674
|
+
pathParams: { id: fhirPatientId },
|
|
675
675
|
body: request
|
|
676
676
|
});
|
|
677
677
|
}
|
|
678
|
-
listMedications(
|
|
678
|
+
listMedications(fhirPatientId, query) {
|
|
679
679
|
return this.send("GET", "/patients/{id}/medications", {
|
|
680
|
-
pathParams: { id:
|
|
680
|
+
pathParams: { id: fhirPatientId },
|
|
681
681
|
query
|
|
682
682
|
});
|
|
683
683
|
}
|
|
684
|
-
getMedication(
|
|
684
|
+
getMedication(fhirPatientId, medicationId) {
|
|
685
685
|
return this.send("GET", "/patients/{id}/medications/{med_id}", {
|
|
686
|
-
pathParams: { id:
|
|
686
|
+
pathParams: { id: fhirPatientId, med_id: medicationId }
|
|
687
687
|
});
|
|
688
688
|
}
|
|
689
|
-
updateMedicationStatus(
|
|
689
|
+
updateMedicationStatus(fhirPatientId, medicationId, request) {
|
|
690
690
|
return this.send("PUT", "/patients/{id}/medications/{med_id}", {
|
|
691
|
-
pathParams: { id:
|
|
691
|
+
pathParams: { id: fhirPatientId, med_id: medicationId },
|
|
692
692
|
body: request
|
|
693
693
|
});
|
|
694
694
|
}
|
|
@@ -879,15 +879,15 @@ var PersonClient = class extends BaseServiceClient {
|
|
|
879
879
|
});
|
|
880
880
|
}
|
|
881
881
|
// ─── Person CRUD (authenticated) ─────────────────────────────────────
|
|
882
|
-
updatePhone(
|
|
882
|
+
updatePhone(fhirPersonId, request) {
|
|
883
883
|
return this.send("POST", "/persons/{person_id}/phone", {
|
|
884
|
-
pathParams: { person_id:
|
|
884
|
+
pathParams: { person_id: fhirPersonId },
|
|
885
885
|
body: request
|
|
886
886
|
});
|
|
887
887
|
}
|
|
888
|
-
verifySms(
|
|
888
|
+
verifySms(fhirPersonId, request) {
|
|
889
889
|
return this.send("POST", "/persons/{person_id}/verify-sms", {
|
|
890
|
-
pathParams: { person_id:
|
|
890
|
+
pathParams: { person_id: fhirPersonId },
|
|
891
891
|
body: request
|
|
892
892
|
});
|
|
893
893
|
}
|
|
@@ -895,18 +895,18 @@ var PersonClient = class extends BaseServiceClient {
|
|
|
895
895
|
* Get a person by ID.
|
|
896
896
|
* GET /persons/{person_id}
|
|
897
897
|
*/
|
|
898
|
-
get(
|
|
898
|
+
get(fhirPersonId) {
|
|
899
899
|
return this.send("GET", "/persons/{person_id}", {
|
|
900
|
-
pathParams: { person_id:
|
|
900
|
+
pathParams: { person_id: fhirPersonId }
|
|
901
901
|
});
|
|
902
902
|
}
|
|
903
903
|
/**
|
|
904
904
|
* Update a person's fields.
|
|
905
905
|
* PATCH /persons/{person_id}
|
|
906
906
|
*/
|
|
907
|
-
update(
|
|
907
|
+
update(fhirPersonId, request) {
|
|
908
908
|
return this.send("PATCH", "/persons/{person_id}", {
|
|
909
|
-
pathParams: { person_id:
|
|
909
|
+
pathParams: { person_id: fhirPersonId },
|
|
910
910
|
body: request
|
|
911
911
|
});
|
|
912
912
|
}
|
|
@@ -915,18 +915,18 @@ var PersonClient = class extends BaseServiceClient {
|
|
|
915
915
|
* Get a presigned upload URL for a person's photo.
|
|
916
916
|
* GET /persons/{person_id}/photo/upload-url
|
|
917
917
|
*/
|
|
918
|
-
getPhotoUploadUrl(
|
|
918
|
+
getPhotoUploadUrl(fhirPersonId) {
|
|
919
919
|
return this.send("GET", "/persons/{person_id}/photo/upload-url", {
|
|
920
|
-
pathParams: { person_id:
|
|
920
|
+
pathParams: { person_id: fhirPersonId }
|
|
921
921
|
});
|
|
922
922
|
}
|
|
923
923
|
/**
|
|
924
924
|
* Upload a person's photo (base64).
|
|
925
925
|
* POST /persons/{person_id}/photo
|
|
926
926
|
*/
|
|
927
|
-
uploadPhoto(
|
|
927
|
+
uploadPhoto(fhirPersonId, request) {
|
|
928
928
|
return this.send("POST", "/persons/{person_id}/photo", {
|
|
929
|
-
pathParams: { person_id:
|
|
929
|
+
pathParams: { person_id: fhirPersonId },
|
|
930
930
|
body: request
|
|
931
931
|
});
|
|
932
932
|
}
|
|
@@ -934,9 +934,9 @@ var PersonClient = class extends BaseServiceClient {
|
|
|
934
934
|
* Get a person's photo by binary_id.
|
|
935
935
|
* GET /persons/{person_id}/photo?binary_id=...
|
|
936
936
|
*/
|
|
937
|
-
getPhoto(
|
|
937
|
+
getPhoto(fhirPersonId, query) {
|
|
938
938
|
return this.send("GET", "/persons/{person_id}/photo", {
|
|
939
|
-
pathParams: { person_id:
|
|
939
|
+
pathParams: { person_id: fhirPersonId },
|
|
940
940
|
query
|
|
941
941
|
});
|
|
942
942
|
}
|
|
@@ -967,27 +967,27 @@ var ProviderClient = class extends BaseServiceClient {
|
|
|
967
967
|
return this.send("POST", "/auth/confirm-reset-password", { body: request, auth: false });
|
|
968
968
|
}
|
|
969
969
|
// ─── Practitioner CRUD ─────────────────────────────────────────────
|
|
970
|
-
updatePhone(
|
|
971
|
-
return this.send("POST", "/practitioners/{practitioner_id}/phone", { pathParams: { practitioner_id:
|
|
970
|
+
updatePhone(fhirPractitionerId, request) {
|
|
971
|
+
return this.send("POST", "/practitioners/{practitioner_id}/phone", { pathParams: { practitioner_id: fhirPractitionerId }, body: request });
|
|
972
972
|
}
|
|
973
|
-
verifySms(
|
|
974
|
-
return this.send("POST", "/practitioners/{practitioner_id}/verify-sms", { pathParams: { practitioner_id:
|
|
973
|
+
verifySms(fhirPractitionerId, request) {
|
|
974
|
+
return this.send("POST", "/practitioners/{practitioner_id}/verify-sms", { pathParams: { practitioner_id: fhirPractitionerId }, body: request });
|
|
975
975
|
}
|
|
976
|
-
get(
|
|
977
|
-
return this.send("GET", "/practitioners/{practitioner_id}", { pathParams: { practitioner_id:
|
|
976
|
+
get(fhirPractitionerId) {
|
|
977
|
+
return this.send("GET", "/practitioners/{practitioner_id}", { pathParams: { practitioner_id: fhirPractitionerId } });
|
|
978
978
|
}
|
|
979
|
-
update(
|
|
980
|
-
return this.send("PATCH", "/practitioners/{practitioner_id}", { pathParams: { practitioner_id:
|
|
979
|
+
update(fhirPractitionerId, request) {
|
|
980
|
+
return this.send("PATCH", "/practitioners/{practitioner_id}", { pathParams: { practitioner_id: fhirPractitionerId }, body: request });
|
|
981
981
|
}
|
|
982
982
|
// ─── Photo ─────────────────────────────────────────────────────────
|
|
983
|
-
getPhotoUploadUrl(
|
|
984
|
-
return this.send("GET", "/practitioners/{practitioner_id}/photo/upload-url", { pathParams: { practitioner_id:
|
|
983
|
+
getPhotoUploadUrl(fhirPractitionerId) {
|
|
984
|
+
return this.send("GET", "/practitioners/{practitioner_id}/photo/upload-url", { pathParams: { practitioner_id: fhirPractitionerId } });
|
|
985
985
|
}
|
|
986
|
-
uploadPhoto(
|
|
987
|
-
return this.send("POST", "/practitioners/{practitioner_id}/photo", { pathParams: { practitioner_id:
|
|
986
|
+
uploadPhoto(fhirPractitionerId, request) {
|
|
987
|
+
return this.send("POST", "/practitioners/{practitioner_id}/photo", { pathParams: { practitioner_id: fhirPractitionerId }, body: request });
|
|
988
988
|
}
|
|
989
|
-
getPhoto(
|
|
990
|
-
return this.send("GET", "/practitioners/{practitioner_id}/photo", { pathParams: { practitioner_id:
|
|
989
|
+
getPhoto(fhirPractitionerId, query) {
|
|
990
|
+
return this.send("GET", "/practitioners/{practitioner_id}/photo", { pathParams: { practitioner_id: fhirPractitionerId }, query });
|
|
991
991
|
}
|
|
992
992
|
};
|
|
993
993
|
|
|
@@ -1019,6 +1019,18 @@ var TelehealthClient = class extends BaseServiceClient {
|
|
|
1019
1019
|
connect() {
|
|
1020
1020
|
return this.connectService();
|
|
1021
1021
|
}
|
|
1022
|
+
createChannel() {
|
|
1023
|
+
return this.send("POST", "/telehealth/channels");
|
|
1024
|
+
}
|
|
1025
|
+
createPatientToken(request) {
|
|
1026
|
+
return this.send("POST", "/telehealth/tokens/patient", { body: request });
|
|
1027
|
+
}
|
|
1028
|
+
createProviderToken(request) {
|
|
1029
|
+
return this.send("POST", "/telehealth/tokens/provider", { body: request });
|
|
1030
|
+
}
|
|
1031
|
+
fetchRtcToken(request) {
|
|
1032
|
+
return this.send("POST", "/fetch_rtc_token", { body: request });
|
|
1033
|
+
}
|
|
1022
1034
|
};
|
|
1023
1035
|
|
|
1024
1036
|
// src/clients/VitalsClient.ts
|