@hipnation-truth/sdk 0.2.0 → 0.3.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
@@ -65,6 +65,7 @@ interface AppointmentListOptions {
65
65
  declare const ENVIRONMENTS: {
66
66
  readonly local: "local";
67
67
  readonly staging: "staging";
68
+ readonly stg: "stg";
68
69
  readonly sandbox: "sandbox";
69
70
  readonly uat: "uat";
70
71
  readonly production: "production";
@@ -446,6 +447,37 @@ declare class PatientDetailsResource {
446
447
  getMedical(elationId: string): Promise<PatientMedicalDetailsResult>;
447
448
  }
448
449
 
450
+ /**
451
+ * PhysiciansResource — Convex-backed physician lookups.
452
+ *
453
+ * Populated from Elation by Truth's daily PhysiciansBackfillCron. Replaces
454
+ * per-physician Elation HTTP hops with a single Convex batch query.
455
+ */
456
+
457
+ interface Physician {
458
+ _id: string;
459
+ elationId: number;
460
+ firstName?: string;
461
+ lastName?: string;
462
+ npi?: string;
463
+ credentials?: string;
464
+ specialties?: string[];
465
+ practice?: number;
466
+ email?: string;
467
+ phone?: string;
468
+ lastSyncedAt: string;
469
+ }
470
+ declare class PhysiciansResource {
471
+ private readonly convex;
472
+ constructor(convex: ConvexHttpClient);
473
+ /**
474
+ * Resolve a batch of physicians by Elation IDs. Missing ids are dropped.
475
+ */
476
+ getByElationIds(ids: number[]): Promise<Physician[]>;
477
+ getByElationId(id: number): Promise<Physician | null>;
478
+ listByPractice(practice: number, limit?: number): Promise<Physician[]>;
479
+ }
480
+
449
481
  /**
450
482
  * Patient interfaces for the Truth SDK.
451
483
  */
@@ -1066,6 +1098,8 @@ declare class TruthClient {
1066
1098
  readonly attachments: AttachmentsResource;
1067
1099
  /** Notes — push formatted notes to Elation */
1068
1100
  readonly notes: NotesResource;
1101
+ /** Physicians (Convex-backed cache from Elation) */
1102
+ readonly physicians: PhysiciansResource;
1069
1103
  private readonly convex;
1070
1104
  private readonly tracker;
1071
1105
  constructor(config: TruthClientConfig);
@@ -1193,4 +1227,4 @@ declare class Tracker {
1193
1227
  private registerShutdownHooks;
1194
1228
  }
1195
1229
 
1196
- 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 };
1230
+ 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
@@ -65,6 +65,7 @@ interface AppointmentListOptions {
65
65
  declare const ENVIRONMENTS: {
66
66
  readonly local: "local";
67
67
  readonly staging: "staging";
68
+ readonly stg: "stg";
68
69
  readonly sandbox: "sandbox";
69
70
  readonly uat: "uat";
70
71
  readonly production: "production";
@@ -446,6 +447,37 @@ declare class PatientDetailsResource {
446
447
  getMedical(elationId: string): Promise<PatientMedicalDetailsResult>;
447
448
  }
448
449
 
450
+ /**
451
+ * PhysiciansResource — Convex-backed physician lookups.
452
+ *
453
+ * Populated from Elation by Truth's daily PhysiciansBackfillCron. Replaces
454
+ * per-physician Elation HTTP hops with a single Convex batch query.
455
+ */
456
+
457
+ interface Physician {
458
+ _id: string;
459
+ elationId: number;
460
+ firstName?: string;
461
+ lastName?: string;
462
+ npi?: string;
463
+ credentials?: string;
464
+ specialties?: string[];
465
+ practice?: number;
466
+ email?: string;
467
+ phone?: string;
468
+ lastSyncedAt: string;
469
+ }
470
+ declare class PhysiciansResource {
471
+ private readonly convex;
472
+ constructor(convex: ConvexHttpClient);
473
+ /**
474
+ * Resolve a batch of physicians by Elation IDs. Missing ids are dropped.
475
+ */
476
+ getByElationIds(ids: number[]): Promise<Physician[]>;
477
+ getByElationId(id: number): Promise<Physician | null>;
478
+ listByPractice(practice: number, limit?: number): Promise<Physician[]>;
479
+ }
480
+
449
481
  /**
450
482
  * Patient interfaces for the Truth SDK.
451
483
  */
@@ -1066,6 +1098,8 @@ declare class TruthClient {
1066
1098
  readonly attachments: AttachmentsResource;
1067
1099
  /** Notes — push formatted notes to Elation */
1068
1100
  readonly notes: NotesResource;
1101
+ /** Physicians (Convex-backed cache from Elation) */
1102
+ readonly physicians: PhysiciansResource;
1069
1103
  private readonly convex;
1070
1104
  private readonly tracker;
1071
1105
  constructor(config: TruthClientConfig);
@@ -1193,4 +1227,4 @@ declare class Tracker {
1193
1227
  private registerShutdownHooks;
1194
1228
  }
1195
1229
 
1196
- 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 };
1230
+ 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,
@@ -680,6 +681,58 @@ var PatientDetailsResource = class {
680
681
  }
681
682
  };
682
683
 
684
+ // src/resources/physicians.ts
685
+ var PhysiciansResource = class {
686
+ constructor(convex) {
687
+ this.convex = convex;
688
+ }
689
+ /**
690
+ * Resolve a batch of physicians by Elation IDs. Missing ids are dropped.
691
+ */
692
+ getByElationIds(ids) {
693
+ return __async(this, null, function* () {
694
+ if (ids.length === 0) {
695
+ return [];
696
+ }
697
+ try {
698
+ const rows = yield this.convex.query(
699
+ "physicians:getByElationIds",
700
+ { ids }
701
+ );
702
+ return rows != null ? rows : [];
703
+ } catch (e) {
704
+ return [];
705
+ }
706
+ });
707
+ }
708
+ getByElationId(id) {
709
+ return __async(this, null, function* () {
710
+ try {
711
+ const row = yield this.convex.query(
712
+ "physicians:getByElationId",
713
+ { id }
714
+ );
715
+ return row != null ? row : null;
716
+ } catch (e) {
717
+ return null;
718
+ }
719
+ });
720
+ }
721
+ listByPractice(practice, limit) {
722
+ return __async(this, null, function* () {
723
+ try {
724
+ const rows = yield this.convex.query(
725
+ "physicians:listByPractice",
726
+ { practice, limit }
727
+ );
728
+ return rows != null ? rows : [];
729
+ } catch (e) {
730
+ return [];
731
+ }
732
+ });
733
+ }
734
+ };
735
+
683
736
  // src/resources/patients.ts
684
737
  var PatientResource = class {
685
738
  constructor(convexClient) {
@@ -968,8 +1021,9 @@ function generateUuidV7() {
968
1021
  var API_URLS = {
969
1022
  local: "http://localhost:3000",
970
1023
  staging: "https://app.sandbox.communication-hub.com",
1024
+ stg: "https://app.sandbox.communication-hub.com",
971
1025
  sandbox: "https://app.sandbox.communication-hub.com",
972
- uat: "https://app.sandbox.communication-hub.com",
1026
+ uat: "https://app.truth.communication-hub.com",
973
1027
  production: "https://app.truth.communication-hub.com"
974
1028
  };
975
1029
  var DEFAULT_BATCH_SIZE = 25;
@@ -1131,8 +1185,9 @@ function sleep(ms) {
1131
1185
  var CONVEX_URLS = {
1132
1186
  local: "https://courteous-duck-623.convex.cloud",
1133
1187
  staging: "https://courteous-duck-623.convex.cloud",
1188
+ stg: "https://courteous-duck-623.convex.cloud",
1134
1189
  sandbox: "https://courteous-duck-623.convex.cloud",
1135
- uat: "https://courteous-duck-623.convex.cloud",
1190
+ uat: "https://gallant-gecko-217.convex.cloud",
1136
1191
  production: "https://gallant-gecko-217.convex.cloud"
1137
1192
  };
1138
1193
  var TruthClient = class {
@@ -1165,6 +1220,7 @@ var TruthClient = class {
1165
1220
  this.convex
1166
1221
  );
1167
1222
  this.notes = new NotesResource(apiUrl, config.apiKey);
1223
+ this.physicians = new PhysiciansResource(this.convex);
1168
1224
  }
1169
1225
  /**
1170
1226
  * The resolved Truth API base URL for this environment.
@@ -1298,6 +1354,7 @@ var EVENT_TYPES = {
1298
1354
  var ENVIRONMENTS = {
1299
1355
  local: "local",
1300
1356
  staging: "staging",
1357
+ stg: "stg",
1301
1358
  sandbox: "sandbox",
1302
1359
  uat: "uat",
1303
1360
  production: "production"
@@ -1325,6 +1382,7 @@ var ENVIRONMENTS = {
1325
1382
  PatientDetailsError,
1326
1383
  PatientDetailsResource,
1327
1384
  PatientResource,
1385
+ PhysiciansResource,
1328
1386
  REMINDER_EVENTS,
1329
1387
  RemindersResource,
1330
1388
  SECURITY_EVENTS,