@hipnation-truth/sdk 0.2.1 → 0.4.0

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
@@ -445,6 +445,20 @@ declare class PatientDetailsResource {
445
445
  get(input: PatientDetailsInput): Promise<PatientDetailsResult>;
446
446
  getBasic(input: PatientDetailsInput): Promise<PatientBasicDetailsResult>;
447
447
  getMedical(elationId: string): Promise<PatientMedicalDetailsResult>;
448
+ /**
449
+ * Trigger a server-side refresh of the patient's Elation medical
450
+ * records (medications, problems, allergies, appointments) into the
451
+ * Convex cache. Fire-and-forget — the UI should read via the Convex-
452
+ * reactive `usePatientMedical` hook.
453
+ */
454
+ refreshMedical(elationId: number): Promise<{
455
+ totals: {
456
+ medications: number;
457
+ problems: number;
458
+ allergies: number;
459
+ appointments: number;
460
+ };
461
+ }>;
448
462
  }
449
463
 
450
464
  /**
@@ -519,6 +533,37 @@ declare class PatientResource {
519
533
  list(options?: PatientListOptions): Promise<PaginatedResult<Patient>>;
520
534
  }
521
535
 
536
+ /**
537
+ * PhysiciansResource — Convex-backed physician lookups.
538
+ *
539
+ * Populated from Elation by Truth's daily PhysiciansBackfillCron. Replaces
540
+ * per-physician Elation HTTP hops with a single Convex batch query.
541
+ */
542
+
543
+ interface Physician {
544
+ _id: string;
545
+ elationId: number;
546
+ firstName?: string;
547
+ lastName?: string;
548
+ npi?: string;
549
+ credentials?: string;
550
+ specialties?: string[];
551
+ practice?: number;
552
+ email?: string;
553
+ phone?: string;
554
+ lastSyncedAt: string;
555
+ }
556
+ declare class PhysiciansResource {
557
+ private readonly convex;
558
+ constructor(convex: ConvexHttpClient);
559
+ /**
560
+ * Resolve a batch of physicians by Elation IDs. Missing ids are dropped.
561
+ */
562
+ getByElationIds(ids: number[]): Promise<Physician[]>;
563
+ getByElationId(id: number): Promise<Physician | null>;
564
+ listByPractice(practice: number, limit?: number): Promise<Physician[]>;
565
+ }
566
+
522
567
  /**
523
568
  * Reminder types — scheduled conversation reminders.
524
569
  */
@@ -1067,6 +1112,8 @@ declare class TruthClient {
1067
1112
  readonly attachments: AttachmentsResource;
1068
1113
  /** Notes — push formatted notes to Elation */
1069
1114
  readonly notes: NotesResource;
1115
+ /** Physicians (Convex-backed cache from Elation) */
1116
+ readonly physicians: PhysiciansResource;
1070
1117
  private readonly convex;
1071
1118
  private readonly tracker;
1072
1119
  constructor(config: TruthClientConfig);
@@ -1194,4 +1241,4 @@ declare class Tracker {
1194
1241
  private registerShutdownHooks;
1195
1242
  }
1196
1243
 
1197
- export { AUTH_EVENTS, type ActorContext, type Appointment, type AppointmentListOptions, AppointmentResource, type Attachment, AttachmentsError, AttachmentsResource, type AuthEventType, type AuthLoginFailedPayload, type AuthLoginSucceededPayload, CALL_EVENTS, CONVERSATION_EVENTS, type CallConnectedPayload, type CallEndedPayload, type CallEventType, type CallInitiatedPayload, type CallMissedPayload, type CallStatusResponse, type ConversationAttachmentDownloadedPayload, type ConversationAttachmentUploadedPayload, type ConversationCreatedPayload, type ConversationEventType, type ConversationMarkedReadPayload, type ConversationMessageReceivedPayload, type ConversationMessageSentPayload, type CreateTaskInput, type CreateUploadUrlInput, type CreateUploadUrlResult, type DetectionResult, type DialpadNumberInfo, DialpadProxyError, DialpadResource, type DialpadUser, ENVIRONMENTS, EVENT_TYPES, EhrProviderProxy, EhrProxyError, EhrResource, type Environment, type EventActor, type EventCompliance, type EventEnvelope, type EventPayloadMap, type EventSubject, type EventType, type GetDownloadUrlResult, type InitiateCallResponse, MessagesResource, NOTIFICATION_EVENTS, type NonVisitNoteBullet, NotesError, NotesResource, type NotificationDeliveredPayload, type NotificationEventType, type NotificationOpenedPayload, type NotificationSentPayload, PROVIDER_EVENTS, type PaginatedResult, type Patient, type PatientBasicDetailsResult, PatientDetailsError, type PatientDetailsInput, PatientDetailsResource, type PatientDetailsResult, type PatientListOptions, type PatientMedicalDetailsResult, PatientResource, type ProviderEventType, type ProviderSyncFailedPayload, type ProviderSyncStartedPayload, type ProviderSyncSucceededPayload, type PushNoteToElationInput, type PushNoteToElationResult, REMINDER_EVENTS, type RecordAttachmentInput, type Reminder, type ReminderEventType, type ReminderScheduledPayload, type ReminderStatus, type ReminderTriggeredPayload, RemindersResource, SECURITY_EVENTS, type ScheduleReminderInput, type ScheduleReminderResult, type SecurityAccessDeniedPayload, type SecurityEventType, type SendSmsParams, type SendSmsResponse, TASK_EVENTS, TRANSLATION_EVENTS, type Task, type TaskAssignedPayload, type TaskCreatedPayload, type TaskEventType, type TaskStatus, type TaskStatusChangedPayload, TasksResource, type TrackOptions, Tracker, type TranslateBatchInput, type TranslateTextInput, type TranslationCompletedPayload, TranslationError, type TranslationEventType, type TranslationRequestedPayload, TranslationResource, type TranslationResult, TruthClient, type TruthClientConfig, type UpdateTaskStatusInput, type VoicemailAuthResponse, generateUuidV7 };
1244
+ export { AUTH_EVENTS, type ActorContext, type Appointment, type AppointmentListOptions, AppointmentResource, type Attachment, AttachmentsError, AttachmentsResource, type AuthEventType, type AuthLoginFailedPayload, type AuthLoginSucceededPayload, CALL_EVENTS, CONVERSATION_EVENTS, type CallConnectedPayload, type CallEndedPayload, type CallEventType, type CallInitiatedPayload, type CallMissedPayload, type CallStatusResponse, type ConversationAttachmentDownloadedPayload, type ConversationAttachmentUploadedPayload, type ConversationCreatedPayload, type ConversationEventType, type ConversationMarkedReadPayload, type ConversationMessageReceivedPayload, type ConversationMessageSentPayload, type CreateTaskInput, type CreateUploadUrlInput, type CreateUploadUrlResult, type DetectionResult, type DialpadNumberInfo, DialpadProxyError, DialpadResource, type DialpadUser, ENVIRONMENTS, EVENT_TYPES, EhrProviderProxy, EhrProxyError, EhrResource, type Environment, type EventActor, type EventCompliance, type EventEnvelope, type EventPayloadMap, type EventSubject, type EventType, type GetDownloadUrlResult, type InitiateCallResponse, MessagesResource, NOTIFICATION_EVENTS, type NonVisitNoteBullet, NotesError, NotesResource, type NotificationDeliveredPayload, type NotificationEventType, type NotificationOpenedPayload, type NotificationSentPayload, PROVIDER_EVENTS, type PaginatedResult, type Patient, type PatientBasicDetailsResult, PatientDetailsError, type PatientDetailsInput, PatientDetailsResource, type PatientDetailsResult, type PatientListOptions, type PatientMedicalDetailsResult, PatientResource, type Physician, PhysiciansResource, type ProviderEventType, type ProviderSyncFailedPayload, type ProviderSyncStartedPayload, type ProviderSyncSucceededPayload, type PushNoteToElationInput, type PushNoteToElationResult, REMINDER_EVENTS, type RecordAttachmentInput, type Reminder, type ReminderEventType, type ReminderScheduledPayload, type ReminderStatus, type ReminderTriggeredPayload, RemindersResource, SECURITY_EVENTS, type ScheduleReminderInput, type ScheduleReminderResult, type SecurityAccessDeniedPayload, type SecurityEventType, type SendSmsParams, type SendSmsResponse, TASK_EVENTS, TRANSLATION_EVENTS, type Task, type TaskAssignedPayload, type TaskCreatedPayload, type TaskEventType, type TaskStatus, type TaskStatusChangedPayload, TasksResource, type TrackOptions, Tracker, type TranslateBatchInput, type TranslateTextInput, type TranslationCompletedPayload, TranslationError, type TranslationEventType, type TranslationRequestedPayload, TranslationResource, type TranslationResult, TruthClient, type TruthClientConfig, type UpdateTaskStatusInput, type VoicemailAuthResponse, generateUuidV7 };
package/dist/index.d.ts CHANGED
@@ -445,6 +445,20 @@ declare class PatientDetailsResource {
445
445
  get(input: PatientDetailsInput): Promise<PatientDetailsResult>;
446
446
  getBasic(input: PatientDetailsInput): Promise<PatientBasicDetailsResult>;
447
447
  getMedical(elationId: string): Promise<PatientMedicalDetailsResult>;
448
+ /**
449
+ * Trigger a server-side refresh of the patient's Elation medical
450
+ * records (medications, problems, allergies, appointments) into the
451
+ * Convex cache. Fire-and-forget — the UI should read via the Convex-
452
+ * reactive `usePatientMedical` hook.
453
+ */
454
+ refreshMedical(elationId: number): Promise<{
455
+ totals: {
456
+ medications: number;
457
+ problems: number;
458
+ allergies: number;
459
+ appointments: number;
460
+ };
461
+ }>;
448
462
  }
449
463
 
450
464
  /**
@@ -519,6 +533,37 @@ declare class PatientResource {
519
533
  list(options?: PatientListOptions): Promise<PaginatedResult<Patient>>;
520
534
  }
521
535
 
536
+ /**
537
+ * PhysiciansResource — Convex-backed physician lookups.
538
+ *
539
+ * Populated from Elation by Truth's daily PhysiciansBackfillCron. Replaces
540
+ * per-physician Elation HTTP hops with a single Convex batch query.
541
+ */
542
+
543
+ interface Physician {
544
+ _id: string;
545
+ elationId: number;
546
+ firstName?: string;
547
+ lastName?: string;
548
+ npi?: string;
549
+ credentials?: string;
550
+ specialties?: string[];
551
+ practice?: number;
552
+ email?: string;
553
+ phone?: string;
554
+ lastSyncedAt: string;
555
+ }
556
+ declare class PhysiciansResource {
557
+ private readonly convex;
558
+ constructor(convex: ConvexHttpClient);
559
+ /**
560
+ * Resolve a batch of physicians by Elation IDs. Missing ids are dropped.
561
+ */
562
+ getByElationIds(ids: number[]): Promise<Physician[]>;
563
+ getByElationId(id: number): Promise<Physician | null>;
564
+ listByPractice(practice: number, limit?: number): Promise<Physician[]>;
565
+ }
566
+
522
567
  /**
523
568
  * Reminder types — scheduled conversation reminders.
524
569
  */
@@ -1067,6 +1112,8 @@ declare class TruthClient {
1067
1112
  readonly attachments: AttachmentsResource;
1068
1113
  /** Notes — push formatted notes to Elation */
1069
1114
  readonly notes: NotesResource;
1115
+ /** Physicians (Convex-backed cache from Elation) */
1116
+ readonly physicians: PhysiciansResource;
1070
1117
  private readonly convex;
1071
1118
  private readonly tracker;
1072
1119
  constructor(config: TruthClientConfig);
@@ -1194,4 +1241,4 @@ declare class Tracker {
1194
1241
  private registerShutdownHooks;
1195
1242
  }
1196
1243
 
1197
- export { AUTH_EVENTS, type ActorContext, type Appointment, type AppointmentListOptions, AppointmentResource, type Attachment, AttachmentsError, AttachmentsResource, type AuthEventType, type AuthLoginFailedPayload, type AuthLoginSucceededPayload, CALL_EVENTS, CONVERSATION_EVENTS, type CallConnectedPayload, type CallEndedPayload, type CallEventType, type CallInitiatedPayload, type CallMissedPayload, type CallStatusResponse, type ConversationAttachmentDownloadedPayload, type ConversationAttachmentUploadedPayload, type ConversationCreatedPayload, type ConversationEventType, type ConversationMarkedReadPayload, type ConversationMessageReceivedPayload, type ConversationMessageSentPayload, type CreateTaskInput, type CreateUploadUrlInput, type CreateUploadUrlResult, type DetectionResult, type DialpadNumberInfo, DialpadProxyError, DialpadResource, type DialpadUser, ENVIRONMENTS, EVENT_TYPES, EhrProviderProxy, EhrProxyError, EhrResource, type Environment, type EventActor, type EventCompliance, type EventEnvelope, type EventPayloadMap, type EventSubject, type EventType, type GetDownloadUrlResult, type InitiateCallResponse, MessagesResource, NOTIFICATION_EVENTS, type NonVisitNoteBullet, NotesError, NotesResource, type NotificationDeliveredPayload, type NotificationEventType, type NotificationOpenedPayload, type NotificationSentPayload, PROVIDER_EVENTS, type PaginatedResult, type Patient, type PatientBasicDetailsResult, PatientDetailsError, type PatientDetailsInput, PatientDetailsResource, type PatientDetailsResult, type PatientListOptions, type PatientMedicalDetailsResult, PatientResource, type ProviderEventType, type ProviderSyncFailedPayload, type ProviderSyncStartedPayload, type ProviderSyncSucceededPayload, type PushNoteToElationInput, type PushNoteToElationResult, REMINDER_EVENTS, type RecordAttachmentInput, type Reminder, type ReminderEventType, type ReminderScheduledPayload, type ReminderStatus, type ReminderTriggeredPayload, RemindersResource, SECURITY_EVENTS, type ScheduleReminderInput, type ScheduleReminderResult, type SecurityAccessDeniedPayload, type SecurityEventType, type SendSmsParams, type SendSmsResponse, TASK_EVENTS, TRANSLATION_EVENTS, type Task, type TaskAssignedPayload, type TaskCreatedPayload, type TaskEventType, type TaskStatus, type TaskStatusChangedPayload, TasksResource, type TrackOptions, Tracker, type TranslateBatchInput, type TranslateTextInput, type TranslationCompletedPayload, TranslationError, type TranslationEventType, type TranslationRequestedPayload, TranslationResource, type TranslationResult, TruthClient, type TruthClientConfig, type UpdateTaskStatusInput, type VoicemailAuthResponse, generateUuidV7 };
1244
+ export { AUTH_EVENTS, type ActorContext, type Appointment, type AppointmentListOptions, AppointmentResource, type Attachment, AttachmentsError, AttachmentsResource, type AuthEventType, type AuthLoginFailedPayload, type AuthLoginSucceededPayload, CALL_EVENTS, CONVERSATION_EVENTS, type CallConnectedPayload, type CallEndedPayload, type CallEventType, type CallInitiatedPayload, type CallMissedPayload, type CallStatusResponse, type ConversationAttachmentDownloadedPayload, type ConversationAttachmentUploadedPayload, type ConversationCreatedPayload, type ConversationEventType, type ConversationMarkedReadPayload, type ConversationMessageReceivedPayload, type ConversationMessageSentPayload, type CreateTaskInput, type CreateUploadUrlInput, type CreateUploadUrlResult, type DetectionResult, type DialpadNumberInfo, DialpadProxyError, DialpadResource, type DialpadUser, ENVIRONMENTS, EVENT_TYPES, EhrProviderProxy, EhrProxyError, EhrResource, type Environment, type EventActor, type EventCompliance, type EventEnvelope, type EventPayloadMap, type EventSubject, type EventType, type GetDownloadUrlResult, type InitiateCallResponse, MessagesResource, NOTIFICATION_EVENTS, type NonVisitNoteBullet, NotesError, NotesResource, type NotificationDeliveredPayload, type NotificationEventType, type NotificationOpenedPayload, type NotificationSentPayload, PROVIDER_EVENTS, type PaginatedResult, type Patient, type PatientBasicDetailsResult, PatientDetailsError, type PatientDetailsInput, PatientDetailsResource, type PatientDetailsResult, type PatientListOptions, type PatientMedicalDetailsResult, PatientResource, type Physician, PhysiciansResource, type ProviderEventType, type ProviderSyncFailedPayload, type ProviderSyncStartedPayload, type ProviderSyncSucceededPayload, type PushNoteToElationInput, type PushNoteToElationResult, REMINDER_EVENTS, type RecordAttachmentInput, type Reminder, type ReminderEventType, type ReminderScheduledPayload, type ReminderStatus, type ReminderTriggeredPayload, RemindersResource, SECURITY_EVENTS, type ScheduleReminderInput, type ScheduleReminderResult, type SecurityAccessDeniedPayload, type SecurityEventType, type SendSmsParams, type SendSmsResponse, TASK_EVENTS, TRANSLATION_EVENTS, type Task, type TaskAssignedPayload, type TaskCreatedPayload, type TaskEventType, type TaskStatus, type TaskStatusChangedPayload, TasksResource, type TrackOptions, Tracker, type TranslateBatchInput, type TranslateTextInput, type TranslationCompletedPayload, TranslationError, type TranslationEventType, type TranslationRequestedPayload, TranslationResource, type TranslationResult, TruthClient, type TruthClientConfig, type UpdateTaskStatusInput, type VoicemailAuthResponse, generateUuidV7 };
package/dist/index.js CHANGED
@@ -76,6 +76,7 @@ __export(src_exports, {
76
76
  PatientDetailsError: () => PatientDetailsError,
77
77
  PatientDetailsResource: () => PatientDetailsResource,
78
78
  PatientResource: () => PatientResource,
79
+ PhysiciansResource: () => PhysiciansResource,
79
80
  REMINDER_EVENTS: () => REMINDER_EVENTS,
80
81
  RemindersResource: () => RemindersResource,
81
82
  SECURITY_EVENTS: () => SECURITY_EVENTS,
@@ -678,6 +679,17 @@ var PatientDetailsResource = class {
678
679
  );
679
680
  });
680
681
  }
682
+ /**
683
+ * Trigger a server-side refresh of the patient's Elation medical
684
+ * records (medications, problems, allergies, appointments) into the
685
+ * Convex cache. Fire-and-forget — the UI should read via the Convex-
686
+ * reactive `usePatientMedical` hook.
687
+ */
688
+ refreshMedical(elationId) {
689
+ return __async(this, null, function* () {
690
+ return yield this.post("/patients/medical/refresh", { elationId });
691
+ });
692
+ }
681
693
  };
682
694
 
683
695
  // src/resources/patients.ts
@@ -760,6 +772,58 @@ var PatientResource = class {
760
772
  }
761
773
  };
762
774
 
775
+ // src/resources/physicians.ts
776
+ var PhysiciansResource = class {
777
+ constructor(convex) {
778
+ this.convex = convex;
779
+ }
780
+ /**
781
+ * Resolve a batch of physicians by Elation IDs. Missing ids are dropped.
782
+ */
783
+ getByElationIds(ids) {
784
+ return __async(this, null, function* () {
785
+ if (ids.length === 0) {
786
+ return [];
787
+ }
788
+ try {
789
+ const rows = yield this.convex.query(
790
+ "physicians:getByElationIds",
791
+ { ids }
792
+ );
793
+ return rows != null ? rows : [];
794
+ } catch (e) {
795
+ return [];
796
+ }
797
+ });
798
+ }
799
+ getByElationId(id) {
800
+ return __async(this, null, function* () {
801
+ try {
802
+ const row = yield this.convex.query(
803
+ "physicians:getByElationId",
804
+ { id }
805
+ );
806
+ return row != null ? row : null;
807
+ } catch (e) {
808
+ return null;
809
+ }
810
+ });
811
+ }
812
+ listByPractice(practice, limit) {
813
+ return __async(this, null, function* () {
814
+ try {
815
+ const rows = yield this.convex.query(
816
+ "physicians:listByPractice",
817
+ { practice, limit }
818
+ );
819
+ return rows != null ? rows : [];
820
+ } catch (e) {
821
+ return [];
822
+ }
823
+ });
824
+ }
825
+ };
826
+
763
827
  // src/resources/reminders.ts
764
828
  var RemindersResource = class {
765
829
  constructor(convexClient) {
@@ -1167,6 +1231,7 @@ var TruthClient = class {
1167
1231
  this.convex
1168
1232
  );
1169
1233
  this.notes = new NotesResource(apiUrl, config.apiKey);
1234
+ this.physicians = new PhysiciansResource(this.convex);
1170
1235
  }
1171
1236
  /**
1172
1237
  * The resolved Truth API base URL for this environment.
@@ -1328,6 +1393,7 @@ var ENVIRONMENTS = {
1328
1393
  PatientDetailsError,
1329
1394
  PatientDetailsResource,
1330
1395
  PatientResource,
1396
+ PhysiciansResource,
1331
1397
  REMINDER_EVENTS,
1332
1398
  RemindersResource,
1333
1399
  SECURITY_EVENTS,