@hipnation-truth/sdk 0.27.0 → 0.28.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.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as convex_browser from 'convex/browser';
2
2
  import { ConvexHttpClient } from 'convex/browser';
3
3
  import { z } from 'zod';
4
+ import { FunctionReference } from 'convex/server';
4
5
 
5
6
  /**
6
7
  * Appointment interfaces for the Truth SDK.
@@ -247,6 +248,349 @@ declare class AttachmentsResource {
247
248
  }>;
248
249
  }
249
250
 
251
+ /**
252
+ * CareInboxResource — care-team shared-mailbox email (T12).
253
+ *
254
+ * Writes go through the Truth oRPC `careInbox` router (all
255
+ * `verifiedUserProcedure`, so every call REQUIRES the user JWT):
256
+ * - `linkMessage` POST /api/care-inbox/link
257
+ * - `unlinkMessage` POST /api/care-inbox/unlink
258
+ * - `replyToThread` POST /api/care-inbox/outbound/thread-reply
259
+ * - `composeEmail` POST /api/care-inbox/outbound/compose
260
+ * Reads are Convex queries; use the hooks in `@hipnation-truth/sdk/react`
261
+ * (`useEmailThreads`, …) or `createCareInboxSource`. Nothing here is
262
+ * persisted offline.
263
+ *
264
+ * Two type layers:
265
+ * - `*View` types are the raw Convex query payloads (nullable where the
266
+ * stored row can lack a value).
267
+ * - The contract types (`EmailMessage`, `EmailThreadSummary`, `ThreadPage`,
268
+ * …) mirror comhub's `lib/email/careInboxSource.ts` exactly. `to*`
269
+ * projections turn views into contract shapes: a missing string becomes
270
+ * "" and a missing participant `{ address: "", name: null }` because the
271
+ * contract declares those fields non-null.
272
+ *
273
+ * Errors: every rejection is a `CareInboxError` whose `code` is the comhub
274
+ * `CareInboxErrorCode`, so it satisfies comhub's `Error & { code }` contract
275
+ * as-is. `status` (0 = no HTTP response), `rpcCode` (oRPC / transport code),
276
+ * `reason` and `detail` carry the server detail. `toCareInboxError()` maps
277
+ * anything thrown — including a Convex `ConvexError` from a hook — onto it.
278
+ */
279
+
280
+ type EmailDirection = "inbound" | "outbound";
281
+ /**
282
+ * Thread-list filter. "unlinked" is served only to triage callers (threads
283
+ * with at least one unlinked message); others get forbidden/not_triage.
284
+ */
285
+ type ThreadListFilter = "all" | "unread" | "unlinked";
286
+ interface EmailMailbox {
287
+ id: string;
288
+ /** Shared mailbox address. "" for non-triage callers (server-redacted). */
289
+ address: string;
290
+ displayName: string;
291
+ }
292
+ interface MailboxAccess {
293
+ mailboxes: EmailMailbox[];
294
+ /** May see Unlinked and link/unlink (admin-only until G-TRIAGE). */
295
+ canTriage: boolean;
296
+ }
297
+ interface EmailParticipant {
298
+ address: string;
299
+ name: string | null;
300
+ }
301
+ interface EmailMessage {
302
+ id: string;
303
+ threadId: string;
304
+ mailboxId: string;
305
+ direction: EmailDirection;
306
+ from: EmailParticipant;
307
+ to: EmailParticipant[];
308
+ subject: string;
309
+ /** Epoch milliseconds. */
310
+ sentAt: number;
311
+ hasAttachments: boolean;
312
+ linkedPatientId: string | null;
313
+ linkedPatientName: string | null;
314
+ /** Always null in build 1 (metadata only). */
315
+ bodyText: string | null;
316
+ }
317
+ interface EmailThreadSummary {
318
+ id: string;
319
+ mailboxId: string;
320
+ subject: string;
321
+ /** Epoch milliseconds of the newest message. */
322
+ lastMessageAt: number;
323
+ lastDirection: EmailDirection;
324
+ counterpart: EmailParticipant;
325
+ messageCount: number;
326
+ unreadCount: number;
327
+ /** Triage callers only; always 0 for staff. */
328
+ unlinkedCount: number;
329
+ linkedPatientName: string | null;
330
+ hasAttachments: boolean;
331
+ }
332
+ interface LinkedPatientContact {
333
+ patientId: string;
334
+ name: string;
335
+ email: string | null;
336
+ phone: string | null;
337
+ office: string | null;
338
+ }
339
+ interface EmailThreadDetail {
340
+ summary: EmailThreadSummary;
341
+ mailbox: EmailMailbox;
342
+ /** Oldest first. */
343
+ messages: EmailMessage[];
344
+ /** Not provided in build 1 (always null). */
345
+ patientContact?: LinkedPatientContact | null;
346
+ }
347
+ interface ListThreadsArgs {
348
+ mailboxId?: string;
349
+ filter?: ThreadListFilter;
350
+ cursor?: string | null;
351
+ /** Server default 25, max 50. */
352
+ limit?: number;
353
+ }
354
+ interface ThreadPage {
355
+ threads: EmailThreadSummary[];
356
+ /** A mailbox-filtered page can be short; keep paging while non-null. */
357
+ nextCursor: string | null;
358
+ }
359
+ interface PatientLinkCandidate {
360
+ patientId: string;
361
+ displayName: string;
362
+ /** Office name when known; never an email address. */
363
+ detail: string | null;
364
+ }
365
+ interface LinkMessageArgs {
366
+ messageId: string;
367
+ patientId: string;
368
+ /**
369
+ * Client idempotency key (8-128 chars of `[A-Za-z0-9_:.-]`). A key the
370
+ * server already recorded for the message is a no-op that returns the
371
+ * current state, so a late retry can never undo a newer unlink.
372
+ */
373
+ requestId: string;
374
+ }
375
+ interface UnlinkMessageArgs {
376
+ messageId: string;
377
+ /** Client idempotency key; see `LinkMessageArgs.requestId`. */
378
+ requestId: string;
379
+ }
380
+ interface LinkResult {
381
+ message: EmailMessage;
382
+ }
383
+ interface SendReplyArgs {
384
+ threadId: string;
385
+ body: string;
386
+ clientRequestId: string;
387
+ }
388
+ interface SendEmailArgs {
389
+ to: string;
390
+ subject: string;
391
+ body: string;
392
+ patientId?: string;
393
+ mailboxId: string;
394
+ clientRequestId: string;
395
+ }
396
+ /** Send is disabled in this build (always rejects forbidden/send_disabled). */
397
+ interface SendResult {
398
+ message: EmailMessage;
399
+ thread: EmailThreadSummary;
400
+ }
401
+ interface MarkReadArgs {
402
+ threadId: string;
403
+ }
404
+ interface MarkReadResult {
405
+ thread: EmailThreadSummary;
406
+ }
407
+ /** comhub `CareInboxErrorCode`. */
408
+ type CareInboxErrorCode = "forbidden" | "not_found" | "offline" | "unavailable" | "validation" | "unknown";
409
+ /** `EmailMailbox` plus the server-derived switches. */
410
+ interface CareInboxMailbox extends EmailMailbox {
411
+ mode: "mirror" | "live";
412
+ /** Live mailbox AND send enabled on the deployment. */
413
+ canSend: boolean;
414
+ /** bodyVisibility !== "none" (bodies still need openThreadBodies). */
415
+ bodyVisible: boolean;
416
+ }
417
+ interface CareInboxMailboxAccess extends MailboxAccess {
418
+ mailboxes: CareInboxMailbox[];
419
+ }
420
+ interface CareInboxThreadDetail extends EmailThreadDetail {
421
+ mailbox: CareInboxMailbox;
422
+ /** Whether `openThreadBodies` would serve bodies to this caller. */
423
+ bodyVisible: boolean;
424
+ patientContact: null;
425
+ }
426
+ /** Triage-only unlinked message page (`listUnlinked`). */
427
+ interface UnlinkedMessagePage {
428
+ messages: EmailMessage[];
429
+ nextCursor: string | null;
430
+ }
431
+ /** Back-compat aliases (T12 names). */
432
+ type CareInboxEmailMessage = EmailMessage;
433
+ type CareInboxEmailThreadSummary = EmailThreadSummary;
434
+ type CareInboxLinkResult = LinkResult;
435
+ type CareInboxSendResult = SendResult;
436
+ /**
437
+ * SDK call input: the contract args with `requestId` optional. Omit it and
438
+ * the SDK generates one for this call; pass your own to make retries across
439
+ * calls idempotent.
440
+ */
441
+ type LinkEmailMessageInput = Omit<LinkMessageArgs, "requestId"> & Partial<Pick<LinkMessageArgs, "requestId">>;
442
+ type UnlinkEmailMessageInput = Omit<UnlinkMessageArgs, "requestId"> & Partial<Pick<UnlinkMessageArgs, "requestId">>;
443
+ type ReplyToEmailThreadInput = SendReplyArgs;
444
+ type ComposeEmailInput = SendEmailArgs;
445
+ type EmailParticipantView = EmailParticipant;
446
+ /** `careInboxQueries` message row. `bodyText` is always null from queries. */
447
+ interface EmailMessageView {
448
+ id: string;
449
+ threadId: string | null;
450
+ mailboxId: string;
451
+ direction: EmailDirection;
452
+ from: EmailParticipantView | null;
453
+ to: EmailParticipantView[];
454
+ subject: string | null;
455
+ sentAt: number;
456
+ hasAttachments: boolean;
457
+ linkedPatientId: string | null;
458
+ linkedPatientName: string | null;
459
+ bodyText: null;
460
+ }
461
+ interface EmailThreadSummaryView {
462
+ id: string;
463
+ mailboxId: string;
464
+ subject: string | null;
465
+ lastMessageAt: number;
466
+ lastDirection: EmailDirection | null;
467
+ counterpart: EmailParticipantView | null;
468
+ messageCount: number;
469
+ unreadCount: number;
470
+ unlinkedCount: number;
471
+ linkedPatientId: string | null;
472
+ linkedPatientName: string | null;
473
+ hasAttachments: boolean;
474
+ }
475
+ interface EmailMailboxView {
476
+ id: string;
477
+ displayName: string;
478
+ mode: "mirror" | "live";
479
+ canSend: boolean;
480
+ bodyVisible: boolean;
481
+ /** Present only when the caller can triage. */
482
+ address?: string;
483
+ }
484
+ interface EmailMailboxAccessView {
485
+ mailboxes: EmailMailboxView[];
486
+ canTriage: boolean;
487
+ }
488
+ /** Filters `listThreadsForUser` serves ("unlinked": triage only). */
489
+ type EmailThreadListFilter = ThreadListFilter;
490
+ interface EmailThreadPageView {
491
+ threads: EmailThreadSummaryView[];
492
+ nextCursor: string | null;
493
+ }
494
+ interface EmailThreadDetailView {
495
+ summary: EmailThreadSummaryView;
496
+ mailbox: EmailMailboxView;
497
+ /** Oldest first. Staff: linked only; triage: linked + unlinked. */
498
+ messages: EmailMessageView[];
499
+ bodyVisible: boolean;
500
+ patientContact: null;
501
+ }
502
+ interface UnlinkedEmailPageView {
503
+ messages: EmailMessageView[];
504
+ nextCursor: string | null;
505
+ }
506
+ type PatientLinkCandidateView = PatientLinkCandidate;
507
+ interface MarkEmailThreadReadResult {
508
+ thread: EmailThreadSummaryView;
509
+ }
510
+ interface EmailThreadBodiesView {
511
+ messages: {
512
+ id: string;
513
+ bodyText: string | null;
514
+ }[];
515
+ }
516
+ declare function toEmailMessage(m: EmailMessageView): EmailMessage;
517
+ /**
518
+ * `lastDirection` is null only for a thread with no visible message (it
519
+ * cannot happen for a summary the server lists; kept defensive). Projects to
520
+ * "inbound".
521
+ */
522
+ declare function toEmailThreadSummary(t: EmailThreadSummaryView): EmailThreadSummary;
523
+ declare function toEmailMailbox(m: EmailMailboxView): CareInboxMailbox;
524
+ declare function toMailboxAccess(a: EmailMailboxAccessView): CareInboxMailboxAccess;
525
+ declare function toEmailThreadDetail(d: EmailThreadDetailView): CareInboxThreadDetail;
526
+ declare function toThreadPage(p: EmailThreadPageView): ThreadPage;
527
+ declare function toUnlinkedMessagePage(p: UnlinkedEmailPageView): UnlinkedMessagePage;
528
+ declare function toMarkReadResult(r: MarkEmailThreadReadResult): MarkReadResult;
529
+ /**
530
+ * Machine-readable sub-code. Server-sent: `send_disabled` | `not_triage` |
531
+ * `body_gated` | `unauthenticated` (Convex: no identity). SDK-derived:
532
+ * `unauthenticated` (no user JWT, or HTTP 401). The contract has no auth
533
+ * code, so `unauthenticated` surfaces as `forbidden` on every path.
534
+ */
535
+ type CareInboxErrorReason = "send_disabled" | "not_triage" | "body_gated" | "unauthenticated";
536
+ interface CareInboxErrorFields {
537
+ /** HTTP status; 0 when there was no HTTP response (incl. Convex errors). */
538
+ status?: number;
539
+ /**
540
+ * oRPC code (`FORBIDDEN`, `NOT_FOUND`, …) or, for status 0, `TRANSPORT`
541
+ * (fetch threw), `TIMEOUT`, `NO_API_KEY`, `NO_USER_TOKEN`.
542
+ */
543
+ rpcCode?: string | null;
544
+ reason?: CareInboxErrorReason | null;
545
+ /** Fixed server marker (e.g. `PATIENT_HAS_NO_OFFICE`), when present. */
546
+ detail?: string | null;
547
+ }
548
+ /**
549
+ * The single care-inbox error. `code` is the comhub `CareInboxErrorCode`, so
550
+ * an instance satisfies comhub's `CareInboxError` (`Error & { code }`). The
551
+ * message never carries content, addresses or ids.
552
+ */
553
+ declare class CareInboxError extends Error {
554
+ readonly code: CareInboxErrorCode;
555
+ readonly status: number;
556
+ readonly rpcCode: string | null;
557
+ readonly reason: CareInboxErrorReason | null;
558
+ readonly detail: string | null;
559
+ constructor(code: CareInboxErrorCode, fields?: CareInboxErrorFields);
560
+ }
561
+ /** True for any value carrying a contract `code` (comhub `isCareInboxError`). */
562
+ declare function isCareInboxError(value: unknown): value is Error & {
563
+ code: CareInboxErrorCode;
564
+ };
565
+ /**
566
+ * Coerce anything thrown by the resource, a care-inbox Convex function
567
+ * (`ConvexError({ code, reason? })`, payload on `.data`) or a comhub-style
568
+ * error into a `CareInboxError`. Never throws; unrecognised → `unknown`.
569
+ */
570
+ declare function toCareInboxError(value: unknown): CareInboxError;
571
+ interface CareInboxErrorInfo {
572
+ code: CareInboxErrorCode;
573
+ reason: CareInboxErrorReason | null;
574
+ }
575
+ /** `{ code, reason }` of anything thrown (see `toCareInboxError`). */
576
+ declare function careInboxErrorInfo(err: unknown): CareInboxErrorInfo;
577
+ declare class CareInboxResource {
578
+ /** 30s upstream timeout — matches ConversationsResource. */
579
+ private static readonly REQUEST_TIMEOUT_MS;
580
+ private readonly baseUrl;
581
+ private readonly auth;
582
+ constructor(apiBaseUrl: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
583
+ /** Link one message to a patient (triage only). */
584
+ linkMessage(input: LinkEmailMessageInput): Promise<LinkResult>;
585
+ /** Undo a manual link (triage only). */
586
+ unlinkMessage(input: UnlinkEmailMessageInput): Promise<LinkResult>;
587
+ /** Reply into a thread. This build always rejects 403 `send_disabled`. */
588
+ replyToThread(input: SendReplyArgs): Promise<SendResult>;
589
+ /** Start a new email. This build always rejects 403 `send_disabled`. */
590
+ composeEmail(input: SendEmailArgs): Promise<SendResult>;
591
+ private post;
592
+ }
593
+
250
594
  /** Address a conversation by either Convex `_id` or the phonePair. */
251
595
  interface ConversationAddress {
252
596
  conversationId?: string;
@@ -403,6 +747,19 @@ declare class ConversationsResource {
403
747
  }): Promise<{
404
748
  updated: true;
405
749
  }>;
750
+ /**
751
+ * Mark / unmark a conversation Urgent (conversation-level, shared by
752
+ * participants). Refused if `userId` is not a participant.
753
+ */
754
+ setUrgent(input: {
755
+ conversationId: string;
756
+ userId: string;
757
+ isUrgent: boolean;
758
+ }): Promise<{
759
+ updated: true;
760
+ isUrgent: boolean;
761
+ changed: boolean;
762
+ }>;
406
763
  /**
407
764
  * Zero unread on every conversation the user has reads for, except
408
765
  * those whose `providerPhone` is in `excludedProviderPhones`.
@@ -634,6 +991,16 @@ declare class EhrProxyError extends Error {
634
991
  * Caller assembles the note body (text + bullets). Truth owns the Elation
635
992
  * OAuth token and the HTTP call so applications can drop Elation
636
993
  * credentials from their own config.
994
+ *
995
+ * BREAKING — 0.26.20, `pushConversationToElation`:
996
+ * - AUTH CLASS CHANGED. The server route moved from `applicationProcedure`
997
+ * to `verifiedUserProcedure`, so an API key alone (including a secret
998
+ * `hn_sk_*` or legacy `hn_live_*` key) now gets 401. Callers MUST supply
999
+ * `getAuthToken` on the client so a verified Clerk JWT accompanies the
1000
+ * request; this resource already sends it with `requireUserToken: true`.
1001
+ * - `input.initiatedBy` is DEPRECATED and ignored server-side. The audit
1002
+ * row's actor is the JWT `sub`. Passing a differing value is logged as a
1003
+ * warning server-side and will be removed in a future major.
637
1004
  */
638
1005
 
639
1006
  interface NonVisitNoteBullet {
@@ -664,14 +1031,27 @@ interface PushConversationToElationInput {
664
1031
  /** One-of: conversationId (Convex) or phonePair. */
665
1032
  conversationId?: string;
666
1033
  phonePair?: string;
667
- /** Actor user id — recorded on the audit row. */
668
- initiatedBy: string;
1034
+ /**
1035
+ * @deprecated Ignored by the server; the actor recorded on the audit row is
1036
+ * derived from the verified Clerk JWT (`sub`). Supplying a value has no
1037
+ * effect and will be removed in a future major.
1038
+ */
1039
+ initiatedBy?: string;
669
1040
  /** Pre-assembled note body (transcript-style text). */
670
1041
  noteText: string;
671
1042
  bullets?: NonVisitNoteBullet[];
672
1043
  notesPushed?: number;
673
1044
  messagesPushed?: number;
674
1045
  tasksPushed?: number;
1046
+ /**
1047
+ * Convex ids of the `conversationNotes` rows included in this push. When
1048
+ * set, Truth rejects the call with 409 CONFLICT if any is already marked
1049
+ * sent (unless `resend`), rejects ids that are not in this conversation with
1050
+ * 404, and stamps each note sent on success (never on failure).
1051
+ */
1052
+ noteIds?: string[];
1053
+ /** Explicitly allow re-sending notes already marked sent. Default false. */
1054
+ resend?: boolean;
675
1055
  }
676
1056
  interface PushConversationToElationResult {
677
1057
  success: true;
@@ -680,6 +1060,8 @@ interface PushConversationToElationResult {
680
1060
  notesPushed: number;
681
1061
  messagesPushed: number;
682
1062
  tasksPushed: number;
1063
+ /** Notes stamped sent by this call (empty when no `noteIds` were supplied). */
1064
+ sentNoteIds: string[];
683
1065
  }
684
1066
  declare class NotesResource {
685
1067
  private readonly baseUrl;
@@ -701,6 +1083,11 @@ declare class NotesResource {
701
1083
  * physician/practice in Elation, posts the note, and writes an audit
702
1084
  * row to `elationSyncEvents`. Replaces CommHub's `pushNotesToElation`
703
1085
  * Hasura action.
1086
+ *
1087
+ * Auth: requires a user token. The server runs this route under
1088
+ * `verifiedUserProcedure`, so the API key alone is rejected with 401 —
1089
+ * configure `getAuthToken` on the client. `input.initiatedBy` is ignored;
1090
+ * the audit row's actor is the verified JWT `sub`.
704
1091
  */
705
1092
  pushConversationToElation(input: PushConversationToElationInput): Promise<PushConversationToElationResult>;
706
1093
  }
@@ -1185,6 +1572,8 @@ declare const reportSchema: z.ZodObject<{
1185
1572
  members: z.ZodArray<z.ZodObject<{
1186
1573
  elationId: z.ZodString;
1187
1574
  name: z.ZodString;
1575
+ lastName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1576
+ firstName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1188
1577
  doctor: z.ZodNullable<z.ZodString>;
1189
1578
  status: z.ZodEnum<{
1190
1579
  data: "data";
@@ -1797,6 +2186,8 @@ declare class TruthClient {
1797
2186
  readonly notifications: NotificationsResource;
1798
2187
  /** Conversation-tied writes — notes, tasks, outbound messages. */
1799
2188
  readonly conversations: ConversationsResource;
2189
+ /** Care-team email inbox — link/unlink and (gated) send via oRPC. */
2190
+ readonly careInbox: CareInboxResource;
1800
2191
  /** User settings — notification preferences (Convex-backed) */
1801
2192
  readonly userSettings: UserSettingsResource;
1802
2193
  private readonly convex;
@@ -1892,6 +2283,74 @@ declare class TruthClient {
1892
2283
  destroy(): Promise<void>;
1893
2284
  }
1894
2285
 
2286
+ /**
2287
+ * `createCareInboxSource` — a promise-based object with exactly the method
2288
+ * set of comhub's `CareInboxSource` (lib/email/careInboxSource.ts), so the
2289
+ * comhub adapter is a pass-through. Reads are one-shot Convex queries
2290
+ * (never persisted); link/unlink/send go through `CareInboxResource`.
2291
+ *
2292
+ * Every rejection is a `CareInboxError` (`Error & { code }` with the comhub
2293
+ * code set). `getThread` rejects `unavailable` when the feature flag is off
2294
+ * (the query returns null then). In React use `useCareInboxSource()` from
2295
+ * `@hipnation-truth/sdk/react`, which rebuilds the source when Convex auth
2296
+ * flips so comhub's query hooks refetch.
2297
+ */
2298
+
2299
+ declare const careInboxRefs: {
2300
+ listThreadsForUser: FunctionReference<"query", "public", {
2301
+ mailboxId?: string;
2302
+ filter?: ThreadListFilter;
2303
+ cursor?: string | null;
2304
+ limit?: number;
2305
+ }, EmailThreadPageView, string | undefined>;
2306
+ getThread: FunctionReference<"query", "public", {
2307
+ threadId: string;
2308
+ }, EmailThreadDetailView | null, string | undefined>;
2309
+ listUnlinked: FunctionReference<"query", "public", {
2310
+ mailboxId: string;
2311
+ cursor?: string | null;
2312
+ limit?: number;
2313
+ }, UnlinkedEmailPageView, string | undefined>;
2314
+ unreadEmailCount: FunctionReference<"query", "public", {
2315
+ mailboxId?: string;
2316
+ }, number, string | undefined>;
2317
+ listMailboxesForUser: FunctionReference<"query", "public", Record<string, never>, EmailMailboxAccessView, string | undefined>;
2318
+ searchPatientsForLink: FunctionReference<"query", "public", {
2319
+ q: string;
2320
+ }, PatientLinkCandidate[], string | undefined>;
2321
+ markRead: FunctionReference<"mutation", "public", {
2322
+ threadId: string;
2323
+ }, MarkEmailThreadReadResult, string | undefined>;
2324
+ openThreadBodies: FunctionReference<"mutation", "public", {
2325
+ threadId: string;
2326
+ }, EmailThreadBodiesView, string | undefined>;
2327
+ };
2328
+ /** The Convex surface the source needs (`ConvexReactClient` satisfies it). */
2329
+ interface CareInboxConvexClient {
2330
+ query(ref: FunctionReference<"query">, args: Record<string, unknown>): Promise<unknown>;
2331
+ mutation(ref: FunctionReference<"mutation">, args: Record<string, unknown>): Promise<unknown>;
2332
+ }
2333
+ interface CareInboxSourceDeps {
2334
+ convex: CareInboxConvexClient;
2335
+ careInbox: Pick<CareInboxResource, "linkMessage" | "unlinkMessage" | "replyToThread" | "composeEmail">;
2336
+ }
2337
+ /** Method set of comhub's `CareInboxSource` (minus optional `subscribe`). */
2338
+ interface CareInboxSdkSource {
2339
+ listThreads(args?: ListThreadsArgs): Promise<ThreadPage>;
2340
+ getUnreadCount(args?: {
2341
+ mailboxId?: string;
2342
+ }): Promise<number>;
2343
+ getThread(threadId: string): Promise<CareInboxThreadDetail>;
2344
+ listMailboxesForUser(): Promise<CareInboxMailboxAccess>;
2345
+ searchPatientsForLink(query: string): Promise<PatientLinkCandidate[]>;
2346
+ linkMessage(args: LinkMessageArgs): Promise<LinkResult>;
2347
+ unlinkMessage(args: UnlinkMessageArgs): Promise<LinkResult>;
2348
+ sendReply(args: SendReplyArgs): Promise<SendResult>;
2349
+ sendEmail(args: SendEmailArgs): Promise<SendResult>;
2350
+ markRead(args: MarkReadArgs): Promise<MarkReadResult>;
2351
+ }
2352
+ declare function createCareInboxSource({ convex, careInbox, }: CareInboxSourceDeps): CareInboxSdkSource;
2353
+
1895
2354
  /**
1896
2355
  * Event tracker with batching, retry, and flush support.
1897
2356
  *
@@ -1981,4 +2440,4 @@ declare function subscriptionToJSON(sub: PushSubscription): {
1981
2440
  };
1982
2441
  declare function onServiceWorkerMessage(type: string, callback: (payload: unknown) => void): () => void;
1983
2442
 
1984
- export { AUTH_EVENTS, type ActorContext, type Appointment, type AppointmentListOptions, AppointmentResource, type Attachment, AttachmentsError, AttachmentsResource, type AuthEventType, type AuthLoginFailedPayload, type AuthLoginSucceededPayload, type AuthTokenFetcher, CALL_EVENTS, CONVERSATION_EVENTS, type CallConnectedPayload, type CallEndedPayload, type CallEventType, type CallInitiatedPayload, type CallMissedPayload, type CallStatusResponse, type CancelScheduledNotificationResult, type ConversationAddress, type ConversationAttachmentDownloadedPayload, type ConversationAttachmentUploadedPayload, type ConversationCreatedPayload, type ConversationEventType, type ConversationMarkedReadPayload, type ConversationMessageReceivedPayload, type ConversationMessageSentPayload, type ConversationTaskPriority, type ConversationTaskStatus, ConversationsError, ConversationsResource, type CreateConversationNoteInput, type CreateConversationTaskInput, 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, type MemberActivationReport, MessagesResource, NOTIFICATION_EVENTS, type NonVisitNoteBullet, NotesError, NotesResource, type NotificationDeliveredPayload, type NotificationEventType, type NotificationOpenedPayload, type NotificationPlatform, type NotificationPreferences, type NotificationSentPayload, NotificationsError, NotificationsResource, 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 PushEventPayload, type PushNoteToElationInput, type PushNoteToElationResult, REMINDER_EVENTS, type RecordAttachmentInput, type RegisterDeviceInput, type RegisterDeviceResult, type Reminder, type ReminderEventType, type ReminderScheduledPayload, type ReminderStatus, type ReminderTriggeredPayload, RemindersResource, ReportsError, ReportsResource, SECURITY_EVENTS, type ScheduleNotificationInput, type ScheduleNotificationResult, type ScheduleReminderInput, type ScheduleReminderResult, type ScheduledJobStatus, type ScheduledNotification, type SecurityAccessDeniedPayload, type SecurityEventType, type SendConversationMessageInput, type SendConversationMessageResult, type SendNotificationInput, type SendNotificationResult, type SendSmsParams, type SendSmsResponse, type SetConversationTaskStatusInput, 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 UnregisterDeviceInput, type UpdateNotificationsInput, type UpdateNotificationsResult, type UpdatePreferencesInput, type UpdateTaskStatusInput, type UserSettings, UserSettingsResource, type VoicemailAuthResponse, type WebPushConfig, generateUuidV7, isWebPushSupported, onServiceWorkerMessage, registerServiceWorker, subscribeToPush, subscriptionToJSON };
2443
+ export { AUTH_EVENTS, type ActorContext, type Appointment, type AppointmentListOptions, AppointmentResource, type Attachment, AttachmentsError, AttachmentsResource, type AuthEventType, type AuthLoginFailedPayload, type AuthLoginSucceededPayload, type AuthTokenFetcher, CALL_EVENTS, CONVERSATION_EVENTS, type CallConnectedPayload, type CallEndedPayload, type CallEventType, type CallInitiatedPayload, type CallMissedPayload, type CallStatusResponse, type CancelScheduledNotificationResult, type CareInboxConvexClient, type CareInboxEmailMessage, type CareInboxEmailThreadSummary, CareInboxError, type CareInboxErrorCode, type CareInboxErrorFields, type CareInboxErrorInfo, type CareInboxErrorReason, type CareInboxLinkResult, type CareInboxMailbox, type CareInboxMailboxAccess, CareInboxResource, type CareInboxSdkSource, type CareInboxSendResult, type CareInboxSourceDeps, type CareInboxThreadDetail, type ComposeEmailInput, type ConversationAddress, type ConversationAttachmentDownloadedPayload, type ConversationAttachmentUploadedPayload, type ConversationCreatedPayload, type ConversationEventType, type ConversationMarkedReadPayload, type ConversationMessageReceivedPayload, type ConversationMessageSentPayload, type ConversationTaskPriority, type ConversationTaskStatus, ConversationsError, ConversationsResource, type CreateConversationNoteInput, type CreateConversationTaskInput, type CreateTaskInput, type CreateUploadUrlInput, type CreateUploadUrlResult, type DetectionResult, type DialpadNumberInfo, DialpadProxyError, DialpadResource, type DialpadUser, ENVIRONMENTS, EVENT_TYPES, EhrProviderProxy, EhrProxyError, EhrResource, type EmailDirection, type EmailMailbox, type EmailMailboxAccessView, type EmailMailboxView, type EmailMessage, type EmailMessageView, type EmailParticipant, type EmailParticipantView, type EmailThreadBodiesView, type EmailThreadDetail, type EmailThreadDetailView, type EmailThreadListFilter, type EmailThreadPageView, type EmailThreadSummary, type EmailThreadSummaryView, type Environment, type EventActor, type EventCompliance, type EventEnvelope, type EventPayloadMap, type EventSubject, type EventType, type GetDownloadUrlResult, type InitiateCallResponse, type LinkEmailMessageInput, type LinkMessageArgs, type LinkResult, type LinkedPatientContact, type ListThreadsArgs, type MailboxAccess, type MarkEmailThreadReadResult, type MarkReadArgs, type MarkReadResult, type MemberActivationReport, MessagesResource, NOTIFICATION_EVENTS, type NonVisitNoteBullet, NotesError, NotesResource, type NotificationDeliveredPayload, type NotificationEventType, type NotificationOpenedPayload, type NotificationPlatform, type NotificationPreferences, type NotificationSentPayload, NotificationsError, NotificationsResource, PROVIDER_EVENTS, type PaginatedResult, type Patient, type PatientBasicDetailsResult, PatientDetailsError, type PatientDetailsInput, PatientDetailsResource, type PatientDetailsResult, type PatientLinkCandidate, type PatientLinkCandidateView, type PatientListOptions, type PatientMedicalDetailsResult, PatientResource, type Physician, PhysiciansResource, type ProviderEventType, type ProviderSyncFailedPayload, type ProviderSyncStartedPayload, type ProviderSyncSucceededPayload, type PushEventPayload, type PushNoteToElationInput, type PushNoteToElationResult, REMINDER_EVENTS, type RecordAttachmentInput, type RegisterDeviceInput, type RegisterDeviceResult, type Reminder, type ReminderEventType, type ReminderScheduledPayload, type ReminderStatus, type ReminderTriggeredPayload, RemindersResource, type ReplyToEmailThreadInput, ReportsError, ReportsResource, SECURITY_EVENTS, type ScheduleNotificationInput, type ScheduleNotificationResult, type ScheduleReminderInput, type ScheduleReminderResult, type ScheduledJobStatus, type ScheduledNotification, type SecurityAccessDeniedPayload, type SecurityEventType, type SendConversationMessageInput, type SendConversationMessageResult, type SendEmailArgs, type SendNotificationInput, type SendNotificationResult, type SendReplyArgs, type SendResult, type SendSmsParams, type SendSmsResponse, type SetConversationTaskStatusInput, TASK_EVENTS, TRANSLATION_EVENTS, type Task, type TaskAssignedPayload, type TaskCreatedPayload, type TaskEventType, type TaskStatus, type TaskStatusChangedPayload, TasksResource, type ThreadListFilter, type ThreadPage, type TrackOptions, Tracker, type TranslateBatchInput, type TranslateTextInput, type TranslationCompletedPayload, TranslationError, type TranslationEventType, type TranslationRequestedPayload, TranslationResource, type TranslationResult, TruthClient, type TruthClientConfig, type UnlinkEmailMessageInput, type UnlinkMessageArgs, type UnlinkedEmailPageView, type UnlinkedMessagePage, type UnregisterDeviceInput, type UpdateNotificationsInput, type UpdateNotificationsResult, type UpdatePreferencesInput, type UpdateTaskStatusInput, type UserSettings, UserSettingsResource, type VoicemailAuthResponse, type WebPushConfig, careInboxErrorInfo, careInboxRefs, createCareInboxSource, generateUuidV7, isCareInboxError, isWebPushSupported, onServiceWorkerMessage, registerServiceWorker, subscribeToPush, subscriptionToJSON, toCareInboxError, toEmailMailbox, toEmailMessage, toEmailThreadDetail, toEmailThreadSummary, toMailboxAccess, toMarkReadResult, toThreadPage, toUnlinkedMessagePage };