@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/react.d.ts CHANGED
@@ -522,8 +522,12 @@ declare function usePatients(options?: UsePatientListOptions): any;
522
522
  declare function usePatient(id: string): any;
523
523
  /**
524
524
  * Subscribe to a patient by their Elation ID.
525
+ *
526
+ * Accepts the id in any form (string/number/bigint) and coerces it to a
527
+ * `bigint` (int64) for the now-int64 Convex `patients:getByElationId` arg.
528
+ * Returns `null` (skip) for a non-numeric / absent id.
525
529
  */
526
- declare function usePatientByElationId(elationId: string): any;
530
+ declare function usePatientByElationId(elationId: string | number | bigint): any;
527
531
  /**
528
532
  * Subscribe to a patient by their Hint ID.
529
533
  */
@@ -943,7 +947,7 @@ interface FamilyMemberRow {
943
947
  _creationTime: number;
944
948
  firstName: string;
945
949
  lastName: string;
946
- elationId?: string;
950
+ elationId?: string | bigint;
947
951
  hintId?: string;
948
952
  familyId?: string;
949
953
  phones: Array<{
@@ -1108,8 +1112,14 @@ declare function usePatientSearch(options: UsePatientSearchOptions): UseQueryRes
1108
1112
  interface Patient {
1109
1113
  /** Truth platform patient ID */
1110
1114
  id: string;
1111
- /** Elation EHR patient ID (if linked) */
1112
- elationId?: string;
1115
+ /**
1116
+ * Elation EHR patient ID (if linked).
1117
+ *
1118
+ * `bigint | string` during the int64 normalization transition: Convex stores
1119
+ * the normalized int64 (a JS `bigint` over the wire) or a legacy string.
1120
+ * Render via `String(elationId)` / `.toString()`.
1121
+ */
1122
+ elationId?: string | bigint;
1113
1123
  /** Hint EHR patient ID (if linked) */
1114
1124
  hintId?: string;
1115
1125
  /** Patient first name */
@@ -2084,8 +2094,12 @@ declare class PatientResource {
2084
2094
  get(id: string): Promise<Patient | null>;
2085
2095
  /**
2086
2096
  * Get a patient by their Elation EHR ID.
2097
+ *
2098
+ * Accepts the id in any form (string/number/bigint) and coerces it to a
2099
+ * `bigint` (int64) for the now-int64 Convex `patients:getByElationId` arg.
2100
+ * Returns `null` for a non-numeric / absent id.
2087
2101
  */
2088
- getByElationId(elationId: string): Promise<Patient | null>;
2102
+ getByElationId(elationId: string | number | bigint): Promise<Patient | null>;
2089
2103
  /**
2090
2104
  * Get a patient by their Hint EHR ID.
2091
2105
  */
package/dist/react.js CHANGED
@@ -1410,6 +1410,41 @@ var PatientDetailsResource = class {
1410
1410
  }
1411
1411
  };
1412
1412
 
1413
+ // src/react/elation-id.ts
1414
+ function toBigIntElationId(value) {
1415
+ if (value === void 0 || value === null || value === "") {
1416
+ return void 0;
1417
+ }
1418
+ if (typeof value === "bigint") {
1419
+ return value;
1420
+ }
1421
+ if (typeof value === "number") {
1422
+ if (!Number.isFinite(value) || !Number.isInteger(value)) {
1423
+ return void 0;
1424
+ }
1425
+ return BigInt(Math.trunc(value));
1426
+ }
1427
+ if (typeof value === "string") {
1428
+ const trimmed = value.trim();
1429
+ if (!/^\d+$/.test(trimmed)) {
1430
+ return void 0;
1431
+ }
1432
+ try {
1433
+ return BigInt(trimmed);
1434
+ } catch (e) {
1435
+ return void 0;
1436
+ }
1437
+ }
1438
+ return void 0;
1439
+ }
1440
+ function toFiniteElationId(value) {
1441
+ if (value === void 0 || value === null || value === "") {
1442
+ return void 0;
1443
+ }
1444
+ const n = typeof value === "number" ? value : Number(value);
1445
+ return Number.isFinite(n) ? n : void 0;
1446
+ }
1447
+
1413
1448
  // src/resources/patients.ts
1414
1449
  var PatientResource = class {
1415
1450
  constructor(convexClient) {
@@ -1435,13 +1470,21 @@ var PatientResource = class {
1435
1470
  }
1436
1471
  /**
1437
1472
  * Get a patient by their Elation EHR ID.
1473
+ *
1474
+ * Accepts the id in any form (string/number/bigint) and coerces it to a
1475
+ * `bigint` (int64) for the now-int64 Convex `patients:getByElationId` arg.
1476
+ * Returns `null` for a non-numeric / absent id.
1438
1477
  */
1439
1478
  getByElationId(elationId) {
1440
1479
  return __async(this, null, function* () {
1480
+ const id = toBigIntElationId(elationId);
1481
+ if (id === void 0) {
1482
+ return null;
1483
+ }
1441
1484
  try {
1442
1485
  const result = yield this.convex.query(
1443
1486
  "patients:getByElationId",
1444
- { elationId }
1487
+ { elationId: id }
1445
1488
  );
1446
1489
  return result != null ? result : null;
1447
1490
  } catch (e) {
@@ -2805,17 +2848,6 @@ function useConversationTasksByPhonePair(phonePair) {
2805
2848
 
2806
2849
  // src/react/hooks.ts
2807
2850
  var import_react5 = require("react");
2808
-
2809
- // src/react/elation-id.ts
2810
- function toFiniteElationId(value) {
2811
- if (value === void 0 || value === null || value === "") {
2812
- return void 0;
2813
- }
2814
- const n = typeof value === "number" ? value : Number(value);
2815
- return Number.isFinite(n) ? n : void 0;
2816
- }
2817
-
2818
- // src/react/hooks.ts
2819
2851
  var import_server5 = require("convex/server");
2820
2852
  var patientsListRef = (0, import_server5.makeFunctionReference)("patients:list");
2821
2853
  var patientsGetRef = (0, import_server5.makeFunctionReference)("patients:get");
@@ -2831,9 +2863,11 @@ function usePatient(id) {
2831
2863
  return usePersistentQuery(patientsGetRef, { id });
2832
2864
  }
2833
2865
  function usePatientByElationId(elationId) {
2834
- return usePersistentQuery(patientsByElationIdRef, {
2835
- elationId
2836
- });
2866
+ const id = toBigIntElationId(elationId);
2867
+ return usePersistentQuery(
2868
+ patientsByElationIdRef,
2869
+ id !== void 0 ? { elationId: id } : "skip"
2870
+ );
2837
2871
  }
2838
2872
  function usePatientByHintId(hintId) {
2839
2873
  return usePersistentQuery(patientsByHintIdRef, {
@@ -2947,9 +2981,10 @@ function usePatientBasic(input, options) {
2947
2981
  const apiKey = (_b = options == null ? void 0 : options.apiKey) != null ? _b : sdkContext == null ? void 0 : sdkContext.apiKey;
2948
2982
  const getAuthToken = sdkContext == null ? void 0 : sdkContext.getAuthToken;
2949
2983
  const elationId = toFiniteElationId(input.elationId);
2984
+ const elationIdBig = toBigIntElationId(input.elationId);
2950
2985
  const elationRow = usePersistentQuery(
2951
2986
  elationPatientByIdRef,
2952
- elationId !== void 0 ? { elationId } : "skip"
2987
+ elationIdBig !== void 0 ? { elationId: elationIdBig } : "skip"
2953
2988
  );
2954
2989
  const hintRow = usePersistentQuery(
2955
2990
  hintPatientByIdRef,