@hipnation-truth/sdk 0.26.14 → 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.mjs CHANGED
@@ -1311,6 +1311,34 @@ var PatientDetailsResource = class {
1311
1311
  }
1312
1312
  };
1313
1313
 
1314
+ // src/react/elation-id.ts
1315
+ function toBigIntElationId(value) {
1316
+ if (value === void 0 || value === null || value === "") {
1317
+ return void 0;
1318
+ }
1319
+ if (typeof value === "bigint") {
1320
+ return value;
1321
+ }
1322
+ if (typeof value === "number") {
1323
+ if (!Number.isFinite(value) || !Number.isInteger(value)) {
1324
+ return void 0;
1325
+ }
1326
+ return BigInt(Math.trunc(value));
1327
+ }
1328
+ if (typeof value === "string") {
1329
+ const trimmed = value.trim();
1330
+ if (!/^\d+$/.test(trimmed)) {
1331
+ return void 0;
1332
+ }
1333
+ try {
1334
+ return BigInt(trimmed);
1335
+ } catch (e) {
1336
+ return void 0;
1337
+ }
1338
+ }
1339
+ return void 0;
1340
+ }
1341
+
1314
1342
  // src/resources/patients.ts
1315
1343
  var PatientResource = class {
1316
1344
  constructor(convexClient) {
@@ -1336,13 +1364,21 @@ var PatientResource = class {
1336
1364
  }
1337
1365
  /**
1338
1366
  * Get a patient by their Elation EHR ID.
1367
+ *
1368
+ * Accepts the id in any form (string/number/bigint) and coerces it to a
1369
+ * `bigint` (int64) for the now-int64 Convex `patients:getByElationId` arg.
1370
+ * Returns `null` for a non-numeric / absent id.
1339
1371
  */
1340
1372
  getByElationId(elationId) {
1341
1373
  return __async(this, null, function* () {
1374
+ const id = toBigIntElationId(elationId);
1375
+ if (id === void 0) {
1376
+ return null;
1377
+ }
1342
1378
  try {
1343
1379
  const result = yield this.convex.query(
1344
1380
  "patients:getByElationId",
1345
- { elationId }
1381
+ { elationId: id }
1346
1382
  );
1347
1383
  return result != null ? result : null;
1348
1384
  } catch (e) {