@medplum/core 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (702) hide show
  1. package/README.md +32 -26
  2. package/dist/cjs/index.js +1769 -0
  3. package/dist/cjs/index.js.map +1 -0
  4. package/dist/cjs/index.min.js +16 -0
  5. package/dist/cjs/index.min.js.map +1 -0
  6. package/dist/esm/index.js +1721 -0
  7. package/dist/esm/index.js.map +1 -0
  8. package/dist/esm/index.min.js +16 -0
  9. package/dist/esm/index.min.js.map +1 -0
  10. package/dist/{cache.d.ts → types/cache.d.ts} +1 -0
  11. package/dist/{client.d.ts → types/client.d.ts} +115 -61
  12. package/dist/{crypto.d.ts → types/crypto.d.ts} +0 -0
  13. package/dist/{eventtarget.d.ts → types/eventtarget.d.ts} +0 -0
  14. package/dist/{format.d.ts → types/format.d.ts} +1 -1
  15. package/dist/{index.d.ts → types/index.d.ts} +0 -2
  16. package/dist/types/jwt.d.ts +5 -0
  17. package/dist/{outcomes.d.ts → types/outcomes.d.ts} +7 -2
  18. package/dist/{search.d.ts → types/search.d.ts} +3 -0
  19. package/dist/{searchparams.d.ts → types/searchparams.d.ts} +2 -1
  20. package/dist/{storage.d.ts → types/storage.d.ts} +0 -0
  21. package/dist/{types.d.ts → types/types.d.ts} +18 -4
  22. package/dist/{utils.d.ts → types/utils.d.ts} +1 -1
  23. package/package.json +14 -9
  24. package/rollup.config.js +36 -0
  25. package/dist/cache.js +0 -38
  26. package/dist/cache.js.map +0 -1
  27. package/dist/cache.test.d.ts +0 -1
  28. package/dist/cache.test.js +0 -29
  29. package/dist/cache.test.js.map +0 -1
  30. package/dist/client.js +0 -530
  31. package/dist/client.js.map +0 -1
  32. package/dist/client.test.d.ts +0 -1
  33. package/dist/client.test.js +0 -382
  34. package/dist/client.test.js.map +0 -1
  35. package/dist/crypto.js +0 -22
  36. package/dist/crypto.js.map +0 -1
  37. package/dist/eventtarget.js +0 -39
  38. package/dist/eventtarget.js.map +0 -1
  39. package/dist/eventtarget.test.d.ts +0 -1
  40. package/dist/eventtarget.test.js +0 -44
  41. package/dist/eventtarget.test.js.map +0 -1
  42. package/dist/fhir/AccessPolicy.d.ts +0 -75
  43. package/dist/fhir/AccessPolicy.js +0 -7
  44. package/dist/fhir/AccessPolicy.js.map +0 -1
  45. package/dist/fhir/Account.d.ts +0 -247
  46. package/dist/fhir/Account.js +0 -7
  47. package/dist/fhir/Account.js.map +0 -1
  48. package/dist/fhir/ActivityDefinition.d.ts +0 -500
  49. package/dist/fhir/ActivityDefinition.js +0 -7
  50. package/dist/fhir/ActivityDefinition.js.map +0 -1
  51. package/dist/fhir/Address.d.ts +0 -75
  52. package/dist/fhir/Address.js +0 -7
  53. package/dist/fhir/Address.js.map +0 -1
  54. package/dist/fhir/AdverseEvent.d.ts +0 -303
  55. package/dist/fhir/AdverseEvent.js +0 -7
  56. package/dist/fhir/AdverseEvent.js.map +0 -1
  57. package/dist/fhir/Age.d.ts +0 -47
  58. package/dist/fhir/Age.js +0 -7
  59. package/dist/fhir/Age.js.map +0 -1
  60. package/dist/fhir/AllergyIntolerance.d.ts +0 -283
  61. package/dist/fhir/AllergyIntolerance.js +0 -7
  62. package/dist/fhir/AllergyIntolerance.js.map +0 -1
  63. package/dist/fhir/Annotation.d.ts +0 -42
  64. package/dist/fhir/Annotation.js +0 -7
  65. package/dist/fhir/Annotation.js.map +0 -1
  66. package/dist/fhir/Appointment.d.ts +0 -284
  67. package/dist/fhir/Appointment.js +0 -7
  68. package/dist/fhir/Appointment.js.map +0 -1
  69. package/dist/fhir/AppointmentResponse.d.ts +0 -131
  70. package/dist/fhir/AppointmentResponse.js +0 -7
  71. package/dist/fhir/AppointmentResponse.js.map +0 -1
  72. package/dist/fhir/Attachment.d.ts +0 -58
  73. package/dist/fhir/Attachment.js +0 -7
  74. package/dist/fhir/Attachment.js.map +0 -1
  75. package/dist/fhir/AuditEvent.d.ts +0 -458
  76. package/dist/fhir/AuditEvent.js +0 -7
  77. package/dist/fhir/AuditEvent.js.map +0 -1
  78. package/dist/fhir/Basic.d.ts +0 -110
  79. package/dist/fhir/Basic.js +0 -7
  80. package/dist/fhir/Basic.js.map +0 -1
  81. package/dist/fhir/Binary.d.ts +0 -59
  82. package/dist/fhir/Binary.js +0 -7
  83. package/dist/fhir/Binary.js.map +0 -1
  84. package/dist/fhir/BiologicallyDerivedProduct.d.ts +0 -358
  85. package/dist/fhir/BiologicallyDerivedProduct.js +0 -7
  86. package/dist/fhir/BiologicallyDerivedProduct.js.map +0 -1
  87. package/dist/fhir/BodyStructure.d.ts +0 -119
  88. package/dist/fhir/BodyStructure.js +0 -7
  89. package/dist/fhir/BodyStructure.js.map +0 -1
  90. package/dist/fhir/Bot.d.ts +0 -49
  91. package/dist/fhir/Bot.js +0 -7
  92. package/dist/fhir/Bot.js.map +0 -1
  93. package/dist/fhir/Bundle.d.ts +0 -379
  94. package/dist/fhir/Bundle.js +0 -7
  95. package/dist/fhir/Bundle.js.map +0 -1
  96. package/dist/fhir/CapabilityStatement.d.ts +0 -1044
  97. package/dist/fhir/CapabilityStatement.js +0 -7
  98. package/dist/fhir/CapabilityStatement.js.map +0 -1
  99. package/dist/fhir/CarePlan.d.ts +0 -446
  100. package/dist/fhir/CarePlan.js +0 -7
  101. package/dist/fhir/CarePlan.js.map +0 -1
  102. package/dist/fhir/CareTeam.d.ts +0 -211
  103. package/dist/fhir/CareTeam.js +0 -7
  104. package/dist/fhir/CareTeam.js.map +0 -1
  105. package/dist/fhir/CatalogEntry.d.ts +0 -195
  106. package/dist/fhir/CatalogEntry.js +0 -7
  107. package/dist/fhir/CatalogEntry.js.map +0 -1
  108. package/dist/fhir/ChargeItem.d.ts +0 -287
  109. package/dist/fhir/ChargeItem.js +0 -7
  110. package/dist/fhir/ChargeItem.js.map +0 -1
  111. package/dist/fhir/ChargeItemDefinition.d.ts +0 -401
  112. package/dist/fhir/ChargeItemDefinition.js +0 -7
  113. package/dist/fhir/ChargeItemDefinition.js.map +0 -1
  114. package/dist/fhir/Claim.d.ts +0 -1092
  115. package/dist/fhir/Claim.js +0 -7
  116. package/dist/fhir/Claim.js.map +0 -1
  117. package/dist/fhir/ClaimResponse.d.ts +0 -1040
  118. package/dist/fhir/ClaimResponse.js +0 -7
  119. package/dist/fhir/ClaimResponse.js.map +0 -1
  120. package/dist/fhir/ClientApplication.d.ts +0 -46
  121. package/dist/fhir/ClientApplication.js +0 -7
  122. package/dist/fhir/ClientApplication.js.map +0 -1
  123. package/dist/fhir/ClinicalImpression.d.ts +0 -306
  124. package/dist/fhir/ClinicalImpression.js +0 -7
  125. package/dist/fhir/ClinicalImpression.js.map +0 -1
  126. package/dist/fhir/CodeSystem.d.ts +0 -541
  127. package/dist/fhir/CodeSystem.js +0 -7
  128. package/dist/fhir/CodeSystem.js.map +0 -1
  129. package/dist/fhir/CodeableConcept.d.ts +0 -33
  130. package/dist/fhir/CodeableConcept.js +0 -7
  131. package/dist/fhir/CodeableConcept.js.map +0 -1
  132. package/dist/fhir/Coding.d.ts +0 -50
  133. package/dist/fhir/Coding.js +0 -7
  134. package/dist/fhir/Coding.js.map +0 -1
  135. package/dist/fhir/Communication.d.ts +0 -264
  136. package/dist/fhir/Communication.js +0 -7
  137. package/dist/fhir/Communication.js.map +0 -1
  138. package/dist/fhir/CommunicationRequest.d.ts +0 -261
  139. package/dist/fhir/CommunicationRequest.js +0 -7
  140. package/dist/fhir/CommunicationRequest.js.map +0 -1
  141. package/dist/fhir/CompartmentDefinition.d.ts +0 -217
  142. package/dist/fhir/CompartmentDefinition.js +0 -7
  143. package/dist/fhir/CompartmentDefinition.js.map +0 -1
  144. package/dist/fhir/Composition.d.ts +0 -429
  145. package/dist/fhir/Composition.js +0 -7
  146. package/dist/fhir/Composition.js.map +0 -1
  147. package/dist/fhir/ConceptMap.d.ts +0 -518
  148. package/dist/fhir/ConceptMap.js +0 -7
  149. package/dist/fhir/ConceptMap.js.map +0 -1
  150. package/dist/fhir/Condition.d.ts +0 -326
  151. package/dist/fhir/Condition.js +0 -7
  152. package/dist/fhir/Condition.js.map +0 -1
  153. package/dist/fhir/Consent.d.ts +0 -460
  154. package/dist/fhir/Consent.js +0 -7
  155. package/dist/fhir/Consent.js.map +0 -1
  156. package/dist/fhir/ContactDetail.d.ts +0 -31
  157. package/dist/fhir/ContactDetail.js +0 -7
  158. package/dist/fhir/ContactDetail.js.map +0 -1
  159. package/dist/fhir/ContactPoint.d.ts +0 -47
  160. package/dist/fhir/ContactPoint.js +0 -7
  161. package/dist/fhir/ContactPoint.js.map +0 -1
  162. package/dist/fhir/Contract.d.ts +0 -1452
  163. package/dist/fhir/Contract.js +0 -7
  164. package/dist/fhir/Contract.js.map +0 -1
  165. package/dist/fhir/Contributor.d.ts +0 -37
  166. package/dist/fhir/Contributor.js +0 -7
  167. package/dist/fhir/Contributor.js.map +0 -1
  168. package/dist/fhir/Count.d.ts +0 -49
  169. package/dist/fhir/Count.js +0 -7
  170. package/dist/fhir/Count.js.map +0 -1
  171. package/dist/fhir/Coverage.d.ts +0 -327
  172. package/dist/fhir/Coverage.js +0 -7
  173. package/dist/fhir/Coverage.js.map +0 -1
  174. package/dist/fhir/CoverageEligibilityRequest.d.ts +0 -404
  175. package/dist/fhir/CoverageEligibilityRequest.js +0 -7
  176. package/dist/fhir/CoverageEligibilityRequest.js.map +0 -1
  177. package/dist/fhir/CoverageEligibilityResponse.d.ts +0 -434
  178. package/dist/fhir/CoverageEligibilityResponse.js +0 -7
  179. package/dist/fhir/CoverageEligibilityResponse.js.map +0 -1
  180. package/dist/fhir/DataRequirement.d.ts +0 -239
  181. package/dist/fhir/DataRequirement.js +0 -7
  182. package/dist/fhir/DataRequirement.js.map +0 -1
  183. package/dist/fhir/DetectedIssue.d.ts +0 -252
  184. package/dist/fhir/DetectedIssue.js +0 -7
  185. package/dist/fhir/DetectedIssue.js.map +0 -1
  186. package/dist/fhir/Device.d.ts +0 -493
  187. package/dist/fhir/Device.js +0 -7
  188. package/dist/fhir/Device.js.map +0 -1
  189. package/dist/fhir/DeviceDefinition.d.ts +0 -486
  190. package/dist/fhir/DeviceDefinition.js +0 -7
  191. package/dist/fhir/DeviceDefinition.js.map +0 -1
  192. package/dist/fhir/DeviceMetric.d.ts +0 -199
  193. package/dist/fhir/DeviceMetric.js +0 -7
  194. package/dist/fhir/DeviceMetric.js.map +0 -1
  195. package/dist/fhir/DeviceRequest.d.ts +0 -296
  196. package/dist/fhir/DeviceRequest.js +0 -7
  197. package/dist/fhir/DeviceRequest.js.map +0 -1
  198. package/dist/fhir/DeviceUseStatement.d.ts +0 -168
  199. package/dist/fhir/DeviceUseStatement.js +0 -7
  200. package/dist/fhir/DeviceUseStatement.js.map +0 -1
  201. package/dist/fhir/DiagnosticReport.d.ts +0 -254
  202. package/dist/fhir/DiagnosticReport.js +0 -7
  203. package/dist/fhir/DiagnosticReport.js.map +0 -1
  204. package/dist/fhir/Distance.d.ts +0 -47
  205. package/dist/fhir/Distance.js +0 -7
  206. package/dist/fhir/Distance.js.map +0 -1
  207. package/dist/fhir/DocumentManifest.d.ts +0 -196
  208. package/dist/fhir/DocumentManifest.js +0 -7
  209. package/dist/fhir/DocumentManifest.js.map +0 -1
  210. package/dist/fhir/DocumentReference.d.ts +0 -349
  211. package/dist/fhir/DocumentReference.js +0 -7
  212. package/dist/fhir/DocumentReference.js.map +0 -1
  213. package/dist/fhir/Dosage.d.ts +0 -152
  214. package/dist/fhir/Dosage.js +0 -7
  215. package/dist/fhir/Dosage.js.map +0 -1
  216. package/dist/fhir/Duration.d.ts +0 -46
  217. package/dist/fhir/Duration.js +0 -7
  218. package/dist/fhir/Duration.js.map +0 -1
  219. package/dist/fhir/EffectEvidenceSynthesis.d.ts +0 -591
  220. package/dist/fhir/EffectEvidenceSynthesis.js +0 -7
  221. package/dist/fhir/EffectEvidenceSynthesis.js.map +0 -1
  222. package/dist/fhir/Element.d.ts +0 -21
  223. package/dist/fhir/Element.js +0 -7
  224. package/dist/fhir/Element.js.map +0 -1
  225. package/dist/fhir/ElementDefinition.d.ts +0 -2701
  226. package/dist/fhir/ElementDefinition.js +0 -7
  227. package/dist/fhir/ElementDefinition.js.map +0 -1
  228. package/dist/fhir/Encounter.d.ts +0 -558
  229. package/dist/fhir/Encounter.js +0 -7
  230. package/dist/fhir/Encounter.js.map +0 -1
  231. package/dist/fhir/Endpoint.d.ts +0 -140
  232. package/dist/fhir/Endpoint.js +0 -7
  233. package/dist/fhir/Endpoint.js.map +0 -1
  234. package/dist/fhir/EnrollmentRequest.d.ts +0 -113
  235. package/dist/fhir/EnrollmentRequest.js +0 -7
  236. package/dist/fhir/EnrollmentRequest.js.map +0 -1
  237. package/dist/fhir/EnrollmentResponse.d.ts +0 -117
  238. package/dist/fhir/EnrollmentResponse.js +0 -7
  239. package/dist/fhir/EnrollmentResponse.js.map +0 -1
  240. package/dist/fhir/EpisodeOfCare.d.ts +0 -246
  241. package/dist/fhir/EpisodeOfCare.js +0 -7
  242. package/dist/fhir/EpisodeOfCare.js.map +0 -1
  243. package/dist/fhir/EventDefinition.d.ts +0 -253
  244. package/dist/fhir/EventDefinition.js +0 -7
  245. package/dist/fhir/EventDefinition.js.map +0 -1
  246. package/dist/fhir/Evidence.d.ts +0 -252
  247. package/dist/fhir/Evidence.js +0 -7
  248. package/dist/fhir/Evidence.js.map +0 -1
  249. package/dist/fhir/EvidenceVariable.d.ts +0 -370
  250. package/dist/fhir/EvidenceVariable.js +0 -7
  251. package/dist/fhir/EvidenceVariable.js.map +0 -1
  252. package/dist/fhir/ExampleScenario.d.ts +0 -628
  253. package/dist/fhir/ExampleScenario.js +0 -7
  254. package/dist/fhir/ExampleScenario.js.map +0 -1
  255. package/dist/fhir/ExplanationOfBenefit.d.ts +0 -1841
  256. package/dist/fhir/ExplanationOfBenefit.js +0 -7
  257. package/dist/fhir/ExplanationOfBenefit.js.map +0 -1
  258. package/dist/fhir/Expression.d.ts +0 -45
  259. package/dist/fhir/Expression.js +0 -7
  260. package/dist/fhir/Expression.js.map +0 -1
  261. package/dist/fhir/Extension.d.ts +0 -306
  262. package/dist/fhir/Extension.js +0 -7
  263. package/dist/fhir/Extension.js.map +0 -1
  264. package/dist/fhir/FamilyMemberHistory.d.ts +0 -306
  265. package/dist/fhir/FamilyMemberHistory.js +0 -7
  266. package/dist/fhir/FamilyMemberHistory.js.map +0 -1
  267. package/dist/fhir/Flag.d.ts +0 -132
  268. package/dist/fhir/Flag.js +0 -7
  269. package/dist/fhir/Flag.js.map +0 -1
  270. package/dist/fhir/Goal.d.ts +0 -299
  271. package/dist/fhir/Goal.js +0 -7
  272. package/dist/fhir/Goal.js.map +0 -1
  273. package/dist/fhir/GraphDefinition.d.ts +0 -350
  274. package/dist/fhir/GraphDefinition.js +0 -7
  275. package/dist/fhir/GraphDefinition.js.map +0 -1
  276. package/dist/fhir/Group.d.ts +0 -271
  277. package/dist/fhir/Group.js +0 -7
  278. package/dist/fhir/Group.js.map +0 -1
  279. package/dist/fhir/GuidanceResponse.d.ts +0 -196
  280. package/dist/fhir/GuidanceResponse.js +0 -7
  281. package/dist/fhir/GuidanceResponse.js.map +0 -1
  282. package/dist/fhir/HealthcareService.d.ts +0 -356
  283. package/dist/fhir/HealthcareService.js +0 -7
  284. package/dist/fhir/HealthcareService.js.map +0 -1
  285. package/dist/fhir/HumanName.d.ts +0 -58
  286. package/dist/fhir/HumanName.js +0 -7
  287. package/dist/fhir/HumanName.js.map +0 -1
  288. package/dist/fhir/Identifier.d.ts +0 -53
  289. package/dist/fhir/Identifier.js +0 -7
  290. package/dist/fhir/Identifier.js.map +0 -1
  291. package/dist/fhir/ImagingStudy.d.ts +0 -407
  292. package/dist/fhir/ImagingStudy.js +0 -7
  293. package/dist/fhir/ImagingStudy.js.map +0 -1
  294. package/dist/fhir/Immunization.d.ts +0 -444
  295. package/dist/fhir/Immunization.js +0 -7
  296. package/dist/fhir/Immunization.js.map +0 -1
  297. package/dist/fhir/ImmunizationEvaluation.d.ts +0 -149
  298. package/dist/fhir/ImmunizationEvaluation.js +0 -7
  299. package/dist/fhir/ImmunizationEvaluation.js.map +0 -1
  300. package/dist/fhir/ImmunizationRecommendation.d.ts +0 -254
  301. package/dist/fhir/ImmunizationRecommendation.js +0 -7
  302. package/dist/fhir/ImmunizationRecommendation.js.map +0 -1
  303. package/dist/fhir/ImplementationGuide.d.ts +0 -824
  304. package/dist/fhir/ImplementationGuide.js +0 -7
  305. package/dist/fhir/ImplementationGuide.js.map +0 -1
  306. package/dist/fhir/InsurancePlan.d.ts +0 -624
  307. package/dist/fhir/InsurancePlan.js +0 -7
  308. package/dist/fhir/InsurancePlan.js.map +0 -1
  309. package/dist/fhir/Invoice.d.ts +0 -346
  310. package/dist/fhir/Invoice.js +0 -7
  311. package/dist/fhir/Invoice.js.map +0 -1
  312. package/dist/fhir/JsonWebKey.d.ts +0 -99
  313. package/dist/fhir/JsonWebKey.js +0 -7
  314. package/dist/fhir/JsonWebKey.js.map +0 -1
  315. package/dist/fhir/Library.d.ts +0 -277
  316. package/dist/fhir/Library.js +0 -7
  317. package/dist/fhir/Library.js.map +0 -1
  318. package/dist/fhir/Linkage.d.ts +0 -146
  319. package/dist/fhir/Linkage.js +0 -7
  320. package/dist/fhir/Linkage.js.map +0 -1
  321. package/dist/fhir/List.d.ts +0 -200
  322. package/dist/fhir/List.js +0 -7
  323. package/dist/fhir/List.js.map +0 -1
  324. package/dist/fhir/Location.d.ts +0 -277
  325. package/dist/fhir/Location.js +0 -7
  326. package/dist/fhir/Location.js.map +0 -1
  327. package/dist/fhir/Login.d.ts +0 -119
  328. package/dist/fhir/Login.js +0 -7
  329. package/dist/fhir/Login.js.map +0 -1
  330. package/dist/fhir/MarketingStatus.d.ts +0 -82
  331. package/dist/fhir/MarketingStatus.js +0 -7
  332. package/dist/fhir/MarketingStatus.js.map +0 -1
  333. package/dist/fhir/Measure.d.ts +0 -620
  334. package/dist/fhir/Measure.js +0 -7
  335. package/dist/fhir/Measure.js.map +0 -1
  336. package/dist/fhir/MeasureReport.d.ts +0 -463
  337. package/dist/fhir/MeasureReport.js +0 -7
  338. package/dist/fhir/MeasureReport.js.map +0 -1
  339. package/dist/fhir/Media.d.ts +0 -205
  340. package/dist/fhir/Media.js +0 -7
  341. package/dist/fhir/Media.js.map +0 -1
  342. package/dist/fhir/Medication.d.ts +0 -230
  343. package/dist/fhir/Medication.js +0 -7
  344. package/dist/fhir/Medication.js.map +0 -1
  345. package/dist/fhir/MedicationAdministration.d.ts +0 -352
  346. package/dist/fhir/MedicationAdministration.js +0 -7
  347. package/dist/fhir/MedicationAdministration.js.map +0 -1
  348. package/dist/fhir/MedicationDispense.d.ts +0 -343
  349. package/dist/fhir/MedicationDispense.js +0 -7
  350. package/dist/fhir/MedicationDispense.js.map +0 -1
  351. package/dist/fhir/MedicationKnowledge.d.ts +0 -992
  352. package/dist/fhir/MedicationKnowledge.js +0 -7
  353. package/dist/fhir/MedicationKnowledge.js.map +0 -1
  354. package/dist/fhir/MedicationRequest.d.ts +0 -481
  355. package/dist/fhir/MedicationRequest.js +0 -7
  356. package/dist/fhir/MedicationRequest.js.map +0 -1
  357. package/dist/fhir/MedicationStatement.d.ts +0 -228
  358. package/dist/fhir/MedicationStatement.js +0 -7
  359. package/dist/fhir/MedicationStatement.js.map +0 -1
  360. package/dist/fhir/MedicinalProduct.d.ts +0 -453
  361. package/dist/fhir/MedicinalProduct.js +0 -7
  362. package/dist/fhir/MedicinalProduct.js.map +0 -1
  363. package/dist/fhir/MedicinalProductAuthorization.d.ts +0 -271
  364. package/dist/fhir/MedicinalProductAuthorization.js +0 -7
  365. package/dist/fhir/MedicinalProductAuthorization.js.map +0 -1
  366. package/dist/fhir/MedicinalProductContraindication.d.ts +0 -170
  367. package/dist/fhir/MedicinalProductContraindication.js +0 -7
  368. package/dist/fhir/MedicinalProductContraindication.js.map +0 -1
  369. package/dist/fhir/MedicinalProductIndication.d.ts +0 -179
  370. package/dist/fhir/MedicinalProductIndication.js +0 -7
  371. package/dist/fhir/MedicinalProductIndication.js.map +0 -1
  372. package/dist/fhir/MedicinalProductIngredient.d.ts +0 -336
  373. package/dist/fhir/MedicinalProductIngredient.js +0 -7
  374. package/dist/fhir/MedicinalProductIngredient.js.map +0 -1
  375. package/dist/fhir/MedicinalProductInteraction.d.ts +0 -158
  376. package/dist/fhir/MedicinalProductInteraction.js +0 -7
  377. package/dist/fhir/MedicinalProductInteraction.js.map +0 -1
  378. package/dist/fhir/MedicinalProductManufactured.d.ts +0 -113
  379. package/dist/fhir/MedicinalProductManufactured.js +0 -7
  380. package/dist/fhir/MedicinalProductManufactured.js.map +0 -1
  381. package/dist/fhir/MedicinalProductPackaged.d.ts +0 -259
  382. package/dist/fhir/MedicinalProductPackaged.js +0 -7
  383. package/dist/fhir/MedicinalProductPackaged.js.map +0 -1
  384. package/dist/fhir/MedicinalProductPharmaceutical.d.ts +0 -331
  385. package/dist/fhir/MedicinalProductPharmaceutical.js +0 -7
  386. package/dist/fhir/MedicinalProductPharmaceutical.js.map +0 -1
  387. package/dist/fhir/MedicinalProductUndesirableEffect.d.ts +0 -101
  388. package/dist/fhir/MedicinalProductUndesirableEffect.js +0 -7
  389. package/dist/fhir/MedicinalProductUndesirableEffect.js.map +0 -1
  390. package/dist/fhir/MessageDefinition.d.ts +0 -330
  391. package/dist/fhir/MessageDefinition.js +0 -7
  392. package/dist/fhir/MessageDefinition.js.map +0 -1
  393. package/dist/fhir/MessageHeader.d.ts +0 -323
  394. package/dist/fhir/MessageHeader.js +0 -7
  395. package/dist/fhir/MessageHeader.js.map +0 -1
  396. package/dist/fhir/Meta.d.ts +0 -75
  397. package/dist/fhir/Meta.js +0 -7
  398. package/dist/fhir/Meta.js.map +0 -1
  399. package/dist/fhir/MolecularSequence.d.ts +0 -760
  400. package/dist/fhir/MolecularSequence.js +0 -7
  401. package/dist/fhir/MolecularSequence.js.map +0 -1
  402. package/dist/fhir/Money.d.ts +0 -29
  403. package/dist/fhir/Money.js +0 -7
  404. package/dist/fhir/Money.js.map +0 -1
  405. package/dist/fhir/NamingSystem.d.ts +0 -218
  406. package/dist/fhir/NamingSystem.js +0 -7
  407. package/dist/fhir/NamingSystem.js.map +0 -1
  408. package/dist/fhir/Narrative.d.ts +0 -32
  409. package/dist/fhir/Narrative.js +0 -7
  410. package/dist/fhir/Narrative.js.map +0 -1
  411. package/dist/fhir/NutritionOrder.d.ts +0 -566
  412. package/dist/fhir/NutritionOrder.js +0 -7
  413. package/dist/fhir/NutritionOrder.js.map +0 -1
  414. package/dist/fhir/Observation.d.ts +0 -520
  415. package/dist/fhir/Observation.js +0 -7
  416. package/dist/fhir/Observation.js.map +0 -1
  417. package/dist/fhir/ObservationDefinition.d.ts +0 -278
  418. package/dist/fhir/ObservationDefinition.js +0 -7
  419. package/dist/fhir/ObservationDefinition.js.map +0 -1
  420. package/dist/fhir/OperationDefinition.d.ts +0 -468
  421. package/dist/fhir/OperationDefinition.js +0 -7
  422. package/dist/fhir/OperationDefinition.js.map +0 -1
  423. package/dist/fhir/OperationOutcome.d.ts +0 -160
  424. package/dist/fhir/OperationOutcome.js +0 -7
  425. package/dist/fhir/OperationOutcome.js.map +0 -1
  426. package/dist/fhir/Organization.d.ts +0 -184
  427. package/dist/fhir/Organization.js +0 -7
  428. package/dist/fhir/Organization.js.map +0 -1
  429. package/dist/fhir/OrganizationAffiliation.d.ts +0 -145
  430. package/dist/fhir/OrganizationAffiliation.js +0 -7
  431. package/dist/fhir/OrganizationAffiliation.js.map +0 -1
  432. package/dist/fhir/ParameterDefinition.d.ts +0 -57
  433. package/dist/fhir/ParameterDefinition.js +0 -7
  434. package/dist/fhir/ParameterDefinition.js.map +0 -1
  435. package/dist/fhir/Parameters.d.ts +0 -319
  436. package/dist/fhir/Parameters.js +0 -7
  437. package/dist/fhir/Parameters.js.map +0 -1
  438. package/dist/fhir/PasswordChangeRequest.d.ts +0 -51
  439. package/dist/fhir/PasswordChangeRequest.js +0 -7
  440. package/dist/fhir/PasswordChangeRequest.js.map +0 -1
  441. package/dist/fhir/Patient.d.ts +0 -342
  442. package/dist/fhir/Patient.js +0 -7
  443. package/dist/fhir/Patient.js.map +0 -1
  444. package/dist/fhir/PaymentNotice.d.ts +0 -135
  445. package/dist/fhir/PaymentNotice.js +0 -7
  446. package/dist/fhir/PaymentNotice.js.map +0 -1
  447. package/dist/fhir/PaymentReconciliation.d.ts +0 -280
  448. package/dist/fhir/PaymentReconciliation.js +0 -7
  449. package/dist/fhir/PaymentReconciliation.js.map +0 -1
  450. package/dist/fhir/Period.d.ts +0 -32
  451. package/dist/fhir/Period.js +0 -7
  452. package/dist/fhir/Period.js.map +0 -1
  453. package/dist/fhir/Person.d.ts +0 -175
  454. package/dist/fhir/Person.js +0 -7
  455. package/dist/fhir/Person.js.map +0 -1
  456. package/dist/fhir/PlanDefinition.d.ts +0 -837
  457. package/dist/fhir/PlanDefinition.js +0 -7
  458. package/dist/fhir/PlanDefinition.js.map +0 -1
  459. package/dist/fhir/Population.d.ts +0 -62
  460. package/dist/fhir/Population.js +0 -7
  461. package/dist/fhir/Population.js.map +0 -1
  462. package/dist/fhir/Practitioner.d.ts +0 -191
  463. package/dist/fhir/Practitioner.js +0 -7
  464. package/dist/fhir/Practitioner.js.map +0 -1
  465. package/dist/fhir/PractitionerRole.d.ts +0 -259
  466. package/dist/fhir/PractitionerRole.js +0 -7
  467. package/dist/fhir/PractitionerRole.js.map +0 -1
  468. package/dist/fhir/Procedure.d.ts +0 -372
  469. package/dist/fhir/Procedure.js +0 -7
  470. package/dist/fhir/Procedure.js.map +0 -1
  471. package/dist/fhir/ProdCharacteristic.d.ts +0 -112
  472. package/dist/fhir/ProdCharacteristic.js +0 -7
  473. package/dist/fhir/ProdCharacteristic.js.map +0 -1
  474. package/dist/fhir/ProductShelfLife.d.ts +0 -70
  475. package/dist/fhir/ProductShelfLife.js +0 -7
  476. package/dist/fhir/ProductShelfLife.js.map +0 -1
  477. package/dist/fhir/Project.d.ts +0 -43
  478. package/dist/fhir/Project.js +0 -7
  479. package/dist/fhir/Project.js.map +0 -1
  480. package/dist/fhir/ProjectMembership.d.ts +0 -66
  481. package/dist/fhir/ProjectMembership.js +0 -7
  482. package/dist/fhir/ProjectMembership.js.map +0 -1
  483. package/dist/fhir/Provenance.d.ts +0 -258
  484. package/dist/fhir/Provenance.js +0 -7
  485. package/dist/fhir/Provenance.js.map +0 -1
  486. package/dist/fhir/Quantity.d.ts +0 -46
  487. package/dist/fhir/Quantity.js +0 -7
  488. package/dist/fhir/Quantity.js.map +0 -1
  489. package/dist/fhir/Questionnaire.d.ts +0 -603
  490. package/dist/fhir/Questionnaire.js +0 -7
  491. package/dist/fhir/Questionnaire.js.map +0 -1
  492. package/dist/fhir/QuestionnaireResponse.d.ts +0 -313
  493. package/dist/fhir/QuestionnaireResponse.js +0 -7
  494. package/dist/fhir/QuestionnaireResponse.js.map +0 -1
  495. package/dist/fhir/Range.d.ts +0 -30
  496. package/dist/fhir/Range.js +0 -7
  497. package/dist/fhir/Range.js.map +0 -1
  498. package/dist/fhir/Ratio.d.ts +0 -30
  499. package/dist/fhir/Ratio.js +0 -7
  500. package/dist/fhir/Ratio.js.map +0 -1
  501. package/dist/fhir/Reference.d.ts +0 -67
  502. package/dist/fhir/Reference.js +0 -7
  503. package/dist/fhir/Reference.js.map +0 -1
  504. package/dist/fhir/RefreshToken.d.ts +0 -45
  505. package/dist/fhir/RefreshToken.js +0 -7
  506. package/dist/fhir/RefreshToken.js.map +0 -1
  507. package/dist/fhir/RelatedArtifact.d.ts +0 -57
  508. package/dist/fhir/RelatedArtifact.js +0 -7
  509. package/dist/fhir/RelatedArtifact.js.map +0 -1
  510. package/dist/fhir/RelatedPerson.d.ts +0 -190
  511. package/dist/fhir/RelatedPerson.js +0 -7
  512. package/dist/fhir/RelatedPerson.js.map +0 -1
  513. package/dist/fhir/RequestGroup.d.ts +0 -434
  514. package/dist/fhir/RequestGroup.js +0 -7
  515. package/dist/fhir/RequestGroup.js.map +0 -1
  516. package/dist/fhir/ResearchDefinition.d.ts +0 -291
  517. package/dist/fhir/ResearchDefinition.js +0 -7
  518. package/dist/fhir/ResearchDefinition.js.map +0 -1
  519. package/dist/fhir/ResearchElementDefinition.d.ts +0 -431
  520. package/dist/fhir/ResearchElementDefinition.js +0 -7
  521. package/dist/fhir/ResearchElementDefinition.js.map +0 -1
  522. package/dist/fhir/ResearchStudy.d.ts +0 -318
  523. package/dist/fhir/ResearchStudy.js +0 -7
  524. package/dist/fhir/ResearchStudy.js.map +0 -1
  525. package/dist/fhir/ResearchSubject.d.ts +0 -119
  526. package/dist/fhir/ResearchSubject.js +0 -7
  527. package/dist/fhir/ResearchSubject.js.map +0 -1
  528. package/dist/fhir/Resource.d.ts +0 -156
  529. package/dist/fhir/Resource.js +0 -7
  530. package/dist/fhir/Resource.js.map +0 -1
  531. package/dist/fhir/RiskAssessment.d.ts +0 -246
  532. package/dist/fhir/RiskAssessment.js +0 -7
  533. package/dist/fhir/RiskAssessment.js.map +0 -1
  534. package/dist/fhir/RiskEvidenceSynthesis.d.ts +0 -530
  535. package/dist/fhir/RiskEvidenceSynthesis.js +0 -7
  536. package/dist/fhir/RiskEvidenceSynthesis.js.map +0 -1
  537. package/dist/fhir/SampledData.d.ts +0 -62
  538. package/dist/fhir/SampledData.js +0 -7
  539. package/dist/fhir/SampledData.js.map +0 -1
  540. package/dist/fhir/Schedule.d.ts +0 -129
  541. package/dist/fhir/Schedule.js +0 -7
  542. package/dist/fhir/Schedule.js.map +0 -1
  543. package/dist/fhir/SearchParameter.d.ts +0 -277
  544. package/dist/fhir/SearchParameter.js +0 -7
  545. package/dist/fhir/SearchParameter.js.map +0 -1
  546. package/dist/fhir/ServiceRequest.d.ts +0 -309
  547. package/dist/fhir/ServiceRequest.js +0 -7
  548. package/dist/fhir/ServiceRequest.js.map +0 -1
  549. package/dist/fhir/Signature.d.ts +0 -71
  550. package/dist/fhir/Signature.js +0 -7
  551. package/dist/fhir/Signature.js.map +0 -1
  552. package/dist/fhir/Slot.d.ts +0 -134
  553. package/dist/fhir/Slot.js +0 -7
  554. package/dist/fhir/Slot.js.map +0 -1
  555. package/dist/fhir/Specimen.d.ts +0 -366
  556. package/dist/fhir/Specimen.js +0 -7
  557. package/dist/fhir/Specimen.js.map +0 -1
  558. package/dist/fhir/SpecimenDefinition.d.ts +0 -363
  559. package/dist/fhir/SpecimenDefinition.js +0 -7
  560. package/dist/fhir/SpecimenDefinition.js.map +0 -1
  561. package/dist/fhir/StructureDefinition.d.ts +0 -438
  562. package/dist/fhir/StructureDefinition.js +0 -7
  563. package/dist/fhir/StructureDefinition.js.map +0 -1
  564. package/dist/fhir/StructureMap.d.ts +0 -904
  565. package/dist/fhir/StructureMap.js +0 -7
  566. package/dist/fhir/StructureMap.js.map +0 -1
  567. package/dist/fhir/Subscription.d.ts +0 -172
  568. package/dist/fhir/Subscription.js +0 -7
  569. package/dist/fhir/Subscription.js.map +0 -1
  570. package/dist/fhir/Substance.d.ts +0 -213
  571. package/dist/fhir/Substance.js +0 -7
  572. package/dist/fhir/Substance.js.map +0 -1
  573. package/dist/fhir/SubstanceAmount.d.ts +0 -115
  574. package/dist/fhir/SubstanceAmount.js +0 -7
  575. package/dist/fhir/SubstanceAmount.js.map +0 -1
  576. package/dist/fhir/SubstanceNucleicAcid.d.ts +0 -309
  577. package/dist/fhir/SubstanceNucleicAcid.js +0 -7
  578. package/dist/fhir/SubstanceNucleicAcid.js.map +0 -1
  579. package/dist/fhir/SubstancePolymer.d.ts +0 -405
  580. package/dist/fhir/SubstancePolymer.js +0 -7
  581. package/dist/fhir/SubstancePolymer.js.map +0 -1
  582. package/dist/fhir/SubstanceProtein.d.ts +0 -218
  583. package/dist/fhir/SubstanceProtein.js +0 -7
  584. package/dist/fhir/SubstanceProtein.js.map +0 -1
  585. package/dist/fhir/SubstanceReferenceInformation.d.ts +0 -330
  586. package/dist/fhir/SubstanceReferenceInformation.js +0 -7
  587. package/dist/fhir/SubstanceReferenceInformation.js.map +0 -1
  588. package/dist/fhir/SubstanceSourceMaterial.d.ts +0 -521
  589. package/dist/fhir/SubstanceSourceMaterial.js +0 -7
  590. package/dist/fhir/SubstanceSourceMaterial.js.map +0 -1
  591. package/dist/fhir/SubstanceSpecification.d.ts +0 -827
  592. package/dist/fhir/SubstanceSpecification.js +0 -7
  593. package/dist/fhir/SubstanceSpecification.js.map +0 -1
  594. package/dist/fhir/SupplyDelivery.d.ts +0 -205
  595. package/dist/fhir/SupplyDelivery.js +0 -7
  596. package/dist/fhir/SupplyDelivery.js.map +0 -1
  597. package/dist/fhir/SupplyRequest.d.ts +0 -237
  598. package/dist/fhir/SupplyRequest.js +0 -7
  599. package/dist/fhir/SupplyRequest.js.map +0 -1
  600. package/dist/fhir/Task.d.ts +0 -807
  601. package/dist/fhir/Task.js +0 -7
  602. package/dist/fhir/Task.js.map +0 -1
  603. package/dist/fhir/TerminologyCapabilities.d.ts +0 -716
  604. package/dist/fhir/TerminologyCapabilities.js +0 -7
  605. package/dist/fhir/TerminologyCapabilities.js.map +0 -1
  606. package/dist/fhir/TestReport.d.ts +0 -549
  607. package/dist/fhir/TestReport.js +0 -7
  608. package/dist/fhir/TestReport.js.map +0 -1
  609. package/dist/fhir/TestScript.d.ts +0 -1184
  610. package/dist/fhir/TestScript.js +0 -7
  611. package/dist/fhir/TestScript.js.map +0 -1
  612. package/dist/fhir/Timing.d.ts +0 -178
  613. package/dist/fhir/Timing.js +0 -7
  614. package/dist/fhir/Timing.js.map +0 -1
  615. package/dist/fhir/TriggerDefinition.d.ts +0 -65
  616. package/dist/fhir/TriggerDefinition.js +0 -7
  617. package/dist/fhir/TriggerDefinition.js.map +0 -1
  618. package/dist/fhir/UsageContext.d.ts +0 -61
  619. package/dist/fhir/UsageContext.js +0 -7
  620. package/dist/fhir/UsageContext.js.map +0 -1
  621. package/dist/fhir/User.d.ts +0 -45
  622. package/dist/fhir/User.js +0 -7
  623. package/dist/fhir/User.js.map +0 -1
  624. package/dist/fhir/ValueSet.d.ts +0 -725
  625. package/dist/fhir/ValueSet.js +0 -7
  626. package/dist/fhir/ValueSet.js.map +0 -1
  627. package/dist/fhir/VerificationResult.d.ts +0 -340
  628. package/dist/fhir/VerificationResult.js +0 -7
  629. package/dist/fhir/VerificationResult.js.map +0 -1
  630. package/dist/fhir/VisionPrescription.d.ts +0 -264
  631. package/dist/fhir/VisionPrescription.js +0 -7
  632. package/dist/fhir/VisionPrescription.js.map +0 -1
  633. package/dist/fhir/index.d.ts +0 -196
  634. package/dist/fhir/index.js +0 -213
  635. package/dist/fhir/index.js.map +0 -1
  636. package/dist/fhirpath/functions.d.ts +0 -6
  637. package/dist/fhirpath/functions.js +0 -349
  638. package/dist/fhirpath/functions.js.map +0 -1
  639. package/dist/fhirpath/functions.test.d.ts +0 -1
  640. package/dist/fhirpath/functions.test.js +0 -162
  641. package/dist/fhirpath/functions.test.js.map +0 -1
  642. package/dist/fhirpath/index.d.ts +0 -2
  643. package/dist/fhirpath/index.js +0 -15
  644. package/dist/fhirpath/index.js.map +0 -1
  645. package/dist/fhirpath/parse.d.ts +0 -10
  646. package/dist/fhirpath/parse.js +0 -285
  647. package/dist/fhirpath/parse.js.map +0 -1
  648. package/dist/fhirpath/parse.test.d.ts +0 -1
  649. package/dist/fhirpath/parse.test.js +0 -239
  650. package/dist/fhirpath/parse.test.js.map +0 -1
  651. package/dist/fhirpath/tokenize.d.ts +0 -13
  652. package/dist/fhirpath/tokenize.js +0 -43
  653. package/dist/fhirpath/tokenize.js.map +0 -1
  654. package/dist/fhirpath/tokenize.test.d.ts +0 -1
  655. package/dist/fhirpath/tokenize.test.js +0 -69
  656. package/dist/fhirpath/tokenize.test.js.map +0 -1
  657. package/dist/fhirpath/utils.d.ts +0 -13
  658. package/dist/fhirpath/utils.js +0 -34
  659. package/dist/fhirpath/utils.js.map +0 -1
  660. package/dist/fhirpath/utils.test.d.ts +0 -1
  661. package/dist/fhirpath/utils.test.js +0 -22
  662. package/dist/fhirpath/utils.test.js.map +0 -1
  663. package/dist/format.js +0 -56
  664. package/dist/format.js.map +0 -1
  665. package/dist/format.test.d.ts +0 -1
  666. package/dist/format.test.js +0 -127
  667. package/dist/format.test.js.map +0 -1
  668. package/dist/index.js +0 -22
  669. package/dist/index.js.map +0 -1
  670. package/dist/index.test.d.ts +0 -1
  671. package/dist/index.test.js +0 -11
  672. package/dist/index.test.js.map +0 -1
  673. package/dist/jwt.d.ts +0 -5
  674. package/dist/jwt.js +0 -28
  675. package/dist/jwt.js.map +0 -1
  676. package/dist/outcomes.js +0 -140
  677. package/dist/outcomes.js.map +0 -1
  678. package/dist/outcomes.test.d.ts +0 -1
  679. package/dist/outcomes.test.js +0 -38
  680. package/dist/outcomes.test.js.map +0 -1
  681. package/dist/search.js +0 -120
  682. package/dist/search.js.map +0 -1
  683. package/dist/search.test.d.ts +0 -1
  684. package/dist/search.test.js +0 -72
  685. package/dist/search.test.js.map +0 -1
  686. package/dist/searchparams.js +0 -127
  687. package/dist/searchparams.js.map +0 -1
  688. package/dist/searchparams.test.d.ts +0 -1
  689. package/dist/searchparams.test.js +0 -129
  690. package/dist/searchparams.test.js.map +0 -1
  691. package/dist/storage.js +0 -91
  692. package/dist/storage.js.map +0 -1
  693. package/dist/storage.test.d.ts +0 -1
  694. package/dist/storage.test.js +0 -50
  695. package/dist/storage.test.js.map +0 -1
  696. package/dist/types.js +0 -169
  697. package/dist/types.js.map +0 -1
  698. package/dist/utils.js +0 -234
  699. package/dist/utils.js.map +0 -1
  700. package/dist/utils.test.d.ts +0 -1
  701. package/dist/utils.test.js +0 -148
  702. package/dist/utils.test.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.min.js","sources":["../../../../node_modules/tslib/tslib.es6.js","../../../src/cache.ts","../../../src/format.ts","../../../src/utils.ts","../../../src/crypto.ts","../../../src/jwt.ts","../../../src/outcomes.ts","../../../src/search.ts","../../../src/storage.ts","../../../src/types.ts","../../../src/client.ts","../../../src/eventtarget.ts","../../../src/searchparams.ts"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","/**\n * LRU cache (least recently used)\n * Source: https://stackoverflow.com/a/46432113\n */\nexport class LRUCache<T> {\n private readonly max: number;\n private readonly cache: Map<string, T>;\n\n constructor(max = 10) {\n this.max = max;\n this.cache = new Map();\n }\n\n clear(): void {\n this.cache.clear();\n }\n\n get(key: string): T | undefined {\n const item = this.cache.get(key);\n if (item) {\n this.cache.delete(key);\n this.cache.set(key, item);\n }\n return item;\n }\n\n set(key: string, val: T): void {\n if (this.cache.has(key)) {\n this.cache.delete(key);\n } else if (this.cache.size >= this.max) {\n this.cache.delete(this.first());\n }\n this.cache.set(key, val);\n }\n\n private first(): string {\n // This works because the Map class maintains ordered keys.\n return this.cache.keys().next().value;\n }\n}\n","import { Address, HumanName } from '@medplum/fhirtypes';\n\nexport interface AddressFormatOptions {\n all?: boolean;\n use?: boolean;\n}\n\nexport interface HumanNameFormatOptions {\n all?: boolean;\n prefix?: boolean;\n suffix?: boolean;\n use?: boolean;\n}\n\nexport function formatAddress(address: Address, options?: AddressFormatOptions): string {\n const builder = [];\n\n if (address.line) {\n builder.push(...address.line);\n }\n\n if (address.city) {\n builder.push(address.city);\n }\n\n if (address.state) {\n builder.push(address.state);\n }\n\n if (address.postalCode) {\n builder.push(address.postalCode);\n }\n\n if (address.use && (options?.all || options?.use)) {\n builder.push('[' + address.use + ']');\n }\n\n return builder.join(', ').trim();\n}\n\nexport function formatHumanName(name: HumanName, options?: HumanNameFormatOptions): string {\n const builder = [];\n\n if (name.prefix && (options?.all || options?.prefix)) {\n builder.push(...name.prefix);\n }\n\n if (name.given) {\n builder.push(...name.given);\n }\n\n if (name.family) {\n builder.push(name.family);\n }\n\n if (name.suffix && (options?.all || options?.suffix)) {\n builder.push(...name.suffix);\n }\n\n if (name.use && (options?.all || options?.use)) {\n builder.push('[' + name.use + ']');\n }\n\n return builder.join(' ').trim();\n}\n\nexport function formatGivenName(name: HumanName): string {\n const builder: string[] = [];\n if (name.given) {\n builder.push(...name.given);\n }\n return builder.join(' ').trim();\n}\n\nexport function formatFamilyName(name: HumanName): string {\n return name.family || '';\n}\n","import { Device, Patient, Practitioner, Reference, RelatedPerson, Resource } from '@medplum/fhirtypes';\nimport { formatHumanName } from './format';\n\nexport type ProfileResource = Patient | Practitioner | RelatedPerson;\n\n/**\n * Creates a reference resource.\n * @param resource The FHIR reesource.\n * @returns A reference resource.\n */\nexport function createReference<T extends Resource>(resource: T): Reference<T> {\n const reference = getReferenceString(resource);\n const display = getDisplayString(resource);\n return display === reference ? { reference } : { reference, display };\n}\n\n/**\n * Returns a reference string for a resource.\n * @param resource The FHIR resource.\n * @returns A reference string of the form resourceType/id.\n */\nexport function getReferenceString(resource: Resource): string {\n return resource.resourceType + '/' + resource.id;\n}\n\n/**\n * Returns true if the resource is a \"ProfileResource\".\n * @param resource The FHIR resource.\n * @returns True if the resource is a \"ProfileResource\".\n */\nexport function isProfileResource(resource: Resource): boolean {\n return (\n resource.resourceType === 'Patient' ||\n resource.resourceType === 'Practitioner' ||\n resource.resourceType === 'RelatedPerson'\n );\n}\n\n/**\n * Returns a display string for the resource.\n * @param resource The input resource.\n * @return Human friendly display string.\n */\nexport function getDisplayString(resource: Resource): string {\n if (isProfileResource(resource)) {\n const profileName = getProfileResourceDisplayString(resource as ProfileResource);\n if (profileName) {\n return profileName;\n }\n }\n if (resource.resourceType === 'Device') {\n const deviceName = getDeviceDisplayString(resource);\n if (deviceName) {\n return deviceName;\n }\n }\n if (resource.resourceType === 'User') {\n if (resource.email) {\n return resource.email;\n }\n }\n if ('name' in resource && resource.name && typeof resource.name === 'string') {\n return resource.name;\n }\n return getReferenceString(resource);\n}\n\n/**\n * Returns a display string for a profile resource if one is found.\n * @param resource The profile resource.\n * @returns The display name if one is found.\n */\nfunction getProfileResourceDisplayString(resource: ProfileResource): string | undefined {\n const names = resource.name;\n if (names && names.length > 0) {\n return formatHumanName(names[0]);\n }\n return undefined;\n}\n\n/**\n * Returns a display string for a device resource if one is found.\n * @param device The device resource.\n * @returns The display name if one is found.\n */\nfunction getDeviceDisplayString(device: Device): string | undefined {\n const names = device.deviceName;\n if (names && names.length > 0) {\n return names[0].name;\n }\n return undefined;\n}\n\n/**\n * Returns an image URL for the resource, if one is available.\n * @param resource The input resource.\n * @returns The image URL for the resource or undefined.\n */\nexport function getImageSrc(resource: Resource): string | undefined {\n if (isProfileResource(resource)) {\n const photos = (resource as ProfileResource).photo;\n if (photos) {\n for (const photo of photos) {\n if (photo.url && photo.contentType && photo.contentType.startsWith('image/')) {\n return photo.url;\n }\n }\n }\n }\n return undefined;\n}\n\n/**\n * Returns a Date property as a Date.\n * When working with JSON objects, Dates are often serialized as ISO-8601 strings.\n * When that happens, we need to safely convert to a proper Date object.\n * @param date The date property value, which could be a string or a Date object.\n * @returns A Date object.\n */\nexport function getDateProperty(date: string | undefined): Date | undefined {\n return date ? new Date(date) : undefined;\n}\n\n/**\n * FHIR JSON stringify.\n * Removes properties with empty string values.\n * Removes objects with zero properties.\n * See: https://www.hl7.org/fhir/json.html\n * @param value The input value.\n * @param pretty Optional flag to pretty-print the JSON.\n * @returns The resulting JSON string.\n */\nexport function stringify(value: any, pretty?: boolean): string {\n return JSON.stringify(value, stringifyReplacer, pretty ? 2 : undefined);\n}\n\n/**\n * Evaluates JSON key/value pairs for FHIR JSON stringify.\n * Removes properties with empty string values.\n * Removes objects with zero properties.\n * @param {string} k Property key.\n * @param {*} v Property value.\n */\nfunction stringifyReplacer(k: string, v: any): any {\n return isEmpty(v) ? undefined : v;\n}\n\n/**\n * Returns true if the value is empty (null, undefined, empty string, or empty object).\n * @param v Any value.\n * @returns True if the value is an empty string or an empty object.\n */\nfunction isEmpty(v: any): boolean {\n if (v === null || v === undefined) {\n return true;\n }\n const t = typeof v;\n return (t === 'string' && v === '') || (t === 'object' && Object.keys(v).length === 0);\n}\n\n/**\n * Resource equality.\n * Ignores meta.versionId and meta.lastUpdated.\n * See: https://dmitripavlutin.com/how-to-compare-objects-in-javascript/#4-deep-equality\n * @param object1 The first object.\n * @param object2 The second object.\n * @returns True if the objects are equal.\n */\nexport function deepEquals(object1: any, object2: any, path?: string): boolean {\n let keys1 = Object.keys(object1);\n let keys2 = Object.keys(object2);\n if (path === 'meta') {\n keys1 = keys1.filter((k) => k !== 'versionId' && k !== 'lastUpdated' && k !== 'author');\n keys2 = keys2.filter((k) => k !== 'versionId' && k !== 'lastUpdated' && k !== 'author');\n }\n if (keys1.length !== keys2.length) {\n return false;\n }\n for (const key of keys1) {\n const val1 = object1[key];\n const val2 = object2[key];\n if (isObject(val1) && isObject(val2)) {\n if (!deepEquals(val1, val2, key)) {\n return false;\n }\n } else {\n if (val1 !== val2) {\n return false;\n }\n }\n }\n return true;\n}\n\nfunction isObject(object: any): boolean {\n return object !== null && typeof object === 'object';\n}\n\n// Precompute hex octets\n// See: https://stackoverflow.com/a/55200387\nconst byteToHex: string[] = [];\nfor (let n = 0; n < 256; n++) {\n byteToHex.push(n.toString(16).padStart(2, '0'));\n}\n\n/**\n * Converts an ArrayBuffer to hex string.\n * See: https://stackoverflow.com/a/55200387\n * @param arrayBuffer The input array buffer.\n * @returns The resulting hex string.\n */\nexport function arrayBufferToHex(arrayBuffer: ArrayBuffer): string {\n const bytes = new Uint8Array(arrayBuffer);\n const result: string[] = new Array(bytes.length);\n for (let i = 0; i < bytes.length; i++) {\n result[i] = byteToHex[bytes[i]];\n }\n return result.join('');\n}\n\n/**\n * Converts an ArrayBuffer to a base-64 encoded string.\n * @param arrayBuffer The input array buffer.\n * @returns The base-64 encoded string.\n */\nexport function arrayBufferToBase64(arrayBuffer: ArrayBuffer): string {\n const bytes = new Uint8Array(arrayBuffer);\n const result: string[] = [];\n for (let i = 0; i < bytes.length; i++) {\n result[i] = String.fromCharCode(bytes[i]);\n }\n return window.btoa(result.join(''));\n}\n\nexport function capitalize(word: string): string {\n return word.charAt(0).toUpperCase() + word.substr(1);\n}\n\nexport function isLowerCase(c: string): boolean {\n return c === c.toLowerCase();\n}\n","import { arrayBufferToHex } from './utils';\n\n/**\n * Returns a cryptographically secure random string.\n */\nexport function getRandomString(): string {\n const randomItems = new Uint32Array(28);\n crypto.getRandomValues(randomItems);\n return arrayBufferToHex(randomItems.buffer);\n}\n\n/**\n * Encrypts a string with SHA256 encryption.\n * @param str\n */\nexport async function encryptSHA256(str: string): Promise<ArrayBuffer> {\n return crypto.subtle.digest('SHA-256', new TextEncoder().encode(str));\n}\n","/**\n * Decodes a section of a JWT.\n * See: https://tools.ietf.org/html/rfc7519\n * @param payload\n */\nfunction decodePayload(payload: string): Record<string, number | string> {\n const cleanedPayload = payload.replace(/-/g, '+').replace(/_/g, '/');\n const decodedPayload = window.atob(cleanedPayload);\n const uriEncodedPayload = Array.from(decodedPayload).reduce((acc, char) => {\n const uriEncodedChar = ('00' + char.charCodeAt(0).toString(16)).slice(-2);\n return `${acc}%${uriEncodedChar}`;\n }, '');\n const jsonPayload = decodeURIComponent(uriEncodedPayload);\n return JSON.parse(jsonPayload);\n}\n\n/**\n * Parses the JWT payload.\n * @param token JWT token\n */\nexport function parseJWTPayload(token: string): Record<string, number | string> {\n const [_header, payload, _signature] = token.split('.');\n return decodePayload(payload);\n}\n","import { OperationOutcome } from '@medplum/fhirtypes';\n\nconst OK_ID = 'ok';\nconst CREATED_ID = 'created';\nconst GONE_ID = 'gone';\nconst NOT_MODIFIED_ID = 'not-modified';\nconst NOT_FOUND_ID = 'not-found';\nconst ACCESS_DENIED = 'access-denied';\n\nexport const allOk: OperationOutcome = {\n resourceType: 'OperationOutcome',\n id: OK_ID,\n issue: [\n {\n severity: 'information',\n code: 'information',\n details: {\n text: 'All OK',\n },\n },\n ],\n};\n\nexport const created: OperationOutcome = {\n resourceType: 'OperationOutcome',\n id: CREATED_ID,\n issue: [\n {\n severity: 'information',\n code: 'information',\n details: {\n text: 'Created',\n },\n },\n ],\n};\n\nexport const notModified: OperationOutcome = {\n resourceType: 'OperationOutcome',\n id: NOT_MODIFIED_ID,\n issue: [\n {\n severity: 'information',\n code: 'information',\n details: {\n text: 'Not Modified',\n },\n },\n ],\n};\n\nexport const notFound: OperationOutcome = {\n resourceType: 'OperationOutcome',\n id: NOT_FOUND_ID,\n issue: [\n {\n severity: 'error',\n code: 'not-found',\n details: {\n text: 'Not found',\n },\n },\n ],\n};\n\nexport const gone: OperationOutcome = {\n resourceType: 'OperationOutcome',\n id: GONE_ID,\n issue: [\n {\n severity: 'error',\n code: 'gone',\n details: {\n text: 'Gone',\n },\n },\n ],\n};\n\nexport const accessDenied: OperationOutcome = {\n resourceType: 'OperationOutcome',\n id: ACCESS_DENIED,\n issue: [\n {\n severity: 'error',\n code: 'access-denied',\n details: {\n text: 'Access Denied',\n },\n },\n ],\n};\n\nexport function badRequest(details: string, expression?: string): OperationOutcome {\n return {\n resourceType: 'OperationOutcome',\n issue: [\n {\n severity: 'error',\n code: 'invalid',\n details: {\n text: details,\n },\n expression: expression ? [expression] : undefined,\n },\n ],\n };\n}\n\nexport function isOk(outcome: OperationOutcome): boolean {\n return outcome.id === OK_ID || outcome.id === CREATED_ID || outcome.id === NOT_MODIFIED_ID;\n}\n\nexport function isNotFound(outcome: OperationOutcome): boolean {\n return outcome.id === NOT_FOUND_ID;\n}\n\nexport function isGone(outcome: OperationOutcome): boolean {\n return outcome.id === GONE_ID;\n}\n\nexport function getStatus(outcome: OperationOutcome): number {\n if (outcome.id === OK_ID) {\n return 200;\n } else if (outcome.id === CREATED_ID) {\n return 201;\n } else if (outcome.id === NOT_MODIFIED_ID) {\n return 304;\n } else if (outcome.id === ACCESS_DENIED) {\n return 403;\n } else if (outcome.id === NOT_FOUND_ID) {\n return 404;\n } else if (outcome.id === GONE_ID) {\n return 410;\n } else {\n return 400;\n }\n}\n\n/**\n * Asserts that the operation completed successfully and that the resource is defined.\n * @param outcome The operation outcome.\n * @param resource The resource that may or may not have been returned.\n */\nexport function assertOk<T>(outcome: OperationOutcome, resource: T | undefined): asserts resource is T {\n if (!isOk(outcome) || resource === undefined) {\n throw new OperationOutcomeError(outcome);\n }\n}\n\nexport class OperationOutcomeError extends Error {\n readonly outcome: OperationOutcome;\n\n constructor(outcome: OperationOutcome) {\n super(outcome?.issue?.[0].details?.text);\n this.outcome = outcome;\n }\n}\n","export interface SearchRequest {\n readonly resourceType: string;\n readonly filters?: Filter[];\n readonly sortRules?: SortRule[];\n readonly page?: number;\n readonly count?: number;\n readonly fields?: string[];\n readonly name?: string;\n}\n\nexport interface Filter {\n code: string;\n operator: Operator;\n value: string;\n unitSystem?: string;\n unitCode?: string;\n}\n\nexport interface SortRule {\n code: string;\n descending?: boolean;\n}\n\n/**\n * Search operators.\n * These operators represent \"modifiers\" and \"prefixes\" in FHIR search.\n * See: https://www.hl7.org/fhir/search.html\n */\nexport enum Operator {\n EQUALS = 'eq',\n NOT_EQUALS = 'ne',\n\n // Numbers\n GREATER_THAN = 'gt',\n LESS_THAN = 'lt',\n GREATER_THAN_OR_EQUALS = 'ge',\n LESS_THAN_OR_EQUALS = 'le',\n\n // Dates\n STARTS_AFTER = 'sa',\n ENDS_BEFORE = 'eb',\n APPROXIMATELY = 'ap',\n\n // String\n CONTAINS = 'contains',\n EXACT = 'exact',\n\n // Token\n TEXT = 'text',\n ABOVE = 'above',\n BELOW = 'below',\n IN = 'in',\n NOT_IN = 'not-in',\n OF_TYPE = 'of-type',\n}\n\nconst MODIFIER_OPERATORS: Operator[] = [\n Operator.CONTAINS,\n Operator.EXACT,\n Operator.TEXT,\n Operator.ABOVE,\n Operator.BELOW,\n Operator.IN,\n Operator.NOT_IN,\n Operator.OF_TYPE,\n];\n\nconst PREFIX_OPERATORS: Operator[] = [\n Operator.NOT_EQUALS,\n Operator.GREATER_THAN,\n Operator.LESS_THAN,\n Operator.GREATER_THAN_OR_EQUALS,\n Operator.LESS_THAN_OR_EQUALS,\n Operator.STARTS_AFTER,\n Operator.ENDS_BEFORE,\n Operator.APPROXIMATELY,\n];\n\n/**\n * Parses a URL into a SearchRequest.\n *\n * See the FHIR search spec: http://hl7.org/fhir/r4/search.html\n *\n * @param location The URL to parse.\n * @returns Parsed search definition.\n */\nexport function parseSearchDefinition(location: { pathname: string; search?: string }): SearchRequest {\n const resourceType = location.pathname.split('/').pop() as string;\n const params = new URLSearchParams(location.search);\n const filters: Filter[] = [];\n const sortRules: SortRule[] = [];\n let fields;\n let page = 0;\n let count = 10;\n\n params.forEach((value, key) => {\n if (key === '_fields') {\n fields = value.split(',');\n } else if (key === '_page') {\n page = parseInt(value);\n } else if (key === '_count') {\n count = parseInt(value);\n } else if (key === '_sort') {\n sortRules.push(parseSortRule(value));\n } else {\n filters.push(parseSearchFilter(key, value));\n }\n });\n\n return {\n resourceType,\n filters,\n fields,\n page,\n count,\n sortRules,\n };\n}\n\n/**\n * Parses a URL query parameter into a sort rule.\n *\n * By default, the sort rule is the field name.\n *\n * Sort rules can be reversed into descending order by prefixing the field name with a minus sign.\n *\n * See sorting: http://hl7.org/fhir/r4/search.html#_sort\n *\n * @param value The URL parameter value.\n * @returns The parsed sort rule.\n */\nfunction parseSortRule(value: string): SortRule {\n if (value.startsWith('-')) {\n return { code: value.substring(1), descending: true };\n } else {\n return { code: value };\n }\n}\n\n/**\n * Parses a URL query parameter into a search filter.\n *\n * FHIR search filters can be specified as modifiers or prefixes.\n *\n * For string properties, modifiers are appended to the key, e.g. \"name:contains=eve\".\n *\n * For date and numeric properties, prefixes are prepended to the value, e.g. \"birthdate=gt2000\".\n *\n * See the FHIR search spec: http://hl7.org/fhir/r4/search.html\n *\n * @param key The URL parameter key.\n * @param value The URL parameter value.\n * @returns The parsed search filter.\n */\nfunction parseSearchFilter(key: string, value: string): Filter {\n let code = key;\n let operator = Operator.EQUALS;\n\n for (const modifier of MODIFIER_OPERATORS) {\n const modifierIndex = code.indexOf(':' + modifier);\n if (modifierIndex !== -1) {\n operator = modifier;\n code = code.substring(0, modifierIndex);\n }\n }\n\n for (const prefix of PREFIX_OPERATORS) {\n if (value.match(new RegExp('^' + prefix + '\\\\d'))) {\n operator = prefix;\n value = value.substring(prefix.length);\n }\n }\n\n return { code, operator, value };\n}\n\n/**\n * Formats a search definition object into a query string.\n * Note: The return value does not include the resource type.\n * @param {!SearchRequest} definition The search definition.\n * @returns Formatted URL.\n */\nexport function formatSearchQuery(definition: SearchRequest): string {\n const params: string[] = [];\n\n if (definition.fields) {\n params.push('_fields=' + definition.fields.join(','));\n }\n\n if (definition.filters) {\n definition.filters.forEach((filter) => {\n const modifier = MODIFIER_OPERATORS.includes(filter.operator) ? ':' + filter.operator : '';\n const prefix = PREFIX_OPERATORS.includes(filter.operator) ? filter.operator : '';\n params.push(`${filter.code}${modifier}=${prefix}${encodeURIComponent(filter.value)}`);\n });\n }\n\n if (definition.sortRules) {\n params.push(formatSortRules(definition.sortRules));\n }\n\n if (definition.page && definition.page > 0) {\n params.push('_page=' + definition.page);\n }\n\n if (definition.count && definition.count > 0) {\n params.push('_count=' + definition.count);\n }\n\n if (params.length === 0) {\n return '';\n }\n\n params.sort();\n return '?' + params.join('&');\n}\n\nfunction formatSortRules(sortRules: SortRule[] | undefined): string {\n if (!sortRules || sortRules.length === 0) {\n return '';\n }\n return '_sort=' + sortRules.map((sr) => (sr.descending ? '-' + sr.code : sr.code)).join(',');\n}\n","import { stringify } from './utils';\n\n/**\n * The ClientStorage class is a utility class for storing strings and objects.\n *\n * When using MedplumClient in the browser, it will be backed by browser localStorage.\n *\n * When Using MedplumClient in the server, it will be backed by the MemoryStorage class.\n */\nexport class ClientStorage {\n private readonly storage: Storage;\n\n constructor() {\n this.storage = typeof localStorage !== 'undefined' ? localStorage : new MemoryStorage();\n }\n\n clear(): void {\n this.storage.clear();\n }\n\n getString(key: string): string | undefined {\n return this.storage.getItem(key) || undefined;\n }\n\n setString(key: string, value: string | undefined): void {\n if (value) {\n this.storage.setItem(key, value);\n } else {\n this.storage.removeItem(key);\n }\n }\n\n getObject<T>(key: string): T | undefined {\n const str = this.getString(key);\n return str ? (JSON.parse(str) as T) : undefined;\n }\n\n setObject<T>(key: string, value: T): void {\n this.setString(key, value ? stringify(value) : undefined);\n }\n}\n\n/**\n * The MemoryStorage class is a minimal in-memory implementation of the Storage interface.\n */\nexport class MemoryStorage implements Storage {\n private data: Map<string, string>;\n\n constructor() {\n this.data = new Map<string, string>();\n }\n\n /**\n * Returns the number of key/value pairs.\n */\n get length(): number {\n return this.data.size;\n }\n\n /**\n * Removes all key/value pairs, if there are any.\n */\n clear(): void {\n this.data.clear();\n }\n\n /**\n * Returns the current value associated with the given key, or null if the given key does not exist.\n */\n getItem(key: string): string | null {\n return this.data.get(key) ?? null;\n }\n\n /**\n * Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.\n */\n setItem(key: string, value: string | null): void {\n if (value) {\n this.data.set(key, value);\n } else {\n this.data.delete(key);\n }\n }\n\n /**\n * Removes the key/value pair with the given key, if a key/value pair with the given key exists.\n */\n removeItem(key: string): void {\n this.data.delete(key);\n }\n\n /**\n * Returns the name of the nth key, or null if n is greater than or equal to the number of key/value pairs.\n */\n key(index: number): string | null {\n return Array.from(this.data.keys())[index];\n }\n}\n","import { ElementDefinition, SearchParameter, StructureDefinition } from '@medplum/fhirtypes';\nimport { capitalize } from './utils';\n\n/**\n * List of property types.\n * http://www.hl7.org/fhir/valueset-defined-types.html\n * The list here includes additions found from StructureDefinition resources.\n */\nexport enum PropertyType {\n Address = 'Address',\n Age = 'Age',\n Annotation = 'Annotation',\n Attachment = 'Attachment',\n BackboneElement = 'BackboneElement',\n CodeableConcept = 'CodeableConcept',\n Coding = 'Coding',\n ContactDetail = 'ContactDetail',\n ContactPoint = 'ContactPoint',\n Contributor = 'Contributor',\n Count = 'Count',\n DataRequirement = 'DataRequirement',\n Distance = 'Distance',\n Dosage = 'Dosage',\n Duration = 'Duration',\n Expression = 'Expression',\n Extension = 'Extension',\n HumanName = 'HumanName',\n Identifier = 'Identifier',\n MarketingStatus = 'MarketingStatus',\n Meta = 'Meta',\n Money = 'Money',\n Narrative = 'Narrative',\n ParameterDefinition = 'ParameterDefinition',\n Period = 'Period',\n Population = 'Population',\n ProdCharacteristic = 'ProdCharacteristic',\n ProductShelfLife = 'ProductShelfLife',\n Quantity = 'Quantity',\n Range = 'Range',\n Ratio = 'Ratio',\n Reference = 'Reference',\n RelatedArtifact = 'RelatedArtifact',\n Resource = 'Resource',\n SampledData = 'SampledData',\n Signature = 'Signature',\n SubstanceAmount = 'SubstanceAmount',\n SystemString = 'http://hl7.org/fhirpath/System.String',\n Timing = 'Timing',\n TriggerDefinition = 'TriggerDefinition',\n UsageContext = 'UsageContext',\n base64Binary = 'base64Binary',\n boolean = 'boolean',\n canonical = 'canonical',\n code = 'code',\n date = 'date',\n dateTime = 'dateTime',\n decimal = 'decimal',\n id = 'id',\n instant = 'instant',\n integer = 'integer',\n markdown = 'markdown',\n oid = 'oid',\n positiveInt = 'positiveInt',\n string = 'string',\n time = 'time',\n unsignedInt = 'unsignedInt',\n uri = 'uri',\n url = 'url',\n uuid = 'uuid',\n}\n\n/**\n * An IndexedStructureDefinition is a lookup-optimized version of a StructureDefinition.\n *\n * StructureDefinition resources contain schema information for other resource types.\n * These schemas can be used to automatically generate user interface elements for\n * resources.\n *\n * However, a StructureDefinition resource is not optimized for realtime lookups. All\n * resource types, sub types, and property definitions are stored in a flat array of\n * ElementDefinition objects. Therefore, to lookup the schema for a property (i.e., \"Patient.name\")\n * requires a linear scan of all ElementDefinition objects\n *\n * A StructureDefinition resource contains information about one or more types.\n * For example, the \"Patient\" StructureDefinition includes \"Patient\", \"Patient_Contact\",\n * \"Patient_Communication\", and \"Patient_Link\". This is inefficient.\n *\n * Instead, we create an indexed version of the StructureDefinition, called IndexedStructureDefinition.\n * In an IndexedStructureDefinition, retrieving a property definition is a hashtable lookup.\n *\n * The hierarchy is:\n * IndexedStructureDefinition - top level for one resource type\n * TypeSchema - one per resource type and all contained BackboneElements\n * PropertySchema - one per property/field\n */\nexport interface IndexedStructureDefinition {\n types: { [resourceType: string]: TypeSchema };\n}\n\n/**\n * An indexed TypeSchema.\n *\n * Example: The IndexedStructureDefinition for \"Patient\" would include the following TypeSchemas:\n * 1) Patient\n * 2) Patient_Contact\n * 3) Patient_Communication\n * 4) Patient_Link\n */\nexport interface TypeSchema {\n display: string;\n properties: { [name: string]: ElementDefinition };\n searchParams?: { [code: string]: SearchParameter };\n description?: string;\n parentType?: string;\n}\n\n/**\n * Creates a new empty IndexedStructureDefinition.\n * @returns The empty IndexedStructureDefinition.\n */\nexport function createSchema(): IndexedStructureDefinition {\n return { types: {} };\n}\n\n/**\n * Indexes a StructureDefinition for fast lookup.\n * See comments on IndexedStructureDefinition for more details.\n * @param schema The output IndexedStructureDefinition.\n * @param structureDefinition The original StructureDefinition.\n */\nexport function indexStructureDefinition(\n schema: IndexedStructureDefinition,\n structureDefinition: StructureDefinition\n): void {\n const typeName = structureDefinition.name;\n if (!typeName) {\n return;\n }\n\n schema.types[typeName] = {\n display: typeName,\n description: structureDefinition.description,\n properties: {},\n };\n\n const elements = structureDefinition.snapshot?.element;\n if (elements) {\n // Filter out any elements missing path or type\n const filtered = elements.filter((e) => e.path !== typeName && e.path);\n\n // First pass, build types\n filtered.forEach((element) => indexType(schema, element));\n\n // Second pass, build properties\n filtered.forEach((element) => indexProperty(schema, element));\n }\n}\n\n/**\n * Indexes TypeSchema from an ElementDefinition.\n * In the common case, there will be many ElementDefinition instances per TypeSchema.\n * Only the first occurrence is saved.\n * @param schema The output IndexedStructureDefinition.\n * @param element The input ElementDefinition.\n */\nfunction indexType(schema: IndexedStructureDefinition, element: ElementDefinition): void {\n const path = element.path as string;\n const typeCode = element.type?.[0]?.code;\n if (typeCode !== 'Element' && typeCode !== 'BackboneElement') {\n return;\n }\n const parts = path.split('.');\n const typeName = buildTypeName(parts);\n if (!(typeName in schema.types)) {\n schema.types[typeName] = {\n display: typeName,\n description: element.definition,\n parentType: buildTypeName(parts.slice(0, parts.length - 1)),\n properties: {},\n };\n }\n}\n\n/**\n * Indexes PropertySchema from an ElementDefinition.\n * @param schema The output IndexedStructureDefinition.\n * @param element The input ElementDefinition.\n */\nfunction indexProperty(schema: IndexedStructureDefinition, element: ElementDefinition): void {\n const path = element.path as string;\n const parts = path.split('.');\n if (parts.length === 1) {\n return;\n }\n const typeName = buildTypeName(parts.slice(0, parts.length - 1));\n const typeSchema = schema.types[typeName];\n const key = parts[parts.length - 1];\n typeSchema.properties[key] = element;\n}\n\n/**\n * Indexes a SearchParameter resource for fast lookup.\n * Indexes by SearchParameter.code, which is the query string parameter name.\n * @param schema The output IndexedStructureDefinition.\n * @param searchParam The SearchParameter resource.\n */\nexport function indexSearchParameter(schema: IndexedStructureDefinition, searchParam: SearchParameter): void {\n if (!searchParam.base) {\n return;\n }\n\n for (const resourceType of searchParam.base) {\n const typeSchema = schema.types[resourceType];\n if (!typeSchema) {\n continue;\n }\n\n if (!typeSchema.searchParams) {\n typeSchema.searchParams = {};\n }\n\n typeSchema.searchParams[searchParam.code as string] = searchParam;\n }\n}\n\nexport function buildTypeName(components: string[]): string {\n return components.map(capitalize).join('');\n}\n\nexport function getPropertyDisplayName(property: ElementDefinition): string {\n // Get the property name, which is the remainder after the last period\n // For example, for path \"Patient.birthDate\"\n // the property name is \"birthDate\"\n const propertyName = (property.path as string).replaceAll('[x]', '').split('.').pop() as string;\n\n // Split by capital letters\n // Capitalize the first letter of each word\n // Join together with spaces in between\n // Then normalize whitespace to single space character\n // For example, for property name \"birthDate\",\n // the display name is \"Birth Date\".\n return propertyName\n .split(/(?=[A-Z])/)\n .map(capitalize)\n .join(' ')\n .replace('_', ' ')\n .replace(/\\s+/g, ' ');\n}\n","// PKCE auth ased on:\n// https://aws.amazon.com/blogs/security/how-to-add-authentication-single-page-web-application-with-amazon-cognito-oauth2-implementation/\n\nimport {\n Binary,\n Bundle,\n Project,\n ProjectMembership,\n Reference,\n Resource,\n SearchParameter,\n StructureDefinition,\n ValueSet,\n} from '@medplum/fhirtypes';\nimport { LRUCache } from './cache';\nimport { encryptSHA256, getRandomString } from './crypto';\nimport { EventTarget } from './eventtarget';\nimport { parseJWTPayload } from './jwt';\nimport { isOk } from './outcomes';\nimport { formatSearchQuery, SearchRequest } from './search';\nimport { ClientStorage } from './storage';\nimport { createSchema, IndexedStructureDefinition, indexSearchParameter, indexStructureDefinition } from './types';\nimport { arrayBufferToBase64, ProfileResource, stringify } from './utils';\n\nconst DEFAULT_BASE_URL = 'https://api.medplum.com/';\nconst DEFAULT_SCOPE = 'launch/patient openid fhirUser offline_access user/*.*';\nconst DEFAULT_RESOURCE_CACHE_SIZE = 1000;\nconst JSON_CONTENT_TYPE = 'application/json';\nconst FHIR_CONTENT_TYPE = 'application/fhir+json';\nconst PATCH_CONTENT_TYPE = 'application/json-patch+json';\n\nexport interface MedplumClientOptions {\n /**\n * The client ID.\n * Optional. Default is to defer to the server to use the default client.\n * Use this to use a specific client for SMART-on-FHIR.\n */\n clientId?: string;\n\n /**\n * Base server URL.\n * Optional. Default value is \"https://api.medplum.com/\".\n * Use this to point to a custom Medplum deployment.\n */\n baseUrl?: string;\n\n /**\n * OAuth2 authorize URL.\n * Optional. Default value is baseUrl + \"/oauth2/authorize\".\n * Use this if you want to use a separate OAuth server.\n */\n authorizeUrl?: string;\n\n /**\n * OAuth2 token URL.\n * Optional. Default value is baseUrl + \"/oauth2/token\".\n * Use this if you want to use a separate OAuth server.\n */\n tokenUrl?: string;\n\n /**\n * OAuth2 logout URL.\n * Optional. Default value is baseUrl + \"/oauth2/logout\".\n * Use this if you want to use a separate OAuth server.\n */\n logoutUrl?: string;\n\n /**\n * Number of resources to store in the cache.\n * Optional. Default value is 1000.\n * Consider using this for performance of displaying Patient or Practitioner resources.\n */\n resourceCacheSize?: number;\n\n /**\n * Optional fetch implementation.\n * Optional. Default is window.fetch.\n * For nodejs applications, consider the 'node-fetch' package.\n */\n fetch?: FetchLike;\n\n /**\n * Optional callback for when the client is unauthenticated.\n * Default is do nothing.\n * For client side applications, consider redirecting to a sign in page.\n */\n onUnauthenticated?: () => void;\n}\n\nexport interface FetchLike {\n (url: string, options?: any): Promise<any>;\n}\n\nexport interface RegisterRequest {\n readonly firstName: string;\n readonly lastName: string;\n readonly projectName: string;\n readonly email: string;\n readonly password: string;\n readonly remember?: boolean;\n readonly recaptchaToken: string;\n}\n\nexport interface GoogleCredentialResponse {\n readonly clientId: string;\n readonly credential: string;\n}\n\nexport interface LoginAuthenticationResponse {\n readonly login: string;\n readonly code?: string;\n readonly memberships?: ProjectMembership[];\n}\n\nexport interface LoginProfileResponse {\n readonly login: string;\n readonly scope: string;\n}\n\nexport interface LoginScopeResponse {\n readonly login: string;\n readonly code: string;\n}\n\nexport interface LoginState {\n readonly project: Reference<Project>;\n readonly profile: Reference<ProfileResource>;\n readonly accessToken: string;\n readonly refreshToken: string;\n}\n\nexport interface TokenResponse {\n readonly token_type: string;\n readonly id_token: string;\n readonly access_token: string;\n readonly refresh_token: string;\n readonly expires_in: number;\n readonly project: Reference<Project>;\n readonly profile: Reference<ProfileResource>;\n}\n\ninterface SchemaGraphQLResponse {\n readonly data: {\n readonly StructureDefinitionList: StructureDefinition[];\n readonly SearchParameterList: SearchParameter[];\n };\n}\n\nexport class MedplumClient extends EventTarget {\n private readonly fetch: FetchLike;\n private readonly storage: ClientStorage;\n private readonly schema: IndexedStructureDefinition;\n private readonly resourceCache: LRUCache<Resource | Promise<Resource>>;\n private readonly baseUrl: string;\n private readonly clientId: string;\n private readonly authorizeUrl: string;\n private readonly tokenUrl: string;\n private readonly logoutUrl: string;\n private readonly onUnauthenticated?: () => void;\n private refreshPromise?: Promise<any>;\n private loading: boolean;\n\n constructor(options?: MedplumClientOptions) {\n super();\n\n if (options?.baseUrl) {\n if (!options.baseUrl.startsWith('http')) {\n throw new Error('Base URL must start with http or https');\n }\n if (!options.baseUrl.endsWith('/')) {\n throw new Error('Base URL must end with a trailing slash');\n }\n }\n\n this.fetch = options?.fetch || window.fetch.bind(window);\n this.storage = new ClientStorage();\n this.schema = createSchema();\n this.resourceCache = new LRUCache(options?.resourceCacheSize ?? DEFAULT_RESOURCE_CACHE_SIZE);\n this.baseUrl = options?.baseUrl || DEFAULT_BASE_URL;\n this.clientId = options?.clientId || '';\n this.authorizeUrl = options?.authorizeUrl || this.baseUrl + 'oauth2/authorize';\n this.tokenUrl = options?.tokenUrl || this.baseUrl + 'oauth2/token';\n this.logoutUrl = options?.logoutUrl || this.baseUrl + 'oauth2/logout';\n this.onUnauthenticated = options?.onUnauthenticated;\n this.loading = false;\n this.refreshProfile().catch(console.log);\n this.setupStorageListener();\n }\n\n /**\n * Clears all auth state including local storage and session storage.\n */\n clear(): void {\n this.storage.clear();\n this.resourceCache.clear();\n this.dispatchEvent({ type: 'change' });\n }\n\n get(url: string): Promise<any> {\n return this.request('GET', url);\n }\n\n post(url: string, body: any, contentType?: string): Promise<any> {\n return this.request('POST', url, contentType, body);\n }\n\n put(url: string, body: any, contentType?: string): Promise<any> {\n return this.request('PUT', url, contentType, body);\n }\n\n delete(url: string): Promise<any> {\n return this.request('DELETE', url);\n }\n\n /**\n * Tries to register a new user.\n * @param request The registration request.\n * @returns Promise to the authentication response.\n */\n async register(request: RegisterRequest): Promise<void> {\n const response = await this.post('auth/register', request);\n await this.setActiveLogin(response as LoginState);\n }\n\n /**\n * Initiates a user login flow.\n * @param email The email address of the user.\n * @param password The password of the user.\n * @param remember Optional flag to remember the user.\n * @returns Promise to the authentication response.\n */\n async startLogin(email: string, password: string, remember?: boolean): Promise<LoginAuthenticationResponse> {\n await this.startPkce();\n return this.post('auth/login', {\n clientId: this.clientId,\n scope: DEFAULT_SCOPE,\n codeChallengeMethod: 'S256',\n codeChallenge: this.storage.getString('codeChallenge') as string,\n email,\n password,\n remember: !!remember,\n }) as Promise<LoginAuthenticationResponse>;\n }\n\n /**\n * Tries to sign in with Google authentication.\n * The response parameter is the result of a Google authentication.\n * See: https://developers.google.com/identity/gsi/web/guides/handle-credential-responses-js-functions\n * @param googleResponse The Google credential response.\n * @returns Promise to the authentication response.\n */\n async startGoogleLogin(googleResponse: GoogleCredentialResponse): Promise<LoginAuthenticationResponse> {\n await this.startPkce();\n return this.post('auth/google', googleResponse) as Promise<LoginAuthenticationResponse>;\n }\n\n /**\n * Signs out locally.\n * Does not invalidate tokens with the server.\n */\n signOut(): Promise<void> {\n this.clear();\n return Promise.resolve();\n }\n\n /**\n * Tries to sign in the user.\n * Returns true if the user is signed in.\n * This may result in navigating away to the sign in page.\n */\n signInWithRedirect(): Promise<ProfileResource | void> | undefined {\n const urlParams = new URLSearchParams(window.location.search);\n const code = urlParams.get('code');\n if (!code) {\n this.requestAuthorization();\n return undefined;\n } else {\n return this.processCode(code);\n }\n }\n\n /**\n * Tries to sign out the user.\n * See: https://docs.aws.amazon.com/cognito/latest/developerguide/logout-endpoint.html\n */\n signOutWithRedirect(): void {\n window.location.assign(this.logoutUrl);\n }\n\n /**\n * Builds a FHIR URL from a collection of URL path components.\n * For example, `buildUrl('/Patient', '123')` returns `fhir/R4/Patient/123`.\n * @param path The path component of the URL.\n * @returns The well-formed FHIR URL.\n */\n fhirUrl(...path: string[]): string {\n const builder = [this.baseUrl, 'fhir/R4'];\n path.forEach((p) => builder.push('/', encodeURIComponent(p)));\n return builder.join('');\n }\n\n /**\n * Sends a FHIR search request.\n * @param search The search query.\n * @returns Promise to the search result bundle.\n */\n search<T extends Resource>(search: SearchRequest): Promise<Bundle<T>> {\n return this.get(this.fhirUrl(search.resourceType) + formatSearchQuery(search));\n }\n\n /**\n * Searches a ValueSet resource using the \"expand\" operation.\n * See: https://www.hl7.org/fhir/operation-valueset-expand.html\n * @param system The ValueSet system url.\n * @param filter The search string.\n * @returns Promise to expanded ValueSet.\n */\n searchValueSet(system: string, filter: string): Promise<ValueSet> {\n return this.get(\n this.fhirUrl('ValueSet', '$expand') +\n `?url=${encodeURIComponent(system)}` +\n `&filter=${encodeURIComponent(filter)}`\n );\n }\n\n /**\n * Returns a cached resource if it is available.\n * @param resourceType The FHIR resource type.\n * @param id The FHIR resource ID.\n * @returns The resource if it is available in the cache; undefined otherwise.\n */\n getCached<T extends Resource>(resourceType: string, id: string): T | undefined {\n const cached = this.resourceCache.get(resourceType + '/' + id) as T | undefined;\n if (cached && !('then' in cached)) {\n return cached;\n }\n return undefined;\n }\n\n /**\n * Returns a cached resource if it is available.\n * @param resourceType The FHIR resource type.\n * @param id The FHIR resource ID.\n * @returns The resource if it is available in the cache; undefined otherwise.\n */\n getCachedReference<T extends Resource>(reference: Reference<T>): T | undefined {\n const cached = this.resourceCache.get(reference.reference as string) as T | undefined;\n if (cached && !('then' in cached)) {\n return cached;\n }\n return undefined;\n }\n\n read<T extends Resource>(resourceType: string, id: string): Promise<T> {\n const cacheKey = resourceType + '/' + id;\n const promise = this.get(this.fhirUrl(resourceType, id)).then((resource: T) => {\n this.resourceCache.set(cacheKey, resource);\n return resource;\n });\n this.resourceCache.set(cacheKey, promise);\n return promise;\n }\n\n readCached<T extends Resource>(resourceType: string, id: string): Promise<T> {\n const cached = this.resourceCache.get(resourceType + '/' + id) as T | Promise<T> | undefined;\n return cached ? Promise.resolve(cached) : this.read(resourceType, id);\n }\n\n readReference<T extends Resource>(reference: Reference<T>): Promise<T> {\n const refString = reference?.reference;\n if (!refString) {\n return Promise.reject('Missing reference');\n }\n const [resourceType, id] = refString.split('/');\n return this.read(resourceType, id);\n }\n\n readCachedReference<T extends Resource>(reference: Reference<T>): Promise<T> {\n const refString = reference?.reference;\n if (!refString) {\n return Promise.reject('Missing reference');\n }\n const [resourceType, id] = refString.split('/');\n return this.readCached(resourceType, id);\n }\n\n /**\n * Returns a cached schema for a resource type.\n * If the schema is not cached, returns undefined.\n * It is assumed that a client will call requestSchema before using this method.\n * @param resourceType The FHIR resource type.\n * @returns The schema if immediately available, undefined otherwise.\n */\n getSchema(): IndexedStructureDefinition {\n return this.schema;\n }\n\n /**\n * Requests the schema for a resource type.\n * If the schema is already cached, the promise is resolved immediately.\n * @param resourceType The FHIR resource type.\n * @returns Promise to a schema with the requested resource type.\n */\n async requestSchema(resourceType: string): Promise<IndexedStructureDefinition> {\n if (resourceType in this.schema.types) {\n return Promise.resolve(this.schema);\n }\n\n const query = `{\n StructureDefinitionList(name: \"${encodeURIComponent(resourceType)}\") {\n name,\n description,\n snapshot {\n element {\n id,\n path,\n min,\n max,\n type {\n code,\n targetProfile\n },\n binding {\n valueSet\n },\n definition\n }\n }\n }\n SearchParameterList(base: \"${encodeURIComponent(resourceType)}\") {\n base,\n code,\n type\n }\n }`.replace(/\\s+/g, ' ');\n\n const response = (await this.graphql(query)) as SchemaGraphQLResponse;\n\n for (const structureDefinition of response.data.StructureDefinitionList) {\n indexStructureDefinition(this.schema, structureDefinition);\n }\n\n for (const searchParameter of response.data.SearchParameterList) {\n indexSearchParameter(this.schema, searchParameter);\n }\n\n return this.schema;\n }\n\n readHistory<T extends Resource>(resourceType: string, id: string): Promise<Bundle<T>> {\n return this.get(this.fhirUrl(resourceType, id, '_history'));\n }\n\n readPatientEverything(id: string): Promise<Bundle> {\n return this.get(this.fhirUrl('Patient', id, '$everything'));\n }\n\n create<T extends Resource>(resource: T): Promise<T> {\n if (!resource.resourceType) {\n throw new Error('Missing resourceType');\n }\n return this.post(this.fhirUrl(resource.resourceType), resource);\n }\n\n createBinary(data: any, filename: string, contentType: string): Promise<Binary> {\n return this.post(this.fhirUrl('Binary') + '?_filename=' + encodeURIComponent(filename), data, contentType);\n }\n\n update<T extends Resource>(resource: T): Promise<T> {\n if (!resource.resourceType) {\n throw new Error('Missing resourceType');\n }\n if (!resource.id) {\n throw new Error('Missing id');\n }\n return this.put(this.fhirUrl(resource.resourceType, resource.id), resource);\n }\n\n patch(resourceType: string, id: string, operations: any): Promise<any> {\n return this.request('PATCH', this.fhirUrl(resourceType, id), PATCH_CONTENT_TYPE, operations);\n }\n\n deleteResource(resourceType: string, id: string): Promise<any> {\n return this.delete(this.fhirUrl(resourceType, id));\n }\n\n graphql(query: string): Promise<any> {\n return this.post(this.fhirUrl('$graphql'), { query }, JSON_CONTENT_TYPE);\n }\n\n getActiveLogin(): LoginState | undefined {\n return this.storage.getObject('activeLogin');\n }\n\n async setActiveLogin(login: LoginState): Promise<void> {\n this.storage.setObject('activeLogin', login);\n this.addLogin(login);\n this.resourceCache.clear();\n this.refreshPromise = undefined;\n await this.refreshProfile();\n }\n\n getLogins(): LoginState[] {\n return this.storage.getObject<LoginState[]>('logins') ?? [];\n }\n\n private addLogin(newLogin: LoginState): void {\n const logins = this.getLogins().filter((login) => login.profile?.reference !== newLogin.profile?.reference);\n logins.push(newLogin);\n this.storage.setObject('logins', logins);\n }\n\n private async refreshProfile(): Promise<ProfileResource | undefined> {\n const reference = this.getActiveLogin()?.profile;\n if (reference?.reference) {\n this.loading = true;\n this.storage.setObject('profile', await this.readCachedReference(reference));\n this.loading = false;\n this.dispatchEvent({ type: 'change' });\n }\n return this.getProfile();\n }\n\n getProfile(): ProfileResource | undefined {\n return this.storage.getObject('profile');\n }\n\n isLoading(): boolean {\n return this.loading;\n }\n\n /**\n * Makes an HTTP request.\n * @param {string} method\n * @param {string} url\n * @param {string=} contentType\n * @param {Object=} body\n */\n private async request(method: string, url: string, contentType?: string, body?: any): Promise<any> {\n if (this.refreshPromise) {\n await this.refreshPromise;\n }\n\n if (!url.startsWith('http')) {\n url = this.baseUrl + url;\n }\n\n const headers: Record<string, string> = {\n 'Content-Type': contentType || FHIR_CONTENT_TYPE,\n };\n\n const accessToken = this.getActiveLogin()?.accessToken;\n if (accessToken) {\n headers['Authorization'] = 'Bearer ' + accessToken;\n }\n\n const options: RequestInit = {\n method: method,\n cache: 'no-cache',\n credentials: 'include',\n headers,\n };\n\n if (body) {\n if (typeof body === 'string' || (typeof File !== 'undefined' && body instanceof File)) {\n options.body = body;\n } else {\n options.body = stringify(body);\n }\n }\n\n const response = await this.fetch(url, options);\n if (response.status === 401) {\n // Refresh and try again\n return this.handleUnauthenticated(method, url, contentType, body);\n }\n\n if (response.status === 204 || response.status === 304) {\n // No content or change\n return undefined;\n }\n\n const obj = await response.json();\n if (obj.resourceType === 'OperationOutcome' && !isOk(obj)) {\n return Promise.reject(obj);\n }\n return obj;\n }\n\n /**\n * Handles an unauthenticated response from the server.\n * First, tries to refresh the access token and retry the request.\n * Otherwise, calls unauthenticated callbacks and rejects.\n * @param method The HTTP method of the original request.\n * @param url The URL of the original request.\n * @param contentType The content type of the original request.\n * @param body The body of the original request.\n */\n private async handleUnauthenticated(method: string, url: string, contentType?: string, body?: any): Promise<any> {\n return this.refresh()\n .then(() => this.request(method, url, contentType, body))\n .catch((error) => {\n this.clear();\n if (this.onUnauthenticated) {\n this.onUnauthenticated();\n }\n return Promise.reject(error);\n });\n }\n\n /**\n * Starts a new PKCE flow.\n * These PKCE values are stateful, and must survive redirects and page refreshes.\n */\n private async startPkce(): Promise<void> {\n const pkceState = getRandomString();\n this.storage.setString('pkceState', pkceState);\n\n const codeVerifier = getRandomString();\n this.storage.setString('codeVerifier', codeVerifier);\n\n const arrayHash = await encryptSHA256(codeVerifier);\n const codeChallenge = arrayBufferToBase64(arrayHash).replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=/g, '');\n this.storage.setString('codeChallenge', codeChallenge);\n }\n\n /**\n * Redirects the user to the login screen for authorization.\n * Clears all auth state including local storage and session storage.\n * See: https://openid.net/specs/openid-connect-core-1_0.html#AuthorizationEndpoint\n */\n private async requestAuthorization(): Promise<void> {\n if (!this.authorizeUrl) {\n throw new Error('Missing authorize URL');\n }\n\n this.startPkce();\n\n window.location.assign(\n this.authorizeUrl +\n '?response_type=code' +\n '&state=' +\n encodeURIComponent(this.storage.getString('pkceState') as string) +\n '&client_id=' +\n encodeURIComponent(this.clientId) +\n '&redirect_uri=' +\n encodeURIComponent(getBaseUrl()) +\n '&scope=' +\n encodeURIComponent(DEFAULT_SCOPE) +\n '&code_challenge_method=S256' +\n '&code_challenge=' +\n encodeURIComponent(this.storage.getString('codeChallenge') as string)\n );\n }\n\n /**\n * Processes an OAuth authorization code.\n * See: https://openid.net/specs/openid-connect-core-1_0.html#TokenRequest\n * @param code The authorization code received by URL parameter.\n */\n processCode(code: string): Promise<ProfileResource> {\n const pkceState = this.storage.getString('pkceState');\n if (!pkceState) {\n this.clear();\n throw new Error('Invalid PCKE state');\n }\n\n const codeVerifier = this.storage.getString('codeVerifier');\n if (!codeVerifier) {\n this.clear();\n throw new Error('Invalid PCKE code verifier');\n }\n\n return this.fetchTokens(\n 'grant_type=authorization_code' +\n (this.clientId ? '&client_id=' + encodeURIComponent(this.clientId) : '') +\n '&code_verifier=' +\n encodeURIComponent(codeVerifier) +\n '&redirect_uri=' +\n encodeURIComponent(getBaseUrl()) +\n '&code=' +\n encodeURIComponent(code)\n );\n }\n\n /**\n * Tries to refresh the auth tokens.\n * See: https://openid.net/specs/openid-connect-core-1_0.html#RefreshTokens\n */\n private async refresh(): Promise<void> {\n if (this.refreshPromise) {\n return this.refreshPromise;\n }\n\n const refreshToken = this.getActiveLogin()?.refreshToken;\n if (!refreshToken) {\n this.clear();\n return Promise.reject('Invalid refresh token');\n }\n\n this.refreshPromise = this.fetchTokens(\n 'grant_type=refresh_token' +\n '&client_id=' +\n encodeURIComponent(this.clientId) +\n '&refresh_token=' +\n encodeURIComponent(refreshToken)\n );\n\n await this.refreshPromise;\n }\n\n /**\n * Makes a POST request to the tokens endpoint.\n * See: https://openid.net/specs/openid-connect-core-1_0.html#TokenEndpoint\n * @param formBody Token parameters in URL encoded format.\n */\n private async fetchTokens(formBody: string): Promise<ProfileResource> {\n if (!this.tokenUrl) {\n return Promise.reject('Missing token URL');\n }\n\n return this.fetch(this.tokenUrl, {\n method: 'POST',\n headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n body: formBody,\n })\n .then((response) => {\n if (!response.ok) {\n return Promise.reject('Failed to fetch tokens');\n }\n return response.json();\n })\n .then((tokens) => this.verifyTokens(tokens))\n .then(() => this.getProfile() as ProfileResource);\n }\n\n /**\n * Verifies the tokens received from the auth server.\n * Validates the JWT against the JWKS.\n * See: https://openid.net/specs/openid-connect-core-1_0.html#TokenEndpoint\n * @param tokens\n */\n private async verifyTokens(tokens: TokenResponse): Promise<void> {\n const token = tokens.access_token;\n\n // Verify token has not expired\n const tokenPayload = parseJWTPayload(token);\n if (Date.now() >= (tokenPayload.exp as number) * 1000) {\n this.clear();\n return Promise.reject('Token expired');\n }\n\n // Verify app_client_id\n if (this.clientId && tokenPayload.client_id !== this.clientId) {\n this.clear();\n return Promise.reject('Token was not issued for this audience');\n }\n\n await this.setActiveLogin({\n accessToken: token,\n refreshToken: tokens.refresh_token,\n project: tokens.project,\n profile: tokens.profile,\n });\n }\n\n /**\n * Sets up a listener for window storage events.\n * This synchronizes state across browser windows and browser tabs.\n */\n private setupStorageListener(): void {\n try {\n window.addEventListener('storage', (e: StorageEvent) => {\n if (e.key === null || e.key === 'activeLogin') {\n // Storage events fire when different tabs make changes.\n // On storage clear (key === null) or activeLogin change (key === 'activeLogin')\n // Refresh the page to ensure the active login is up to date.\n window.location.reload();\n }\n });\n } catch (err) {\n // Silently ignore if this environment does not support storage events\n }\n }\n}\n\n/**\n * Returns the base URL for the current page.\n */\nfunction getBaseUrl(): string {\n return window.location.protocol + '//' + window.location.host + '/';\n}\n","/*\n * Based on: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget\n */\n\ninterface Event {\n type: string;\n defaultPrevented?: boolean;\n}\n\ntype EventListener = (e: Event) => void;\n\nexport class EventTarget {\n private readonly listeners: Record<string, EventListener[]>;\n\n constructor() {\n this.listeners = {};\n }\n\n addEventListener(type: string, callback: EventListener): void {\n if (!this.listeners[type]) {\n this.listeners[type] = [];\n }\n this.listeners[type].push(callback);\n }\n\n removeEventListeneer(type: string, callback: EventListener): void {\n const array = this.listeners[type];\n if (!array) {\n return;\n }\n for (let i = 0; i < array.length; i++) {\n if (array[i] === callback) {\n array.splice(i, 1);\n return;\n }\n }\n }\n\n dispatchEvent(event: Event): boolean {\n const array = this.listeners[event.type];\n if (array) {\n array.forEach((listener) => listener.call(this, event));\n }\n return !event.defaultPrevented;\n }\n}\n","import { SearchParameter } from '@medplum/fhirtypes';\nimport { IndexedStructureDefinition } from './types';\nimport { capitalize } from './utils';\n\nexport enum SearchParameterType {\n BOOLEAN = 'BOOLEAN',\n NUMBER = 'NUMBER',\n QUANTITY = 'QUANTITY',\n TEXT = 'TEXT',\n REFERENCE = 'REFERENCE',\n DATE = 'DATE',\n DATETIME = 'DATETIME',\n PERIOD = 'PERIOD',\n}\n\nexport interface SearchParameterDetails {\n readonly columnName: string;\n readonly type: SearchParameterType;\n readonly array?: boolean;\n}\n\n/**\n * Returns the type details of a SearchParameter.\n *\n * The SearchParameter resource has a \"type\" parameter, but that is missing some critical information.\n *\n * For example:\n * 1) The \"date\" type includes \"date\", \"datetime\", and \"period\".\n * 2) The \"token\" type includes enums and booleans.\n * 3) Arrays/multiple values are not reflected at all.\n *\n * @param structureDefinitions Collection of StructureDefinition resources indexed by name.\n * @param resourceType The root resource type.\n * @param searchParam The search parameter.\n * @returns The search parameter type details.\n */\nexport function getSearchParameterDetails(\n structureDefinitions: IndexedStructureDefinition,\n resourceType: string,\n searchParam: SearchParameter\n): SearchParameterDetails {\n const columnName = convertCodeToColumnName(searchParam.code as string);\n const expression = getExpressionForResourceType(resourceType, searchParam.expression as string)?.split('.');\n if (!expression) {\n // This happens on compound types\n // In the future, explore returning multiple column definitions\n return { columnName, type: SearchParameterType.TEXT };\n }\n\n let baseType = resourceType;\n let propertyType = undefined;\n let array = false;\n\n for (let i = 1; i < expression.length; i++) {\n const propertyName = expression[i];\n const propertyDef = structureDefinitions.types[baseType]?.properties?.[propertyName];\n if (!propertyDef) {\n // This happens on complex properties such as \"collected[x]\"/\"collectedDateTime\"/\"collectedPeriod\"\n // In the future, explore returning multiple column definitions\n return { columnName, type: SearchParameterType.TEXT, array };\n }\n\n if (propertyDef.max === '*') {\n array = true;\n }\n\n propertyType = propertyDef.type?.[0].code;\n if (!propertyType) {\n // This happens when one of parent properties uses contentReference\n // In the future, explore following the reference\n return { columnName, type: SearchParameterType.TEXT, array };\n }\n\n if (i < expression.length - 1) {\n if (propertyType === 'Element' || propertyType === 'BackboneElement') {\n baseType = baseType + capitalize(propertyName);\n } else {\n baseType = propertyType;\n }\n }\n }\n\n const type = getSearchParameterType(searchParam, propertyType as string);\n return { columnName, type, array };\n}\n\n/**\n * Converts a hyphen-delimited code to camelCase string.\n * @param code The search parameter code.\n * @returns The SQL column name.\n */\nfunction convertCodeToColumnName(code: string): string {\n return code.split('-').reduce((result, word, index) => result + (index ? capitalize(word) : word), '');\n}\n\nfunction getSearchParameterType(searchParam: SearchParameter, propertyType: string): SearchParameterType {\n let type = SearchParameterType.TEXT;\n switch (searchParam.type) {\n case 'date':\n type = SearchParameterType.DATE;\n break;\n case 'number':\n type = SearchParameterType.NUMBER;\n break;\n case 'quantity':\n type = SearchParameterType.QUANTITY;\n break;\n case 'reference':\n type = SearchParameterType.REFERENCE;\n break;\n case 'token':\n if (propertyType === 'boolean') {\n type = SearchParameterType.BOOLEAN;\n }\n break;\n }\n return type;\n}\n\nexport function getExpressionForResourceType(resourceType: string, expression: string): string | undefined {\n const expressions = expression.split(' | ');\n for (const e of expressions) {\n const simplified = simplifyExpression(e);\n if (simplified.startsWith(resourceType + '.')) {\n return simplified;\n }\n }\n return undefined;\n}\n\nfunction simplifyExpression(input: string): string {\n let result = input.trim();\n\n if (result.startsWith('(') && result.endsWith(')')) {\n result = result.substring(1, result.length - 1);\n }\n\n if (result.includes(' as ')) {\n result = result.substring(0, result.indexOf(' as '));\n }\n\n if (result.includes('.where(')) {\n result = result.substring(0, result.indexOf('.where('));\n }\n\n return result;\n}\n"],"names":["__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","value","step","next","e","rejected","result","done","then","apply","LRUCache","constructor","max","this","cache","Map","clear","get","key","item","delete","set","val","has","size","first","keys","formatAddress","address","options","builder","line","push","city","state","postalCode","use","all","join","trim","formatHumanName","name","prefix","given","family","suffix","formatGivenName","formatFamilyName","createReference","resource","reference","getReferenceString","display","getDisplayString","resourceType","id","isProfileResource","profileName","names","length","getProfileResourceDisplayString","deviceName","device","getDeviceDisplayString","email","getImageSrc","photos","photo","url","contentType","startsWith","getDateProperty","date","Date","undefined","stringify","pretty","JSON","stringifyReplacer","k","v","t","Object","isEmpty","deepEquals","object1","object2","path","keys1","keys2","filter","val1","val2","isObject","object","byteToHex","n","toString","padStart","arrayBufferToHex","arrayBuffer","bytes","Uint8Array","Array","i","arrayBufferToBase64","String","fromCharCode","window","btoa","capitalize","word","charAt","toUpperCase","substr","isLowerCase","c","toLowerCase","getRandomString","randomItems","Uint32Array","crypto","getRandomValues","buffer","parseJWTPayload","token","_header","payload","_signature","split","cleanedPayload","replace","decodedPayload","atob","uriEncodedPayload","from","reduce","acc","char","charCodeAt","slice","jsonPayload","decodeURIComponent","parse","decodePayload","allOk","issue","severity","code","details","text","created","notModified","notFound","gone","accessDenied","badRequest","expression","isOk","outcome","isNotFound","isGone","getStatus","assertOk","OperationOutcomeError","Error","super","Operator","MODIFIER_OPERATORS","CONTAINS","EXACT","TEXT","ABOVE","BELOW","IN","NOT_IN","OF_TYPE","PREFIX_OPERATORS","NOT_EQUALS","GREATER_THAN","LESS_THAN","GREATER_THAN_OR_EQUALS","LESS_THAN_OR_EQUALS","STARTS_AFTER","ENDS_BEFORE","APPROXIMATELY","parseSearchDefinition","location","pathname","pop","params","URLSearchParams","search","filters","sortRules","fields","page","count","forEach","parseInt","substring","descending","parseSortRule","operator","EQUALS","modifier","modifierIndex","indexOf","match","RegExp","parseSearchFilter","formatSearchQuery","definition","includes","encodeURIComponent","map","sr","formatSortRules","sort","ClientStorage","storage","localStorage","MemoryStorage","getString","getItem","setString","setItem","removeItem","getObject","str","setObject","data","index","PropertyType","createSchema","types","indexStructureDefinition","schema","structureDefinition","typeName","description","properties","elements","snapshot","element","filtered","typeCode","type","parts","buildTypeName","parentType","indexType","typeSchema","indexProperty","indexSearchParameter","searchParam","base","searchParams","components","getPropertyDisplayName","property","replaceAll","DEFAULT_SCOPE","MedplumClient","listeners","addEventListener","callback","removeEventListeneer","array","splice","dispatchEvent","event","listener","call","defaultPrevented","baseUrl","endsWith","fetch","bind","resourceCache","resourceCacheSize","clientId","authorizeUrl","tokenUrl","logoutUrl","onUnauthenticated","loading","refreshProfile","catch","console","log","setupStorageListener","request","post","body","put","register","response","setActiveLogin","startLogin","password","remember","startPkce","scope","codeChallengeMethod","codeChallenge","startGoogleLogin","googleResponse","signOut","signInWithRedirect","processCode","requestAuthorization","signOutWithRedirect","assign","fhirUrl","p","searchValueSet","system","getCached","cached","getCachedReference","read","cacheKey","promise","readCached","readReference","refString","readCachedReference","getSchema","requestSchema","query","graphql","StructureDefinitionList","searchParameter","SearchParameterList","readHistory","readPatientEverything","create","createBinary","filename","update","patch","operations","deleteResource","getActiveLogin","login","addLogin","refreshPromise","getLogins","newLogin","logins","profile","getProfile","isLoading","method","headers","accessToken","credentials","File","status","handleUnauthenticated","obj","json","refresh","error","pkceState","codeVerifier","subtle","digest","TextEncoder","encode","encryptSHA256","getBaseUrl","fetchTokens","refreshToken","formBody","ok","tokens","verifyTokens","access_token","tokenPayload","now","exp","client_id","refresh_token","project","reload","err","protocol","host","SearchParameterType","getSearchParameterDetails","structureDefinitions","columnName","getExpressionForResourceType","propertyType","baseType","propertyName","propertyDef","DATE","NUMBER","QUANTITY","REFERENCE","BOOLEAN","getSearchParameterType","expressions","simplified","simplifyExpression","input"],"mappings":";;;;;;;;;;;;;;AAqEO,SAASA,EAAUC,EAASC,EAAYC,EAAGC,GAE9C,OAAO,IAAKD,IAAMA,EAAIE,WAAU,SAAUC,EAASC,GAC/C,SAASC,EAAUC,GAAS,IAAMC,EAAKN,EAAUO,KAAKF,IAAW,MAAOG,GAAKL,EAAOK,IACpF,SAASC,EAASJ,GAAS,IAAMC,EAAKN,EAAiB,MAAEK,IAAW,MAAOG,GAAKL,EAAOK,IACvF,SAASF,EAAKI,GAJlB,IAAeL,EAIaK,EAAOC,KAAOT,EAAQQ,EAAOL,QAJ1CA,EAIyDK,EAAOL,MAJhDA,aAAiBN,EAAIM,EAAQ,IAAIN,GAAE,SAAUG,GAAWA,EAAQG,OAITO,KAAKR,EAAWK,GAClGH,GAAMN,EAAYA,EAAUa,MAAMhB,EAASC,GAAc,KAAKS,iBCvEzDO,EAIXC,YAAYC,EAAM,IAChBC,KAAKD,IAAMA,EACXC,KAAKC,MAAQ,IAAIC,IAGnBC,QACEH,KAAKC,MAAME,QAGbC,IAAIC,GACF,MAAMC,EAAON,KAAKC,MAAMG,IAAIC,GAK5B,OAJIC,IACFN,KAAKC,MAAMM,OAAOF,GAClBL,KAAKC,MAAMO,IAAIH,EAAKC,IAEfA,EAGTE,IAAIH,EAAaI,GACXT,KAAKC,MAAMS,IAAIL,GACjBL,KAAKC,MAAMM,OAAOF,GACTL,KAAKC,MAAMU,MAAQX,KAAKD,KACjCC,KAAKC,MAAMM,OAAOP,KAAKY,SAEzBZ,KAAKC,MAAMO,IAAIH,EAAKI,GAGdG,QAEN,OAAOZ,KAAKC,MAAMY,OAAOvB,OAAOF,gBCvBpB0B,EAAcC,EAAkBC,GAC9C,MAAMC,EAAU,GAsBhB,OApBIF,EAAQG,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1J,EAAO+I,EAAoBY,UAC3B,MACF,IAAK,QACkB,YAAjBP,IACFpJ,EAAO+I,EAAoBa,SAIjC,OAAO5J,EAlCM6J,CAAuBrJ,EAAa4I,GACjD,MAAO,CAAEF,WAAAA,EAAYlJ,KAAAA,EAAMqB,MAAAA,YAoCb8H,GAA6BpV,EAAsBuG,GACjE,MAAMwP,EAAcxP,EAAW5B,MAAM,OACrC,IAAK,MAAM7H,KAAKiZ,EAAa,CAC3B,MAAMC,EAAaC,GAAmBnZ,GACtC,GAAIkZ,EAAWhV,WAAWhB,EAAe,KACvC,OAAOgW,GAMb,SAASC,GAAmBC,GAC1B,IAAIlZ,EAASkZ,EAAMjX,OAcnB,OAZIjC,EAAOgE,WAAW,MAAQhE,EAAO8Q,SAAS,OAC5C9Q,EAASA,EAAOkM,UAAU,EAAGlM,EAAOqD,OAAS,IAG3CrD,EAAO+M,SAAS,UAClB/M,EAASA,EAAOkM,UAAU,EAAGlM,EAAOyM,QAAQ,UAG1CzM,EAAO+M,SAAS,aAClB/M,EAASA,EAAOkM,UAAU,EAAGlM,EAAOyM,QAAQ,aAGvCzM,GA7IT,SAAYgY,GACVA,oBACAA,kBACAA,sBACAA,cACAA,wBACAA,cACAA,sBACAA,kBARF,CAAYA,IAAAA"}
@@ -6,6 +6,7 @@ export declare class LRUCache<T> {
6
6
  private readonly max;
7
7
  private readonly cache;
8
8
  constructor(max?: number);
9
+ clear(): void;
9
10
  get(key: string): T | undefined;
10
11
  set(key: string, val: T): void;
11
12
  private first;
@@ -1,14 +1,15 @@
1
+ import { Binary, Bundle, Project, ProjectMembership, Reference, Resource, ValueSet } from '@medplum/fhirtypes';
1
2
  import { EventTarget } from './eventtarget';
2
- import { Binary, Bundle, Project, Reference, Resource, ValueSet } from './fhir';
3
3
  import { SearchRequest } from './search';
4
4
  import { IndexedStructureDefinition } from './types';
5
5
  import { ProfileResource } from './utils';
6
6
  export interface MedplumClientOptions {
7
7
  /**
8
8
  * The client ID.
9
- * Required.
9
+ * Optional. Default is to defer to the server to use the default client.
10
+ * Use this to use a specific client for SMART-on-FHIR.
10
11
  */
11
- clientId: string;
12
+ clientId?: string;
12
13
  /**
13
14
  * Base server URL.
14
15
  * Optional. Default value is "https://api.medplum.com/".
@@ -39,12 +40,6 @@ export interface MedplumClientOptions {
39
40
  * Consider using this for performance of displaying Patient or Practitioner resources.
40
41
  */
41
42
  resourceCacheSize?: number;
42
- /**
43
- * Number of blob URLs to store in the cache.
44
- * Optional. Default value is 100.
45
- * Consider using this for performance of displaying Patient or Practitioner resources.
46
- */
47
- blobCacheSize?: number;
48
43
  /**
49
44
  * Optional fetch implementation.
50
45
  * Optional. Default is window.fetch.
@@ -61,76 +56,91 @@ export interface MedplumClientOptions {
61
56
  export interface FetchLike {
62
57
  (url: string, options?: any): Promise<any>;
63
58
  }
64
- interface LoginResponse {
65
- project: Project;
66
- profile: ProfileResource;
67
- accessToken: string;
68
- refreshToken: string;
69
- }
70
59
  export interface RegisterRequest {
71
- firstName: string;
72
- lastName: string;
73
- projectName: string;
74
- email: string;
75
- password: string;
76
- remember?: boolean;
60
+ readonly firstName: string;
61
+ readonly lastName: string;
62
+ readonly projectName: string;
63
+ readonly email: string;
64
+ readonly password: string;
65
+ readonly remember?: boolean;
66
+ readonly recaptchaToken: string;
77
67
  }
78
68
  export interface GoogleCredentialResponse {
79
69
  readonly clientId: string;
80
70
  readonly credential: string;
81
71
  }
72
+ export interface LoginAuthenticationResponse {
73
+ readonly login: string;
74
+ readonly code?: string;
75
+ readonly memberships?: ProjectMembership[];
76
+ }
77
+ export interface LoginProfileResponse {
78
+ readonly login: string;
79
+ readonly scope: string;
80
+ }
81
+ export interface LoginScopeResponse {
82
+ readonly login: string;
83
+ readonly code: string;
84
+ }
85
+ export interface LoginState {
86
+ readonly project: Reference<Project>;
87
+ readonly profile: Reference<ProfileResource>;
88
+ readonly accessToken: string;
89
+ readonly refreshToken: string;
90
+ }
91
+ export interface TokenResponse {
92
+ readonly token_type: string;
93
+ readonly id_token: string;
94
+ readonly access_token: string;
95
+ readonly refresh_token: string;
96
+ readonly expires_in: number;
97
+ readonly project: Reference<Project>;
98
+ readonly profile: Reference<ProfileResource>;
99
+ }
82
100
  export declare class MedplumClient extends EventTarget {
83
101
  private readonly fetch;
84
102
  private readonly storage;
85
103
  private readonly schema;
86
104
  private readonly resourceCache;
87
- private readonly blobUrlCache;
88
105
  private readonly baseUrl;
89
106
  private readonly clientId;
90
107
  private readonly authorizeUrl;
91
108
  private readonly tokenUrl;
92
109
  private readonly logoutUrl;
93
110
  private readonly onUnauthenticated?;
94
- private activeLogin?;
95
- constructor(options: MedplumClientOptions);
111
+ private refreshPromise?;
112
+ private loading;
113
+ constructor(options?: MedplumClientOptions);
96
114
  /**
97
115
  * Clears all auth state including local storage and session storage.
98
116
  */
99
117
  clear(): void;
100
- get(url: string, blob?: boolean): Promise<any>;
118
+ get(url: string): Promise<any>;
101
119
  post(url: string, body: any, contentType?: string): Promise<any>;
102
120
  put(url: string, body: any, contentType?: string): Promise<any>;
121
+ delete(url: string): Promise<any>;
103
122
  /**
104
123
  * Tries to register a new user.
105
124
  * @param request The registration request.
106
- * @returns Promise to the user profile resource.
125
+ * @returns Promise to the authentication response.
107
126
  */
108
- register(request: RegisterRequest): Promise<ProfileResource>;
127
+ register(request: RegisterRequest): Promise<void>;
109
128
  /**
110
- * Tries to sign in with email and password.
111
- * @param email The user email address.
112
- * @param password The user password.
113
- * @param role The login role.
114
- * @param scope The OAuth2 login scope.
115
- * @param remember Optional flag to "remember" to generate a refresh token and persist in local storage.
116
- * @returns Promise to the user profile resource.
129
+ * Initiates a user login flow.
130
+ * @param email The email address of the user.
131
+ * @param password The password of the user.
132
+ * @param remember Optional flag to remember the user.
133
+ * @returns Promise to the authentication response.
117
134
  */
118
- signIn(email: string, password: string, role: string, scope: string, remember?: boolean): Promise<ProfileResource>;
135
+ startLogin(email: string, password: string, remember?: boolean): Promise<LoginAuthenticationResponse>;
119
136
  /**
120
137
  * Tries to sign in with Google authentication.
121
138
  * The response parameter is the result of a Google authentication.
122
139
  * See: https://developers.google.com/identity/gsi/web/guides/handle-credential-responses-js-functions
123
140
  * @param googleResponse The Google credential response.
124
- * @returns Promise to the user profile resource.
125
- */
126
- signInWithGoogle(googleResponse: GoogleCredentialResponse): Promise<ProfileResource>;
127
- /**
128
- * Handles a login response.
129
- * This can be used for both "register" and "signIn".
130
- * @param response The login response.
131
- * @returns The user profile.
141
+ * @returns Promise to the authentication response.
132
142
  */
133
- private handleLoginResponse;
143
+ startGoogleLogin(googleResponse: GoogleCredentialResponse): Promise<LoginAuthenticationResponse>;
134
144
  /**
135
145
  * Signs out locally.
136
146
  * Does not invalidate tokens with the server.
@@ -147,8 +157,19 @@ export declare class MedplumClient extends EventTarget {
147
157
  * See: https://docs.aws.amazon.com/cognito/latest/developerguide/logout-endpoint.html
148
158
  */
149
159
  signOutWithRedirect(): void;
160
+ /**
161
+ * Builds a FHIR URL from a collection of URL path components.
162
+ * For example, `buildUrl('/Patient', '123')` returns `fhir/R4/Patient/123`.
163
+ * @param path The path component of the URL.
164
+ * @returns The well-formed FHIR URL.
165
+ */
150
166
  fhirUrl(...path: string[]): string;
151
- search<T extends Resource>(search: string | SearchRequest): Promise<Bundle<T>>;
167
+ /**
168
+ * Sends a FHIR search request.
169
+ * @param search The search query.
170
+ * @returns Promise to the search result bundle.
171
+ */
172
+ search<T extends Resource>(search: SearchRequest): Promise<Bundle<T>>;
152
173
  /**
153
174
  * Searches a ValueSet resource using the "expand" operation.
154
175
  * See: https://www.hl7.org/fhir/operation-valueset-expand.html
@@ -157,35 +178,60 @@ export declare class MedplumClient extends EventTarget {
157
178
  * @returns Promise to expanded ValueSet.
158
179
  */
159
180
  searchValueSet(system: string, filter: string): Promise<ValueSet>;
181
+ /**
182
+ * Returns a cached resource if it is available.
183
+ * @param resourceType The FHIR resource type.
184
+ * @param id The FHIR resource ID.
185
+ * @returns The resource if it is available in the cache; undefined otherwise.
186
+ */
187
+ getCached<T extends Resource>(resourceType: string, id: string): T | undefined;
188
+ /**
189
+ * Returns a cached resource if it is available.
190
+ * @param resourceType The FHIR resource type.
191
+ * @param id The FHIR resource ID.
192
+ * @returns The resource if it is available in the cache; undefined otherwise.
193
+ */
194
+ getCachedReference<T extends Resource>(reference: Reference<T>): T | undefined;
160
195
  read<T extends Resource>(resourceType: string, id: string): Promise<T>;
161
196
  readCached<T extends Resource>(resourceType: string, id: string): Promise<T>;
162
197
  readReference<T extends Resource>(reference: Reference<T>): Promise<T>;
163
198
  readCachedReference<T extends Resource>(reference: Reference<T>): Promise<T>;
164
- getTypeDefinition(resourceType: string): Promise<IndexedStructureDefinition>;
199
+ /**
200
+ * Returns a cached schema for a resource type.
201
+ * If the schema is not cached, returns undefined.
202
+ * It is assumed that a client will call requestSchema before using this method.
203
+ * @param resourceType The FHIR resource type.
204
+ * @returns The schema if immediately available, undefined otherwise.
205
+ */
206
+ getSchema(): IndexedStructureDefinition;
207
+ /**
208
+ * Requests the schema for a resource type.
209
+ * If the schema is already cached, the promise is resolved immediately.
210
+ * @param resourceType The FHIR resource type.
211
+ * @returns Promise to a schema with the requested resource type.
212
+ */
213
+ requestSchema(resourceType: string): Promise<IndexedStructureDefinition>;
165
214
  readHistory<T extends Resource>(resourceType: string, id: string): Promise<Bundle<T>>;
166
215
  readPatientEverything(id: string): Promise<Bundle>;
167
- readBlob(url: string): Promise<Blob>;
168
- readBlobAsObjectUrl(url: string): Promise<string>;
169
- readCachedBlobAsObjectUrl(url: string): Promise<string>;
170
- readBinary(id: string): Promise<Blob>;
171
216
  create<T extends Resource>(resource: T): Promise<T>;
172
- createBinary(data: any, contentType: string): Promise<Binary>;
217
+ createBinary(data: any, filename: string, contentType: string): Promise<Binary>;
173
218
  update<T extends Resource>(resource: T): Promise<T>;
174
219
  patch(resourceType: string, id: string, operations: any): Promise<any>;
175
- graphql(gql: any): Promise<any>;
176
- subscribe(criteria: string, handler: (e: Resource) => void): Promise<EventSource>;
177
- getActiveLogin(): LoginResponse | undefined;
178
- setActiveLogin(login: LoginResponse): void;
179
- getLogins(): LoginResponse[];
180
- addLogin(newLogin: LoginResponse): void;
220
+ deleteResource(resourceType: string, id: string): Promise<any>;
221
+ graphql(query: string): Promise<any>;
222
+ getActiveLogin(): LoginState | undefined;
223
+ setActiveLogin(login: LoginState): Promise<void>;
224
+ getLogins(): LoginState[];
225
+ private addLogin;
226
+ private refreshProfile;
181
227
  getProfile(): ProfileResource | undefined;
228
+ isLoading(): boolean;
182
229
  /**
183
230
  * Makes an HTTP request.
184
231
  * @param {string} method
185
232
  * @param {string} url
186
233
  * @param {string=} contentType
187
234
  * @param {Object=} body
188
- * @param {boolean=} blob
189
235
  */
190
236
  private request;
191
237
  /**
@@ -196,9 +242,13 @@ export declare class MedplumClient extends EventTarget {
196
242
  * @param url The URL of the original request.
197
243
  * @param contentType The content type of the original request.
198
244
  * @param body The body of the original request.
199
- * @param blob Optional blob flag of the original request.
200
245
  */
201
246
  private handleUnauthenticated;
247
+ /**
248
+ * Starts a new PKCE flow.
249
+ * These PKCE values are stateful, and must survive redirects and page refreshes.
250
+ */
251
+ private startPkce;
202
252
  /**
203
253
  * Redirects the user to the login screen for authorization.
204
254
  * Clears all auth state including local storage and session storage.
@@ -210,7 +260,7 @@ export declare class MedplumClient extends EventTarget {
210
260
  * See: https://openid.net/specs/openid-connect-core-1_0.html#TokenRequest
211
261
  * @param code The authorization code received by URL parameter.
212
262
  */
213
- private processCode;
263
+ processCode(code: string): Promise<ProfileResource>;
214
264
  /**
215
265
  * Tries to refresh the auth tokens.
216
266
  * See: https://openid.net/specs/openid-connect-core-1_0.html#RefreshTokens
@@ -229,5 +279,9 @@ export declare class MedplumClient extends EventTarget {
229
279
  * @param tokens
230
280
  */
231
281
  private verifyTokens;
282
+ /**
283
+ * Sets up a listener for window storage events.
284
+ * This synchronizes state across browser windows and browser tabs.
285
+ */
286
+ private setupStorageListener;
232
287
  }
233
- export {};
File without changes
@@ -1,4 +1,4 @@
1
- import { Address, HumanName } from './fhir';
1
+ import { Address, HumanName } from '@medplum/fhirtypes';
2
2
  export interface AddressFormatOptions {
3
3
  all?: boolean;
4
4
  use?: boolean;
@@ -1,6 +1,4 @@
1
1
  export * from './client';
2
- export * from './fhir';
3
- export * from './fhirpath';
4
2
  export * from './format';
5
3
  export * from './outcomes';
6
4
  export * from './search';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Parses the JWT payload.
3
+ * @param token JWT token
4
+ */
5
+ export declare function parseJWTPayload(token: string): Record<string, number | string>;
@@ -1,4 +1,4 @@
1
- import { OperationOutcome } from './fhir';
1
+ import { OperationOutcome } from '@medplum/fhirtypes';
2
2
  export declare const allOk: OperationOutcome;
3
3
  export declare const created: OperationOutcome;
4
4
  export declare const notModified: OperationOutcome;
@@ -10,7 +10,12 @@ export declare function isOk(outcome: OperationOutcome): boolean;
10
10
  export declare function isNotFound(outcome: OperationOutcome): boolean;
11
11
  export declare function isGone(outcome: OperationOutcome): boolean;
12
12
  export declare function getStatus(outcome: OperationOutcome): number;
13
- export declare function assertOk(outcome: OperationOutcome): void;
13
+ /**
14
+ * Asserts that the operation completed successfully and that the resource is defined.
15
+ * @param outcome The operation outcome.
16
+ * @param resource The resource that may or may not have been returned.
17
+ */
18
+ export declare function assertOk<T>(outcome: OperationOutcome, resource: T | undefined): asserts resource is T;
14
19
  export declare class OperationOutcomeError extends Error {
15
20
  readonly outcome: OperationOutcome;
16
21
  constructor(outcome: OperationOutcome);
@@ -44,6 +44,9 @@ export declare enum Operator {
44
44
  }
45
45
  /**
46
46
  * Parses a URL into a SearchRequest.
47
+ *
48
+ * See the FHIR search spec: http://hl7.org/fhir/r4/search.html
49
+ *
47
50
  * @param location The URL to parse.
48
51
  * @returns Parsed search definition.
49
52
  */
@@ -1,4 +1,4 @@
1
- import { SearchParameter } from './fhir';
1
+ import { SearchParameter } from '@medplum/fhirtypes';
2
2
  import { IndexedStructureDefinition } from './types';
3
3
  export declare enum SearchParameterType {
4
4
  BOOLEAN = "BOOLEAN",
@@ -31,3 +31,4 @@ export interface SearchParameterDetails {
31
31
  * @returns The search parameter type details.
32
32
  */
33
33
  export declare function getSearchParameterDetails(structureDefinitions: IndexedStructureDefinition, resourceType: string, searchParam: SearchParameter): SearchParameterDetails;
34
+ export declare function getExpressionForResourceType(resourceType: string, expression: string): string | undefined;
File without changes