@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/react.d.ts
CHANGED
|
@@ -1462,6 +1462,12 @@ interface SetConversationTaskStatusInput {
|
|
|
1462
1462
|
taskId: string;
|
|
1463
1463
|
status: ConversationTaskStatus;
|
|
1464
1464
|
resolvedBy?: string;
|
|
1465
|
+
/**
|
|
1466
|
+
* Email of the user performing the action. Truth excludes the actor
|
|
1467
|
+
* from the task-action push fan-out (legacy parity) — omit it and the
|
|
1468
|
+
* actor notifies themselves.
|
|
1469
|
+
*/
|
|
1470
|
+
actor?: string;
|
|
1465
1471
|
}
|
|
1466
1472
|
interface UpdateConversationTaskInput {
|
|
1467
1473
|
taskId: string;
|
|
@@ -1476,6 +1482,18 @@ interface UpdateConversationTaskInput {
|
|
|
1476
1482
|
status?: ConversationTaskStatus;
|
|
1477
1483
|
assignee?: string;
|
|
1478
1484
|
type?: string;
|
|
1485
|
+
/**
|
|
1486
|
+
* Email of the user performing the action. Truth excludes the actor
|
|
1487
|
+
* from the task-action push fan-out (legacy parity) — omit it and the
|
|
1488
|
+
* actor notifies themselves.
|
|
1489
|
+
*/
|
|
1490
|
+
actor?: string;
|
|
1491
|
+
}
|
|
1492
|
+
interface SetConversationTaskArchivedInput {
|
|
1493
|
+
taskId: string;
|
|
1494
|
+
archived: boolean;
|
|
1495
|
+
/** Email of the acting user — excluded from the archive push fan-out. */
|
|
1496
|
+
actor?: string;
|
|
1479
1497
|
}
|
|
1480
1498
|
interface SendConversationMessageInput {
|
|
1481
1499
|
fromNumber: string;
|
|
@@ -1508,6 +1526,11 @@ declare class ConversationTasksSubresource {
|
|
|
1508
1526
|
setStatus(input: SetConversationTaskStatusInput): Promise<{
|
|
1509
1527
|
ok: true;
|
|
1510
1528
|
}>;
|
|
1529
|
+
/** Archive or un-archive a task (hides it from My Tasks without deleting). */
|
|
1530
|
+
setArchived(input: SetConversationTaskArchivedInput): Promise<{
|
|
1531
|
+
ok: true;
|
|
1532
|
+
changed: boolean;
|
|
1533
|
+
}>;
|
|
1511
1534
|
/**
|
|
1512
1535
|
* Update task fields (priority, assignee, description, type). Wraps
|
|
1513
1536
|
* `PATCH /api/conversations/tasks/{id}` so CommHub doesn't have to
|
|
@@ -1725,7 +1748,8 @@ declare class MessagesResource {
|
|
|
1725
1748
|
* EHR proxy resource — typed access to Truth's EHR proxy endpoints.
|
|
1726
1749
|
*
|
|
1727
1750
|
* Provides per-provider proxy methods so consumers never construct
|
|
1728
|
-
* proxy URLs manually.
|
|
1751
|
+
* proxy URLs manually. Every request carries the application's
|
|
1752
|
+
* `X-API-Key` — Truth's API gate rejects unauthenticated callers.
|
|
1729
1753
|
*
|
|
1730
1754
|
* @example
|
|
1731
1755
|
* ```ts
|
|
@@ -1737,28 +1761,23 @@ declare class MessagesResource {
|
|
|
1737
1761
|
declare class EhrProviderProxy {
|
|
1738
1762
|
private readonly baseUrl;
|
|
1739
1763
|
private readonly provider;
|
|
1740
|
-
|
|
1764
|
+
private readonly apiKey;
|
|
1765
|
+
constructor(apiBaseUrl: string, provider: string, apiKey: string);
|
|
1766
|
+
private headers;
|
|
1767
|
+
private request;
|
|
1741
1768
|
/**
|
|
1742
1769
|
* GET request to the EHR proxy.
|
|
1743
1770
|
* @param path — path relative to the provider root (e.g., "/patients/123/")
|
|
1744
1771
|
* @param params — optional query parameters
|
|
1745
1772
|
*/
|
|
1746
1773
|
get<T = unknown>(path: string, params?: Record<string, unknown>): Promise<T>;
|
|
1747
|
-
/**
|
|
1748
|
-
* POST request to the EHR proxy.
|
|
1749
|
-
*/
|
|
1774
|
+
/** POST request to the EHR proxy. */
|
|
1750
1775
|
post<T = unknown>(path: string, body?: unknown): Promise<T>;
|
|
1751
|
-
/**
|
|
1752
|
-
* PUT request to the EHR proxy.
|
|
1753
|
-
*/
|
|
1776
|
+
/** PUT request to the EHR proxy. */
|
|
1754
1777
|
put<T = unknown>(path: string, body?: unknown): Promise<T>;
|
|
1755
|
-
/**
|
|
1756
|
-
* PATCH request to the EHR proxy.
|
|
1757
|
-
*/
|
|
1778
|
+
/** PATCH request to the EHR proxy. */
|
|
1758
1779
|
patch<T = unknown>(path: string, body?: unknown): Promise<T>;
|
|
1759
|
-
/**
|
|
1760
|
-
* DELETE request to the EHR proxy.
|
|
1761
|
-
*/
|
|
1780
|
+
/** DELETE request to the EHR proxy. */
|
|
1762
1781
|
delete<T = unknown>(path: string): Promise<T>;
|
|
1763
1782
|
}
|
|
1764
1783
|
declare class EhrResource {
|
|
@@ -1766,7 +1785,7 @@ declare class EhrResource {
|
|
|
1766
1785
|
readonly elation: EhrProviderProxy;
|
|
1767
1786
|
/** Hint Health proxy */
|
|
1768
1787
|
readonly hint: EhrProviderProxy;
|
|
1769
|
-
constructor(apiBaseUrl: string);
|
|
1788
|
+
constructor(apiBaseUrl: string, apiKey: string);
|
|
1770
1789
|
}
|
|
1771
1790
|
|
|
1772
1791
|
/**
|
package/dist/react.js
CHANGED
|
@@ -670,10 +670,22 @@ var ConversationTasksSubresource = class {
|
|
|
670
670
|
return __async(this, null, function* () {
|
|
671
671
|
return this.post(
|
|
672
672
|
`/conversations/tasks/${encodeURIComponent(input.taskId)}/status`,
|
|
673
|
-
__spreadValues({
|
|
673
|
+
__spreadValues(__spreadValues({
|
|
674
674
|
id: input.taskId,
|
|
675
675
|
status: input.status
|
|
676
|
-
}, input.resolvedBy ? { resolvedBy: input.resolvedBy } : {})
|
|
676
|
+
}, input.resolvedBy ? { resolvedBy: input.resolvedBy } : {}), input.actor ? { actor: input.actor } : {})
|
|
677
|
+
);
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
/** Archive or un-archive a task (hides it from My Tasks without deleting). */
|
|
681
|
+
setArchived(input) {
|
|
682
|
+
return __async(this, null, function* () {
|
|
683
|
+
return this.post(
|
|
684
|
+
`/conversations/tasks/${encodeURIComponent(input.taskId)}/archive`,
|
|
685
|
+
__spreadValues({
|
|
686
|
+
id: input.taskId,
|
|
687
|
+
archived: input.archived
|
|
688
|
+
}, input.actor ? { actor: input.actor } : {})
|
|
677
689
|
);
|
|
678
690
|
});
|
|
679
691
|
}
|
|
@@ -686,12 +698,12 @@ var ConversationTasksSubresource = class {
|
|
|
686
698
|
return __async(this, null, function* () {
|
|
687
699
|
return this.patch(
|
|
688
700
|
`/conversations/tasks/${encodeURIComponent(input.taskId)}`,
|
|
689
|
-
__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
701
|
+
__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
690
702
|
id: input.taskId,
|
|
691
703
|
conversationId: input.conversationId,
|
|
692
704
|
author: input.author,
|
|
693
705
|
description: input.description
|
|
694
|
-
}, 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 } : {})
|
|
706
|
+
}, 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 } : {})
|
|
695
707
|
);
|
|
696
708
|
});
|
|
697
709
|
}
|
|
@@ -1193,16 +1205,22 @@ var DialpadProxyError = class extends Error {
|
|
|
1193
1205
|
|
|
1194
1206
|
// src/resources/ehr.ts
|
|
1195
1207
|
var EhrProviderProxy = class {
|
|
1196
|
-
constructor(apiBaseUrl, provider) {
|
|
1208
|
+
constructor(apiBaseUrl, provider, apiKey) {
|
|
1197
1209
|
this.baseUrl = apiBaseUrl;
|
|
1198
1210
|
this.provider = provider;
|
|
1211
|
+
this.apiKey = apiKey;
|
|
1199
1212
|
}
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1213
|
+
headers(withBody) {
|
|
1214
|
+
const headers = {
|
|
1215
|
+
Accept: "application/json",
|
|
1216
|
+
"X-API-Key": this.apiKey
|
|
1217
|
+
};
|
|
1218
|
+
if (withBody) {
|
|
1219
|
+
headers["Content-Type"] = "application/json";
|
|
1220
|
+
}
|
|
1221
|
+
return headers;
|
|
1222
|
+
}
|
|
1223
|
+
request(method, path, body, params) {
|
|
1206
1224
|
return __async(this, null, function* () {
|
|
1207
1225
|
const url = new URL(`/api/ehr/${this.provider}${path}`, this.baseUrl);
|
|
1208
1226
|
if (params) {
|
|
@@ -1213,96 +1231,55 @@ var EhrProviderProxy = class {
|
|
|
1213
1231
|
}
|
|
1214
1232
|
}
|
|
1215
1233
|
const response = yield fetch(url.toString(), {
|
|
1216
|
-
method
|
|
1217
|
-
headers:
|
|
1234
|
+
method,
|
|
1235
|
+
headers: this.headers(body !== void 0),
|
|
1236
|
+
body: body !== void 0 ? JSON.stringify(body) : void 0
|
|
1218
1237
|
});
|
|
1219
1238
|
if (!response.ok) {
|
|
1220
|
-
throw new EhrProxyError(this.provider,
|
|
1239
|
+
throw new EhrProxyError(this.provider, method, path, response.status);
|
|
1221
1240
|
}
|
|
1222
1241
|
return yield response.json();
|
|
1223
1242
|
});
|
|
1224
1243
|
}
|
|
1225
1244
|
/**
|
|
1226
|
-
*
|
|
1245
|
+
* GET request to the EHR proxy.
|
|
1246
|
+
* @param path — path relative to the provider root (e.g., "/patients/123/")
|
|
1247
|
+
* @param params — optional query parameters
|
|
1227
1248
|
*/
|
|
1249
|
+
get(path, params) {
|
|
1250
|
+
return __async(this, null, function* () {
|
|
1251
|
+
return this.request("GET", path, void 0, params);
|
|
1252
|
+
});
|
|
1253
|
+
}
|
|
1254
|
+
/** POST request to the EHR proxy. */
|
|
1228
1255
|
post(path, body) {
|
|
1229
1256
|
return __async(this, null, function* () {
|
|
1230
|
-
|
|
1231
|
-
const response = yield fetch(url, {
|
|
1232
|
-
method: "POST",
|
|
1233
|
-
headers: {
|
|
1234
|
-
"Content-Type": "application/json",
|
|
1235
|
-
Accept: "application/json"
|
|
1236
|
-
},
|
|
1237
|
-
body: body !== void 0 ? JSON.stringify(body) : void 0
|
|
1238
|
-
});
|
|
1239
|
-
if (!response.ok) {
|
|
1240
|
-
throw new EhrProxyError(this.provider, "POST", path, response.status);
|
|
1241
|
-
}
|
|
1242
|
-
return yield response.json();
|
|
1257
|
+
return this.request("POST", path, body);
|
|
1243
1258
|
});
|
|
1244
1259
|
}
|
|
1245
|
-
/**
|
|
1246
|
-
* PUT request to the EHR proxy.
|
|
1247
|
-
*/
|
|
1260
|
+
/** PUT request to the EHR proxy. */
|
|
1248
1261
|
put(path, body) {
|
|
1249
1262
|
return __async(this, null, function* () {
|
|
1250
|
-
|
|
1251
|
-
const response = yield fetch(url, {
|
|
1252
|
-
method: "PUT",
|
|
1253
|
-
headers: {
|
|
1254
|
-
"Content-Type": "application/json",
|
|
1255
|
-
Accept: "application/json"
|
|
1256
|
-
},
|
|
1257
|
-
body: body !== void 0 ? JSON.stringify(body) : void 0
|
|
1258
|
-
});
|
|
1259
|
-
if (!response.ok) {
|
|
1260
|
-
throw new EhrProxyError(this.provider, "PUT", path, response.status);
|
|
1261
|
-
}
|
|
1262
|
-
return yield response.json();
|
|
1263
|
+
return this.request("PUT", path, body);
|
|
1263
1264
|
});
|
|
1264
1265
|
}
|
|
1265
|
-
/**
|
|
1266
|
-
* PATCH request to the EHR proxy.
|
|
1267
|
-
*/
|
|
1266
|
+
/** PATCH request to the EHR proxy. */
|
|
1268
1267
|
patch(path, body) {
|
|
1269
1268
|
return __async(this, null, function* () {
|
|
1270
|
-
|
|
1271
|
-
const response = yield fetch(url, {
|
|
1272
|
-
method: "PATCH",
|
|
1273
|
-
headers: {
|
|
1274
|
-
"Content-Type": "application/json",
|
|
1275
|
-
Accept: "application/json"
|
|
1276
|
-
},
|
|
1277
|
-
body: body !== void 0 ? JSON.stringify(body) : void 0
|
|
1278
|
-
});
|
|
1279
|
-
if (!response.ok) {
|
|
1280
|
-
throw new EhrProxyError(this.provider, "PATCH", path, response.status);
|
|
1281
|
-
}
|
|
1282
|
-
return yield response.json();
|
|
1269
|
+
return this.request("PATCH", path, body);
|
|
1283
1270
|
});
|
|
1284
1271
|
}
|
|
1285
|
-
/**
|
|
1286
|
-
* DELETE request to the EHR proxy.
|
|
1287
|
-
*/
|
|
1272
|
+
/** DELETE request to the EHR proxy. */
|
|
1288
1273
|
delete(path) {
|
|
1289
1274
|
return __async(this, null, function* () {
|
|
1290
|
-
|
|
1291
|
-
const response = yield fetch(url, {
|
|
1292
|
-
method: "DELETE",
|
|
1293
|
-
headers: { Accept: "application/json" }
|
|
1294
|
-
});
|
|
1295
|
-
if (!response.ok) {
|
|
1296
|
-
throw new EhrProxyError(this.provider, "DELETE", path, response.status);
|
|
1297
|
-
}
|
|
1298
|
-
return yield response.json();
|
|
1275
|
+
return this.request("DELETE", path);
|
|
1299
1276
|
});
|
|
1300
1277
|
}
|
|
1301
1278
|
};
|
|
1302
1279
|
var EhrResource = class {
|
|
1303
|
-
constructor(apiBaseUrl) {
|
|
1304
|
-
this.elation = new EhrProviderProxy(apiBaseUrl, "elation");
|
|
1305
|
-
this.hint = new EhrProviderProxy(apiBaseUrl, "hint");
|
|
1280
|
+
constructor(apiBaseUrl, apiKey) {
|
|
1281
|
+
this.elation = new EhrProviderProxy(apiBaseUrl, "elation", apiKey);
|
|
1282
|
+
this.hint = new EhrProviderProxy(apiBaseUrl, "hint", apiKey);
|
|
1306
1283
|
}
|
|
1307
1284
|
};
|
|
1308
1285
|
var EhrProxyError = class extends Error {
|
|
@@ -2253,7 +2230,7 @@ var TruthClient = class {
|
|
|
2253
2230
|
const apiUrl = this.tracker.apiUrl;
|
|
2254
2231
|
this.patients = new PatientResource(this.convex);
|
|
2255
2232
|
this.appointments = new AppointmentResource(this.convex);
|
|
2256
|
-
this.ehr = new EhrResource(apiUrl);
|
|
2233
|
+
this.ehr = new EhrResource(apiUrl, config.apiKey);
|
|
2257
2234
|
this.messages = new MessagesResource(apiUrl, config.apiKey);
|
|
2258
2235
|
this.reminders = new RemindersResource(this.convex);
|
|
2259
2236
|
this.translation = new TranslationResource(apiUrl, config.apiKey);
|