@hipnation-truth/sdk 0.25.1 → 0.25.3
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/index.d.mts +34 -15
- package/dist/index.d.ts +34 -15
- package/dist/index.js +53 -76
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -76
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.ts +34 -15
- package/dist/react.js +53 -76
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -281,6 +281,12 @@ interface SetConversationTaskStatusInput {
|
|
|
281
281
|
taskId: string;
|
|
282
282
|
status: ConversationTaskStatus;
|
|
283
283
|
resolvedBy?: string;
|
|
284
|
+
/**
|
|
285
|
+
* Email of the user performing the action. Truth excludes the actor
|
|
286
|
+
* from the task-action push fan-out (legacy parity) — omit it and the
|
|
287
|
+
* actor notifies themselves.
|
|
288
|
+
*/
|
|
289
|
+
actor?: string;
|
|
284
290
|
}
|
|
285
291
|
interface UpdateConversationTaskInput {
|
|
286
292
|
taskId: string;
|
|
@@ -295,6 +301,18 @@ interface UpdateConversationTaskInput {
|
|
|
295
301
|
status?: ConversationTaskStatus;
|
|
296
302
|
assignee?: string;
|
|
297
303
|
type?: string;
|
|
304
|
+
/**
|
|
305
|
+
* Email of the user performing the action. Truth excludes the actor
|
|
306
|
+
* from the task-action push fan-out (legacy parity) — omit it and the
|
|
307
|
+
* actor notifies themselves.
|
|
308
|
+
*/
|
|
309
|
+
actor?: string;
|
|
310
|
+
}
|
|
311
|
+
interface SetConversationTaskArchivedInput {
|
|
312
|
+
taskId: string;
|
|
313
|
+
archived: boolean;
|
|
314
|
+
/** Email of the acting user — excluded from the archive push fan-out. */
|
|
315
|
+
actor?: string;
|
|
298
316
|
}
|
|
299
317
|
interface SendConversationMessageInput {
|
|
300
318
|
fromNumber: string;
|
|
@@ -331,6 +349,11 @@ declare class ConversationTasksSubresource {
|
|
|
331
349
|
setStatus(input: SetConversationTaskStatusInput): Promise<{
|
|
332
350
|
ok: true;
|
|
333
351
|
}>;
|
|
352
|
+
/** Archive or un-archive a task (hides it from My Tasks without deleting). */
|
|
353
|
+
setArchived(input: SetConversationTaskArchivedInput): Promise<{
|
|
354
|
+
ok: true;
|
|
355
|
+
changed: boolean;
|
|
356
|
+
}>;
|
|
334
357
|
/**
|
|
335
358
|
* Update task fields (priority, assignee, description, type). Wraps
|
|
336
359
|
* `PATCH /api/conversations/tasks/{id}` so CommHub doesn't have to
|
|
@@ -559,7 +582,8 @@ declare class DialpadProxyError extends Error {
|
|
|
559
582
|
* EHR proxy resource — typed access to Truth's EHR proxy endpoints.
|
|
560
583
|
*
|
|
561
584
|
* Provides per-provider proxy methods so consumers never construct
|
|
562
|
-
* proxy URLs manually.
|
|
585
|
+
* proxy URLs manually. Every request carries the application's
|
|
586
|
+
* `X-API-Key` — Truth's API gate rejects unauthenticated callers.
|
|
563
587
|
*
|
|
564
588
|
* @example
|
|
565
589
|
* ```ts
|
|
@@ -571,28 +595,23 @@ declare class DialpadProxyError extends Error {
|
|
|
571
595
|
declare class EhrProviderProxy {
|
|
572
596
|
private readonly baseUrl;
|
|
573
597
|
private readonly provider;
|
|
574
|
-
|
|
598
|
+
private readonly apiKey;
|
|
599
|
+
constructor(apiBaseUrl: string, provider: string, apiKey: string);
|
|
600
|
+
private headers;
|
|
601
|
+
private request;
|
|
575
602
|
/**
|
|
576
603
|
* GET request to the EHR proxy.
|
|
577
604
|
* @param path — path relative to the provider root (e.g., "/patients/123/")
|
|
578
605
|
* @param params — optional query parameters
|
|
579
606
|
*/
|
|
580
607
|
get<T = unknown>(path: string, params?: Record<string, unknown>): Promise<T>;
|
|
581
|
-
/**
|
|
582
|
-
* POST request to the EHR proxy.
|
|
583
|
-
*/
|
|
608
|
+
/** POST request to the EHR proxy. */
|
|
584
609
|
post<T = unknown>(path: string, body?: unknown): Promise<T>;
|
|
585
|
-
/**
|
|
586
|
-
* PUT request to the EHR proxy.
|
|
587
|
-
*/
|
|
610
|
+
/** PUT request to the EHR proxy. */
|
|
588
611
|
put<T = unknown>(path: string, body?: unknown): Promise<T>;
|
|
589
|
-
/**
|
|
590
|
-
* PATCH request to the EHR proxy.
|
|
591
|
-
*/
|
|
612
|
+
/** PATCH request to the EHR proxy. */
|
|
592
613
|
patch<T = unknown>(path: string, body?: unknown): Promise<T>;
|
|
593
|
-
/**
|
|
594
|
-
* DELETE request to the EHR proxy.
|
|
595
|
-
*/
|
|
614
|
+
/** DELETE request to the EHR proxy. */
|
|
596
615
|
delete<T = unknown>(path: string): Promise<T>;
|
|
597
616
|
}
|
|
598
617
|
declare class EhrResource {
|
|
@@ -600,7 +619,7 @@ declare class EhrResource {
|
|
|
600
619
|
readonly elation: EhrProviderProxy;
|
|
601
620
|
/** Hint Health proxy */
|
|
602
621
|
readonly hint: EhrProviderProxy;
|
|
603
|
-
constructor(apiBaseUrl: string);
|
|
622
|
+
constructor(apiBaseUrl: string, apiKey: string);
|
|
604
623
|
}
|
|
605
624
|
declare class EhrProxyError extends Error {
|
|
606
625
|
readonly provider: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -281,6 +281,12 @@ interface SetConversationTaskStatusInput {
|
|
|
281
281
|
taskId: string;
|
|
282
282
|
status: ConversationTaskStatus;
|
|
283
283
|
resolvedBy?: string;
|
|
284
|
+
/**
|
|
285
|
+
* Email of the user performing the action. Truth excludes the actor
|
|
286
|
+
* from the task-action push fan-out (legacy parity) — omit it and the
|
|
287
|
+
* actor notifies themselves.
|
|
288
|
+
*/
|
|
289
|
+
actor?: string;
|
|
284
290
|
}
|
|
285
291
|
interface UpdateConversationTaskInput {
|
|
286
292
|
taskId: string;
|
|
@@ -295,6 +301,18 @@ interface UpdateConversationTaskInput {
|
|
|
295
301
|
status?: ConversationTaskStatus;
|
|
296
302
|
assignee?: string;
|
|
297
303
|
type?: string;
|
|
304
|
+
/**
|
|
305
|
+
* Email of the user performing the action. Truth excludes the actor
|
|
306
|
+
* from the task-action push fan-out (legacy parity) — omit it and the
|
|
307
|
+
* actor notifies themselves.
|
|
308
|
+
*/
|
|
309
|
+
actor?: string;
|
|
310
|
+
}
|
|
311
|
+
interface SetConversationTaskArchivedInput {
|
|
312
|
+
taskId: string;
|
|
313
|
+
archived: boolean;
|
|
314
|
+
/** Email of the acting user — excluded from the archive push fan-out. */
|
|
315
|
+
actor?: string;
|
|
298
316
|
}
|
|
299
317
|
interface SendConversationMessageInput {
|
|
300
318
|
fromNumber: string;
|
|
@@ -331,6 +349,11 @@ declare class ConversationTasksSubresource {
|
|
|
331
349
|
setStatus(input: SetConversationTaskStatusInput): Promise<{
|
|
332
350
|
ok: true;
|
|
333
351
|
}>;
|
|
352
|
+
/** Archive or un-archive a task (hides it from My Tasks without deleting). */
|
|
353
|
+
setArchived(input: SetConversationTaskArchivedInput): Promise<{
|
|
354
|
+
ok: true;
|
|
355
|
+
changed: boolean;
|
|
356
|
+
}>;
|
|
334
357
|
/**
|
|
335
358
|
* Update task fields (priority, assignee, description, type). Wraps
|
|
336
359
|
* `PATCH /api/conversations/tasks/{id}` so CommHub doesn't have to
|
|
@@ -559,7 +582,8 @@ declare class DialpadProxyError extends Error {
|
|
|
559
582
|
* EHR proxy resource — typed access to Truth's EHR proxy endpoints.
|
|
560
583
|
*
|
|
561
584
|
* Provides per-provider proxy methods so consumers never construct
|
|
562
|
-
* proxy URLs manually.
|
|
585
|
+
* proxy URLs manually. Every request carries the application's
|
|
586
|
+
* `X-API-Key` — Truth's API gate rejects unauthenticated callers.
|
|
563
587
|
*
|
|
564
588
|
* @example
|
|
565
589
|
* ```ts
|
|
@@ -571,28 +595,23 @@ declare class DialpadProxyError extends Error {
|
|
|
571
595
|
declare class EhrProviderProxy {
|
|
572
596
|
private readonly baseUrl;
|
|
573
597
|
private readonly provider;
|
|
574
|
-
|
|
598
|
+
private readonly apiKey;
|
|
599
|
+
constructor(apiBaseUrl: string, provider: string, apiKey: string);
|
|
600
|
+
private headers;
|
|
601
|
+
private request;
|
|
575
602
|
/**
|
|
576
603
|
* GET request to the EHR proxy.
|
|
577
604
|
* @param path — path relative to the provider root (e.g., "/patients/123/")
|
|
578
605
|
* @param params — optional query parameters
|
|
579
606
|
*/
|
|
580
607
|
get<T = unknown>(path: string, params?: Record<string, unknown>): Promise<T>;
|
|
581
|
-
/**
|
|
582
|
-
* POST request to the EHR proxy.
|
|
583
|
-
*/
|
|
608
|
+
/** POST request to the EHR proxy. */
|
|
584
609
|
post<T = unknown>(path: string, body?: unknown): Promise<T>;
|
|
585
|
-
/**
|
|
586
|
-
* PUT request to the EHR proxy.
|
|
587
|
-
*/
|
|
610
|
+
/** PUT request to the EHR proxy. */
|
|
588
611
|
put<T = unknown>(path: string, body?: unknown): Promise<T>;
|
|
589
|
-
/**
|
|
590
|
-
* PATCH request to the EHR proxy.
|
|
591
|
-
*/
|
|
612
|
+
/** PATCH request to the EHR proxy. */
|
|
592
613
|
patch<T = unknown>(path: string, body?: unknown): Promise<T>;
|
|
593
|
-
/**
|
|
594
|
-
* DELETE request to the EHR proxy.
|
|
595
|
-
*/
|
|
614
|
+
/** DELETE request to the EHR proxy. */
|
|
596
615
|
delete<T = unknown>(path: string): Promise<T>;
|
|
597
616
|
}
|
|
598
617
|
declare class EhrResource {
|
|
@@ -600,7 +619,7 @@ declare class EhrResource {
|
|
|
600
619
|
readonly elation: EhrProviderProxy;
|
|
601
620
|
/** Hint Health proxy */
|
|
602
621
|
readonly hint: EhrProviderProxy;
|
|
603
|
-
constructor(apiBaseUrl: string);
|
|
622
|
+
constructor(apiBaseUrl: string, apiKey: string);
|
|
604
623
|
}
|
|
605
624
|
declare class EhrProxyError extends Error {
|
|
606
625
|
readonly provider: string;
|
package/dist/index.js
CHANGED
|
@@ -398,10 +398,22 @@ var ConversationTasksSubresource = class {
|
|
|
398
398
|
return __async(this, null, function* () {
|
|
399
399
|
return this.post(
|
|
400
400
|
`/conversations/tasks/${encodeURIComponent(input.taskId)}/status`,
|
|
401
|
-
__spreadValues({
|
|
401
|
+
__spreadValues(__spreadValues({
|
|
402
402
|
id: input.taskId,
|
|
403
403
|
status: input.status
|
|
404
|
-
}, input.resolvedBy ? { resolvedBy: input.resolvedBy } : {})
|
|
404
|
+
}, input.resolvedBy ? { resolvedBy: input.resolvedBy } : {}), input.actor ? { actor: input.actor } : {})
|
|
405
|
+
);
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
/** Archive or un-archive a task (hides it from My Tasks without deleting). */
|
|
409
|
+
setArchived(input) {
|
|
410
|
+
return __async(this, null, function* () {
|
|
411
|
+
return this.post(
|
|
412
|
+
`/conversations/tasks/${encodeURIComponent(input.taskId)}/archive`,
|
|
413
|
+
__spreadValues({
|
|
414
|
+
id: input.taskId,
|
|
415
|
+
archived: input.archived
|
|
416
|
+
}, input.actor ? { actor: input.actor } : {})
|
|
405
417
|
);
|
|
406
418
|
});
|
|
407
419
|
}
|
|
@@ -414,12 +426,12 @@ var ConversationTasksSubresource = class {
|
|
|
414
426
|
return __async(this, null, function* () {
|
|
415
427
|
return this.patch(
|
|
416
428
|
`/conversations/tasks/${encodeURIComponent(input.taskId)}`,
|
|
417
|
-
__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
429
|
+
__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
418
430
|
id: input.taskId,
|
|
419
431
|
conversationId: input.conversationId,
|
|
420
432
|
author: input.author,
|
|
421
433
|
description: input.description
|
|
422
|
-
}, input.title !== void 0 ? { title: input.title } : {}), input.priority ? { priority: input.priority } : {}), input.status ? { status: input.status } : {}), input.assignee !== void 0 ? { assignee: input.assignee } : {}), input.type !== void 0 ? { type: input.type } : {})
|
|
434
|
+
}, input.title !== void 0 ? { title: input.title } : {}), input.priority ? { priority: input.priority } : {}), input.status ? { status: input.status } : {}), input.assignee !== void 0 ? { assignee: input.assignee } : {}), input.type !== void 0 ? { type: input.type } : {}), input.actor ? { actor: input.actor } : {})
|
|
423
435
|
);
|
|
424
436
|
});
|
|
425
437
|
}
|
|
@@ -921,16 +933,22 @@ var DialpadProxyError = class extends Error {
|
|
|
921
933
|
|
|
922
934
|
// src/resources/ehr.ts
|
|
923
935
|
var EhrProviderProxy = class {
|
|
924
|
-
constructor(apiBaseUrl, provider) {
|
|
936
|
+
constructor(apiBaseUrl, provider, apiKey) {
|
|
925
937
|
this.baseUrl = apiBaseUrl;
|
|
926
938
|
this.provider = provider;
|
|
939
|
+
this.apiKey = apiKey;
|
|
927
940
|
}
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
941
|
+
headers(withBody) {
|
|
942
|
+
const headers = {
|
|
943
|
+
Accept: "application/json",
|
|
944
|
+
"X-API-Key": this.apiKey
|
|
945
|
+
};
|
|
946
|
+
if (withBody) {
|
|
947
|
+
headers["Content-Type"] = "application/json";
|
|
948
|
+
}
|
|
949
|
+
return headers;
|
|
950
|
+
}
|
|
951
|
+
request(method, path, body, params) {
|
|
934
952
|
return __async(this, null, function* () {
|
|
935
953
|
const url = new URL(`/api/ehr/${this.provider}${path}`, this.baseUrl);
|
|
936
954
|
if (params) {
|
|
@@ -941,96 +959,55 @@ var EhrProviderProxy = class {
|
|
|
941
959
|
}
|
|
942
960
|
}
|
|
943
961
|
const response = yield fetch(url.toString(), {
|
|
944
|
-
method
|
|
945
|
-
headers:
|
|
962
|
+
method,
|
|
963
|
+
headers: this.headers(body !== void 0),
|
|
964
|
+
body: body !== void 0 ? JSON.stringify(body) : void 0
|
|
946
965
|
});
|
|
947
966
|
if (!response.ok) {
|
|
948
|
-
throw new EhrProxyError(this.provider,
|
|
967
|
+
throw new EhrProxyError(this.provider, method, path, response.status);
|
|
949
968
|
}
|
|
950
969
|
return yield response.json();
|
|
951
970
|
});
|
|
952
971
|
}
|
|
953
972
|
/**
|
|
954
|
-
*
|
|
973
|
+
* GET request to the EHR proxy.
|
|
974
|
+
* @param path — path relative to the provider root (e.g., "/patients/123/")
|
|
975
|
+
* @param params — optional query parameters
|
|
955
976
|
*/
|
|
977
|
+
get(path, params) {
|
|
978
|
+
return __async(this, null, function* () {
|
|
979
|
+
return this.request("GET", path, void 0, params);
|
|
980
|
+
});
|
|
981
|
+
}
|
|
982
|
+
/** POST request to the EHR proxy. */
|
|
956
983
|
post(path, body) {
|
|
957
984
|
return __async(this, null, function* () {
|
|
958
|
-
|
|
959
|
-
const response = yield fetch(url, {
|
|
960
|
-
method: "POST",
|
|
961
|
-
headers: {
|
|
962
|
-
"Content-Type": "application/json",
|
|
963
|
-
Accept: "application/json"
|
|
964
|
-
},
|
|
965
|
-
body: body !== void 0 ? JSON.stringify(body) : void 0
|
|
966
|
-
});
|
|
967
|
-
if (!response.ok) {
|
|
968
|
-
throw new EhrProxyError(this.provider, "POST", path, response.status);
|
|
969
|
-
}
|
|
970
|
-
return yield response.json();
|
|
985
|
+
return this.request("POST", path, body);
|
|
971
986
|
});
|
|
972
987
|
}
|
|
973
|
-
/**
|
|
974
|
-
* PUT request to the EHR proxy.
|
|
975
|
-
*/
|
|
988
|
+
/** PUT request to the EHR proxy. */
|
|
976
989
|
put(path, body) {
|
|
977
990
|
return __async(this, null, function* () {
|
|
978
|
-
|
|
979
|
-
const response = yield fetch(url, {
|
|
980
|
-
method: "PUT",
|
|
981
|
-
headers: {
|
|
982
|
-
"Content-Type": "application/json",
|
|
983
|
-
Accept: "application/json"
|
|
984
|
-
},
|
|
985
|
-
body: body !== void 0 ? JSON.stringify(body) : void 0
|
|
986
|
-
});
|
|
987
|
-
if (!response.ok) {
|
|
988
|
-
throw new EhrProxyError(this.provider, "PUT", path, response.status);
|
|
989
|
-
}
|
|
990
|
-
return yield response.json();
|
|
991
|
+
return this.request("PUT", path, body);
|
|
991
992
|
});
|
|
992
993
|
}
|
|
993
|
-
/**
|
|
994
|
-
* PATCH request to the EHR proxy.
|
|
995
|
-
*/
|
|
994
|
+
/** PATCH request to the EHR proxy. */
|
|
996
995
|
patch(path, body) {
|
|
997
996
|
return __async(this, null, function* () {
|
|
998
|
-
|
|
999
|
-
const response = yield fetch(url, {
|
|
1000
|
-
method: "PATCH",
|
|
1001
|
-
headers: {
|
|
1002
|
-
"Content-Type": "application/json",
|
|
1003
|
-
Accept: "application/json"
|
|
1004
|
-
},
|
|
1005
|
-
body: body !== void 0 ? JSON.stringify(body) : void 0
|
|
1006
|
-
});
|
|
1007
|
-
if (!response.ok) {
|
|
1008
|
-
throw new EhrProxyError(this.provider, "PATCH", path, response.status);
|
|
1009
|
-
}
|
|
1010
|
-
return yield response.json();
|
|
997
|
+
return this.request("PATCH", path, body);
|
|
1011
998
|
});
|
|
1012
999
|
}
|
|
1013
|
-
/**
|
|
1014
|
-
* DELETE request to the EHR proxy.
|
|
1015
|
-
*/
|
|
1000
|
+
/** DELETE request to the EHR proxy. */
|
|
1016
1001
|
delete(path) {
|
|
1017
1002
|
return __async(this, null, function* () {
|
|
1018
|
-
|
|
1019
|
-
const response = yield fetch(url, {
|
|
1020
|
-
method: "DELETE",
|
|
1021
|
-
headers: { Accept: "application/json" }
|
|
1022
|
-
});
|
|
1023
|
-
if (!response.ok) {
|
|
1024
|
-
throw new EhrProxyError(this.provider, "DELETE", path, response.status);
|
|
1025
|
-
}
|
|
1026
|
-
return yield response.json();
|
|
1003
|
+
return this.request("DELETE", path);
|
|
1027
1004
|
});
|
|
1028
1005
|
}
|
|
1029
1006
|
};
|
|
1030
1007
|
var EhrResource = class {
|
|
1031
|
-
constructor(apiBaseUrl) {
|
|
1032
|
-
this.elation = new EhrProviderProxy(apiBaseUrl, "elation");
|
|
1033
|
-
this.hint = new EhrProviderProxy(apiBaseUrl, "hint");
|
|
1008
|
+
constructor(apiBaseUrl, apiKey) {
|
|
1009
|
+
this.elation = new EhrProviderProxy(apiBaseUrl, "elation", apiKey);
|
|
1010
|
+
this.hint = new EhrProviderProxy(apiBaseUrl, "hint", apiKey);
|
|
1034
1011
|
}
|
|
1035
1012
|
};
|
|
1036
1013
|
var EhrProxyError = class extends Error {
|
|
@@ -1995,7 +1972,7 @@ var TruthClient = class {
|
|
|
1995
1972
|
const apiUrl = this.tracker.apiUrl;
|
|
1996
1973
|
this.patients = new PatientResource(this.convex);
|
|
1997
1974
|
this.appointments = new AppointmentResource(this.convex);
|
|
1998
|
-
this.ehr = new EhrResource(apiUrl);
|
|
1975
|
+
this.ehr = new EhrResource(apiUrl, config.apiKey);
|
|
1999
1976
|
this.messages = new MessagesResource(apiUrl, config.apiKey);
|
|
2000
1977
|
this.reminders = new RemindersResource(this.convex);
|
|
2001
1978
|
this.translation = new TranslationResource(apiUrl, config.apiKey);
|