@ovok/core 0.4.49-rc.3 → 0.4.49-rc.5

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 (421) hide show
  1. package/README.md +23 -666
  2. package/dist/client/ai-fhir/methods/AIFhirResources.d.ts +3 -1
  3. package/dist/client/ai-fhir/methods/AIFhirResources.js +3 -1
  4. package/dist/client/ai-fhir/types/AIFhirPlan.d.ts +8 -0
  5. package/dist/client/ai-fhir/types/AIFhirPlanRequest.d.ts +8 -0
  6. package/dist/client/ai-fhir/types/AIFhirRequest.d.ts +5 -0
  7. package/dist/client/ai-fhir/types/AIFhirResponse.d.ts +6 -0
  8. package/dist/client/auth/errors.d.ts +15 -2
  9. package/dist/client/auth/errors.js +12 -2
  10. package/dist/client/auth/methods/appleLogin.d.ts +1 -0
  11. package/dist/client/auth/methods/appleLogin.js +1 -0
  12. package/dist/client/auth/methods/changePassword.d.ts +1 -0
  13. package/dist/client/auth/methods/changePassword.js +1 -0
  14. package/dist/client/auth/methods/googleLogin.d.ts +1 -0
  15. package/dist/client/auth/methods/googleLogin.js +1 -0
  16. package/dist/client/auth/methods/login.d.ts +6 -0
  17. package/dist/client/auth/methods/login.js +6 -0
  18. package/dist/client/auth/methods/register.d.ts +5 -0
  19. package/dist/client/auth/methods/register.js +5 -0
  20. package/dist/client/auth/methods/registerPractitioner.d.ts +5 -0
  21. package/dist/client/auth/methods/registerPractitioner.js +5 -0
  22. package/dist/client/auth/methods/reloadSession.d.ts +3 -0
  23. package/dist/client/auth/methods/requestDeleteUser.d.ts +4 -5
  24. package/dist/client/auth/methods/requestDeleteUser.js +4 -5
  25. package/dist/client/auth/methods/setPasswordFromReset.d.ts +1 -0
  26. package/dist/client/auth/methods/setPasswordFromReset.js +1 -0
  27. package/dist/client/auth/session-fetch.d.ts +11 -0
  28. package/dist/client/auth/types/Account.d.ts +8 -1
  29. package/dist/client/auth/types/AppleLoginBody.d.ts +16 -0
  30. package/dist/client/auth/types/AppleLoginBody.js +5 -0
  31. package/dist/client/auth/types/AuthResponse.d.ts +12 -0
  32. package/dist/client/auth/types/ChangePasswordBody.d.ts +7 -0
  33. package/dist/client/auth/types/ChangePasswordResponse.d.ts +5 -0
  34. package/dist/client/auth/types/CompletePasswordResetBody.d.ts +8 -0
  35. package/dist/client/auth/types/GoogleLoginBody.d.ts +5 -0
  36. package/dist/client/auth/types/LoginBody.d.ts +15 -1
  37. package/dist/client/auth/types/LoginError.d.ts +21 -2
  38. package/dist/client/auth/types/LoginError.js +8 -2
  39. package/dist/client/auth/types/LoginResponse.d.ts +8 -1
  40. package/dist/client/auth/types/RegisterBody.d.ts +12 -0
  41. package/dist/client/auth/types/RegisterPractitionerBody.d.ts +5 -0
  42. package/dist/client/auth/types/RegisterResponse.d.ts +7 -0
  43. package/dist/client/auth/types/RequestDeleteUserBody.d.ts +7 -7
  44. package/dist/client/auth/types/RequestDeleteUserResponse.d.ts +14 -0
  45. package/dist/client/auth/types/ResetPasswordBody.d.ts +5 -0
  46. package/dist/client/auth/types/Session.d.ts +14 -2
  47. package/dist/client/change-history/methods.d.ts +6 -0
  48. package/dist/client/change-history/methods.js +6 -0
  49. package/dist/client/change-history/types.d.ts +82 -0
  50. package/dist/client/chat/ai/methods/createAiSession.d.ts +6 -0
  51. package/dist/client/chat/ai/methods/createAiSession.js +6 -0
  52. package/dist/client/chat/ai/types/CreateAiSessionResponse.d.ts +17 -0
  53. package/dist/client/chat/ai/types/SessionMessagesResponse.d.ts +9 -0
  54. package/dist/client/cms/locale.d.ts +12 -2
  55. package/dist/client/cms/locale.js +9 -2
  56. package/dist/client/cms/methods.d.ts +6 -2
  57. package/dist/client/cms/methods.js +7 -3
  58. package/dist/client/cms/types.d.ts +44 -4
  59. package/dist/client/consent/methods.d.ts +16 -0
  60. package/dist/client/consent/methods.js +16 -0
  61. package/dist/client/consent/types.d.ts +53 -1
  62. package/dist/client/consent/types.js +10 -1
  63. package/dist/client/email/methods.d.ts +3 -0
  64. package/dist/client/email/methods.js +3 -0
  65. package/dist/client/email/types.d.ts +33 -0
  66. package/dist/client/errors/field-errors.d.ts +3 -0
  67. package/dist/client/errors/field-errors.js +3 -0
  68. package/dist/client/errors/ovok-error-utils.d.ts +6 -0
  69. package/dist/client/errors/ovok-error-utils.js +6 -0
  70. package/dist/client/errors/ovok-error.d.ts +36 -4
  71. package/dist/client/errors/ovok-error.js +15 -4
  72. package/dist/client/errors/rate-limit-error.d.ts +11 -2
  73. package/dist/client/errors/rate-limit-error.js +10 -2
  74. package/dist/client/errors/sign-in-required-error.d.ts +5 -2
  75. package/dist/client/errors/sign-in-required-error.js +5 -2
  76. package/dist/client/experience/methods.d.ts +38 -0
  77. package/dist/client/experience/methods.js +35 -0
  78. package/dist/client/experience/types.d.ts +316 -0
  79. package/dist/client/experience/types.js +1 -0
  80. package/dist/client/invites/methods.d.ts +27 -9
  81. package/dist/client/invites/methods.js +27 -9
  82. package/dist/client/invites/parse-accept-invite-link.d.ts +3 -1
  83. package/dist/client/invites/parse-accept-invite-link.js +3 -1
  84. package/dist/client/invites/types.d.ts +55 -0
  85. package/dist/client/invites/types.js +12 -0
  86. package/dist/client/notifications/methods.d.ts +15 -0
  87. package/dist/client/notifications/methods.js +15 -0
  88. package/dist/client/notifications/types.d.ts +249 -2
  89. package/dist/client/observation/bundle-entry-status.d.ts +3 -0
  90. package/dist/client/observation/bundle-entry-status.js +13 -0
  91. package/dist/client/observation/fhir-systems.d.ts +7 -0
  92. package/dist/client/observation/fhir-systems.js +8 -1
  93. package/dist/client/observation/methods/generateObservationBodiesByMeasurement.d.ts +3 -0
  94. package/dist/client/observation/methods/generateObservationBodiesByMeasurement.js +10 -65
  95. package/dist/client/observation/methods/getLatestObservationsByCodes.d.ts +3 -0
  96. package/dist/client/observation/methods/getLatestObservationsByCodes.js +3 -0
  97. package/dist/client/observation/methods/observationsToMeasurements.d.ts +23 -1
  98. package/dist/client/observation/methods/observationsToMeasurements.js +72 -12
  99. package/dist/client/observation/methods/saveMeasurement.d.ts +3 -1
  100. package/dist/client/observation/methods/saveMeasurement.js +3 -1
  101. package/dist/client/observation/observation-bundle-utils.d.ts +11 -7
  102. package/dist/client/observation/observation-bundle-utils.js +61 -71
  103. package/dist/client/observation/observation-coding.d.ts +12 -0
  104. package/dist/client/observation/observation-coding.js +69 -0
  105. package/dist/client/observation/observation-groups.d.ts +12 -0
  106. package/dist/client/observation/observation-groups.js +51 -0
  107. package/dist/client/observation/reading-group-backfill.d.ts +13 -0
  108. package/dist/client/observation/reading-group-backfill.js +79 -0
  109. package/dist/client/observation/reading-group.d.ts +14 -0
  110. package/dist/client/observation/reading-group.js +85 -0
  111. package/dist/client/observation/series.d.ts +28 -5
  112. package/dist/client/observation/series.js +16 -6
  113. package/dist/client/observation/services/base-observation-service.d.ts +1 -1
  114. package/dist/client/observation/services/base-observation-service.js +6 -12
  115. package/dist/client/observation/services/blood-pressure.d.ts +2 -0
  116. package/dist/client/observation/services/blood-pressure.js +9 -5
  117. package/dist/client/observation/services/component-observation-services.js +2 -2
  118. package/dist/client/observation/services/creator.d.ts +5 -0
  119. package/dist/client/observation/services/creator.js +5 -0
  120. package/dist/client/observation/services/ecg-observation-fragments.d.ts +4 -0
  121. package/dist/client/observation/services/ecg-observation-fragments.js +30 -37
  122. package/dist/client/observation/services/ecg.d.ts +3 -1
  123. package/dist/client/observation/services/ecg.js +19 -19
  124. package/dist/client/observation/services/uric-acid-service.js +2 -13
  125. package/dist/client/observation/services/urine-analyte-values.d.ts +4 -0
  126. package/dist/client/observation/services/urine-analyte-values.js +27 -0
  127. package/dist/client/observation/types/GetLatestObservationsByCodeParams.d.ts +10 -0
  128. package/dist/client/observation/types/MeasurementTypeKey.d.ts +26 -0
  129. package/dist/client/observation/types/MeasurementTypeKey.js +26 -0
  130. package/dist/client/observation/types/ObservationCode.d.ts +64 -1
  131. package/dist/client/observation/types/ObservationCode.js +64 -1
  132. package/dist/client/observation/types/UrineAnalytes.d.ts +29 -0
  133. package/dist/client/observation/types/UrineAnalytes.js +18 -9
  134. package/dist/client/observation/types/generate-measurement/Sample.d.ts +33 -0
  135. package/dist/client/observation/types/generate-observation-body/GenerateObservationBodyParams.d.ts +9 -0
  136. package/dist/client/observation/types/measurement/BabySleepMeasurement.d.ts +3 -0
  137. package/dist/client/observation/types/measurement/BloodGlucoseMeasurement.d.ts +7 -0
  138. package/dist/client/observation/types/measurement/BloodPressureMeasurement.d.ts +10 -0
  139. package/dist/client/observation/types/measurement/BloodPressureStates.d.ts +10 -0
  140. package/dist/client/observation/types/measurement/BloodPressureStates.js +10 -0
  141. package/dist/client/observation/types/measurement/BodyTemperatureMeasurement.d.ts +7 -0
  142. package/dist/client/observation/types/measurement/BodyWeightMeasurmement.d.ts +8 -0
  143. package/dist/client/observation/types/measurement/EcgDiagnosticFlag.d.ts +18 -0
  144. package/dist/client/observation/types/measurement/EcgDiagnosticFlag.js +18 -0
  145. package/dist/client/observation/types/measurement/EcgMeasurement.d.ts +9 -0
  146. package/dist/client/observation/types/measurement/HeartRateMeasurement.d.ts +7 -0
  147. package/dist/client/observation/types/measurement/HeartRateVariabilityMeasurement.d.ts +7 -0
  148. package/dist/client/observation/types/measurement/LipidPanelMeasurement.d.ts +12 -0
  149. package/dist/client/observation/types/measurement/Measurement.d.ts +9 -0
  150. package/dist/client/observation/types/measurement/MeasurementDevice.d.ts +10 -0
  151. package/dist/client/observation/types/measurement/MeasurementSeries.d.ts +2 -0
  152. package/dist/client/observation/types/measurement/PulseOximeterMeasurement.d.ts +10 -0
  153. package/dist/client/observation/types/measurement/RespiratoryRateMeasurement.d.ts +7 -0
  154. package/dist/client/observation/types/measurement/RespiratoryTherapyMeasurement.d.ts +3 -0
  155. package/dist/client/observation/types/measurement/RestingHeartRateMeasurement.d.ts +7 -0
  156. package/dist/client/observation/types/measurement/SpirometryMeasurement.d.ts +23 -0
  157. package/dist/client/observation/types/measurement/StepCountMeasurement.d.ts +9 -0
  158. package/dist/client/observation/types/measurement/UrineAnalyzeMeasurement.d.ts +29 -0
  159. package/dist/client/observation/types/measurement/Vo2MaxMeasurement.d.ts +7 -0
  160. package/dist/client/observation/types/measurement/WalkingHeartRateAverageMeasurement.d.ts +7 -0
  161. package/dist/client/observation/types/service/MeasurementField.d.ts +5 -1
  162. package/dist/client/observation/utils/getDeviceObject.js +15 -32
  163. package/dist/client/observation/utils/getObservationValueDisplay.d.ts +2 -0
  164. package/dist/client/offline/offline-measurement-queue.d.ts +56 -1
  165. package/dist/client/offline/offline-measurement-queue.js +23 -8
  166. package/dist/client/offline/shared-measurement-queue.d.ts +16 -1
  167. package/dist/client/offline/shared-measurement-queue.js +3 -1
  168. package/dist/client/ovok-client.d.ts +28 -6
  169. package/dist/client/ovok-client.js +19 -11
  170. package/dist/client/patient/methods.d.ts +21 -0
  171. package/dist/client/patient/methods.js +21 -0
  172. package/dist/client/patient/types.d.ts +131 -0
  173. package/dist/client/patient-sharing/methods.d.ts +18 -0
  174. package/dist/client/patient-sharing/methods.js +18 -0
  175. package/dist/client/patient-sharing/types.d.ts +89 -1
  176. package/dist/client/platform/methods.d.ts +22 -0
  177. package/dist/client/platform/methods.js +20 -0
  178. package/dist/client/platform/types.d.ts +194 -1
  179. package/dist/client/platform/types.js +24 -0
  180. package/dist/client/questionnaire-response/methods/createQuestionnaireResponseWithObservations.d.ts +3 -0
  181. package/dist/client/questionnaire-response/methods/createQuestionnaireResponseWithObservations.js +3 -0
  182. package/dist/client/questionnaire-response/methods/extractQuestionnaireObservations.d.ts +3 -0
  183. package/dist/client/questionnaire-response/methods/extractQuestionnaireObservations.js +3 -0
  184. package/dist/client/questionnaire-response/methods/populateQuestionnaire.d.ts +3 -0
  185. package/dist/client/questionnaire-response/methods/populateQuestionnaire.js +3 -0
  186. package/dist/client/questionnaire-response/methods/submitQuestionnaireResponse.d.ts +3 -0
  187. package/dist/client/questionnaire-response/methods/submitQuestionnaireResponse.js +3 -0
  188. package/dist/client/questionnaire-response/types.d.ts +6 -0
  189. package/dist/client/signals/errors.d.ts +13 -2
  190. package/dist/client/signals/errors.js +9 -2
  191. package/dist/client/signals/methods.d.ts +9 -0
  192. package/dist/client/signals/methods.js +9 -0
  193. package/dist/client/signals/types.d.ts +31 -0
  194. package/dist/client/slim/methods.d.ts +268 -21
  195. package/dist/client/slim/methods.js +264 -21
  196. package/dist/client/slim/paging.d.ts +22 -2
  197. package/dist/client/slim/paging.js +6 -2
  198. package/dist/client/slim/types.d.ts +920 -1
  199. package/dist/client/storage.d.ts +15 -1
  200. package/dist/client/storage.js +7 -1
  201. package/dist/client/wearables/methods.d.ts +24 -0
  202. package/dist/client/wearables/methods.js +24 -0
  203. package/dist/client/wearables/types.d.ts +74 -0
  204. package/dist/conformance/api-requirements.d.ts +31 -5
  205. package/dist/conformance/api-requirements.js +47 -10
  206. package/dist/conformance/capability-requirements.d.ts +4 -26
  207. package/dist/conformance/capability-requirements.js +5 -27
  208. package/dist/conformance/capability.d.ts +9 -1
  209. package/dist/conformance/capability.js +3 -1
  210. package/dist/hooks/account-hooks.d.ts +35 -0
  211. package/dist/hooks/account-hooks.js +33 -0
  212. package/dist/hooks/api-hooks.d.ts +74 -4
  213. package/dist/hooks/api-hooks.js +56 -4
  214. package/dist/hooks/cms-hooks.d.ts +9 -3
  215. package/dist/hooks/cms-hooks.js +9 -3
  216. package/dist/hooks/email-hooks.d.ts +3 -0
  217. package/dist/hooks/email-hooks.js +3 -0
  218. package/dist/hooks/experience-hooks.d.ts +26 -0
  219. package/dist/hooks/experience-hooks.js +24 -0
  220. package/dist/hooks/index.d.ts +18 -0
  221. package/dist/hooks/index.js +18 -0
  222. package/dist/hooks/invites-hooks.d.ts +21 -2
  223. package/dist/hooks/invites-hooks.js +21 -2
  224. package/dist/hooks/notification-ack-hooks.d.ts +6 -2
  225. package/dist/hooks/notification-ack-hooks.js +6 -2
  226. package/dist/hooks/notification-hooks.d.ts +27 -3
  227. package/dist/hooks/notification-hooks.js +27 -3
  228. package/dist/hooks/notification-note-hooks.d.ts +41 -0
  229. package/dist/hooks/notification-note-hooks.js +33 -0
  230. package/dist/hooks/observation-hooks.d.ts +30 -0
  231. package/dist/hooks/observation-hooks.js +26 -3
  232. package/dist/hooks/patient-hooks.d.ts +53 -0
  233. package/dist/hooks/patient-hooks.js +48 -0
  234. package/dist/hooks/patient-sharing-hooks.d.ts +18 -0
  235. package/dist/hooks/patient-sharing-hooks.js +18 -0
  236. package/dist/hooks/platform-hooks.d.ts +32 -0
  237. package/dist/hooks/platform-hooks.js +23 -0
  238. package/dist/hooks/poll-hooks.d.ts +17 -1
  239. package/dist/hooks/poll-hooks.js +3 -1
  240. package/dist/hooks/signals-hooks.d.ts +3 -0
  241. package/dist/hooks/signals-hooks.js +3 -0
  242. package/dist/hooks/wearables-hooks.d.ts +23 -0
  243. package/dist/hooks/wearables-hooks.js +21 -0
  244. package/dist/index.d.ts +1 -965
  245. package/dist/index.js +1 -71
  246. package/dist/next/auth/saved-accounts-store.d.ts +10 -0
  247. package/dist/next/auth/session.d.ts +17 -0
  248. package/dist/next/auth/user-session.d.ts +5 -0
  249. package/dist/next/config/ovok-config.d.ts +45 -0
  250. package/dist/next/errors/ovok-account-error.d.ts +14 -1
  251. package/dist/next/errors/ovok-account-error.js +8 -1
  252. package/dist/next/errors/ovok-errors.d.ts +88 -0
  253. package/dist/next/errors/ovok-errors.js +67 -0
  254. package/dist/next/http/http-client.d.ts +5 -0
  255. package/dist/next/http/transmit.d.ts +7 -0
  256. package/dist/next/http/url.d.ts +10 -0
  257. package/dist/next/ovok.d.ts +31 -1
  258. package/dist/next/ovok.js +5 -1
  259. package/dist/next/paging/page.d.ts +13 -1
  260. package/dist/next/react/context.d.ts +7 -0
  261. package/dist/next/react/context.js +7 -0
  262. package/dist/next/react/index.d.ts +24 -0
  263. package/dist/next/react/index.js +18 -0
  264. package/dist/next/react/query-hooks.d.ts +69 -0
  265. package/dist/next/react/query-hooks.js +31 -0
  266. package/dist/next/resources/accounts/accounts-resource.d.ts +6 -0
  267. package/dist/next/resources/accounts/accounts-resource.js +6 -0
  268. package/dist/next/resources/ai/ai-chat-resource.d.ts +7 -0
  269. package/dist/next/resources/ai/ai-chat-resource.js +5 -0
  270. package/dist/next/resources/ai/ai-resource.d.ts +13 -0
  271. package/dist/next/resources/ai/ai-resource.js +6 -0
  272. package/dist/next/resources/ai/chat-messages-resource.d.ts +7 -0
  273. package/dist/next/resources/ai/chat-messages-resource.js +7 -0
  274. package/dist/next/resources/ai/chat-sessions-resource.d.ts +14 -0
  275. package/dist/next/resources/ai/chat-sessions-resource.js +8 -0
  276. package/dist/next/resources/auth/auth-sessions-resource.d.ts +6 -1
  277. package/dist/next/resources/auth/auth-sessions-resource.js +6 -1
  278. package/dist/next/resources/auth/registration.d.ts +18 -1
  279. package/dist/next/resources/auth/social-login.d.ts +12 -0
  280. package/dist/next/resources/auth-resource.d.ts +54 -1
  281. package/dist/next/resources/auth-resource.js +23 -0
  282. package/dist/next/resources/bots/bots-resource.d.ts +15 -0
  283. package/dist/next/resources/bots/bots-resource.js +5 -0
  284. package/dist/next/resources/cms/cms-delivery.d.ts +14 -2
  285. package/dist/next/resources/cms/cms-documents-resource.d.ts +7 -1
  286. package/dist/next/resources/cms/cms-documents-resource.js +7 -1
  287. package/dist/next/resources/cms/cms-resource.d.ts +7 -0
  288. package/dist/next/resources/cms/cms-resource.js +5 -0
  289. package/dist/next/resources/cms/release-notes-resource.d.ts +6 -0
  290. package/dist/next/resources/cms/release-notes-resource.js +6 -0
  291. package/dist/next/resources/consent/consent-resource.d.ts +22 -0
  292. package/dist/next/resources/consent/consent-resource.js +20 -0
  293. package/dist/next/resources/content/content-resource.d.ts +18 -0
  294. package/dist/next/resources/content/content-resource.js +12 -0
  295. package/dist/next/resources/documents/documents-resource.d.ts +24 -0
  296. package/dist/next/resources/documents/documents-resource.js +10 -0
  297. package/dist/next/resources/email/email-resource.d.ts +6 -0
  298. package/dist/next/resources/email/email-resource.js +5 -0
  299. package/dist/next/resources/email/email-templates-resource.d.ts +6 -0
  300. package/dist/next/resources/email/email-templates-resource.js +6 -0
  301. package/dist/next/resources/fhir-resource.d.ts +36 -0
  302. package/dist/next/resources/fhir-resource.js +21 -0
  303. package/dist/next/resources/health-resource.d.ts +16 -0
  304. package/dist/next/resources/health-resource.js +5 -0
  305. package/dist/next/resources/invites/invite-flow-resource.d.ts +7 -1
  306. package/dist/next/resources/invites/invite-flow-resource.js +7 -1
  307. package/dist/next/resources/invites/invites-resource.d.ts +15 -0
  308. package/dist/next/resources/invites/invites-resource.js +5 -0
  309. package/dist/next/resources/localization/i18next-resource.d.ts +6 -0
  310. package/dist/next/resources/localization/i18next-resource.js +6 -0
  311. package/dist/next/resources/localization/locales-resource.d.ts +7 -0
  312. package/dist/next/resources/localization/locales-resource.js +7 -0
  313. package/dist/next/resources/localization/localizations-resource.d.ts +17 -0
  314. package/dist/next/resources/localization/localizations-resource.js +9 -0
  315. package/dist/next/resources/measurements/measurements-resource.d.ts +64 -3
  316. package/dist/next/resources/measurements/measurements-resource.js +45 -6
  317. package/dist/next/resources/measurements/observation-builder.d.ts +6 -1
  318. package/dist/next/resources/measurements/observation-builder.js +16 -7
  319. package/dist/next/resources/measurements/offline-measurement-queue-types.d.ts +32 -0
  320. package/dist/next/resources/measurements/save-error.js +3 -4
  321. package/dist/next/resources/patient/fhir-records.d.ts +19 -1
  322. package/dist/next/resources/patient/fhir-records.js +19 -1
  323. package/dist/next/resources/patient/patient-resource.d.ts +15 -0
  324. package/dist/next/resources/patient/patient-resource.js +6 -0
  325. package/dist/next/resources/projects/project-features-resource.d.ts +7 -0
  326. package/dist/next/resources/projects/project-features-resource.js +7 -0
  327. package/dist/next/resources/projects/project-members-resource.d.ts +19 -0
  328. package/dist/next/resources/projects/project-members-resource.js +9 -0
  329. package/dist/next/resources/projects/project-settings-resource.d.ts +8 -0
  330. package/dist/next/resources/projects/project-settings-resource.js +8 -0
  331. package/dist/next/resources/projects/projects-resource.d.ts +15 -0
  332. package/dist/next/resources/projects/projects-resource.js +5 -0
  333. package/dist/next/resources/questionnaires/questionnaires-resource.d.ts +13 -0
  334. package/dist/next/resources/questionnaires/questionnaires-resource.js +13 -0
  335. package/dist/next/resources/realtime/realtime-resource.d.ts +11 -0
  336. package/dist/next/resources/realtime/realtime-resource.js +11 -0
  337. package/dist/next/resources/realtime/realtime-socket.js +12 -5
  338. package/dist/next/resources/realtime/realtime-types.d.ts +19 -1
  339. package/dist/next/resources/session/saved-accounts-resource.d.ts +16 -0
  340. package/dist/next/resources/session/saved-accounts-resource.js +16 -0
  341. package/dist/next/resources/session/session-resource.d.ts +8 -0
  342. package/dist/next/resources/session/session-resource.js +7 -0
  343. package/dist/next/resources/sharing/sharing-invites-resource.d.ts +7 -0
  344. package/dist/next/resources/sharing/sharing-invites-resource.js +7 -0
  345. package/dist/next/resources/sharing/sharing-resource.d.ts +8 -0
  346. package/dist/next/resources/sharing/sharing-resource.js +5 -0
  347. package/dist/next/resources/sharing/sharing-settings-resource.d.ts +7 -0
  348. package/dist/next/resources/sharing/sharing-settings-resource.js +7 -0
  349. package/dist/next/resources/sharing/sharing-shares-resource.d.ts +7 -0
  350. package/dist/next/resources/sharing/sharing-shares-resource.js +7 -0
  351. package/dist/next/resources/signals/signals-gateway-resource.d.ts +15 -0
  352. package/dist/next/resources/signals/signals-gateway-resource.js +6 -0
  353. package/dist/next/resources/signals/signals-resource.d.ts +7 -0
  354. package/dist/next/resources/signals/signals-resource.js +5 -0
  355. package/dist/next/resources/signals/undeliverable-resource.d.ts +35 -0
  356. package/dist/next/resources/signals/undeliverable-resource.js +6 -0
  357. package/dist/next/resources/slim/slim-alarms-resource.d.ts +7 -0
  358. package/dist/next/resources/slim/slim-alarms-resource.js +7 -0
  359. package/dist/next/resources/slim/slim-change-history-resource.d.ts +6 -0
  360. package/dist/next/resources/slim/slim-change-history-resource.js +6 -0
  361. package/dist/next/resources/slim/slim-child-projects-resource.d.ts +21 -0
  362. package/dist/next/resources/slim/slim-child-projects-resource.js +8 -0
  363. package/dist/next/resources/slim/slim-devices-resource.d.ts +31 -0
  364. package/dist/next/resources/slim/slim-devices-resource.js +16 -0
  365. package/dist/next/resources/slim/slim-exports-resource.d.ts +6 -0
  366. package/dist/next/resources/slim/slim-exports-resource.js +6 -0
  367. package/dist/next/resources/slim/slim-locations-resource.d.ts +9 -0
  368. package/dist/next/resources/slim/slim-locations-resource.js +9 -0
  369. package/dist/next/resources/slim/slim-medical-notifications-resource.d.ts +6 -0
  370. package/dist/next/resources/slim/slim-medical-notifications-resource.js +6 -0
  371. package/dist/next/resources/slim/slim-notification-notes-resource.d.ts +10 -0
  372. package/dist/next/resources/slim/slim-notification-notes-resource.js +10 -0
  373. package/dist/next/resources/slim/slim-notifications-resource.d.ts +10 -0
  374. package/dist/next/resources/slim/slim-notifications-resource.js +6 -0
  375. package/dist/next/resources/slim/slim-organizations-resource.d.ts +9 -0
  376. package/dist/next/resources/slim/slim-organizations-resource.js +9 -0
  377. package/dist/next/resources/slim/slim-out-of-bed-resource.d.ts +12 -0
  378. package/dist/next/resources/slim/slim-out-of-bed-resource.js +7 -0
  379. package/dist/next/resources/slim/slim-patient-thresholds-resource.d.ts +6 -0
  380. package/dist/next/resources/slim/slim-patient-thresholds-resource.js +6 -0
  381. package/dist/next/resources/slim/slim-patients-resource.d.ts +11 -0
  382. package/dist/next/resources/slim/slim-patients-resource.js +10 -0
  383. package/dist/next/resources/slim/slim-policies-resource.d.ts +10 -0
  384. package/dist/next/resources/slim/slim-policies-resource.js +10 -0
  385. package/dist/next/resources/slim/slim-practitioners-resource.d.ts +6 -0
  386. package/dist/next/resources/slim/slim-practitioners-resource.js +6 -0
  387. package/dist/next/resources/slim/slim-projects-resource.d.ts +12 -0
  388. package/dist/next/resources/slim/slim-projects-resource.js +11 -0
  389. package/dist/next/resources/slim/slim-queries.d.ts +51 -0
  390. package/dist/next/resources/slim/slim-resource.d.ts +21 -0
  391. package/dist/next/resources/slim/slim-resource.js +6 -0
  392. package/dist/next/resources/slim/slim-sleep-resource.d.ts +6 -0
  393. package/dist/next/resources/slim/slim-sleep-resource.js +6 -0
  394. package/dist/next/resources/slim/slim-thresholds-resource.d.ts +5 -0
  395. package/dist/next/resources/slim/slim-thresholds-resource.js +5 -0
  396. package/dist/next/resources/slim/slim-trends-resource.d.ts +6 -0
  397. package/dist/next/resources/slim/slim-trends-resource.js +6 -0
  398. package/dist/next/resources/slim/slim-users-resource.d.ts +12 -0
  399. package/dist/next/resources/slim/slim-users-resource.js +6 -0
  400. package/dist/next/resources/slim/slim-zones-resource.d.ts +8 -0
  401. package/dist/next/resources/slim/slim-zones-resource.js +8 -0
  402. package/dist/next/resources/video-calls/video-call-access-resource.d.ts +13 -0
  403. package/dist/next/resources/video-calls/video-call-access-resource.js +8 -0
  404. package/dist/next/resources/video-calls/video-call-appointments-resource.d.ts +8 -0
  405. package/dist/next/resources/video-calls/video-call-appointments-resource.js +8 -0
  406. package/dist/next/resources/video-calls/video-call-emails-resource.d.ts +8 -0
  407. package/dist/next/resources/video-calls/video-call-emails-resource.js +8 -0
  408. package/dist/next/resources/video-calls/video-calls-resource.d.ts +14 -0
  409. package/dist/next/resources/video-calls/video-calls-resource.js +6 -0
  410. package/dist/next/resources/wearables/wearable-connections-resource.d.ts +8 -0
  411. package/dist/next/resources/wearables/wearable-connections-resource.js +8 -0
  412. package/dist/next/resources/wearables/wearable-providers-resource.d.ts +10 -0
  413. package/dist/next/resources/wearables/wearable-providers-resource.js +10 -0
  414. package/dist/next/resources/wearables/wearables-resource.d.ts +7 -0
  415. package/dist/next/resources/wearables/wearables-resource.js +5 -0
  416. package/dist/next/storage/ovok-storage.d.ts +16 -0
  417. package/dist/next/storage/ovok-storage.js +8 -0
  418. package/dist/types/ValidationError.d.ts +9 -0
  419. package/dist/utils/patch/getPatchOperationType.d.ts +3 -0
  420. package/dist/utils/patch/getPatchOperationType.js +3 -0
  421. package/package.json +52 -13
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getDeviceObject = void 0;
4
4
  const EXTENSION_BASE_URL = "http://ovok.com/fhir/StructureDefinition";
5
5
  const LOCAL_NAME_URL = `${EXTENSION_BASE_URL}/device-local-name`;
6
- const MANUFACTURER_DATA_URL = `${EXTENSION_BASE_URL}/device-manufacturer-data`;
7
6
  const MANUFACTURER_NAME_URL = `${EXTENSION_BASE_URL}/device-manufacturer-name`;
8
7
  const MODEL_URL = `${EXTENSION_BASE_URL}/device-model`;
9
8
  const SERIAL_NUMBER_URL = `${EXTENSION_BASE_URL}/device-serial-number`;
@@ -39,7 +38,7 @@ const getOptionalStringExtension = (url, value) => {
39
38
  return [{ url, valueString: value }];
40
39
  };
41
40
  const getDeviceObject = (measurementDevice) => {
42
- var _a, _b, _c, _d, _e;
41
+ var _a, _b, _c, _d;
43
42
  if (!measurementDevice) {
44
43
  return {
45
44
  identifier: {
@@ -47,37 +46,21 @@ const getDeviceObject = (measurementDevice) => {
47
46
  },
48
47
  };
49
48
  }
49
+ const display = measurementDevice.variant
50
+ ? variantDisplay(measurementDevice.variant)
51
+ : measurementDevice.name;
52
+ const extension = [
53
+ ...getOptionalStringExtension(LOCAL_NAME_URL, measurementDevice.localName),
54
+ ...getOptionalStringExtension(MANUFACTURER_NAME_URL, (_b = (_a = measurementDevice.variant) === null || _a === void 0 ? void 0 : _a.manufacturer) !== null && _b !== void 0 ? _b : measurementDevice.manufacturerName),
55
+ ...getOptionalStringExtension(MODEL_URL, (_d = (_c = measurementDevice.variant) === null || _c === void 0 ? void 0 : _c.model) !== null && _d !== void 0 ? _d : measurementDevice.model),
56
+ ...(measurementDevice.variant ? getOptionalStringExtension(PARSER_URL, measurementDevice.name) : []),
57
+ ...getOptionalStringExtension(SERIAL_NUMBER_URL, measurementDevice.sn),
58
+ ...getBatteryExtension(measurementDevice.batteryPercentage),
59
+ ];
50
60
  return {
51
- ...(measurementDevice.sn
52
- ? {
53
- identifier: {
54
- value: measurementDevice.sn,
55
- },
56
- }
57
- : {}),
58
- display: measurementDevice.variant
59
- ? variantDisplay(measurementDevice.variant)
60
- : (_a = measurementDevice.name) !== null && _a !== void 0 ? _a : "no-name",
61
- extension: [
62
- {
63
- url: LOCAL_NAME_URL,
64
- valueString: measurementDevice.localName || "no-local-name",
65
- },
66
- {
67
- url: MANUFACTURER_DATA_URL,
68
- valueString: measurementDevice.manufacturerData || "no-manufacturer-data",
69
- },
70
- ...getOptionalStringExtension(MANUFACTURER_NAME_URL, (_c = (_b = measurementDevice.variant) === null || _b === void 0 ? void 0 : _b.manufacturer) !== null && _c !== void 0 ? _c : measurementDevice.manufacturerName),
71
- ...getOptionalStringExtension(MODEL_URL, (_e = (_d = measurementDevice.variant) === null || _d === void 0 ? void 0 : _d.model) !== null && _e !== void 0 ? _e : measurementDevice.model),
72
- ...(measurementDevice.variant
73
- ? getOptionalStringExtension(PARSER_URL, measurementDevice.name)
74
- : []),
75
- {
76
- url: SERIAL_NUMBER_URL,
77
- valueString: measurementDevice.sn || "no-serial-number",
78
- },
79
- ...getBatteryExtension(measurementDevice.batteryPercentage),
80
- ],
61
+ ...(measurementDevice.sn ? { identifier: { value: measurementDevice.sn } } : {}),
62
+ ...(display ? { display } : {}),
63
+ ...(extension.length > 0 ? { extension } : {}),
81
64
  };
82
65
  };
83
66
  exports.getDeviceObject = getDeviceObject;
@@ -9,7 +9,9 @@ type Value = Observation[Field];
9
9
  * @returns An object containing the field name and its value or null if none exist.
10
10
  */
11
11
  export declare function getObservationValueDisplay(observation: Observation): {
12
+ /** Name of the observation field holding the value. */
12
13
  field: Field;
14
+ /** The value held in `field`. */
13
15
  value: Value;
14
16
  } | null;
15
17
  export {};
@@ -1,38 +1,81 @@
1
1
  import { Bundle, BundleEntry, Observation } from "@medplum/fhirtypes";
2
2
  import type { IClientStorage, MedplumRequestOptions } from "@medplum/core";
3
+ /**
4
+ * Default client-storage key under which queued measurements are kept.
5
+ */
3
6
  export declare const OFFLINE_MEASUREMENT_QUEUE_STORAGE_KEY = "ovok.core.offline-measurements";
7
+ /**
8
+ * Identifier system that marks an Observation with its offline measurement id.
9
+ */
4
10
  declare const IDENTIFIER_SYSTEM = "https://api.ovok.com/fhir/StructureDefinition/offline-measurement-id";
11
+ /**
12
+ * Settings of the opt-in offline measurement queue.
13
+ */
5
14
  export type OfflineMeasurementQueueOptions = {
15
+ /** Turns the queue on; only `true` enables it. */
6
16
  enabled?: boolean;
17
+ /** Client-storage key for queued measurements; defaults to `OFFLINE_MEASUREMENT_QUEUE_STORAGE_KEY`. */
7
18
  storageKey?: string;
19
+ /** Delivery attempts before an item counts as exhausted; defaults to 8, minimum 1. */
8
20
  maxRetries?: number;
21
+ /** Wait in ms after the first failed attempt, doubled per attempt; defaults to 5000. */
9
22
  retryBackoffMs?: number;
23
+ /** Upper bound in ms for the wait between attempts; defaults to one hour. */
10
24
  maxRetryBackoffMs?: number;
11
25
  /** Returns the active account key. Queue items are delivered only to their owner. */
12
26
  getOwnerKey?: () => string | undefined;
13
27
  };
28
+ /**
29
+ * Options for a queue flush.
30
+ */
14
31
  export type OfflineMeasurementFlushOptions = {
32
+ /** Also retry items that ran out of attempts. */
15
33
  includeExhausted?: boolean;
34
+ /** Give exhausted items a fresh set of attempts, and retry them now. */
16
35
  resetExhausted?: boolean;
17
36
  };
37
+ /**
38
+ * Outcome of a queue flush.
39
+ */
18
40
  export type OfflineMeasurementFlushResult = {
41
+ /** Items sent in this flush. */
19
42
  attempted: number;
43
+ /** Items delivered and removed from the queue. */
20
44
  saved: number;
45
+ /** Items still waiting for a retry, or for their owner to sign in. */
21
46
  queued: number;
47
+ /** Items that ran out of attempts and stay in the queue. */
22
48
  exhausted: number;
49
+ /** Server response per delivered item, keyed by queue id. */
23
50
  responses: Record<string, Bundle>;
51
+ /** Last failure per item still queued, keyed by queue id. */
24
52
  failures: Record<string, OfflineMeasurementFailure>;
25
53
  };
54
+ /**
55
+ * Safe summary of a failed delivery; it never holds the message or payload.
56
+ */
26
57
  export type OfflineMeasurementFailure = {
58
+ /** Error name, `Error` when unknown. */
27
59
  name: string;
60
+ /** Error code, when the error had one. */
28
61
  code?: string;
62
+ /** HTTP status, when the error had one. */
29
63
  status?: number;
30
64
  };
31
65
  type MeasurementTransport = (bundle: Bundle, requestOptions?: MedplumRequestOptions) => Promise<Bundle>;
66
+ /**
67
+ * Deterministic UUID for an observation, ignoring its device-reading identifier.
68
+ *
69
+ * @param observation - Observation to derive the id from.
70
+ */
32
71
  declare const stableMeasurementId: (observation: Observation) => string;
33
- /** How a save names and writes each observation; `SaveObservationsOptions` describes both. */
72
+ /**
73
+ * How a save names and writes each observation; `SaveObservationsOptions` describes both.
74
+ */
34
75
  type ObservationEntryOptions = {
76
+ /** Identifier systems that name a reading, so a repeated save creates it once. */
35
77
  identifierSystems?: readonly string[];
78
+ /** Write over the observation saved under the same reading identifier instead of keeping it. */
36
79
  replace?: boolean;
37
80
  };
38
81
  /**
@@ -40,6 +83,10 @@ type ObservationEntryOptions = {
40
83
  * or one of its reading identifiers, or with `replace`, written over the one saved under its reading identifiers.
41
84
  */
42
85
  declare const entryForObservation: (observation: Observation, { identifierSystems, replace }?: ObservationEntryOptions) => BundleEntry<Observation>;
86
+ /**
87
+ * Durable queue that stores observation bundles in client storage and retries delivery with exponential backoff.
88
+ * Items are delivered only while their owner's account is the active one.
89
+ */
43
90
  export declare class OfflineMeasurementQueue {
44
91
  private readonly storage;
45
92
  private readonly transport;
@@ -50,10 +97,18 @@ export declare class OfflineMeasurementQueue {
50
97
  private readonly getOwnerKey?;
51
98
  private operation;
52
99
  constructor(storage: IClientStorage, transport: MeasurementTransport, options?: OfflineMeasurementQueueOptions);
100
+ /**
101
+ * Queues observations, then flushes the queue; an identical save is queued once.
102
+ *
103
+ * @throws Error when an owner key is configured but no account is active.
104
+ */
53
105
  enqueueAndFlush: (observations: Observation[], requestOptions?: MedplumRequestOptions, entryOptions?: ObservationEntryOptions) => Promise<{
106
+ /** Queue id of this save. */
54
107
  id: string;
108
+ /** Outcome of the flush that followed. */
55
109
  flush: OfflineMeasurementFlushResult;
56
110
  }>;
111
+ /** Retries the queued items that are due and resolves with the outcome. */
57
112
  flush: (options?: OfflineMeasurementFlushOptions, requestOptions?: MedplumRequestOptions) => Promise<OfflineMeasurementFlushResult>;
58
113
  private runExclusive;
59
114
  private readQueue;
@@ -1,13 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.stableMeasurementId = exports.entryForObservation = exports.OFFLINE_MEASUREMENT_IDENTIFIER_SYSTEM = exports.DEFAULT_OFFLINE_MEASUREMENT_QUEUE_KEY = exports.OfflineMeasurementQueue = exports.OFFLINE_MEASUREMENT_QUEUE_STORAGE_KEY = void 0;
4
+ const bundle_entry_status_1 = require("../observation/bundle-entry-status");
4
5
  const fhir_systems_1 = require("../observation/fhir-systems");
5
6
  const request_options_1 = require("../request-options");
7
+ /**
8
+ * Default client-storage key under which queued measurements are kept.
9
+ */
6
10
  exports.OFFLINE_MEASUREMENT_QUEUE_STORAGE_KEY = "ovok.core.offline-measurements";
7
11
  exports.DEFAULT_OFFLINE_MEASUREMENT_QUEUE_KEY = exports.OFFLINE_MEASUREMENT_QUEUE_STORAGE_KEY;
8
12
  const DEFAULT_MAX_RETRIES = 8;
9
13
  const DEFAULT_RETRY_BACKOFF_MS = 5000;
10
14
  const DEFAULT_MAX_RETRY_BACKOFF_MS = 60 * 60 * 1000;
15
+ /**
16
+ * Identifier system that marks an Observation with its offline measurement id.
17
+ */
11
18
  const IDENTIFIER_SYSTEM = "https://api.ovok.com/fhir/StructureDefinition/offline-measurement-id";
12
19
  exports.OFFLINE_MEASUREMENT_IDENTIFIER_SYSTEM = IDENTIFIER_SYSTEM;
13
20
  const canonicalize = (value) => {
@@ -46,6 +53,11 @@ const stableValueId = (input) => {
46
53
  hex[16] = ((Number.parseInt(hex[16], 16) & 0x3) | 0x8).toString(16);
47
54
  return `${hex.slice(0, 8).join("")}-${hex.slice(8, 12).join("")}-${hex.slice(12, 16).join("")}-${hex.slice(16, 20).join("")}-${hex.slice(20).join("")}`;
48
55
  };
56
+ /**
57
+ * Deterministic UUID for an observation, ignoring its device-reading identifier.
58
+ *
59
+ * @param observation - Observation to derive the id from.
60
+ */
49
61
  const stableMeasurementId = (observation) => {
50
62
  const identifiers = observation.identifier;
51
63
  if (!(identifiers === null || identifiers === void 0 ? void 0 : identifiers.some((identifier) => identifier.system === fhir_systems_1.DEVICE_READING_IDENTIFIER_SYSTEM))) {
@@ -114,14 +126,7 @@ const entryForObservation = (observation, { identifierSystems = [], replace = fa
114
126
  };
115
127
  };
116
128
  exports.entryForObservation = entryForObservation;
117
- const isFailedResponse = (bundle) => {
118
- var _a, _b;
119
- return (_b = (_a = bundle.entry) === null || _a === void 0 ? void 0 : _a.some((entry) => {
120
- var _a, _b;
121
- const status = (_b = (_a = entry.response) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : "";
122
- return status.startsWith("4") || status.startsWith("5");
123
- })) !== null && _b !== void 0 ? _b : false;
124
- };
129
+ const isFailedResponse = (bundle) => { var _a, _b; return (_b = (_a = bundle.entry) === null || _a === void 0 ? void 0 : _a.some(bundle_entry_status_1.isFailedEntry)) !== null && _b !== void 0 ? _b : false; };
125
130
  /** The stored failure: name, and code/status when present; never the message or payload. */
126
131
  const summarizeFailure = (error) => {
127
132
  const failure = error;
@@ -140,12 +145,21 @@ const tally = (result, item) => {
140
145
  result.queued++;
141
146
  }
142
147
  };
148
+ /**
149
+ * Durable queue that stores observation bundles in client storage and retries delivery with exponential backoff.
150
+ * Items are delivered only while their owner's account is the active one.
151
+ */
143
152
  class OfflineMeasurementQueue {
144
153
  constructor(storage, transport, options = {}) {
145
154
  var _a, _b, _c, _d;
146
155
  this.storage = storage;
147
156
  this.transport = transport;
148
157
  this.operation = Promise.resolve();
158
+ /**
159
+ * Queues observations, then flushes the queue; an identical save is queued once.
160
+ *
161
+ * @throws Error when an owner key is configured but no account is active.
162
+ */
149
163
  this.enqueueAndFlush = (observations, requestOptions, entryOptions) => {
150
164
  var _a;
151
165
  const ownerKey = (_a = this.getOwnerKey) === null || _a === void 0 ? void 0 : _a.call(this);
@@ -172,6 +186,7 @@ class OfflineMeasurementQueue {
172
186
  return { id, flush: await this.flushQueue(queue, {}, ...(0, request_options_1.optionalArg)(requestOptions)) };
173
187
  });
174
188
  };
189
+ /** Retries the queued items that are due and resolves with the outcome. */
175
190
  this.flush = (options = {}, requestOptions) => this.runExclusive(async () => {
176
191
  var _a, _b;
177
192
  await ((_b = (_a = this.storage).getInitPromise) === null || _b === void 0 ? void 0 : _b.call(_a));
@@ -1,14 +1,29 @@
1
1
  import { Observation } from "@medplum/fhirtypes";
2
- /** Storage contract shared by native/background and React integrations. */
2
+ /**
3
+ * Storage contract shared by native/background and React integrations.
4
+ */
3
5
  export declare const OVOK_SHARED_MEASUREMENT_QUEUE_KEY = "@ovok/shared/measurements";
6
+ /**
7
+ * One queued item in the storage shared by native/background and React code.
8
+ */
4
9
  export type SharedMeasurementQueueEntry = {
10
+ /** Unique id of the entry. */
5
11
  id: string;
12
+ /** What the payload is: an observation or a Bluetooth result. */
6
13
  kind: "observation" | "bluetooth-result";
14
+ /** ISO 8601 time the entry was queued. */
7
15
  queuedAt: string;
16
+ /** Number of delivery attempts so far. */
8
17
  attempt: number;
18
+ /** The observation, or the raw Bluetooth result. */
9
19
  payload: Observation | Record<string, unknown>;
10
20
  };
21
+ /**
22
+ * Async key-value storage the shared queue is kept in.
23
+ */
11
24
  export interface SharedMeasurementQueueStorage {
25
+ /** Returns the stored value, or `null` when the key is absent. */
12
26
  getItem: (key: string) => Promise<string | null>;
27
+ /** Stores a value under a key. */
13
28
  setItem: (key: string, value: string) => Promise<void>;
14
29
  }
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OVOK_SHARED_MEASUREMENT_QUEUE_KEY = void 0;
4
- /** Storage contract shared by native/background and React integrations. */
4
+ /**
5
+ * Storage contract shared by native/background and React integrations.
6
+ */
5
7
  exports.OVOK_SHARED_MEASUREMENT_QUEUE_KEY = "@ovok/shared/measurements";
@@ -26,14 +26,23 @@ import * as slimMethods from "./slim/methods";
26
26
  import * as wearableMethods from "./wearables/methods";
27
27
  export { MAX_CONDITIONAL_OBSERVATION_ENTRIES, MAX_OBSERVATION_BUNDLE_BYTES, } from "./observation/observation-bundle-utils";
28
28
  export type { OvokUnauthenticatedReason } from "./auth/session-fetch";
29
+ /**
30
+ * Outcome of a measurement save: stored on the server, or queued offline.
31
+ */
29
32
  export type SaveObservationsResult = {
33
+ /** The server accepted the observations. */
30
34
  status: "saved";
35
+ /** Server response to the save. */
31
36
  response: Bundle;
32
37
  } | {
38
+ /** The offline queue holds the observations for a later delivery. */
33
39
  status: "queued";
40
+ /** Queue id; see `OfflineMeasurementFlushResult`. */
34
41
  queueId: string;
35
42
  };
36
- /** Medplum's request options, and how a save names and writes its observations. */
43
+ /**
44
+ * The client's request options, and how a save names and writes its observations.
45
+ */
37
46
  export type SaveObservationsOptions = MedplumRequestOptions & {
38
47
  /**
39
48
  * Identifier systems that name a reading for good, such as an app's own reading key. An observation carrying an
@@ -48,16 +57,27 @@ export type SaveObservationsOptions = MedplumRequestOptions & {
48
57
  replace?: boolean;
49
58
  };
50
59
  export type OvokFhirVersion = "R4" | "R5";
60
+ /**
61
+ * Configuration of an `OvokClient`: the base client options plus Ovok settings.
62
+ */
51
63
  export type OvokClientOptions = Omit<MedplumClientOptions, "onUnauthenticated"> & {
64
+ /** Called when the session ends and the user must sign in again, with the reason. */
52
65
  onUnauthenticated?: (reason: OvokUnauthenticatedReason) => void;
66
+ /** Id of the ClientApplication used for social login and password-reset requests. */
53
67
  socialLoginClientId?: string;
68
+ /** Abort a request after this many milliseconds; no timeout when omitted. */
54
69
  requestTimeoutMs?: number;
70
+ /** Opt-in offline queue for measurement saves; see `OfflineMeasurementQueueOptions`. */
55
71
  offlineQueue?: OfflineMeasurementQueueOptions;
56
72
  /** Keep the saved login when a refresh cannot reach the server. */
57
73
  keepSessionOnRefreshUnavailable?: boolean;
58
74
  };
75
+ /**
76
+ * Client for one Ovok project: FHIR and Ovok API calls, sessions, saved accounts and the opt-in offline measurement queue.
77
+ */
59
78
  export declare class OvokClient extends MedplumClient {
60
79
  protected socialLoginClientId: string;
80
+ /** Storage the client keeps logins and queued measurements in, when set up. */
61
81
  clientStorage: IClientStorage | undefined;
62
82
  private readonly hasExplicitStorageAdapter;
63
83
  private readonly offlineQueueOptions;
@@ -68,8 +88,10 @@ export declare class OvokClient extends MedplumClient {
68
88
  private profileRetry;
69
89
  private profileRetryMs;
70
90
  /**
71
- * @param config - The configuration for the client.
72
- * @param config.socialLoginClientId - The social login client id to use for the client.
91
+ * Creates a client for one Ovok project.
92
+ *
93
+ * @param config - Client configuration.
94
+ * @throws RangeError when `requestTimeoutMs` is not a positive finite number.
73
95
  */
74
96
  constructor(config: OvokClientOptions);
75
97
  get<T = unknown>(url: URL | string, options?: MedplumRequestOptions): ReadablePromise<T>;
@@ -118,7 +140,7 @@ export declare class OvokClient extends MedplumClient {
118
140
  /** The signed-in account, on its server and project: what queued measurements and a running save belong to. */
119
141
  private accountKey;
120
142
  /**
121
- * Medplum clears its entire client storage after an unrecoverable 401. Keep
143
+ * The FHIR client clears its entire storage after an unrecoverable 401. Keep
122
144
  * saved accounts (marking only the active one expired) and queued measurements.
123
145
  * Use clearAllAccounts() when the caller intends to remove all saved accounts.
124
146
  */
@@ -137,12 +159,11 @@ export declare class OvokClient extends MedplumClient {
137
159
  * account differs from `account`: the rest of a reading is never written under someone else's sign-in.
138
160
  */
139
161
  private executeObservationBundle;
162
+ private executeSave;
140
163
  private mapError;
141
164
  private bindMethods;
142
165
  /**
143
166
  * Gets the `SubscriptionManager` for WebSocket subscriptions.
144
- *
145
- * @category Subscriptions
146
167
  * @returns the `SubscriptionManager` for this client.
147
168
  */
148
169
  getSubscriptionManager(): SubscriptionManager;
@@ -151,6 +172,7 @@ type Methods = typeof authMethods & typeof observationMethods & typeof questionn
151
172
  type Omitted<T> = Omit<T, "executeBot">;
152
173
  declare module "./ovok-client" {
153
174
  interface OvokClient extends Omitted<Methods> {
175
+ /** Executes a bot by identifier (`POST /bots?identifier=`). */
154
176
  executeBot: typeof botMethods.executeBot;
155
177
  clientStorage: IClientStorage | undefined;
156
178
  }
@@ -57,6 +57,7 @@ const inviteMethods = __importStar(require("./invites/methods"));
57
57
  const notificationMethods = __importStar(require("./notifications/methods"));
58
58
  const observationMethods = __importStar(require("./observation/methods"));
59
59
  const observation_bundle_utils_1 = require("./observation/observation-bundle-utils");
60
+ const observation_groups_1 = require("./observation/observation-groups");
60
61
  const offline_1 = require("./offline");
61
62
  const patientMethods = __importStar(require("./patient/methods"));
62
63
  const patientSharingMethods = __importStar(require("./patient-sharing/methods"));
@@ -82,10 +83,15 @@ const isRetrySafePost = (pathname) => pathname === "/ai/fhir/search";
82
83
  /** A failed profile load is tried again after this long, doubling up to the maximum. */
83
84
  const PROFILE_RETRY_MS = 2000;
84
85
  const PROFILE_RETRY_MAX_MS = 60000;
86
+ /**
87
+ * Client for one Ovok project: FHIR and Ovok API calls, sessions, saved accounts and the opt-in offline measurement queue.
88
+ */
85
89
  class OvokClient extends core_1.MedplumClient {
86
90
  /**
87
- * @param config - The configuration for the client.
88
- * @param config.socialLoginClientId - The social login client id to use for the client.
91
+ * Creates a client for one Ovok project.
92
+ *
93
+ * @param config - Client configuration.
94
+ * @throws RangeError when `requestTimeoutMs` is not a positive finite number.
89
95
  */
90
96
  constructor(config) {
91
97
  var _a, _b, _c, _d, _e, _f;
@@ -379,10 +385,11 @@ class OvokClient extends core_1.MedplumClient {
379
385
  .filter((group) => group.length > 0)
380
386
  .map((group) => (0, observation_bundle_utils_1.linkObservationMembers)(group).map((observation) => (0, offline_1.entryForObservation)(observation, entryOptions)));
381
387
  const responses = [];
382
- for (const request of (0, observation_bundle_utils_1.packObservationGroups)(entryGroups)) {
383
- // A reading alone keeps a single save's atomicity; several share a batch.
384
- const type = request.length === 1 ? "transaction" : "batch";
385
- responses.push(await this.executeObservationBundle({ resourceType: "Bundle", type, entry: request.flat() }, requestOptions, account));
388
+ for (const request of (0, observation_groups_1.packObservationGroups)(entryGroups)) {
389
+ // A reading alone keeps a single save's atomicity; several go main observations first.
390
+ responses.push(request.length === 1
391
+ ? await this.executeObservationBundle({ resourceType: "Bundle", type: "transaction", entry: request.flat() }, requestOptions, account)
392
+ : await this.executeSave((execute) => (0, observation_groups_1.executeReadingsBatch)(request, execute), requestOptions, account));
386
393
  }
387
394
  return {
388
395
  resourceType: "Bundle",
@@ -434,7 +441,7 @@ class OvokClient extends core_1.MedplumClient {
434
441
  ].join("|");
435
442
  }
436
443
  /**
437
- * Medplum clears its entire client storage after an unrecoverable 401. Keep
444
+ * The FHIR client clears its entire storage after an unrecoverable 401. Keep
438
445
  * saved accounts (marking only the active one expired) and queued measurements.
439
446
  * Use clearAllAccounts() when the caller intends to remove all saved accounts.
440
447
  */
@@ -530,9 +537,12 @@ class OvokClient extends core_1.MedplumClient {
530
537
  * Sends a save's bundle, over several requests when it must. A later request isn't sent once the signed-in
531
538
  * account differs from `account`: the rest of a reading is never written under someone else's sign-in.
532
539
  */
533
- async executeObservationBundle(bundle, requestOptions, account = this.accountKey()) {
540
+ executeObservationBundle(bundle, requestOptions, account = this.accountKey()) {
541
+ return this.executeSave((execute) => (0, observation_bundle_utils_1.executeObservationBundle)(bundle, execute), requestOptions, account);
542
+ }
543
+ async executeSave(run, requestOptions, account = this.accountKey()) {
534
544
  try {
535
- const response = await (0, observation_bundle_utils_1.executeObservationBundle)(bundle, (request) => {
545
+ const response = await run((request) => {
536
546
  if (this.accountKey() !== account) {
537
547
  throw new Error("The signed-in account changed during the save; the rest of it was not sent.");
538
548
  }
@@ -563,8 +573,6 @@ class OvokClient extends core_1.MedplumClient {
563
573
  }
564
574
  /**
565
575
  * Gets the `SubscriptionManager` for WebSocket subscriptions.
566
- *
567
- * @category Subscriptions
568
576
  * @returns the `SubscriptionManager` for this client.
569
577
  */
570
578
  getSubscriptionManager() {
@@ -1,24 +1,45 @@
1
1
  import type { MedplumRequestOptions } from "@medplum/core";
2
2
  import { OvokClient } from "../ovok-client";
3
3
  import { OvokCurrentPatientProfile, OvokPatientLatestObservationsQuery, OvokPatientObservationBundle, OvokPatientAppointment, OvokPatientCarePlan, OvokPatientDashboard, OvokPatientDashboardQuery, OvokPatientDevice, OvokPatientMeasurement, OvokPatientNotification, OvokPatientQuestionnaire, OvokPatientQuestionnaireResponse, OvokPatientResourceQuery, OvokPatientSchedule, OvokPatientSchedulingQuery, OvokPatientSlot } from "./types";
4
+ /** Reads the signed-in patient's profile, project and access context from `GET /auth/me`. */
4
5
  export declare function getCurrentPatientProfile(this: OvokClient, requestOptions?: MedplumRequestOptions): Promise<OvokCurrentPatientProfile>;
6
+ /** Fetches the latest observation per code from `GET /fhir/Observation/$lastn`. */
5
7
  export declare function getPatientLatestObservations(this: OvokClient, params?: OvokPatientLatestObservationsQuery, requestOptions?: MedplumRequestOptions): Promise<OvokPatientObservationBundle>;
8
+ /** Searches Appointments. */
6
9
  export declare function listPatientAppointments(this: OvokClient, params?: OvokPatientSchedulingQuery, requestOptions?: MedplumRequestOptions): Promise<OvokPatientAppointment[]>;
10
+ /** Reads an Appointment by ID. */
7
11
  export declare function getPatientAppointment(this: OvokClient, appointmentId: string, requestOptions?: MedplumRequestOptions): Promise<OvokPatientAppointment>;
12
+ /** Creates an Appointment. */
8
13
  export declare function createPatientAppointment(this: OvokClient, appointment: OvokPatientAppointment, requestOptions?: MedplumRequestOptions): Promise<OvokPatientAppointment>;
14
+ /** Updates an Appointment. */
9
15
  export declare function updatePatientAppointment(this: OvokClient, appointment: OvokPatientAppointment, requestOptions?: MedplumRequestOptions): Promise<OvokPatientAppointment>;
16
+ /** Searches Schedules. */
10
17
  export declare function listPatientSchedules(this: OvokClient, params?: OvokPatientSchedulingQuery, requestOptions?: MedplumRequestOptions): Promise<OvokPatientSchedule[]>;
18
+ /** Searches Slots. */
11
19
  export declare function listPatientSlots(this: OvokClient, params?: OvokPatientSchedulingQuery, requestOptions?: MedplumRequestOptions): Promise<OvokPatientSlot[]>;
20
+ /** Searches Observations to list measurement history. */
12
21
  export declare function listPatientMeasurementHistory(this: OvokClient, params?: OvokPatientResourceQuery, requestOptions?: MedplumRequestOptions): Promise<OvokPatientMeasurement[]>;
22
+ /** Reads an Observation by ID. */
13
23
  export declare function getPatientMeasurement(this: OvokClient, measurementId: string, requestOptions?: MedplumRequestOptions): Promise<OvokPatientMeasurement>;
24
+ /** Searches CarePlans. */
14
25
  export declare function listPatientCarePlans(this: OvokClient, params?: OvokPatientResourceQuery, requestOptions?: MedplumRequestOptions): Promise<OvokPatientCarePlan[]>;
26
+ /** Reads a CarePlan by ID. */
15
27
  export declare function getPatientCarePlan(this: OvokClient, carePlanId: string, requestOptions?: MedplumRequestOptions): Promise<OvokPatientCarePlan>;
28
+ /** Searches Questionnaires. */
16
29
  export declare function listPatientQuestionnaires(this: OvokClient, params?: OvokPatientResourceQuery, requestOptions?: MedplumRequestOptions): Promise<OvokPatientQuestionnaire[]>;
30
+ /** Reads a Questionnaire by ID. */
17
31
  export declare function getPatientQuestionnaire(this: OvokClient, questionnaireId: string, requestOptions?: MedplumRequestOptions): Promise<OvokPatientQuestionnaire>;
32
+ /** Searches QuestionnaireResponses. */
18
33
  export declare function listPatientQuestionnaireResponses(this: OvokClient, params?: OvokPatientResourceQuery, requestOptions?: MedplumRequestOptions): Promise<OvokPatientQuestionnaireResponse[]>;
34
+ /** Reads a QuestionnaireResponse by ID. */
19
35
  export declare function getPatientQuestionnaireResponse(this: OvokClient, questionnaireResponseId: string, requestOptions?: MedplumRequestOptions): Promise<OvokPatientQuestionnaireResponse>;
36
+ /** Searches Devices. */
20
37
  export declare function listPatientDevices(this: OvokClient, params?: OvokPatientResourceQuery, requestOptions?: MedplumRequestOptions): Promise<OvokPatientDevice[]>;
38
+ /** Reads a Device by ID. */
21
39
  export declare function getPatientDevice(this: OvokClient, deviceId: string, requestOptions?: MedplumRequestOptions): Promise<OvokPatientDevice>;
40
+ /** Searches CommunicationRequests that carry notifications. */
22
41
  export declare function listPatientNotifications(this: OvokClient, params?: OvokPatientResourceQuery, requestOptions?: MedplumRequestOptions): Promise<OvokPatientNotification[]>;
42
+ /** Reads a notification (CommunicationRequest) by ID. */
23
43
  export declare function getPatientNotification(this: OvokClient, notificationId: string, requestOptions?: MedplumRequestOptions): Promise<OvokPatientNotification>;
44
+ /** Loads the profile, latest observations, measurement history and care plans of the signed-in patient. */
24
45
  export declare function getPatientDashboard(this: OvokClient, params?: OvokPatientDashboardQuery, requestOptions?: MedplumRequestOptions): Promise<OvokPatientDashboard>;
@@ -23,9 +23,11 @@ exports.getPatientNotification = getPatientNotification;
23
23
  exports.getPatientDashboard = getPatientDashboard;
24
24
  const query_string_1 = require("../query-string");
25
25
  const request_options_1 = require("../request-options");
26
+ /** Reads the signed-in patient's profile, project and access context from `GET /auth/me`. */
26
27
  async function getCurrentPatientProfile(requestOptions) {
27
28
  return this.get("/auth/me", ...(0, request_options_1.optionalArg)(requestOptions));
28
29
  }
30
+ /** Fetches the latest observation per code from `GET /fhir/Observation/$lastn`. */
29
31
  async function getPatientLatestObservations(params = {}, requestOptions) {
30
32
  return this.get(`/fhir/Observation/$lastn${(0, query_string_1.toQueryString)({
31
33
  patient: params.patient,
@@ -33,60 +35,79 @@ async function getPatientLatestObservations(params = {}, requestOptions) {
33
35
  code: params.code,
34
36
  })}`, { cache: "no-cache", ...requestOptions });
35
37
  }
38
+ /** Searches Appointments. */
36
39
  async function listPatientAppointments(params = {}, requestOptions) {
37
40
  return this.searchResources("Appointment", params, ...(0, request_options_1.optionalArg)(requestOptions));
38
41
  }
42
+ /** Reads an Appointment by ID. */
39
43
  async function getPatientAppointment(appointmentId, requestOptions) {
40
44
  return this.readResource("Appointment", appointmentId, ...(0, request_options_1.optionalArg)(requestOptions));
41
45
  }
46
+ /** Creates an Appointment. */
42
47
  async function createPatientAppointment(appointment, requestOptions) {
43
48
  return this.createResource(appointment, ...(0, request_options_1.optionalArg)(requestOptions));
44
49
  }
50
+ /** Updates an Appointment. */
45
51
  async function updatePatientAppointment(appointment, requestOptions) {
46
52
  return this.updateResource(appointment, ...(0, request_options_1.optionalArg)(requestOptions));
47
53
  }
54
+ /** Searches Schedules. */
48
55
  async function listPatientSchedules(params = {}, requestOptions) {
49
56
  return this.searchResources("Schedule", params, ...(0, request_options_1.optionalArg)(requestOptions));
50
57
  }
58
+ /** Searches Slots. */
51
59
  async function listPatientSlots(params = {}, requestOptions) {
52
60
  return this.searchResources("Slot", params, ...(0, request_options_1.optionalArg)(requestOptions));
53
61
  }
62
+ /** Searches Observations to list measurement history. */
54
63
  async function listPatientMeasurementHistory(params = {}, requestOptions) {
55
64
  return (await this.searchResources("Observation", params, ...(0, request_options_1.optionalArg)(requestOptions)));
56
65
  }
66
+ /** Reads an Observation by ID. */
57
67
  async function getPatientMeasurement(measurementId, requestOptions) {
58
68
  return this.readResource("Observation", measurementId, ...(0, request_options_1.optionalArg)(requestOptions));
59
69
  }
70
+ /** Searches CarePlans. */
60
71
  async function listPatientCarePlans(params = {}, requestOptions) {
61
72
  return (await this.searchResources("CarePlan", params, ...(0, request_options_1.optionalArg)(requestOptions)));
62
73
  }
74
+ /** Reads a CarePlan by ID. */
63
75
  async function getPatientCarePlan(carePlanId, requestOptions) {
64
76
  return this.readResource("CarePlan", carePlanId, ...(0, request_options_1.optionalArg)(requestOptions));
65
77
  }
78
+ /** Searches Questionnaires. */
66
79
  async function listPatientQuestionnaires(params = {}, requestOptions) {
67
80
  return (await this.searchResources("Questionnaire", params, ...(0, request_options_1.optionalArg)(requestOptions)));
68
81
  }
82
+ /** Reads a Questionnaire by ID. */
69
83
  async function getPatientQuestionnaire(questionnaireId, requestOptions) {
70
84
  return this.readResource("Questionnaire", questionnaireId, ...(0, request_options_1.optionalArg)(requestOptions));
71
85
  }
86
+ /** Searches QuestionnaireResponses. */
72
87
  async function listPatientQuestionnaireResponses(params = {}, requestOptions) {
73
88
  return (await this.searchResources("QuestionnaireResponse", params, ...(0, request_options_1.optionalArg)(requestOptions)));
74
89
  }
90
+ /** Reads a QuestionnaireResponse by ID. */
75
91
  async function getPatientQuestionnaireResponse(questionnaireResponseId, requestOptions) {
76
92
  return this.readResource("QuestionnaireResponse", questionnaireResponseId, ...(0, request_options_1.optionalArg)(requestOptions));
77
93
  }
94
+ /** Searches Devices. */
78
95
  async function listPatientDevices(params = {}, requestOptions) {
79
96
  return (await this.searchResources("Device", params, ...(0, request_options_1.optionalArg)(requestOptions)));
80
97
  }
98
+ /** Reads a Device by ID. */
81
99
  async function getPatientDevice(deviceId, requestOptions) {
82
100
  return this.readResource("Device", deviceId, ...(0, request_options_1.optionalArg)(requestOptions));
83
101
  }
102
+ /** Searches CommunicationRequests that carry notifications. */
84
103
  async function listPatientNotifications(params = {}, requestOptions) {
85
104
  return (await this.searchResources("CommunicationRequest", params, ...(0, request_options_1.optionalArg)(requestOptions)));
86
105
  }
106
+ /** Reads a notification (CommunicationRequest) by ID. */
87
107
  async function getPatientNotification(notificationId, requestOptions) {
88
108
  return this.readResource("CommunicationRequest", notificationId, ...(0, request_options_1.optionalArg)(requestOptions));
89
109
  }
110
+ /** Loads the profile, latest observations, measurement history and care plans of the signed-in patient. */
90
111
  async function getPatientDashboard(params = {}, requestOptions) {
91
112
  var _a, _b, _c, _d, _e, _f;
92
113
  const profile = await this.getCurrentPatientProfile(requestOptions);