@hipnation-truth/sdk 0.25.3 → 0.26.1

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
@@ -202,8 +202,9 @@ declare class AttachmentsError extends Error {
202
202
  declare class AttachmentsResource {
203
203
  private readonly baseUrl;
204
204
  private readonly apiKey;
205
+ private readonly auth;
205
206
  private readonly convex;
206
- constructor(apiBaseUrl: string, apiKey: string, convexClient: ConvexHttpClient);
207
+ constructor(apiBaseUrl: string, apiKey: string, convexClient: ConvexHttpClient, getAuthToken?: AuthTokenFetcher);
207
208
  private post;
208
209
  createUploadUrl(input: CreateUploadUrlInput): Promise<CreateUploadUrlResult>;
209
210
  getDownloadUrl(s3Key: string, expiresIn?: number): Promise<GetDownloadUrlResult>;
@@ -239,19 +240,6 @@ declare class AttachmentsResource {
239
240
  }>;
240
241
  }
241
242
 
242
- /**
243
- * ConversationsResource — write methods that hang off a specific
244
- * conversation: notes, tasks, outbound messages.
245
- *
246
- * Replaces CommHub's `truthConversationApi.ts` raw-fetch wrappers so
247
- * the frontend goes through a typed SDK surface instead of building
248
- * URLs by hand.
249
- *
250
- * All methods proxy the matching oRPC procedures (`/conversations/*`)
251
- * via Truth's application-key auth. Errors surface as
252
- * `ConversationsError` with a status code so callers can distinguish
253
- * transport failures (status=0) from API rejections (status>=400).
254
- */
255
243
  /** Address a conversation by either Convex `_id` or the phonePair. */
256
244
  interface ConversationAddress {
257
245
  conversationId?: string;
@@ -383,8 +371,9 @@ declare class ConversationsResource {
383
371
  private static readonly REQUEST_TIMEOUT_MS;
384
372
  private readonly baseUrl;
385
373
  private readonly apiKey;
374
+ private readonly auth;
386
375
  private readonly convex;
387
- constructor(apiBaseUrl: string, apiKey: string, convex?: convex_browser.ConvexHttpClient);
376
+ constructor(apiBaseUrl: string, apiKey: string, convex?: convex_browser.ConvexHttpClient, getAuthToken?: AuthTokenFetcher);
388
377
  /**
389
378
  * Mark a conversation read for the calling user (zeroes unreadCount,
390
379
  * stamps `lastReadAt`). Calls the public Convex `markRead` mutation
@@ -436,6 +425,7 @@ declare class ConversationsResource {
436
425
  * const url = await truth.messages.dialpad.authenticateVoicemail(voicemailLink);
437
426
  * ```
438
427
  */
428
+
439
429
  interface SendSmsParams {
440
430
  from_number: string;
441
431
  to_number: string;
@@ -475,7 +465,8 @@ interface VoicemailAuthResponse {
475
465
  declare class DialpadResource {
476
466
  private readonly baseUrl;
477
467
  private readonly apiKey;
478
- constructor(apiBaseUrl: string, apiKey: string);
468
+ private readonly auth;
469
+ constructor(apiBaseUrl: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
479
470
  /**
480
471
  * Send an SMS or MMS message via Dialpad.
481
472
  */
@@ -540,7 +531,8 @@ declare class MessagesResource {
540
531
  readonly dialpad: DialpadResource;
541
532
  private readonly baseUrl;
542
533
  private readonly apiKey;
543
- constructor(apiBaseUrl: string, apiKey: string);
534
+ private readonly auth;
535
+ constructor(apiBaseUrl: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
544
536
  /**
545
537
  * Get an authenticated URL for a Dialpad voicemail recording.
546
538
  *
@@ -592,12 +584,12 @@ declare class DialpadProxyError extends Error {
592
584
  * const hintPatient = await truth.ehr.hint.get('/provider/patients/456');
593
585
  * ```
594
586
  */
587
+
595
588
  declare class EhrProviderProxy {
596
589
  private readonly baseUrl;
597
590
  private readonly provider;
598
- private readonly apiKey;
599
- constructor(apiBaseUrl: string, provider: string, apiKey: string);
600
- private headers;
591
+ private readonly auth;
592
+ constructor(apiBaseUrl: string, provider: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
601
593
  private request;
602
594
  /**
603
595
  * GET request to the EHR proxy.
@@ -619,7 +611,7 @@ declare class EhrResource {
619
611
  readonly elation: EhrProviderProxy;
620
612
  /** Hint Health proxy */
621
613
  readonly hint: EhrProviderProxy;
622
- constructor(apiBaseUrl: string, apiKey: string);
614
+ constructor(apiBaseUrl: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
623
615
  }
624
616
  declare class EhrProxyError extends Error {
625
617
  readonly provider: string;
@@ -636,6 +628,7 @@ declare class EhrProxyError extends Error {
636
628
  * OAuth token and the HTTP call so applications can drop Elation
637
629
  * credentials from their own config.
638
630
  */
631
+
639
632
  interface NonVisitNoteBullet {
640
633
  text: string;
641
634
  category?: string;
@@ -684,7 +677,8 @@ interface PushConversationToElationResult {
684
677
  declare class NotesResource {
685
678
  private readonly baseUrl;
686
679
  private readonly apiKey;
687
- constructor(apiBaseUrl: string, apiKey: string);
680
+ private readonly auth;
681
+ constructor(apiBaseUrl: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
688
682
  /** 30s upstream timeout — Elation API has occasional slow hops; we
689
683
  * don't want a pending mutation to hold the UI thread indefinitely. */
690
684
  private static readonly REQUEST_TIMEOUT_MS;
@@ -714,6 +708,7 @@ declare class NotesResource {
714
708
  * Client-side React usage lives in `@hipnation-truth/sdk/react` via
715
709
  * the `useNotifications` hook which mirrors `expo-notifications`.
716
710
  */
711
+
717
712
  type NotificationPlatform = "ios" | "android" | "web";
718
713
  interface RegisterDeviceInput {
719
714
  userId: string;
@@ -828,7 +823,8 @@ declare class NotificationsError extends Error {
828
823
  declare class NotificationsResource {
829
824
  private readonly baseUrl;
830
825
  private readonly apiKey;
831
- constructor(apiBaseUrl: string, apiKey: string);
826
+ private readonly auth;
827
+ constructor(apiBaseUrl: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
832
828
  private post;
833
829
  private get;
834
830
  private delete;
@@ -886,6 +882,7 @@ declare class NotificationsResource {
886
882
  * X-API-Key. Replaces CommHub's getPatientDetails / getPatientBasicDetails
887
883
  * / getPatientMedicalDetails actions.
888
884
  */
885
+
889
886
  interface PatientDetailsInput {
890
887
  hintId?: string;
891
888
  elationId?: string;
@@ -912,7 +909,8 @@ declare class PatientDetailsError extends Error {
912
909
  declare class PatientDetailsResource {
913
910
  private readonly baseUrl;
914
911
  private readonly apiKey;
915
- constructor(apiBaseUrl: string, apiKey: string);
912
+ private readonly auth;
913
+ constructor(apiBaseUrl: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
916
914
  private post;
917
915
  get(input: PatientDetailsInput): Promise<PatientDetailsResult>;
918
916
  getBasic(input: PatientDetailsInput): Promise<PatientBasicDetailsResult>;
@@ -1213,7 +1211,8 @@ declare class TranslationError extends Error {
1213
1211
  declare class TranslationResource {
1214
1212
  private readonly baseUrl;
1215
1213
  private readonly apiKey;
1216
- constructor(apiBaseUrl: string, apiKey: string);
1214
+ private readonly auth;
1215
+ constructor(apiBaseUrl: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
1217
1216
  private post;
1218
1217
  translate(input: TranslateTextInput): Promise<TranslationResult>;
1219
1218
  translateBatch(input: TranslateBatchInput): Promise<TranslationResult[]>;
package/dist/index.d.ts CHANGED
@@ -202,8 +202,9 @@ declare class AttachmentsError extends Error {
202
202
  declare class AttachmentsResource {
203
203
  private readonly baseUrl;
204
204
  private readonly apiKey;
205
+ private readonly auth;
205
206
  private readonly convex;
206
- constructor(apiBaseUrl: string, apiKey: string, convexClient: ConvexHttpClient);
207
+ constructor(apiBaseUrl: string, apiKey: string, convexClient: ConvexHttpClient, getAuthToken?: AuthTokenFetcher);
207
208
  private post;
208
209
  createUploadUrl(input: CreateUploadUrlInput): Promise<CreateUploadUrlResult>;
209
210
  getDownloadUrl(s3Key: string, expiresIn?: number): Promise<GetDownloadUrlResult>;
@@ -239,19 +240,6 @@ declare class AttachmentsResource {
239
240
  }>;
240
241
  }
241
242
 
242
- /**
243
- * ConversationsResource — write methods that hang off a specific
244
- * conversation: notes, tasks, outbound messages.
245
- *
246
- * Replaces CommHub's `truthConversationApi.ts` raw-fetch wrappers so
247
- * the frontend goes through a typed SDK surface instead of building
248
- * URLs by hand.
249
- *
250
- * All methods proxy the matching oRPC procedures (`/conversations/*`)
251
- * via Truth's application-key auth. Errors surface as
252
- * `ConversationsError` with a status code so callers can distinguish
253
- * transport failures (status=0) from API rejections (status>=400).
254
- */
255
243
  /** Address a conversation by either Convex `_id` or the phonePair. */
256
244
  interface ConversationAddress {
257
245
  conversationId?: string;
@@ -383,8 +371,9 @@ declare class ConversationsResource {
383
371
  private static readonly REQUEST_TIMEOUT_MS;
384
372
  private readonly baseUrl;
385
373
  private readonly apiKey;
374
+ private readonly auth;
386
375
  private readonly convex;
387
- constructor(apiBaseUrl: string, apiKey: string, convex?: convex_browser.ConvexHttpClient);
376
+ constructor(apiBaseUrl: string, apiKey: string, convex?: convex_browser.ConvexHttpClient, getAuthToken?: AuthTokenFetcher);
388
377
  /**
389
378
  * Mark a conversation read for the calling user (zeroes unreadCount,
390
379
  * stamps `lastReadAt`). Calls the public Convex `markRead` mutation
@@ -436,6 +425,7 @@ declare class ConversationsResource {
436
425
  * const url = await truth.messages.dialpad.authenticateVoicemail(voicemailLink);
437
426
  * ```
438
427
  */
428
+
439
429
  interface SendSmsParams {
440
430
  from_number: string;
441
431
  to_number: string;
@@ -475,7 +465,8 @@ interface VoicemailAuthResponse {
475
465
  declare class DialpadResource {
476
466
  private readonly baseUrl;
477
467
  private readonly apiKey;
478
- constructor(apiBaseUrl: string, apiKey: string);
468
+ private readonly auth;
469
+ constructor(apiBaseUrl: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
479
470
  /**
480
471
  * Send an SMS or MMS message via Dialpad.
481
472
  */
@@ -540,7 +531,8 @@ declare class MessagesResource {
540
531
  readonly dialpad: DialpadResource;
541
532
  private readonly baseUrl;
542
533
  private readonly apiKey;
543
- constructor(apiBaseUrl: string, apiKey: string);
534
+ private readonly auth;
535
+ constructor(apiBaseUrl: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
544
536
  /**
545
537
  * Get an authenticated URL for a Dialpad voicemail recording.
546
538
  *
@@ -592,12 +584,12 @@ declare class DialpadProxyError extends Error {
592
584
  * const hintPatient = await truth.ehr.hint.get('/provider/patients/456');
593
585
  * ```
594
586
  */
587
+
595
588
  declare class EhrProviderProxy {
596
589
  private readonly baseUrl;
597
590
  private readonly provider;
598
- private readonly apiKey;
599
- constructor(apiBaseUrl: string, provider: string, apiKey: string);
600
- private headers;
591
+ private readonly auth;
592
+ constructor(apiBaseUrl: string, provider: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
601
593
  private request;
602
594
  /**
603
595
  * GET request to the EHR proxy.
@@ -619,7 +611,7 @@ declare class EhrResource {
619
611
  readonly elation: EhrProviderProxy;
620
612
  /** Hint Health proxy */
621
613
  readonly hint: EhrProviderProxy;
622
- constructor(apiBaseUrl: string, apiKey: string);
614
+ constructor(apiBaseUrl: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
623
615
  }
624
616
  declare class EhrProxyError extends Error {
625
617
  readonly provider: string;
@@ -636,6 +628,7 @@ declare class EhrProxyError extends Error {
636
628
  * OAuth token and the HTTP call so applications can drop Elation
637
629
  * credentials from their own config.
638
630
  */
631
+
639
632
  interface NonVisitNoteBullet {
640
633
  text: string;
641
634
  category?: string;
@@ -684,7 +677,8 @@ interface PushConversationToElationResult {
684
677
  declare class NotesResource {
685
678
  private readonly baseUrl;
686
679
  private readonly apiKey;
687
- constructor(apiBaseUrl: string, apiKey: string);
680
+ private readonly auth;
681
+ constructor(apiBaseUrl: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
688
682
  /** 30s upstream timeout — Elation API has occasional slow hops; we
689
683
  * don't want a pending mutation to hold the UI thread indefinitely. */
690
684
  private static readonly REQUEST_TIMEOUT_MS;
@@ -714,6 +708,7 @@ declare class NotesResource {
714
708
  * Client-side React usage lives in `@hipnation-truth/sdk/react` via
715
709
  * the `useNotifications` hook which mirrors `expo-notifications`.
716
710
  */
711
+
717
712
  type NotificationPlatform = "ios" | "android" | "web";
718
713
  interface RegisterDeviceInput {
719
714
  userId: string;
@@ -828,7 +823,8 @@ declare class NotificationsError extends Error {
828
823
  declare class NotificationsResource {
829
824
  private readonly baseUrl;
830
825
  private readonly apiKey;
831
- constructor(apiBaseUrl: string, apiKey: string);
826
+ private readonly auth;
827
+ constructor(apiBaseUrl: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
832
828
  private post;
833
829
  private get;
834
830
  private delete;
@@ -886,6 +882,7 @@ declare class NotificationsResource {
886
882
  * X-API-Key. Replaces CommHub's getPatientDetails / getPatientBasicDetails
887
883
  * / getPatientMedicalDetails actions.
888
884
  */
885
+
889
886
  interface PatientDetailsInput {
890
887
  hintId?: string;
891
888
  elationId?: string;
@@ -912,7 +909,8 @@ declare class PatientDetailsError extends Error {
912
909
  declare class PatientDetailsResource {
913
910
  private readonly baseUrl;
914
911
  private readonly apiKey;
915
- constructor(apiBaseUrl: string, apiKey: string);
912
+ private readonly auth;
913
+ constructor(apiBaseUrl: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
916
914
  private post;
917
915
  get(input: PatientDetailsInput): Promise<PatientDetailsResult>;
918
916
  getBasic(input: PatientDetailsInput): Promise<PatientBasicDetailsResult>;
@@ -1213,7 +1211,8 @@ declare class TranslationError extends Error {
1213
1211
  declare class TranslationResource {
1214
1212
  private readonly baseUrl;
1215
1213
  private readonly apiKey;
1216
- constructor(apiBaseUrl: string, apiKey: string);
1214
+ private readonly auth;
1215
+ constructor(apiBaseUrl: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
1217
1216
  private post;
1218
1217
  translate(input: TranslateTextInput): Promise<TranslationResult>;
1219
1218
  translateBatch(input: TranslateBatchInput): Promise<TranslationResult[]>;