@hipnation-truth/sdk 0.26.13 → 0.26.15
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 +13 -3
- package/dist/index.d.ts +13 -3
- package/dist/index.js +44 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -3
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.ts +19 -5
- package/dist/react.js +58 -18
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -949,8 +949,14 @@ declare class PatientDetailsResource {
|
|
|
949
949
|
interface Patient {
|
|
950
950
|
/** Truth platform patient ID */
|
|
951
951
|
id: string;
|
|
952
|
-
/**
|
|
953
|
-
|
|
952
|
+
/**
|
|
953
|
+
* Elation EHR patient ID (if linked).
|
|
954
|
+
*
|
|
955
|
+
* `bigint | string` during the int64 normalization transition: Convex stores
|
|
956
|
+
* the normalized int64 (a JS `bigint` over the wire) or a legacy string.
|
|
957
|
+
* Render via `String(elationId)` / `.toString()`.
|
|
958
|
+
*/
|
|
959
|
+
elationId?: string | bigint;
|
|
954
960
|
/** Hint EHR patient ID (if linked) */
|
|
955
961
|
hintId?: string;
|
|
956
962
|
/** Patient first name */
|
|
@@ -1000,8 +1006,12 @@ declare class PatientResource {
|
|
|
1000
1006
|
get(id: string): Promise<Patient | null>;
|
|
1001
1007
|
/**
|
|
1002
1008
|
* Get a patient by their Elation EHR ID.
|
|
1009
|
+
*
|
|
1010
|
+
* Accepts the id in any form (string/number/bigint) and coerces it to a
|
|
1011
|
+
* `bigint` (int64) for the now-int64 Convex `patients:getByElationId` arg.
|
|
1012
|
+
* Returns `null` for a non-numeric / absent id.
|
|
1003
1013
|
*/
|
|
1004
|
-
getByElationId(elationId: string): Promise<Patient | null>;
|
|
1014
|
+
getByElationId(elationId: string | number | bigint): Promise<Patient | null>;
|
|
1005
1015
|
/**
|
|
1006
1016
|
* Get a patient by their Hint EHR ID.
|
|
1007
1017
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -949,8 +949,14 @@ declare class PatientDetailsResource {
|
|
|
949
949
|
interface Patient {
|
|
950
950
|
/** Truth platform patient ID */
|
|
951
951
|
id: string;
|
|
952
|
-
/**
|
|
953
|
-
|
|
952
|
+
/**
|
|
953
|
+
* Elation EHR patient ID (if linked).
|
|
954
|
+
*
|
|
955
|
+
* `bigint | string` during the int64 normalization transition: Convex stores
|
|
956
|
+
* the normalized int64 (a JS `bigint` over the wire) or a legacy string.
|
|
957
|
+
* Render via `String(elationId)` / `.toString()`.
|
|
958
|
+
*/
|
|
959
|
+
elationId?: string | bigint;
|
|
954
960
|
/** Hint EHR patient ID (if linked) */
|
|
955
961
|
hintId?: string;
|
|
956
962
|
/** Patient first name */
|
|
@@ -1000,8 +1006,12 @@ declare class PatientResource {
|
|
|
1000
1006
|
get(id: string): Promise<Patient | null>;
|
|
1001
1007
|
/**
|
|
1002
1008
|
* Get a patient by their Elation EHR ID.
|
|
1009
|
+
*
|
|
1010
|
+
* Accepts the id in any form (string/number/bigint) and coerces it to a
|
|
1011
|
+
* `bigint` (int64) for the now-int64 Convex `patients:getByElationId` arg.
|
|
1012
|
+
* Returns `null` for a non-numeric / absent id.
|
|
1003
1013
|
*/
|
|
1004
|
-
getByElationId(elationId: string): Promise<Patient | null>;
|
|
1014
|
+
getByElationId(elationId: string | number | bigint): Promise<Patient | null>;
|
|
1005
1015
|
/**
|
|
1006
1016
|
* Get a patient by their Hint EHR ID.
|
|
1007
1017
|
*/
|
package/dist/index.js
CHANGED
|
@@ -205,6 +205,11 @@ var REQUIRE_TOKEN_RETRY_DELAY_MS = 150;
|
|
|
205
205
|
function delay(ms) {
|
|
206
206
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
207
207
|
}
|
|
208
|
+
var USER_TOKEN_HEADER = "X-Truth-Authorization";
|
|
209
|
+
function setUserToken(headers, token) {
|
|
210
|
+
headers.Authorization = `Bearer ${token}`;
|
|
211
|
+
headers[USER_TOKEN_HEADER] = `Bearer ${token}`;
|
|
212
|
+
}
|
|
208
213
|
function resolveAuthToken(getAuthToken) {
|
|
209
214
|
return __async(this, null, function* () {
|
|
210
215
|
try {
|
|
@@ -235,7 +240,7 @@ function buildAuthHeaders(auth, options) {
|
|
|
235
240
|
for (let attempt = 0; attempt < REQUIRE_TOKEN_MAX_ATTEMPTS; attempt++) {
|
|
236
241
|
const token = yield resolveAuthToken(auth.getAuthToken);
|
|
237
242
|
if (token) {
|
|
238
|
-
headers
|
|
243
|
+
setUserToken(headers, token);
|
|
239
244
|
return headers;
|
|
240
245
|
}
|
|
241
246
|
if (attempt < REQUIRE_TOKEN_MAX_ATTEMPTS - 1) {
|
|
@@ -249,7 +254,7 @@ function buildAuthHeaders(auth, options) {
|
|
|
249
254
|
if (auth.getAuthToken) {
|
|
250
255
|
const token = yield resolveAuthToken(auth.getAuthToken);
|
|
251
256
|
if (token) {
|
|
252
|
-
headers
|
|
257
|
+
setUserToken(headers, token);
|
|
253
258
|
}
|
|
254
259
|
}
|
|
255
260
|
return headers;
|
|
@@ -1371,6 +1376,34 @@ var PatientDetailsResource = class {
|
|
|
1371
1376
|
}
|
|
1372
1377
|
};
|
|
1373
1378
|
|
|
1379
|
+
// src/react/elation-id.ts
|
|
1380
|
+
function toBigIntElationId(value) {
|
|
1381
|
+
if (value === void 0 || value === null || value === "") {
|
|
1382
|
+
return void 0;
|
|
1383
|
+
}
|
|
1384
|
+
if (typeof value === "bigint") {
|
|
1385
|
+
return value;
|
|
1386
|
+
}
|
|
1387
|
+
if (typeof value === "number") {
|
|
1388
|
+
if (!Number.isFinite(value) || !Number.isInteger(value)) {
|
|
1389
|
+
return void 0;
|
|
1390
|
+
}
|
|
1391
|
+
return BigInt(Math.trunc(value));
|
|
1392
|
+
}
|
|
1393
|
+
if (typeof value === "string") {
|
|
1394
|
+
const trimmed = value.trim();
|
|
1395
|
+
if (!/^\d+$/.test(trimmed)) {
|
|
1396
|
+
return void 0;
|
|
1397
|
+
}
|
|
1398
|
+
try {
|
|
1399
|
+
return BigInt(trimmed);
|
|
1400
|
+
} catch (e) {
|
|
1401
|
+
return void 0;
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
return void 0;
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1374
1407
|
// src/resources/patients.ts
|
|
1375
1408
|
var PatientResource = class {
|
|
1376
1409
|
constructor(convexClient) {
|
|
@@ -1396,13 +1429,21 @@ var PatientResource = class {
|
|
|
1396
1429
|
}
|
|
1397
1430
|
/**
|
|
1398
1431
|
* Get a patient by their Elation EHR ID.
|
|
1432
|
+
*
|
|
1433
|
+
* Accepts the id in any form (string/number/bigint) and coerces it to a
|
|
1434
|
+
* `bigint` (int64) for the now-int64 Convex `patients:getByElationId` arg.
|
|
1435
|
+
* Returns `null` for a non-numeric / absent id.
|
|
1399
1436
|
*/
|
|
1400
1437
|
getByElationId(elationId) {
|
|
1401
1438
|
return __async(this, null, function* () {
|
|
1439
|
+
const id = toBigIntElationId(elationId);
|
|
1440
|
+
if (id === void 0) {
|
|
1441
|
+
return null;
|
|
1442
|
+
}
|
|
1402
1443
|
try {
|
|
1403
1444
|
const result = yield this.convex.query(
|
|
1404
1445
|
"patients:getByElationId",
|
|
1405
|
-
{ elationId }
|
|
1446
|
+
{ elationId: id }
|
|
1406
1447
|
);
|
|
1407
1448
|
return result != null ? result : null;
|
|
1408
1449
|
} catch (e) {
|