@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
@@ -1,22 +1,54 @@
1
1
  import type { RequestOptions } from "../../http/transmit";
2
2
  import type { Bundle } from "@medplum/fhirtypes";
3
+ /**
4
+ * Options for retrying queued measurements.
5
+ *
6
+ * @category measurements
7
+ */
3
8
  export type OfflineMeasurementFlushOptions = {
9
+ /** Also retry measurements that ran out of retries. */
4
10
  includeExhausted?: boolean;
11
+ /** Give exhausted measurements a fresh set of retries before flushing. */
5
12
  resetExhausted?: boolean;
6
13
  };
14
+ /**
15
+ * A summary of why the last attempt to send a measurement failed.
16
+ *
17
+ * @category measurements
18
+ */
7
19
  export type OfflineMeasurementFailure = {
20
+ /** Error name. */
8
21
  name: string;
22
+ /** Error code, when it has one. */
9
23
  code?: string;
24
+ /** HTTP status, when the failure was a response. */
10
25
  status?: number;
11
26
  };
27
+ /**
28
+ * The outcome of a flush, with counts and per-measurement responses.
29
+ *
30
+ * @category measurements
31
+ */
12
32
  export type OfflineMeasurementFlushResult = {
33
+ /** Measurements a send was tried for. */
13
34
  attempted: number;
35
+ /** Measurements sent and removed from the queue. */
14
36
  saved: number;
37
+ /** Measurements still waiting to be retried. */
15
38
  queued: number;
39
+ /** Measurements that ran out of retries and are held back. */
16
40
  exhausted: number;
41
+ /** The server response for each saved measurement, by queue id. */
17
42
  responses: Record<string, Bundle>;
43
+ /** The last failure for each measurement that has one, by queue id. */
18
44
  failures: Record<string, OfflineMeasurementFailure>;
19
45
  };
46
+ /**
47
+ * Controls for the offline measurement queue.
48
+ *
49
+ * @category measurements
50
+ */
20
51
  export type OfflineMeasurementQueueApi = {
52
+ /** Sends queued measurements that are due and the signed-in account owns. */
21
53
  flush: (options?: OfflineMeasurementFlushOptions, requestOptions?: RequestOptions) => Promise<OfflineMeasurementFlushResult>;
22
54
  };
@@ -2,15 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isBundle = void 0;
4
4
  exports.saveErrorFrom = saveErrorFrom;
5
+ const bundle_entry_status_1 = require("../../../client/observation/bundle-entry-status");
5
6
  const ovok_errors_1 = require("../../errors/ovok-errors");
6
- const FAILED_STATUS = /^[45]/;
7
7
  const isBundle = (value) => typeof value === "object" && value !== null && value.resourceType === "Bundle";
8
8
  exports.isBundle = isBundle;
9
9
  /** A save's response that refused or left out an observation; a refused one gives its own status. */
10
10
  function saveErrorFrom(response) {
11
- var _a;
12
- const statuses = ((_a = response.entry) !== null && _a !== void 0 ? _a : []).map((entry) => { var _a, _b; return (_b = (_a = entry.response) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : ""; });
13
- const refused = statuses.find((status) => FAILED_STATUS.test(status));
11
+ var _a, _b, _c;
12
+ const refused = (_c = (_b = ((_a = response.entry) !== null && _a !== void 0 ? _a : []).find(bundle_entry_status_1.isFailedEntry)) === null || _b === void 0 ? void 0 : _b.response) === null || _c === void 0 ? void 0 : _c.status;
14
13
  const message = refused
15
14
  ? `The server refused an observation of the reading: ${refused}.`
16
15
  : "The server's response left out an observation of the reading.";
@@ -2,18 +2,36 @@ import type { Appointment, ExtractResource, ResourceType } from "@medplum/fhirty
2
2
  import { RequestOptions } from "../../http/transmit";
3
3
  import { QueryParams } from "../../http/url";
4
4
  import { FhirResource } from "../fhir-resource";
5
- /** Lists resolve to the first page's resources, as the Medplum client's `searchResources` did. */
5
+ /**
6
+ * FHIR resources of one type that can be listed; a list resolves to the first page's resources.
7
+ *
8
+ * @category patient
9
+ */
6
10
  export declare class FhirListResource<K extends ResourceType> {
7
11
  protected readonly fhir: FhirResource;
8
12
  protected readonly type: K;
9
13
  constructor(fhir: FhirResource, type: K);
14
+ /** Lists the first page of matching resources. */
10
15
  list(params?: QueryParams, options?: RequestOptions): Promise<ExtractResource<K>[]>;
11
16
  }
17
+ /**
18
+ * FHIR resources of one type that can be read by ID.
19
+ *
20
+ * @category patient
21
+ */
12
22
  export declare class FhirRecordsResource<K extends ResourceType> extends FhirListResource<K> {
23
+ /** Reads one resource by ID. */
13
24
  retrieve(id: string, options?: RequestOptions): Promise<ExtractResource<K>>;
14
25
  }
26
+ /**
27
+ * Appointments of the patient.
28
+ *
29
+ * @category patient
30
+ */
15
31
  export declare class AppointmentsResource extends FhirRecordsResource<"Appointment"> {
16
32
  constructor(fhir: FhirResource);
33
+ /** Creates an appointment. */
17
34
  create(appointment: Appointment, options?: RequestOptions): Promise<Appointment>;
35
+ /** Replaces the appointment with the given ID. */
18
36
  update(id: string, appointment: Appointment, options?: RequestOptions): Promise<Appointment>;
19
37
  }
@@ -1,31 +1,49 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AppointmentsResource = exports.FhirRecordsResource = exports.FhirListResource = void 0;
4
- /** Lists resolve to the first page's resources, as the Medplum client's `searchResources` did. */
4
+ /**
5
+ * FHIR resources of one type that can be listed; a list resolves to the first page's resources.
6
+ *
7
+ * @category patient
8
+ */
5
9
  class FhirListResource {
6
10
  constructor(fhir, type) {
7
11
  this.fhir = fhir;
8
12
  this.type = type;
9
13
  }
14
+ /** Lists the first page of matching resources. */
10
15
  async list(params = {}, options) {
11
16
  const page = await this.fhir.search(this.type, params, options);
12
17
  return page.data;
13
18
  }
14
19
  }
15
20
  exports.FhirListResource = FhirListResource;
21
+ /**
22
+ * FHIR resources of one type that can be read by ID.
23
+ *
24
+ * @category patient
25
+ */
16
26
  class FhirRecordsResource extends FhirListResource {
27
+ /** Reads one resource by ID. */
17
28
  retrieve(id, options) {
18
29
  return this.fhir.read(this.type, id, options);
19
30
  }
20
31
  }
21
32
  exports.FhirRecordsResource = FhirRecordsResource;
33
+ /**
34
+ * Appointments of the patient.
35
+ *
36
+ * @category patient
37
+ */
22
38
  class AppointmentsResource extends FhirRecordsResource {
23
39
  constructor(fhir) {
24
40
  super(fhir, "Appointment");
25
41
  }
42
+ /** Creates an appointment. */
26
43
  create(appointment, options) {
27
44
  return this.fhir.create(appointment, options);
28
45
  }
46
+ /** Replaces the appointment with the given ID. */
29
47
  update(id, appointment, options) {
30
48
  return this.fhir.update({ ...appointment, id }, options);
31
49
  }
@@ -3,18 +3,33 @@ import { HttpClient } from "../../http/http-client";
3
3
  import { RequestOptions } from "../../http/transmit";
4
4
  import { FhirResource } from "../fhir-resource";
5
5
  import { AppointmentsResource, FhirListResource, FhirRecordsResource } from "./fhir-records";
6
+ /**
7
+ * The signed-in patient's own records.
8
+ *
9
+ * @category patient
10
+ */
6
11
  export declare class PatientResource {
7
12
  private readonly http;
13
+ /** Appointments. */
8
14
  readonly appointments: AppointmentsResource;
15
+ /** Schedules. */
9
16
  readonly schedules: FhirListResource<"Schedule">;
17
+ /** Bookable slots. */
10
18
  readonly slots: FhirListResource<"Slot">;
19
+ /** Measurements, stored as Observations. */
11
20
  readonly measurements: FhirRecordsResource<"Observation">;
21
+ /** Care plans. */
12
22
  readonly carePlans: FhirRecordsResource<"CarePlan">;
23
+ /** Questionnaires. */
13
24
  readonly questionnaires: FhirRecordsResource<"Questionnaire">;
25
+ /** Questionnaire responses. */
14
26
  readonly questionnaireResponses: FhirRecordsResource<"QuestionnaireResponse">;
27
+ /** Devices. */
15
28
  readonly devices: FhirRecordsResource<"Device">;
29
+ /** Notifications, stored as CommunicationRequests. */
16
30
  readonly notifications: FhirRecordsResource<"CommunicationRequest">;
17
31
  constructor(http: HttpClient, fhir: FhirResource);
32
+ /** Reads the latest observations. Calls `GET fhir/Observation/$lastn`. */
18
33
  latestObservations(params?: OvokPatientLatestObservationsQuery, options?: RequestOptions): Promise<OvokPatientObservationBundle>;
19
34
  /** Every read is scoped to the signed-in patient unless its query names another. */
20
35
  dashboard(params?: OvokPatientDashboardQuery, options?: RequestOptions): Promise<OvokPatientDashboard>;
@@ -5,6 +5,11 @@ const query_string_1 = require("../../../client/query-string");
5
5
  const auth_resource_1 = require("../auth-resource");
6
6
  const fhir_records_1 = require("./fhir-records");
7
7
  const LATEST_OBSERVATIONS_PATH = "fhir/Observation/$lastn";
8
+ /**
9
+ * The signed-in patient's own records.
10
+ *
11
+ * @category patient
12
+ */
8
13
  class PatientResource {
9
14
  constructor(http, fhir) {
10
15
  this.http = http;
@@ -18,6 +23,7 @@ class PatientResource {
18
23
  this.devices = new fhir_records_1.FhirRecordsResource(fhir, "Device");
19
24
  this.notifications = new fhir_records_1.FhirRecordsResource(fhir, "CommunicationRequest");
20
25
  }
26
+ /** Reads the latest observations. Calls `GET fhir/Observation/$lastn`. */
21
27
  latestObservations(params = {}, options) {
22
28
  const { patient, max, code } = params;
23
29
  return this.http.get(`${LATEST_OBSERVATIONS_PATH}${(0, query_string_1.toQueryString)({ patient, max, code })}`, options);
@@ -1,9 +1,16 @@
1
1
  import type { OvokProjectFeature, OvokProjectFeatures } from "../../../client/platform/types";
2
2
  import { HttpClient } from "../../http/http-client";
3
3
  import { RequestOptions } from "../../http/transmit";
4
+ /**
5
+ * Features enabled on the current project.
6
+ *
7
+ * @category projects
8
+ */
4
9
  export declare class ProjectFeaturesResource {
5
10
  private readonly http;
6
11
  constructor(http: HttpClient);
12
+ /** Reads the project's features. Calls `GET v1/projects/me/features`. */
7
13
  retrieve(options?: RequestOptions): Promise<OvokProjectFeatures>;
14
+ /** Updates the project's features. Calls `PATCH v1/projects/me/features`. */
8
15
  update(features: OvokProjectFeature[], options?: RequestOptions): Promise<OvokProjectFeatures>;
9
16
  }
@@ -2,13 +2,20 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ProjectFeaturesResource = void 0;
4
4
  const FEATURES_PATH = "v1/projects/me/features";
5
+ /**
6
+ * Features enabled on the current project.
7
+ *
8
+ * @category projects
9
+ */
5
10
  class ProjectFeaturesResource {
6
11
  constructor(http) {
7
12
  this.http = http;
8
13
  }
14
+ /** Reads the project's features. Calls `GET v1/projects/me/features`. */
9
15
  retrieve(options) {
10
16
  return this.http.get(FEATURES_PATH, options);
11
17
  }
18
+ /** Updates the project's features. Calls `PATCH v1/projects/me/features`. */
12
19
  update(features, options) {
13
20
  const body = { features };
14
21
  return this.http.patch(FEATURES_PATH, body, options);
@@ -2,18 +2,37 @@ import type { OvokInviteProjectMember, OvokProjectMember, OvokProjectMemberRespo
2
2
  import { HttpClient } from "../../http/http-client";
3
3
  import { RequestOptions } from "../../http/transmit";
4
4
  import { PagePromise } from "../../paging/page";
5
+ /**
6
+ * Filters and paging for listing project members.
7
+ *
8
+ * @category projects
9
+ */
5
10
  export type ProjectMemberListQuery = {
11
+ /** Only members with this access policy. */
6
12
  accessPolicyId?: string;
13
+ /** Only the member with this profile id. */
7
14
  profileId?: string;
15
+ /** Only the member with this user id. */
8
16
  userId?: string;
17
+ /** Page number to fetch. */
9
18
  page?: number;
19
+ /** Members per page. */
10
20
  count?: number;
11
21
  };
22
+ /**
23
+ * Members of the current project.
24
+ *
25
+ * @category projects
26
+ */
12
27
  export declare class ProjectMembersResource {
13
28
  private readonly http;
14
29
  constructor(http: HttpClient);
30
+ /** Lists project members page by page. Calls `GET v1/projects/me/members`. */
15
31
  list(query?: ProjectMemberListQuery, options?: RequestOptions): PagePromise<OvokProjectMember>;
32
+ /** Invites a member to the project. Calls `POST v1/projects/me/members`. */
16
33
  invite(body: OvokInviteProjectMember, options?: RequestOptions): Promise<OvokProjectMemberResponse>;
34
+ /** Updates a membership. Calls `PATCH v1/projects/me/members/{membershipId}`. */
17
35
  update(membershipId: string, body: OvokUpdateProjectMember, options?: RequestOptions): Promise<OvokProjectMemberResponse>;
36
+ /** Removes a member from the project. Calls `DELETE v1/projects/me/members/{membershipId}`. */
18
37
  remove(membershipId: string, options?: RequestOptions): Promise<OvokRemoveProjectMemberResponse>;
19
38
  }
@@ -5,19 +5,28 @@ const url_1 = require("../../http/url");
5
5
  const numbered_pages_1 = require("../../paging/numbered-pages");
6
6
  const MEMBERS_PATH = "v1/projects/me/members";
7
7
  const memberPath = (membershipId) => `${MEMBERS_PATH}/${(0, url_1.pathSegment)(membershipId)}`;
8
+ /**
9
+ * Members of the current project.
10
+ *
11
+ * @category projects
12
+ */
8
13
  class ProjectMembersResource {
9
14
  constructor(http) {
10
15
  this.http = http;
11
16
  }
17
+ /** Lists project members page by page. Calls `GET v1/projects/me/members`. */
12
18
  list(query = {}, options) {
13
19
  return (0, numbered_pages_1.numberedRoutePages)((path) => this.http.get(path, options), MEMBERS_PATH, query);
14
20
  }
21
+ /** Invites a member to the project. Calls `POST v1/projects/me/members`. */
15
22
  invite(body, options) {
16
23
  return this.http.post(MEMBERS_PATH, body, options);
17
24
  }
25
+ /** Updates a membership. Calls `PATCH v1/projects/me/members/{membershipId}`. */
18
26
  update(membershipId, body, options) {
19
27
  return this.http.patch(memberPath(membershipId), body, options);
20
28
  }
29
+ /** Removes a member from the project. Calls `DELETE v1/projects/me/members/{membershipId}`. */
21
30
  remove(membershipId, options) {
22
31
  return this.http.delete(memberPath(membershipId), options);
23
32
  }
@@ -1,10 +1,18 @@
1
1
  import type { OvokProjectSettingKey, OvokProjectSettings, OvokProjectTextSettingKey } from "../../../client/platform/types";
2
2
  import { HttpClient } from "../../http/http-client";
3
3
  import { RequestOptions } from "../../http/transmit";
4
+ /**
5
+ * Settings of the current project.
6
+ *
7
+ * @category projects
8
+ */
4
9
  export declare class ProjectSettingsResource {
5
10
  private readonly http;
6
11
  constructor(http: HttpClient);
12
+ /** Reads all project settings. Calls `GET v1/project/settings`. */
7
13
  retrieve(options?: RequestOptions): Promise<OvokProjectSettings>;
14
+ /** Turns a project setting on or off. Calls `PUT v1/project/settings/{key}`. */
8
15
  update(key: OvokProjectSettingKey, enabled: boolean, options?: RequestOptions): Promise<OvokProjectSettings>;
16
+ /** Sets or clears a text setting. Calls `PUT v1/project/settings/values/{key}`. */
9
17
  updateText(key: OvokProjectTextSettingKey, value: string | null, options?: RequestOptions): Promise<OvokProjectSettings>;
10
18
  }
@@ -4,16 +4,24 @@ exports.ProjectSettingsResource = void 0;
4
4
  const url_1 = require("../../http/url");
5
5
  const SETTINGS_PATH = "v1/project/settings";
6
6
  const TEXT_SETTINGS_PATH = `${SETTINGS_PATH}/values`;
7
+ /**
8
+ * Settings of the current project.
9
+ *
10
+ * @category projects
11
+ */
7
12
  class ProjectSettingsResource {
8
13
  constructor(http) {
9
14
  this.http = http;
10
15
  }
16
+ /** Reads all project settings. Calls `GET v1/project/settings`. */
11
17
  retrieve(options) {
12
18
  return this.http.get(SETTINGS_PATH, options);
13
19
  }
20
+ /** Turns a project setting on or off. Calls `PUT v1/project/settings/{key}`. */
14
21
  update(key, enabled, options) {
15
22
  return this.http.put(`${SETTINGS_PATH}/${(0, url_1.pathSegment)(key)}`, { enabled }, options);
16
23
  }
24
+ /** Sets or clears a text setting. Calls `PUT v1/project/settings/values/{key}`. */
17
25
  updateText(key, value, options) {
18
26
  return this.http.put(`${TEXT_SETTINGS_PATH}/${(0, url_1.pathSegment)(key)}`, { value }, options);
19
27
  }
@@ -5,14 +5,29 @@ import { PagePromise } from "../../paging/page";
5
5
  import { ProjectFeaturesResource } from "./project-features-resource";
6
6
  import { ProjectMembersResource } from "./project-members-resource";
7
7
  import { ProjectSettingsResource } from "./project-settings-resource";
8
+ /**
9
+ * Paging for listing administered projects.
10
+ *
11
+ * @category projects
12
+ */
8
13
  export type ProjectListQuery = {
14
+ /** Page number to fetch. */
9
15
  page?: number;
16
+ /** Projects per page. */
10
17
  count?: number;
11
18
  };
19
+ /**
20
+ * The projects the signed-in user administers, with their members, features and settings.
21
+ *
22
+ * @category projects
23
+ */
12
24
  export declare class ProjectsResource {
13
25
  private readonly http;
26
+ /** Members of the current project. */
14
27
  readonly members: ProjectMembersResource;
28
+ /** Features enabled for the current project. */
15
29
  readonly features: ProjectFeaturesResource;
30
+ /** Settings of the current project. */
16
31
  readonly settings: ProjectSettingsResource;
17
32
  constructor(http: HttpClient);
18
33
  /** The projects the caller administers, wherever they are signed in. */
@@ -6,6 +6,11 @@ const project_features_resource_1 = require("./project-features-resource");
6
6
  const project_members_resource_1 = require("./project-members-resource");
7
7
  const project_settings_resource_1 = require("./project-settings-resource");
8
8
  const PROJECTS_PATH = "v1/projects";
9
+ /**
10
+ * The projects the signed-in user administers, with their members, features and settings.
11
+ *
12
+ * @category projects
13
+ */
9
14
  class ProjectsResource {
10
15
  constructor(http) {
11
16
  this.http = http;
@@ -2,17 +2,30 @@ import type { Bundle, Observation, Parameters, QuestionnaireResponse } from "@me
2
2
  import { HttpClient } from "../../http/http-client";
3
3
  import { RequestOptions } from "../../http/transmit";
4
4
  import { FhirResource } from "../fhir-resource";
5
+ /**
6
+ * Questionnaire operations.
7
+ *
8
+ * @category questionnaires
9
+ */
5
10
  export declare class QuestionnairesResource {
6
11
  private readonly http;
7
12
  constructor(http: HttpClient);
13
+ /** Pre-fills a Questionnaire with `$populate`. Calls `POST fhir/Questionnaire/{questionnaireId}/$populate`. */
8
14
  populate(questionnaireId: string, parameters?: Parameters, options?: RequestOptions): Promise<Parameters>;
9
15
  }
16
+ /**
17
+ * Saves and processes QuestionnaireResponses.
18
+ *
19
+ * @category questionnaires
20
+ */
10
21
  export declare class QuestionnaireResponsesResource {
11
22
  private readonly http;
12
23
  private readonly fhir;
13
24
  constructor(http: HttpClient, fhir: FhirResource);
25
+ /** Saves a QuestionnaireResponse. Calls the FHIR base path as a transaction. */
14
26
  submit(response: QuestionnaireResponse, options?: RequestOptions): Promise<Bundle>;
15
27
  /** One transaction, so the response is never saved without its observations. */
16
28
  submitWithObservations(response: QuestionnaireResponse, observations: Observation[], options?: RequestOptions): Promise<Bundle>;
29
+ /** Runs `$extract` on a stored QuestionnaireResponse. Calls `POST fhir/QuestionnaireResponse/{id}/$extract`. */
17
30
  extract(questionnaireResponseId: string, options?: RequestOptions): Promise<Parameters>;
18
31
  }
@@ -2,20 +2,32 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.QuestionnaireResponsesResource = exports.QuestionnairesResource = void 0;
4
4
  const url_1 = require("../../http/url");
5
+ /**
6
+ * Questionnaire operations.
7
+ *
8
+ * @category questionnaires
9
+ */
5
10
  class QuestionnairesResource {
6
11
  constructor(http) {
7
12
  this.http = http;
8
13
  }
14
+ /** Pre-fills a Questionnaire with `$populate`. Calls `POST fhir/Questionnaire/{questionnaireId}/$populate`. */
9
15
  populate(questionnaireId, parameters = { resourceType: "Parameters", parameter: [] }, options) {
10
16
  return this.http.post(`fhir/Questionnaire/${(0, url_1.pathSegment)(questionnaireId)}/$populate`, parameters, options);
11
17
  }
12
18
  }
13
19
  exports.QuestionnairesResource = QuestionnairesResource;
20
+ /**
21
+ * Saves and processes QuestionnaireResponses.
22
+ *
23
+ * @category questionnaires
24
+ */
14
25
  class QuestionnaireResponsesResource {
15
26
  constructor(http, fhir) {
16
27
  this.http = http;
17
28
  this.fhir = fhir;
18
29
  }
30
+ /** Saves a QuestionnaireResponse. Calls the FHIR base path as a transaction. */
19
31
  submit(response, options) {
20
32
  return this.submitWithObservations(response, [], options);
21
33
  }
@@ -24,6 +36,7 @@ class QuestionnaireResponsesResource {
24
36
  const entry = [createEntry(response), ...observations.map(createEntry)];
25
37
  return this.fhir.batch({ resourceType: "Bundle", type: "transaction", entry }, options);
26
38
  }
39
+ /** Runs `$extract` on a stored QuestionnaireResponse. Calls `POST fhir/QuestionnaireResponse/{id}/$extract`. */
27
40
  extract(questionnaireResponseId, options) {
28
41
  return this.http.post(`fhir/QuestionnaireResponse/${(0, url_1.pathSegment)(questionnaireResponseId)}/$extract`, {}, options);
29
42
  }
@@ -3,11 +3,22 @@ import { FhirResource } from "../fhir-resource";
3
3
  import { SessionResource } from "../session/session-resource";
4
4
  import { RealtimeNotificationHandler, RealtimeUnsubscribe } from "./realtime-types";
5
5
  export type { RealtimeNotification, RealtimeNotificationHandler, RealtimeUnsubscribe, } from "./realtime-types";
6
+ /**
7
+ * Live notifications of resource changes over a websocket.
8
+ *
9
+ * @category realtime
10
+ */
6
11
  export declare class RealtimeResource {
7
12
  private readonly http;
8
13
  private readonly fhir;
9
14
  private readonly baseUrl;
10
15
  private readonly session;
11
16
  constructor(http: HttpClient, fhir: FhirResource, baseUrl: string, session: SessionResource);
17
+ /**
18
+ * Subscribes to resources matching the FHIR search `criteria` and calls `handler` for each change. Creates a `Subscription` resource and opens a websocket.
19
+ *
20
+ * @returns A function that unsubscribes.
21
+ * @throws OvokValidationError when `criteria` is empty.
22
+ */
12
23
  subscribe(criteria: string, handler: RealtimeNotificationHandler): Promise<RealtimeUnsubscribe>;
13
24
  }
@@ -3,6 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RealtimeResource = void 0;
4
4
  const ovok_errors_1 = require("../../errors/ovok-errors");
5
5
  const realtime_connection_1 = require("./realtime-connection");
6
+ /**
7
+ * Live notifications of resource changes over a websocket.
8
+ *
9
+ * @category realtime
10
+ */
6
11
  class RealtimeResource {
7
12
  constructor(http, fhir, baseUrl, session) {
8
13
  this.http = http;
@@ -10,6 +15,12 @@ class RealtimeResource {
10
15
  this.baseUrl = baseUrl;
11
16
  this.session = session;
12
17
  }
18
+ /**
19
+ * Subscribes to resources matching the FHIR search `criteria` and calls `handler` for each change. Creates a `Subscription` resource and opens a websocket.
20
+ *
21
+ * @returns A function that unsubscribes.
22
+ * @throws OvokValidationError when `criteria` is empty.
23
+ */
13
24
  async subscribe(criteria, handler) {
14
25
  if (criteria.trim() === "") {
15
26
  throw new ovok_errors_1.OvokValidationError((0, ovok_errors_1.detailsFor)("A realtime subscription criteria string is required."));
@@ -77,20 +77,21 @@ class RealtimeSocket {
77
77
  this.waitingForPong = false;
78
78
  return;
79
79
  }
80
- if (!isSubscriptionStatus(message)) {
80
+ if (!isStatusBundle(message)) {
81
81
  socket.close();
82
82
  return;
83
83
  }
84
- if (message.type === "handshake") {
84
+ const [{ resource: status }, ...changes] = message.entry;
85
+ if (status.type === "handshake") {
85
86
  this.clearHandshakeTimer();
86
87
  this.onHandshake();
87
88
  return;
88
89
  }
89
- if (message.type === "heartbeat") {
90
+ if (status.type === "heartbeat") {
90
91
  return;
91
92
  }
92
- if (message.type === "event-notification") {
93
- this.handler({ ...message, type: "event-notification" });
93
+ if (status.type === "event-notification") {
94
+ this.handler({ ...status, type: "event-notification", resources: changedResources(changes) });
94
95
  }
95
96
  }
96
97
  socketClosed(socket) {
@@ -150,3 +151,9 @@ const isSubscriptionStatus = (value) => {
150
151
  typeof value.type === "string" &&
151
152
  typeof value.subscription.reference === "string");
152
153
  };
154
+ const isStatusBundle = (value) => value.resourceType === "Bundle" &&
155
+ Array.isArray(value.entry) &&
156
+ isRecord(value.entry[0]) &&
157
+ isSubscriptionStatus(value.entry[0].resource);
158
+ const isResource = (value) => isRecord(value) && typeof value.resourceType === "string";
159
+ const changedResources = (entries) => entries.flatMap((entry) => (isRecord(entry) && isResource(entry.resource) ? [entry.resource] : []));
@@ -1,6 +1,24 @@
1
- import type { SubscriptionStatus } from "@medplum/fhirtypes";
1
+ import type { Resource, SubscriptionStatus } from "@medplum/fhirtypes";
2
+ /**
3
+ * A notification that a resource matching a subscription changed.
4
+ *
5
+ * @category realtime
6
+ */
2
7
  export type RealtimeNotification = SubscriptionStatus & {
8
+ /** Always `"event-notification"`. */
3
9
  type: "event-notification";
10
+ /** The changed resources sent with the notification, in the order the server sent them. */
11
+ resources: Resource[];
4
12
  };
13
+ /**
14
+ * Callback invoked for each realtime notification.
15
+ *
16
+ * @category realtime
17
+ */
5
18
  export type RealtimeNotificationHandler = (notification: RealtimeNotification) => void;
19
+ /**
20
+ * Ends a realtime subscription.
21
+ *
22
+ * @category realtime
23
+ */
6
24
  export type RealtimeUnsubscribe = () => Promise<void>;
@@ -2,12 +2,28 @@ import { SavedAccount } from "../../auth/saved-accounts-store";
2
2
  import { UserSession } from "../../auth/user-session";
3
3
  import { HttpClient } from "../../http/http-client";
4
4
  import { RequestOptions } from "../../http/transmit";
5
+ /**
6
+ * Accounts saved on this device, for switching between them.
7
+ *
8
+ * @category session
9
+ */
5
10
  export declare class SavedAccountsResource {
6
11
  private readonly http;
7
12
  private readonly session;
8
13
  constructor(http: HttpClient, session: UserSession | null);
14
+ /** Lists the saved accounts, marking the active one. */
9
15
  list(): Promise<SavedAccount[]>;
16
+ /**
17
+ * Makes a saved account the active session.
18
+ *
19
+ * @throws OvokAccountError when the account is missing or its session has expired.
20
+ */
10
21
  switch(accountId: string): Promise<void>;
22
+ /**
23
+ * Signs a saved account out and removes it. Calls `DELETE auth/session/current` for that account unless it has expired.
24
+ *
25
+ * @throws OvokAccountError when the account is not saved.
26
+ */
11
27
  remove(accountId: string, options?: RequestOptions): Promise<void>;
12
28
  private userSession;
13
29
  }