@ovok/core 0.4.31 → 0.4.33

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.
Files changed (126) hide show
  1. package/dist/client/ai-fhir/methods/AIFhirResources.d.ts +2 -1
  2. package/dist/client/ai-fhir/methods/AIFhirResources.js +2 -2
  3. package/dist/client/auth/errors.d.ts +6 -0
  4. package/dist/client/auth/errors.js +12 -1
  5. package/dist/client/auth/methods/appleLogin.d.ts +2 -1
  6. package/dist/client/auth/methods/appleLogin.js +2 -2
  7. package/dist/client/auth/methods/changePassword.d.ts +2 -1
  8. package/dist/client/auth/methods/changePassword.js +2 -2
  9. package/dist/client/auth/methods/getSessions.d.ts +2 -1
  10. package/dist/client/auth/methods/getSessions.js +2 -2
  11. package/dist/client/auth/methods/googleLogin.d.ts +2 -1
  12. package/dist/client/auth/methods/googleLogin.js +2 -2
  13. package/dist/client/auth/methods/index.d.ts +1 -0
  14. package/dist/client/auth/methods/index.js +1 -0
  15. package/dist/client/auth/methods/login.d.ts +6 -2
  16. package/dist/client/auth/methods/login.js +60 -44
  17. package/dist/client/auth/methods/logout.d.ts +2 -1
  18. package/dist/client/auth/methods/logout.js +2 -2
  19. package/dist/client/auth/methods/refetchProfile.d.ts +2 -1
  20. package/dist/client/auth/methods/refetchProfile.js +3 -4
  21. package/dist/client/auth/methods/register.d.ts +2 -1
  22. package/dist/client/auth/methods/register.js +2 -2
  23. package/dist/client/auth/methods/registerPractitioner.d.ts +2 -1
  24. package/dist/client/auth/methods/registerPractitioner.js +2 -2
  25. package/dist/client/auth/methods/reloadSession.d.ts +7 -0
  26. package/dist/client/auth/methods/reloadSession.js +23 -0
  27. package/dist/client/auth/methods/requestDeleteUser.d.ts +2 -1
  28. package/dist/client/auth/methods/requestDeleteUser.js +5 -5
  29. package/dist/client/auth/methods/resetPassword.d.ts +2 -1
  30. package/dist/client/auth/methods/resetPassword.js +2 -2
  31. package/dist/client/auth/methods/revokeSessions.d.ts +2 -1
  32. package/dist/client/auth/methods/revokeSessions.js +2 -2
  33. package/dist/client/auth/methods/setPasswordFromReset.d.ts +2 -1
  34. package/dist/client/auth/methods/setPasswordFromReset.js +2 -2
  35. package/dist/client/auth/types/LoginBody.d.ts +10 -20
  36. package/dist/client/auth/types/LoginError.d.ts +15 -0
  37. package/dist/client/auth/types/LoginError.js +15 -0
  38. package/dist/client/bot/methods/executeBot.d.ts +2 -1
  39. package/dist/client/bot/methods/executeBot.js +2 -2
  40. package/dist/client/change-history/methods.d.ts +2 -1
  41. package/dist/client/change-history/methods.js +2 -2
  42. package/dist/client/chat/ai/methods/createAiSession.d.ts +2 -1
  43. package/dist/client/chat/ai/methods/createAiSession.js +2 -2
  44. package/dist/client/cms/methods.d.ts +6 -5
  45. package/dist/client/cms/methods.js +10 -10
  46. package/dist/client/consent/methods.d.ts +5 -4
  47. package/dist/client/consent/methods.js +8 -8
  48. package/dist/client/email/methods.d.ts +2 -1
  49. package/dist/client/email/methods.js +2 -2
  50. package/dist/client/errors/ovok-error-utils.d.ts +7 -0
  51. package/dist/client/errors/ovok-error-utils.js +49 -5
  52. package/dist/client/errors/ovok-error.d.ts +4 -0
  53. package/dist/client/errors/ovok-error.js +17 -4
  54. package/dist/client/errors/rate-limit-error.js +5 -3
  55. package/dist/client/experience/methods.d.ts +32 -31
  56. package/dist/client/experience/methods.js +62 -62
  57. package/dist/client/invites/methods.d.ts +6 -5
  58. package/dist/client/invites/methods.js +17 -11
  59. package/dist/client/notifications/methods.d.ts +6 -5
  60. package/dist/client/notifications/methods.js +10 -10
  61. package/dist/client/notifications/types.d.ts +92 -11
  62. package/dist/client/observation/methods/getLatestObservationsByCodes.d.ts +2 -1
  63. package/dist/client/observation/methods/getLatestObservationsByCodes.js +4 -4
  64. package/dist/client/offline/offline-measurement-queue.d.ts +10 -3
  65. package/dist/client/offline/offline-measurement-queue.js +44 -29
  66. package/dist/client/ovok-client.d.ts +17 -7
  67. package/dist/client/ovok-client.js +235 -43
  68. package/dist/client/patient/methods.d.ts +24 -23
  69. package/dist/client/patient/methods.js +49 -49
  70. package/dist/client/patient-sharing/methods.d.ts +7 -6
  71. package/dist/client/patient-sharing/methods.js +16 -12
  72. package/dist/client/platform/methods.d.ts +24 -23
  73. package/dist/client/platform/methods.js +46 -46
  74. package/dist/client/questionnaire-response/methods/createQuestionnaireResponseWithObservations.d.ts +2 -1
  75. package/dist/client/questionnaire-response/methods/createQuestionnaireResponseWithObservations.js +2 -2
  76. package/dist/client/questionnaire-response/methods/extractQuestionnaireObservations.d.ts +2 -1
  77. package/dist/client/questionnaire-response/methods/extractQuestionnaireObservations.js +2 -2
  78. package/dist/client/questionnaire-response/methods/populateQuestionnaire.d.ts +2 -1
  79. package/dist/client/questionnaire-response/methods/populateQuestionnaire.js +2 -2
  80. package/dist/client/questionnaire-response/methods/submitQuestionnaireResponse.d.ts +2 -1
  81. package/dist/client/questionnaire-response/methods/submitQuestionnaireResponse.js +2 -2
  82. package/dist/client/signals/methods.d.ts +22 -21
  83. package/dist/client/signals/methods.js +42 -42
  84. package/dist/client/slim/methods.d.ts +93 -57
  85. package/dist/client/slim/methods.js +295 -108
  86. package/dist/client/slim/paging.d.ts +18 -0
  87. package/dist/client/slim/paging.js +57 -0
  88. package/dist/client/slim/types.d.ts +370 -3
  89. package/dist/conformance/api-requirements.js +22 -0
  90. package/dist/conformance/capability-requirements.js +1 -1
  91. package/dist/hooks/account-hooks.js +7 -7
  92. package/dist/hooks/api-hooks.d.ts +5 -2
  93. package/dist/hooks/api-hooks.js +39 -16
  94. package/dist/hooks/cms-hooks.js +3 -3
  95. package/dist/hooks/email-hooks.js +1 -1
  96. package/dist/hooks/experience-hooks.js +5 -5
  97. package/dist/hooks/index.d.ts +2 -0
  98. package/dist/hooks/index.js +5 -3
  99. package/dist/hooks/invites-hooks.js +7 -1
  100. package/dist/hooks/notification-ack-hooks.d.ts +2 -1
  101. package/dist/hooks/notification-hooks.d.ts +4 -2
  102. package/dist/hooks/notification-hooks.js +11 -23
  103. package/dist/hooks/notification-invalidation.d.ts +5 -2
  104. package/dist/hooks/notification-invalidation.js +10 -1
  105. package/dist/hooks/notification-note-hooks.js +3 -3
  106. package/dist/hooks/observation-hooks.d.ts +5 -1
  107. package/dist/hooks/observation-hooks.js +6 -6
  108. package/dist/hooks/patient-hooks.js +18 -18
  109. package/dist/hooks/patient-sharing-hooks.js +19 -5
  110. package/dist/hooks/platform-hooks.js +3 -3
  111. package/dist/hooks/poll-hooks.d.ts +14 -0
  112. package/dist/hooks/poll-hooks.js +127 -0
  113. package/dist/hooks/signals-alert-hooks.d.ts +5 -20
  114. package/dist/hooks/signals-alert-hooks.js +38 -34
  115. package/dist/hooks/signals-alert-item-hooks.d.ts +19 -0
  116. package/dist/hooks/signals-alert-item-hooks.js +62 -0
  117. package/dist/hooks/signals-hooks.js +2 -2
  118. package/dist/index.d.ts +3 -0
  119. package/dist/index.js +4 -1
  120. package/dist/utils/auth/exchange-code.d.ts +2 -0
  121. package/dist/utils/auth/exchange-code.js +2 -2
  122. package/dist/utils/auth/handle-tenant-code.d.ts +1 -1
  123. package/dist/utils/auth/handle-tenant-code.js +13 -4
  124. package/dist/utils/auth/start-login.d.ts +3 -1
  125. package/dist/utils/auth/start-login.js +3 -3
  126. package/package.json +1 -1
@@ -46,14 +46,14 @@ const query = (params) => {
46
46
  return encoded === "" ? "" : `?${encoded}`;
47
47
  };
48
48
  const documentUrl = (client, path, params) => `${client.getBaseUrl().replace(/\/$/, "")}${path}${query(params)}`;
49
- async function requestConsentSignature(consentId) {
50
- return this.post(`/consent/signature/${segment(consentId)}`);
49
+ async function requestConsentSignature(consentId, requestOptions) {
50
+ return this.post(`/consent/signature/${segment(consentId)}`, undefined, undefined, requestOptions);
51
51
  }
52
- async function createDocumentUpload(body) {
53
- return this.post("/document", body);
52
+ async function createDocumentUpload(body, requestOptions) {
53
+ return this.post("/document", body, undefined, requestOptions);
54
54
  }
55
- async function listDocuments(params = {}) {
56
- return this.get(`/document${query(params)}`);
55
+ async function listDocuments(params = {}, requestOptions) {
56
+ return this.get(`/document${query(params)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
57
57
  }
58
58
  /** Returns the authenticated document endpoint; navigating/fetching it follows the backend redirect. */
59
59
  async function getDocumentDownloadUrl(documentId, params = {}) {
@@ -63,87 +63,87 @@ async function getDocumentDownloadUrl(documentId, params = {}) {
63
63
  async function getPublicDocumentDownloadUrl(token, params = {}) {
64
64
  return documentUrl(this, `/document/public/${segment(token)}`, params);
65
65
  }
66
- async function deleteDocument(documentId) {
67
- return (await this.delete(`/document/${segment(documentId)}`));
66
+ async function deleteDocument(documentId, requestOptions) {
67
+ return (await this.delete(`/document/${segment(documentId)}`, ...(requestOptions === undefined ? [] : [requestOptions])));
68
68
  }
69
- async function updateDocumentMetadata(documentId, body) {
70
- return (await this.patch(`/document/${segment(documentId)}`, body));
69
+ async function updateDocumentMetadata(documentId, body, requestOptions) {
70
+ return (await this.patch(`/document/${segment(documentId)}`, body, ...(requestOptions === undefined ? [] : [requestOptions])));
71
71
  }
72
- async function generateDocumentReplacementUpload(documentId, body) {
73
- return this.post(`/document/${segment(documentId)}`, body);
72
+ async function generateDocumentReplacementUpload(documentId, body, requestOptions) {
73
+ return this.post(`/document/${segment(documentId)}`, body, undefined, requestOptions);
74
74
  }
75
- async function searchMappedContent(type, language, params = {}) {
76
- return this.get(`/cms/${segment(type)}/map/${segment(language)}${query(params)}`);
75
+ async function searchMappedContent(type, language, params = {}, requestOptions) {
76
+ return this.get(`/cms/${segment(type)}/map/${segment(language)}${query(params)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
77
77
  }
78
- async function copyContentsFromParent(type, language) {
79
- return this.post(`/cms/${segment(type)}/${segment(language)}/copy-from-parent-project`);
78
+ async function copyContentsFromParent(type, language, requestOptions) {
79
+ return this.post(`/cms/${segment(type)}/${segment(language)}/copy-from-parent-project`, undefined, undefined, requestOptions);
80
80
  }
81
- async function copyContentFromParent(type, language, key) {
82
- return this.post(`/cms/${segment(type)}/${segment(language)}/${segment(key)}/copy-from-parent-project`);
81
+ async function copyContentFromParent(type, language, key, requestOptions) {
82
+ return this.post(`/cms/${segment(type)}/${segment(language)}/${segment(key)}/copy-from-parent-project`, undefined, undefined, requestOptions);
83
83
  }
84
- async function createContent(type, language, body) {
85
- return this.post(`/cms/${segment(type)}/${segment(language)}`, body);
84
+ async function createContent(type, language, body, requestOptions) {
85
+ return this.post(`/cms/${segment(type)}/${segment(language)}`, body, undefined, requestOptions);
86
86
  }
87
- async function updateContent(type, language, key, body) {
88
- return (await this.put(`/cms/${segment(type)}/${segment(language)}/${segment(key)}`, body));
87
+ async function updateContent(type, language, key, body, requestOptions) {
88
+ return (await this.put(`/cms/${segment(type)}/${segment(language)}/${segment(key)}`, body, undefined, requestOptions));
89
89
  }
90
- async function getContent(type, language, key) {
91
- return this.get(`/cms/${segment(type)}/${segment(language)}/${segment(key)}`);
90
+ async function getContent(type, language, key, requestOptions) {
91
+ return this.get(`/cms/${segment(type)}/${segment(language)}/${segment(key)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
92
92
  }
93
- async function deleteContent(type, language, key) {
94
- await this.delete(`/cms/${segment(type)}/${segment(language)}/${segment(key)}`);
93
+ async function deleteContent(type, language, key, requestOptions) {
94
+ await this.delete(`/cms/${segment(type)}/${segment(language)}/${segment(key)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
95
95
  }
96
- async function searchContent(type, language, params = {}) {
97
- return this.get(`/cms/${segment(type)}/${segment(language)}${query(params)}`);
96
+ async function searchContent(type, language, params = {}, requestOptions) {
97
+ return this.get(`/cms/${segment(type)}/${segment(language)}${query(params)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
98
98
  }
99
- async function createVideoCallAppointment(body) {
100
- return this.post("/video-call/livekit/appointment", body);
99
+ async function createVideoCallAppointment(body, requestOptions) {
100
+ return this.post("/video-call/livekit/appointment", body, undefined, requestOptions);
101
101
  }
102
- async function updateVideoCallAppointment(appointmentId, body) {
103
- return (await this.put(`/video-call/livekit/appointment/${segment(appointmentId)}`, body));
102
+ async function updateVideoCallAppointment(appointmentId, body, requestOptions) {
103
+ return (await this.put(`/video-call/livekit/appointment/${segment(appointmentId)}`, body, undefined, requestOptions));
104
104
  }
105
- async function listVideoCallAppointments(params = {}) {
106
- return this.get(`/video-call/livekit/appointment${query(params)}`);
105
+ async function listVideoCallAppointments(params = {}, requestOptions) {
106
+ return this.get(`/video-call/livekit/appointment${query(params)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
107
107
  }
108
- async function getVideoCallAccessPermission(appointmentId) {
109
- return this.get(`/video-call/livekit/access-permission/${segment(appointmentId)}`);
108
+ async function getVideoCallAccessPermission(appointmentId, requestOptions) {
109
+ return this.get(`/video-call/livekit/access-permission/${segment(appointmentId)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
110
110
  }
111
- async function createVideoCallGuestAccess(appointmentId, body) {
112
- return this.post(`/video-call/livekit/guest-access/${segment(appointmentId)}`, body);
111
+ async function createVideoCallGuestAccess(appointmentId, body, requestOptions) {
112
+ return this.post(`/video-call/livekit/guest-access/${segment(appointmentId)}`, body, undefined, requestOptions);
113
113
  }
114
- async function createVideoCallUserAccess(appointmentId) {
115
- return this.post(`/video-call/livekit/user-access/${segment(appointmentId)}`);
114
+ async function createVideoCallUserAccess(appointmentId, requestOptions) {
115
+ return this.post(`/video-call/livekit/user-access/${segment(appointmentId)}`, undefined, undefined, requestOptions);
116
116
  }
117
- async function sendVideoCallInvite(body) {
118
- return this.post("/video-call/livekit/mail/invite", body);
117
+ async function sendVideoCallInvite(body, requestOptions) {
118
+ return this.post("/video-call/livekit/mail/invite", body, undefined, requestOptions);
119
119
  }
120
- async function sendVideoCallUpdate(body) {
121
- return this.post("/video-call/livekit/mail/update", body);
120
+ async function sendVideoCallUpdate(body, requestOptions) {
121
+ return this.post("/video-call/livekit/mail/update", body, undefined, requestOptions);
122
122
  }
123
- async function sendVideoCallCancellation(body) {
124
- return this.post("/video-call/livekit/mail/cancel", body);
123
+ async function sendVideoCallCancellation(body, requestOptions) {
124
+ return this.post("/video-call/livekit/mail/cancel", body, undefined, requestOptions);
125
125
  }
126
- async function sendVideoCallActiveNotification(appointmentId) {
127
- return this.post(`/video-call/livekit/notification/active-call/${segment(appointmentId)}`);
126
+ async function sendVideoCallActiveNotification(appointmentId, requestOptions) {
127
+ return this.post(`/video-call/livekit/notification/active-call/${segment(appointmentId)}`, undefined, undefined, requestOptions);
128
128
  }
129
- async function translate(body) {
130
- return this.post("/ai/translation", body);
129
+ async function translate(body, requestOptions) {
130
+ return this.post("/ai/translation", body, undefined, requestOptions);
131
131
  }
132
- async function createChatSession(body) {
133
- return this.post("/ai/session", body);
132
+ async function createChatSession(body, requestOptions) {
133
+ return this.post("/ai/session", body, undefined, requestOptions);
134
134
  }
135
- async function sendChatMessage(sessionId, body) {
136
- return this.post(`/ai/session/${segment(sessionId)}/message`, body);
135
+ async function sendChatMessage(sessionId, body, requestOptions) {
136
+ return this.post(`/ai/session/${segment(sessionId)}/message`, body, undefined, requestOptions);
137
137
  }
138
- async function listChatSessions(params = {}) {
139
- return this.get(`/ai/session${query(params)}`);
138
+ async function listChatSessions(params = {}, requestOptions) {
139
+ return this.get(`/ai/session${query(params)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
140
140
  }
141
- async function getChatSession(sessionId, params = {}) {
142
- return this.get(`/ai/session/${segment(sessionId)}${query(params)}`);
141
+ async function getChatSession(sessionId, params = {}, requestOptions) {
142
+ return this.get(`/ai/session/${segment(sessionId)}${query(params)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
143
143
  }
144
- async function listChatMessages(sessionId, params = {}) {
145
- return this.get(`/ai/session/${segment(sessionId)}/message${query(params)}`);
144
+ async function listChatMessages(sessionId, params = {}, requestOptions) {
145
+ return this.get(`/ai/session/${segment(sessionId)}/message${query(params)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
146
146
  }
147
- async function searchAIFhir(request) {
148
- return this.post("/ai/fhir/search", request);
147
+ async function searchAIFhir(request, requestOptions) {
148
+ return this.post("/ai/fhir/search", request, undefined, requestOptions);
149
149
  }
@@ -1,8 +1,9 @@
1
+ import type { MedplumRequestOptions } from "@medplum/core";
1
2
  import { OvokClient } from "../ovok-client";
2
3
  import { PatientSharingPractitionerShare } from "../patient-sharing/types";
3
4
  import { AcceptInviteBody, InviteBody, InviteSent } from "./types";
4
- export declare function invitePractitioner(this: OvokClient, body: InviteBody): Promise<InviteSent>;
5
- export declare function invitePatient(this: OvokClient, body: InviteBody): Promise<InviteSent>;
6
- export declare function acceptPractitionerInvite(this: OvokClient, body: AcceptInviteBody): Promise<PatientSharingPractitionerShare>;
7
- export declare function acceptPatientInvite(this: OvokClient, body: AcceptInviteBody): Promise<PatientSharingPractitionerShare>;
8
- export declare function acceptInvite(this: OvokClient, body: AcceptInviteBody): Promise<PatientSharingPractitionerShare>;
5
+ export declare function invitePractitioner(this: OvokClient, body: InviteBody, requestOptions?: MedplumRequestOptions): Promise<InviteSent>;
6
+ export declare function invitePatient(this: OvokClient, body: InviteBody, requestOptions?: MedplumRequestOptions): Promise<InviteSent>;
7
+ export declare function acceptPractitionerInvite(this: OvokClient, body: AcceptInviteBody, requestOptions?: MedplumRequestOptions): Promise<PatientSharingPractitionerShare>;
8
+ export declare function acceptPatientInvite(this: OvokClient, body: AcceptInviteBody, requestOptions?: MedplumRequestOptions): Promise<PatientSharingPractitionerShare>;
9
+ export declare function acceptInvite(this: OvokClient, body: AcceptInviteBody, requestOptions?: MedplumRequestOptions): Promise<PatientSharingPractitionerShare>;
@@ -5,26 +5,32 @@ exports.invitePatient = invitePatient;
5
5
  exports.acceptPractitionerInvite = acceptPractitionerInvite;
6
6
  exports.acceptPatientInvite = acceptPatientInvite;
7
7
  exports.acceptInvite = acceptInvite;
8
- function invitePractitioner(body) {
9
- return this.post("/v1/invites/practitioner", body);
8
+ function invitePractitioner(body, requestOptions) {
9
+ return this.post("/v1/invites/practitioner", body, undefined, requestOptions);
10
10
  }
11
- function invitePatient(body) {
12
- return this.post("/v1/invites/patient", body);
11
+ function invitePatient(body, requestOptions) {
12
+ return this.post("/v1/invites/patient", body, undefined, requestOptions);
13
13
  }
14
- function acceptPractitionerInvite(body) {
15
- return this.post("/v1/invites/practitioner/accept", body);
14
+ function acceptPractitionerInvite(body, requestOptions) {
15
+ return this.post("/v1/invites/practitioner/accept", body, undefined, requestOptions);
16
16
  }
17
- function acceptPatientInvite(body) {
18
- return this.post("/v1/invites/patient/accept", body);
17
+ function acceptPatientInvite(body, requestOptions) {
18
+ return this.post("/v1/invites/patient/accept", body, undefined, requestOptions);
19
19
  }
20
- function acceptInvite(body) {
20
+ function acceptInvite(body, requestOptions) {
21
21
  var _a;
22
22
  const resourceType = (_a = this.getProfile()) === null || _a === void 0 ? void 0 : _a.resourceType;
23
23
  if (resourceType === "Practitioner") {
24
- return this.acceptPractitionerInvite(body);
24
+ return this.acceptPractitionerInvite(body, ...(requestOptions === undefined ? [] : [requestOptions])).then((result) => {
25
+ this.invalidateUrl("/v1/patient-sharing/shares");
26
+ return result;
27
+ });
25
28
  }
26
29
  if (resourceType === "Patient") {
27
- return this.acceptPatientInvite(body);
30
+ return this.acceptPatientInvite(body, ...(requestOptions === undefined ? [] : [requestOptions])).then((result) => {
31
+ this.invalidateUrl("/v1/patient-sharing/shares");
32
+ return result;
33
+ });
28
34
  }
29
35
  throw new Error("Accepting an invite requires a signed-in Patient or Practitioner profile.");
30
36
  }
@@ -1,7 +1,8 @@
1
+ import type { MedplumRequestOptions } from "@medplum/core";
1
2
  import { OvokClient } from "../ovok-client";
2
3
  import { CreateNotificationNote, NotificationNote, NotificationNotes, NotificationTargetKind, UpdateNotificationNote } from "./types";
3
- export declare function createNotificationNote(this: OvokClient, body: CreateNotificationNote): Promise<NotificationNote>;
4
- export declare function listNotificationNotes(this: OvokClient, kind: NotificationTargetKind, id: string): Promise<NotificationNotes>;
5
- export declare function updateNotificationNote(this: OvokClient, noteId: string, body: UpdateNotificationNote): Promise<NotificationNote>;
6
- export declare function patchNotificationNote(this: OvokClient, noteId: string, body: UpdateNotificationNote): Promise<NotificationNote>;
7
- export declare function deleteNotificationNote(this: OvokClient, noteId: string): Promise<void>;
4
+ export declare function createNotificationNote(this: OvokClient, body: CreateNotificationNote, requestOptions?: MedplumRequestOptions): Promise<NotificationNote>;
5
+ export declare function listNotificationNotes(this: OvokClient, kind: NotificationTargetKind, id: string, requestOptions?: MedplumRequestOptions): Promise<NotificationNotes>;
6
+ export declare function updateNotificationNote(this: OvokClient, noteId: string, body: UpdateNotificationNote, requestOptions?: MedplumRequestOptions): Promise<NotificationNote>;
7
+ export declare function patchNotificationNote(this: OvokClient, noteId: string, body: UpdateNotificationNote, requestOptions?: MedplumRequestOptions): Promise<NotificationNote>;
8
+ export declare function deleteNotificationNote(this: OvokClient, noteId: string, requestOptions?: MedplumRequestOptions): Promise<void>;
@@ -12,18 +12,18 @@ const TARGET_PATH = {
12
12
  medical: "medical",
13
13
  alert: "raw-alerts",
14
14
  };
15
- function createNotificationNote(body) {
16
- return this.post("/v1/slim/notifications/notes", body);
15
+ function createNotificationNote(body, requestOptions) {
16
+ return this.post("/v1/slim/notifications/notes", body, undefined, requestOptions);
17
17
  }
18
- function listNotificationNotes(kind, id) {
19
- return this.get(`/v1/slim/notifications/${TARGET_PATH[kind]}/${segment(id)}/notes`, { cache: "reload" });
18
+ function listNotificationNotes(kind, id, requestOptions) {
19
+ return this.get(`/v1/slim/notifications/${TARGET_PATH[kind]}/${segment(id)}/notes`, { ...{ cache: "reload" }, ...requestOptions });
20
20
  }
21
- function updateNotificationNote(noteId, body) {
22
- return this.put(`/v1/slim/notifications/notes/${segment(noteId)}`, body);
21
+ function updateNotificationNote(noteId, body, requestOptions) {
22
+ return this.put(`/v1/slim/notifications/notes/${segment(noteId)}`, body, undefined, requestOptions);
23
23
  }
24
- function patchNotificationNote(noteId, body) {
25
- return this.patch(`/v1/slim/notifications/notes/${segment(noteId)}`, body);
24
+ function patchNotificationNote(noteId, body, requestOptions) {
25
+ return this.patch(`/v1/slim/notifications/notes/${segment(noteId)}`, body, ...(requestOptions === undefined ? [] : [requestOptions]));
26
26
  }
27
- async function deleteNotificationNote(noteId) {
28
- await this.delete(`/v1/slim/notifications/notes/${segment(noteId)}`);
27
+ async function deleteNotificationNote(noteId, requestOptions) {
28
+ await this.delete(`/v1/slim/notifications/notes/${segment(noteId)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
29
29
  }
@@ -30,14 +30,15 @@ export type UpdateNotificationNote = {
30
30
  export type SlimAlarmType = "deviceAlarm" | "attention";
31
31
  export type SlimAlarmSeverity = "RED" | "YELLOW" | "ATTENTION";
32
32
  export type SlimAlarmStatus = "active" | "completed";
33
+ export type SlimAlarmDetails = {
34
+ episodeId: string;
35
+ severity: SlimAlarmSeverity;
36
+ /** The server forwards the device's alarm type without normalizing it. */
37
+ type: string;
38
+ text: string | null;
39
+ };
33
40
  export type SlimAlarm = SlimNotification & {
34
- alarm: {
35
- episodeId: string;
36
- severity: SlimAlarmSeverity;
37
- type: SlimAlarmType;
38
- text: string;
39
- };
40
- noteCount: number | null;
41
+ alarm: SlimAlarmDetails | null;
41
42
  };
42
43
  export type SlimAlarmQuery = {
43
44
  type?: SlimAlarmType | readonly SlimAlarmType[];
@@ -56,6 +57,10 @@ export type SlimAlarmsPage = {
56
57
  page: number;
57
58
  count: number;
58
59
  resources: SlimAlarm[];
60
+ truncated: {
61
+ reason: "result-cap" | "scan-budget";
62
+ limit: number;
63
+ } | null;
59
64
  };
60
65
  export type SlimRecentAlarms = {
61
66
  recent: Array<Omit<SlimAlarm, "noteCount"> & {
@@ -63,7 +68,7 @@ export type SlimRecentAlarms = {
63
68
  }>;
64
69
  total: number;
65
70
  warm: false;
66
- source: "medplum";
71
+ source: "redis" | "fhirStore";
67
72
  };
68
73
  export type SlimRecentOutOfBed = {
69
74
  recent: Array<SlimNotification & {
@@ -83,8 +88,84 @@ export type SlimMedicalNotificationsQuery = {
83
88
  cursor?: string;
84
89
  };
85
90
  export type SlimMedicalNotificationsPage = {
86
- items: Array<SlimNotification & {
87
- noteCount: number | null;
88
- }>;
91
+ items: SlimMedicalNotificationRow[];
89
92
  nextCursor: string | null;
90
93
  };
94
+ export type SlimMedicalNotificationsCollection = SlimMedicalNotificationsPage & {
95
+ total: number;
96
+ truncated: boolean;
97
+ };
98
+ /** Mirrors the response DTO in Ovok Core's medical-notification contract. */
99
+ export type SlimMedicalNotificationActor = {
100
+ reference: string;
101
+ display: string | null;
102
+ };
103
+ export type SlimMedicalNotificationAcknowledgement = {
104
+ acknowledgedAt: string | null;
105
+ acknowledgedBy: string | null;
106
+ acknowledgedActor: SlimMedicalNotificationActor | null;
107
+ };
108
+ export type SlimMedicalNotificationContext = {
109
+ patientId: string | null;
110
+ patientName: string | null;
111
+ locationId: string | null;
112
+ locationName: string | null;
113
+ room: string | null;
114
+ bed: string | null;
115
+ floor: string | null;
116
+ deviceId: string | null;
117
+ deviceMedplumId: string | null;
118
+ deviceName: string | null;
119
+ organizationId: string | null;
120
+ organizationName: string | null;
121
+ };
122
+ export type SlimMedicalEpisodeValue = {
123
+ observationId: string;
124
+ valueNumber: number | null;
125
+ valueString: string | null;
126
+ valueUnit: string | null;
127
+ note: string | null;
128
+ observedAt: string | null;
129
+ recordedAt: string;
130
+ };
131
+ export type SlimMedicalEpisodeCore = {
132
+ id: string;
133
+ patientId: string;
134
+ code: string;
135
+ system: string | null;
136
+ display: string | null;
137
+ status: string;
138
+ openedAt: string;
139
+ closedAt: string | null;
140
+ closeReason: string | null;
141
+ lastSampleAt: string | null;
142
+ durationMs: number | null;
143
+ observationCount: number | null;
144
+ firingCount: number | null;
145
+ minValue: number | null;
146
+ maxValue: number | null;
147
+ avgValue: number | null;
148
+ lastValue: number | null;
149
+ peakValue: number | null;
150
+ peakAt: string | null;
151
+ lastFiringValue: number | null;
152
+ lastFiringAt: string | null;
153
+ lastObservationId: string | null;
154
+ firedBand: {
155
+ min: number | null;
156
+ max: number | null;
157
+ triggerVersion: number | null;
158
+ } | null;
159
+ };
160
+ export type SlimMedicalNotificationRow = {
161
+ episode: SlimMedicalEpisodeCore;
162
+ carehub: SlimMedicalNotificationContext;
163
+ acknowledgement: SlimMedicalNotificationAcknowledgement | null;
164
+ noteCount: number | null;
165
+ };
166
+ export type SlimMedicalNotificationDetail = Omit<SlimMedicalNotificationRow, "episode"> & {
167
+ episode: SlimMedicalEpisodeCore & {
168
+ values: SlimMedicalEpisodeValue[];
169
+ truncated: boolean;
170
+ };
171
+ };
@@ -1,4 +1,5 @@
1
1
  import { Bundle, Observation } from "@medplum/fhirtypes";
2
+ import type { MedplumRequestOptions } from "@medplum/core";
2
3
  import { OvokClient } from "../../ovok-client";
3
4
  import { GetLatestObservationsByCodeParams } from "../types/GetLatestObservationsByCodeParams";
4
- export declare function getLatestObservationsByCodes(this: OvokClient, params: GetLatestObservationsByCodeParams): Promise<Bundle<Observation>>;
5
+ export declare function getLatestObservationsByCodes(this: OvokClient, params: GetLatestObservationsByCodeParams, requestOptions?: MedplumRequestOptions): Promise<Bundle<Observation>>;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getLatestObservationsByCodes = getLatestObservationsByCodes;
4
- async function getLatestObservationsByCodes(params) {
4
+ async function getLatestObservationsByCodes(params, requestOptions) {
5
5
  var _a;
6
6
  let patientId = "patientId" in params ? params.patientId : "";
7
7
  if (params.me) {
@@ -15,7 +15,7 @@ async function getLatestObservationsByCodes(params) {
15
15
  patient: `Patient/${patientId}`,
16
16
  ...(params.date ? { date: `ge${params.date}` } : {}),
17
17
  });
18
- return this.get(`/fhir/Observation/$lastn?${urlParams.toString()}`, {
19
- cache: "no-cache",
20
- });
18
+ return this.get(`/fhir/Observation/$lastn?${urlParams.toString()}`, { ...{
19
+ cache: "no-cache",
20
+ }, ...requestOptions });
21
21
  }
@@ -1,5 +1,6 @@
1
1
  import { IClientStorage } from "@medplum/core";
2
2
  import { Bundle, BundleEntry, Observation } from "@medplum/fhirtypes";
3
+ import type { MedplumRequestOptions } from "@medplum/core";
3
4
  export declare const OFFLINE_MEASUREMENT_QUEUE_STORAGE_KEY = "ovok.core.offline-measurements";
4
5
  declare const IDENTIFIER_SYSTEM = "https://api.ovok.com/fhir/StructureDefinition/offline-measurement-id";
5
6
  export type OfflineMeasurementQueueOptions = {
@@ -21,8 +22,14 @@ export type OfflineMeasurementFlushResult = {
21
22
  queued: number;
22
23
  exhausted: number;
23
24
  responses: Record<string, Bundle>;
25
+ failures: Record<string, OfflineMeasurementFailure>;
24
26
  };
25
- type MeasurementTransport = (bundle: Bundle) => Promise<Bundle>;
27
+ export type OfflineMeasurementFailure = {
28
+ name: string;
29
+ code?: string;
30
+ status?: number;
31
+ };
32
+ type MeasurementTransport = (bundle: Bundle, requestOptions?: MedplumRequestOptions) => Promise<Bundle>;
26
33
  declare const stableMeasurementId: (observation: Observation) => string;
27
34
  declare const entryForObservation: (observation: Observation) => BundleEntry<Observation>;
28
35
  export declare class OfflineMeasurementQueue {
@@ -35,11 +42,11 @@ export declare class OfflineMeasurementQueue {
35
42
  private readonly getOwnerKey?;
36
43
  private operation;
37
44
  constructor(storage: IClientStorage, transport: MeasurementTransport, options?: OfflineMeasurementQueueOptions);
38
- enqueueAndFlush: (observations: Observation[]) => Promise<{
45
+ enqueueAndFlush: (observations: Observation[], requestOptions?: MedplumRequestOptions) => Promise<{
39
46
  id: string;
40
47
  flush: OfflineMeasurementFlushResult;
41
48
  }>;
42
- flush: (options?: OfflineMeasurementFlushOptions) => Promise<OfflineMeasurementFlushResult>;
49
+ flush: (options?: OfflineMeasurementFlushOptions, requestOptions?: MedplumRequestOptions) => Promise<OfflineMeasurementFlushResult>;
43
50
  private runExclusive;
44
51
  private readQueue;
45
52
  private writeQueue;
@@ -81,33 +81,36 @@ class OfflineMeasurementQueue {
81
81
  this.storage = storage;
82
82
  this.transport = transport;
83
83
  this.operation = Promise.resolve();
84
- this.enqueueAndFlush = (observations) => this.runExclusive(async () => {
85
- var _a, _b, _c;
86
- await ((_b = (_a = this.storage).getInitPromise) === null || _b === void 0 ? void 0 : _b.call(_a));
87
- const queue = this.readQueue();
88
- const entries = observations.map(entryForObservation);
89
- const ownerKey = (_c = this.getOwnerKey) === null || _c === void 0 ? void 0 : _c.call(this);
90
- if (this.getOwnerKey && !ownerKey) {
91
- throw new Error("Offline measurements require an active account to prevent cross-account delivery.");
92
- }
93
- const id = stableValueId({ ownerKey, entries });
94
- if (!queue.some((item) => item.id === id)) {
95
- queue.push({
96
- id,
97
- ownerKey,
98
- queuedAt: new Date().toISOString(),
99
- attempt: 0,
100
- nextAttemptAt: 0,
101
- entries,
102
- });
103
- this.writeQueue(queue);
104
- }
105
- return { id, flush: await this.flushQueue(queue) };
106
- });
107
- this.flush = (options = {}) => this.runExclusive(async () => {
84
+ this.enqueueAndFlush = (observations, requestOptions) => {
85
+ var _a;
86
+ const ownerKey = (_a = this.getOwnerKey) === null || _a === void 0 ? void 0 : _a.call(this);
87
+ return this.runExclusive(async () => {
88
+ var _a, _b;
89
+ await ((_b = (_a = this.storage).getInitPromise) === null || _b === void 0 ? void 0 : _b.call(_a));
90
+ const queue = this.readQueue();
91
+ const entries = observations.map(entryForObservation);
92
+ if (this.getOwnerKey && !ownerKey) {
93
+ throw new Error("Offline measurements require an active account to prevent cross-account delivery.");
94
+ }
95
+ const id = stableValueId({ ownerKey, entries });
96
+ if (!queue.some((item) => item.id === id)) {
97
+ queue.push({
98
+ id,
99
+ ownerKey,
100
+ queuedAt: new Date().toISOString(),
101
+ attempt: 0,
102
+ nextAttemptAt: 0,
103
+ entries,
104
+ });
105
+ this.writeQueue(queue);
106
+ }
107
+ return { id, flush: await this.flushQueue(queue, {}, ...(requestOptions === undefined ? [] : [requestOptions])) };
108
+ });
109
+ };
110
+ this.flush = (options = {}, requestOptions) => this.runExclusive(async () => {
108
111
  var _a, _b;
109
112
  await ((_b = (_a = this.storage).getInitPromise) === null || _b === void 0 ? void 0 : _b.call(_a));
110
- return this.flushQueue(this.readQueue(), options);
113
+ return this.flushQueue(this.readQueue(), options, ...(requestOptions === undefined ? [] : [requestOptions]));
111
114
  });
112
115
  this.runExclusive = (operation) => {
113
116
  const next = this.operation.then(operation, operation);
@@ -134,7 +137,7 @@ class OfflineMeasurementQueue {
134
137
  throw new Error(`Offline measurement queue could not be persisted at storage key "${this.storageKey}".`);
135
138
  }
136
139
  };
137
- this.flushQueue = async (queue, options = {}) => {
140
+ this.flushQueue = async (queue, options = {}, requestOptions) => {
138
141
  var _a;
139
142
  const result = {
140
143
  attempted: 0,
@@ -142,11 +145,14 @@ class OfflineMeasurementQueue {
142
145
  queued: 0,
143
146
  exhausted: 0,
144
147
  responses: {},
148
+ failures: {},
145
149
  };
146
150
  const now = Date.now();
147
- const ownerKey = (_a = this.getOwnerKey) === null || _a === void 0 ? void 0 : _a.call(this);
148
151
  let changed = false;
149
152
  for (const item of [...queue]) {
153
+ if (item.lastFailure) {
154
+ result.failures[item.id] = item.lastFailure;
155
+ }
150
156
  if (item.exhausted && options.resetExhausted) {
151
157
  item.attempt = 0;
152
158
  item.exhausted = false;
@@ -163,6 +169,7 @@ class OfflineMeasurementQueue {
163
169
  }
164
170
  continue;
165
171
  }
172
+ const ownerKey = (_a = this.getOwnerKey) === null || _a === void 0 ? void 0 : _a.call(this);
166
173
  if (this.getOwnerKey && (!ownerKey || item.ownerKey !== ownerKey)) {
167
174
  result.queued++;
168
175
  continue;
@@ -174,7 +181,7 @@ class OfflineMeasurementQueue {
174
181
  resourceType: "Bundle",
175
182
  type: "transaction",
176
183
  entry: item.entries,
177
- });
184
+ }, ...(requestOptions === undefined ? [] : [requestOptions]));
178
185
  if (isFailedResponse(response)) {
179
186
  throw response;
180
187
  }
@@ -183,7 +190,7 @@ class OfflineMeasurementQueue {
183
190
  result.responses[item.id] = response;
184
191
  changed = true;
185
192
  }
186
- catch (_b) {
193
+ catch (error) {
187
194
  item.attempt = attempt;
188
195
  item.exhausted = attempt >= this.maxRetries;
189
196
  item.nextAttemptAt = item.exhausted
@@ -191,6 +198,14 @@ class OfflineMeasurementQueue {
191
198
  : Date.now() +
192
199
  Math.min(this.maxRetryBackoffMs, this.retryBackoffMs * 2 ** (attempt - 1));
193
200
  changed = true;
201
+ const failure = error;
202
+ const lastFailure = {
203
+ name: typeof (failure === null || failure === void 0 ? void 0 : failure.name) === "string" ? failure.name : "Error",
204
+ ...(typeof (failure === null || failure === void 0 ? void 0 : failure.code) === "string" ? { code: failure.code } : {}),
205
+ ...(typeof (failure === null || failure === void 0 ? void 0 : failure.status) === "number" ? { status: failure.status } : {}),
206
+ };
207
+ item.lastFailure = lastFailure;
208
+ result.failures[item.id] = lastFailure;
194
209
  if (item.exhausted) {
195
210
  result.exhausted++;
196
211
  }