@hipnation-truth/sdk 0.26.14 → 0.26.16

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 CHANGED
@@ -949,8 +949,14 @@ declare class PatientDetailsResource {
949
949
  interface Patient {
950
950
  /** Truth platform patient ID */
951
951
  id: string;
952
- /** Elation EHR patient ID (if linked) */
953
- elationId?: string;
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
- /** Elation EHR patient ID (if linked) */
953
- elationId?: string;
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
@@ -1376,6 +1376,34 @@ var PatientDetailsResource = class {
1376
1376
  }
1377
1377
  };
1378
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
+
1379
1407
  // src/resources/patients.ts
1380
1408
  var PatientResource = class {
1381
1409
  constructor(convexClient) {
@@ -1401,13 +1429,21 @@ var PatientResource = class {
1401
1429
  }
1402
1430
  /**
1403
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.
1404
1436
  */
1405
1437
  getByElationId(elationId) {
1406
1438
  return __async(this, null, function* () {
1439
+ const id = toBigIntElationId(elationId);
1440
+ if (id === void 0) {
1441
+ return null;
1442
+ }
1407
1443
  try {
1408
1444
  const result = yield this.convex.query(
1409
1445
  "patients:getByElationId",
1410
- { elationId }
1446
+ { elationId: id }
1411
1447
  );
1412
1448
  return result != null ? result : null;
1413
1449
  } catch (e) {