@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/react.d.ts CHANGED
@@ -191,6 +191,17 @@ interface ConversationTaskForUserRow extends ConversationTaskRow {
191
191
  * `seenBy.includes(userId)` to derive the per-user boolean.
192
192
  */
193
193
  seenBy: string[];
194
+ /** Persisted archive state (replaces the dropped Hasura `is_archived`). */
195
+ archived: boolean;
196
+ /** ISO timestamp the task was archived, else null. */
197
+ archivedAt: string | null;
198
+ /**
199
+ * Email of whoever made the most recent change (create / status / priority /
200
+ * assignment / archive). The task-notification surfaces read this to SKIP
201
+ * self-changes — the Convex-native replacement for the legacy Hasura
202
+ * `*_changed_by` attribution.
203
+ */
204
+ lastChangeBy: string | null;
194
205
  /**
195
206
  * Which backend table the task lives in:
196
207
  * - `"conversation"` — `conversationTasks`, tied to a conversation.
@@ -522,8 +533,12 @@ declare function usePatients(options?: UsePatientListOptions): any;
522
533
  declare function usePatient(id: string): any;
523
534
  /**
524
535
  * Subscribe to a patient by their Elation ID.
536
+ *
537
+ * Accepts the id in any form (string/number/bigint) and coerces it to a
538
+ * `bigint` (int64) for the now-int64 Convex `patients:getByElationId` arg.
539
+ * Returns `null` (skip) for a non-numeric / absent id.
525
540
  */
526
- declare function usePatientByElationId(elationId: string): any;
541
+ declare function usePatientByElationId(elationId: string | number | bigint): any;
527
542
  /**
528
543
  * Subscribe to a patient by their Hint ID.
529
544
  */
@@ -943,7 +958,7 @@ interface FamilyMemberRow {
943
958
  _creationTime: number;
944
959
  firstName: string;
945
960
  lastName: string;
946
- elationId?: string;
961
+ elationId?: string | bigint;
947
962
  hintId?: string;
948
963
  familyId?: string;
949
964
  phones: Array<{
@@ -1108,8 +1123,14 @@ declare function usePatientSearch(options: UsePatientSearchOptions): UseQueryRes
1108
1123
  interface Patient {
1109
1124
  /** Truth platform patient ID */
1110
1125
  id: string;
1111
- /** Elation EHR patient ID (if linked) */
1112
- elationId?: string;
1126
+ /**
1127
+ * Elation EHR patient ID (if linked).
1128
+ *
1129
+ * `bigint | string` during the int64 normalization transition: Convex stores
1130
+ * the normalized int64 (a JS `bigint` over the wire) or a legacy string.
1131
+ * Render via `String(elationId)` / `.toString()`.
1132
+ */
1133
+ elationId?: string | bigint;
1113
1134
  /** Hint EHR patient ID (if linked) */
1114
1135
  hintId?: string;
1115
1136
  /** Patient first name */
@@ -2084,8 +2105,12 @@ declare class PatientResource {
2084
2105
  get(id: string): Promise<Patient | null>;
2085
2106
  /**
2086
2107
  * Get a patient by their Elation EHR ID.
2108
+ *
2109
+ * Accepts the id in any form (string/number/bigint) and coerces it to a
2110
+ * `bigint` (int64) for the now-int64 Convex `patients:getByElationId` arg.
2111
+ * Returns `null` for a non-numeric / absent id.
2087
2112
  */
2088
- getByElationId(elationId: string): Promise<Patient | null>;
2113
+ getByElationId(elationId: string | number | bigint): Promise<Patient | null>;
2089
2114
  /**
2090
2115
  * Get a patient by their Hint EHR ID.
2091
2116
  */
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,