@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
@@ -1,239 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const definitions_1 = require("@medplum/definitions");
4
- const parse_1 = require("./parse");
5
- test('Parser can build a arithmetic parser with correct order of operations', () => {
6
- const result = (0, parse_1.parseFhirPath)('3 / 3 + 4 * 3 ^ 2 - 1').eval(0);
7
- expect(result).toEqual([36]);
8
- });
9
- test('Parser can build a arithmetic parser with parentheses', () => {
10
- const result = (0, parse_1.parseFhirPath)('3 / 3 + 4 * (3 ^ (2 - 1))').eval(0);
11
- expect(result).toEqual([13]);
12
- });
13
- test('Parser can build a arithmetic parser with correct associativity', () => {
14
- const result = (0, parse_1.parseFhirPath)('5 - 4 - 3 - 2 - 1 + 2 ^ 3 ^ 2').eval(0);
15
- expect(result).toEqual([507]);
16
- });
17
- test('Parser can build an arithmetic parser with prefix operators', () => {
18
- const result = (0, parse_1.parseFhirPath)('-4 + -(4 + 5 - -4)').eval(0);
19
- expect(result).toEqual([-17]);
20
- });
21
- test('Parser throws on missing closing parentheses', () => {
22
- expect(() => (0, parse_1.parseFhirPath)('(2 + 1')).toThrowError('Parse error: expected `)`');
23
- });
24
- test('Parser throws on unexpected symbol', () => {
25
- expect(() => (0, parse_1.parseFhirPath)('*')).toThrowError('Parse error at *. No matching prefix parselet.');
26
- });
27
- test('Parser throws on missing tokens', () => {
28
- expect(() => (0, parse_1.parseFhirPath)('1 * ')).toThrowError('Cant consume any more tokens.');
29
- });
30
- test('Evaluate FHIRPath Patient.name.given on empty resource', () => {
31
- const result = (0, parse_1.parseFhirPath)('Patient.name.given').eval({});
32
- expect(result).toEqual([]);
33
- });
34
- test('Evaluate FHIRPath Patient.name.given', () => {
35
- const result = (0, parse_1.parseFhirPath)('Patient.name.given').eval({
36
- resourceType: 'Patient',
37
- name: [{
38
- given: ['Alice'],
39
- family: 'Smith'
40
- }]
41
- });
42
- expect(result).toEqual(['Alice']);
43
- });
44
- test('Evaluate FHIRPath string concatenation', () => {
45
- const result = (0, parse_1.parseFhirPath)('Patient.name.given + \' \' + Patient.name.family').eval({
46
- resourceType: 'Patient',
47
- name: [{
48
- given: ['Alice'],
49
- family: 'Smith'
50
- }]
51
- });
52
- expect(result).toEqual(['Alice Smith']);
53
- });
54
- test('Evaluate FHIRPath Patient.name.given on array of resources', () => {
55
- const result = (0, parse_1.parseFhirPath)('Patient.name.given').eval([{
56
- resourceType: 'Patient',
57
- name: [{
58
- given: ['Alice'],
59
- family: 'Smith'
60
- }]
61
- },
62
- {
63
- resourceType: 'Patient',
64
- name: [{
65
- given: ['Bob'],
66
- family: 'Jones'
67
- }]
68
- }]);
69
- expect(result).toEqual(['Alice', 'Bob']);
70
- });
71
- test('Evaluate FHIRPath string concatenation on array of resources', () => {
72
- const result = (0, parse_1.parseFhirPath)('Patient.name.given + \' \' + Patient.name.family').eval([{
73
- resourceType: 'Patient',
74
- name: [{
75
- given: ['Alice'],
76
- family: 'Smith'
77
- }]
78
- },
79
- {
80
- resourceType: 'Patient',
81
- name: [{
82
- given: ['Bob'],
83
- family: 'Jones'
84
- }]
85
- }]);
86
- expect(result).toEqual(['Alice Smith', 'Bob Jones']);
87
- });
88
- test('Evaluate FHIRPath Patient.name.given on array of resources', () => {
89
- const result = (0, parse_1.parseFhirPath)('Patient.name.given').eval([{
90
- resourceType: 'Practitioner',
91
- name: [{
92
- given: ['Alice'],
93
- family: 'Smith'
94
- }]
95
- },
96
- {
97
- resourceType: 'Patient',
98
- name: [{
99
- given: ['Bob'],
100
- family: 'Jones'
101
- }]
102
- }]);
103
- expect(result).toEqual(['Bob']);
104
- });
105
- test('Evaluate FHIRPath union', () => {
106
- const result = (0, parse_1.parseFhirPath)('Practitioner.name.given | Patient.name.given').eval({
107
- resourceType: 'Patient',
108
- name: [{
109
- given: ['Alice'],
110
- family: 'Smith'
111
- }]
112
- });
113
- expect(result).toEqual(['Alice']);
114
- });
115
- test('Evaluate FHIRPath union to combine results', () => {
116
- const result = (0, parse_1.parseFhirPath)('Practitioner.name.given | Patient.name.given').eval([{
117
- resourceType: 'Patient',
118
- name: [{
119
- given: ['Alice'],
120
- family: 'Smith'
121
- }]
122
- },
123
- {
124
- resourceType: 'Practitioner',
125
- name: [{
126
- given: ['Bob'],
127
- family: 'Jones'
128
- }]
129
- }]);
130
- expect(result).toEqual(['Alice', 'Bob']);
131
- });
132
- test('Evaluate FHIRPath double union', () => {
133
- const result = (0, parse_1.parseFhirPath)('Patient.name.given | Patient.name.given').eval([{
134
- resourceType: 'Patient',
135
- name: [{
136
- given: ['Alice'],
137
- family: 'Smith'
138
- }]
139
- },
140
- {
141
- resourceType: 'Patient',
142
- name: [{
143
- given: ['Bob'],
144
- family: 'Jones'
145
- }]
146
- }]);
147
- expect(result).toEqual(['Alice', 'Alice', 'Bob', 'Bob']);
148
- });
149
- test('Evaluate ignores non-objects', () => {
150
- const result = (0, parse_1.parseFhirPath)('foo.bar').eval({
151
- foo: 1
152
- });
153
- expect(result).toEqual([]);
154
- });
155
- test('Evaluate fails on function parentheses after non-symbol', () => {
156
- expect(() => (0, parse_1.parseFhirPath)('1()').eval(0)).toThrowError('Unexpected parentheses');
157
- });
158
- test('Evaluate fails on unrecognized function', () => {
159
- expect(() => (0, parse_1.parseFhirPath)('asdf()').eval(0)).toThrowError('Unrecognized function');
160
- });
161
- test('Evaluate FHIRPath where function', () => {
162
- const result = (0, parse_1.parseFhirPath)('Patient.telecom.where(system=\'email\')').eval({
163
- resourceType: 'Patient',
164
- name: [{
165
- given: ['Alice'],
166
- family: 'Smith'
167
- }],
168
- telecom: [
169
- {
170
- system: 'a',
171
- value: 'a'
172
- },
173
- {
174
- system: 'b',
175
- value: 'b'
176
- },
177
- {
178
- system: 'email',
179
- value: 'alice@example.com'
180
- },
181
- {
182
- system: 'c',
183
- value: 'c'
184
- },
185
- ]
186
- });
187
- expect(result).toMatchObject([{
188
- system: 'email',
189
- value: 'alice@example.com'
190
- }]);
191
- });
192
- test('Eval all SearchParameter expressions', () => {
193
- const searchParams = (0, definitions_1.readJson)('fhir/r4/search-parameters.json');
194
- for (const entry of searchParams.entry) {
195
- const resource = entry.resource;
196
- const { expression } = resource;
197
- if (expression) {
198
- expect(() => (0, parse_1.parseFhirPath)((expression))).not.toThrow();
199
- }
200
- }
201
- });
202
- test('Eval FHIRPath resolve function', () => {
203
- const observation = {
204
- resourceType: 'Observation',
205
- subject: {
206
- reference: 'Patient/123'
207
- }
208
- };
209
- const result = (0, parse_1.parseFhirPath)('Observation.subject.resolve()').eval(observation);
210
- expect(result).toMatchObject([{
211
- resourceType: 'Patient',
212
- id: '123'
213
- }]);
214
- });
215
- test('Resolve is resourceType', () => {
216
- const auditEvent = {
217
- resourceType: 'AuditEvent',
218
- entity: [{
219
- what: {
220
- reference: 'Patient/123'
221
- }
222
- }]
223
- };
224
- const result = (0, parse_1.parseFhirPath)('AuditEvent.entity.what.where(resolve() is Patient)').eval(auditEvent);
225
- expect(result).toEqual([{ reference: 'Patient/123' }]);
226
- });
227
- test('Resolve is not resourceType', () => {
228
- const auditEvent = {
229
- resourceType: 'AuditEvent',
230
- entity: [{
231
- what: {
232
- reference: 'Subscription/123'
233
- }
234
- }]
235
- };
236
- const result = (0, parse_1.parseFhirPath)('AuditEvent.entity.what.where(resolve() is Patient)').eval(auditEvent);
237
- expect(result).toEqual([]);
238
- });
239
- //# sourceMappingURL=parse.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parse.test.js","sourceRoot":"","sources":["../../src/fhirpath/parse.test.ts"],"names":[],"mappings":";;AAAA,sDAAgD;AAKhD,mCAAwC;AAExC,IAAI,CAAC,uEAAuE,EAAE,GAAG,EAAE;IACjF,MAAM,MAAM,GAAG,IAAA,qBAAa,EAAC,uBAAuB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC9D,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC/B,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,uDAAuD,EAAE,GAAG,EAAE;IACjE,MAAM,MAAM,GAAG,IAAA,qBAAa,EAAC,2BAA2B,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClE,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC/B,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,iEAAiE,EAAE,GAAG,EAAE;IAC3E,MAAM,MAAM,GAAG,IAAA,qBAAa,EAAC,+BAA+B,CAAC,CAAC,IAA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AC,CAAC,CAAC;AACzD,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,6BAA6B,EAAE,GAAG,EAAE;IACvC,MAAM,UAAU,GAAe;QAC7B,YAAY,EAAE,YAAY;QAC1B,MAAM,EAAE,CAAC;gBACP,IAAI,EAAE;oBACJ,SAAS,EAAE,kBAAkB;iBAC9B;aACF,CAAC;KACH,CAAC;IAEF,MAAM,MAAM,GAAG,IAAA,qBAAa,EAAC,oDAAoD,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACpG,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;AAC7B,CAAC,CAAC,CAAC","sourcesContent":["import { readJson } from '@medplum/definitions';\nimport { AuditEvent } from '..';\nimport { Bundle, BundleEntry } from '../fhir/Bundle';\nimport { Observation } from '../fhir/Observation';\nimport { SearchParameter } from '../fhir/SearchParameter';\nimport { parseFhirPath } from './parse';\n\ntest('Parser can build a arithmetic parser with correct order of operations', () => {\n const result = parseFhirPath('3 / 3 + 4 * 3 ^ 2 - 1').eval(0);\n expect(result).toEqual([36]);\n});\n\ntest('Parser can build a arithmetic parser with parentheses', () => {\n const result = parseFhirPath('3 / 3 + 4 * (3 ^ (2 - 1))').eval(0);\n expect(result).toEqual([13]);\n});\n\ntest('Parser can build a arithmetic parser with correct associativity', () => {\n const result = parseFhirPath('5 - 4 - 3 - 2 - 1 + 2 ^ 3 ^ 2').eval(0);\n expect(result).toEqual([507]);\n});\n\ntest('Parser can build an arithmetic parser with prefix operators', () => {\n const result = parseFhirPath('-4 + -(4 + 5 - -4)').eval(0);\n expect(result).toEqual([-17]);\n});\n\ntest('Parser throws on missing closing parentheses', () => {\n expect(() => parseFhirPath('(2 + 1')).toThrowError('Parse error: expected `)`');\n});\n\ntest('Parser throws on unexpected symbol', () => {\n expect(() => parseFhirPath('*')).toThrowError('Parse error at *. No matching prefix parselet.');\n});\n\ntest('Parser throws on missing tokens', () => {\n expect(() => parseFhirPath('1 * ')).toThrowError('Cant consume any more tokens.');\n});\n\ntest('Evaluate FHIRPath Patient.name.given on empty resource', () => {\n const result = parseFhirPath('Patient.name.given').eval({});\n expect(result).toEqual([]);\n});\n\ntest('Evaluate FHIRPath Patient.name.given', () => {\n const result = parseFhirPath('Patient.name.given').eval({\n resourceType: 'Patient',\n name: [{\n given: ['Alice'],\n family: 'Smith'\n }]\n });\n expect(result).toEqual(['Alice']);\n});\n\ntest('Evaluate FHIRPath string concatenation', () => {\n const result = parseFhirPath('Patient.name.given + \\' \\' + Patient.name.family').eval({\n resourceType: 'Patient',\n name: [{\n given: ['Alice'],\n family: 'Smith'\n }]\n });\n expect(result).toEqual(['Alice Smith']);\n});\n\ntest('Evaluate FHIRPath Patient.name.given on array of resources', () => {\n const result = parseFhirPath('Patient.name.given').eval([{\n resourceType: 'Patient',\n name: [{\n given: ['Alice'],\n family: 'Smith'\n }]\n },\n {\n resourceType: 'Patient',\n name: [{\n given: ['Bob'],\n family: 'Jones'\n }]\n }]);\n expect(result).toEqual(['Alice', 'Bob']);\n});\n\ntest('Evaluate FHIRPath string concatenation on array of resources', () => {\n const result = parseFhirPath('Patient.name.given + \\' \\' + Patient.name.family').eval([{\n resourceType: 'Patient',\n name: [{\n given: ['Alice'],\n family: 'Smith'\n }]\n },\n {\n resourceType: 'Patient',\n name: [{\n given: ['Bob'],\n family: 'Jones'\n }]\n }]);\n expect(result).toEqual(['Alice Smith', 'Bob Jones']);\n});\n\ntest('Evaluate FHIRPath Patient.name.given on array of resources', () => {\n const result = parseFhirPath('Patient.name.given').eval([{\n resourceType: 'Practitioner',\n name: [{\n given: ['Alice'],\n family: 'Smith'\n }]\n },\n {\n resourceType: 'Patient',\n name: [{\n given: ['Bob'],\n family: 'Jones'\n }]\n }]);\n expect(result).toEqual(['Bob']);\n});\n\ntest('Evaluate FHIRPath union', () => {\n const result = parseFhirPath('Practitioner.name.given | Patient.name.given').eval({\n resourceType: 'Patient',\n name: [{\n given: ['Alice'],\n family: 'Smith'\n }]\n });\n expect(result).toEqual(['Alice']);\n});\n\ntest('Evaluate FHIRPath union to combine results', () => {\n const result = parseFhirPath('Practitioner.name.given | Patient.name.given').eval([{\n resourceType: 'Patient',\n name: [{\n given: ['Alice'],\n family: 'Smith'\n }]\n },\n {\n resourceType: 'Practitioner',\n name: [{\n given: ['Bob'],\n family: 'Jones'\n }]\n }]);\n expect(result).toEqual(['Alice', 'Bob']);\n});\n\ntest('Evaluate FHIRPath double union', () => {\n const result = parseFhirPath('Patient.name.given | Patient.name.given').eval([{\n resourceType: 'Patient',\n name: [{\n given: ['Alice'],\n family: 'Smith'\n }]\n },\n {\n resourceType: 'Patient',\n name: [{\n given: ['Bob'],\n family: 'Jones'\n }]\n }]);\n expect(result).toEqual(['Alice', 'Alice', 'Bob', 'Bob']);\n});\n\ntest('Evaluate ignores non-objects', () => {\n const result = parseFhirPath('foo.bar').eval({\n foo: 1\n });\n expect(result).toEqual([]);\n});\n\ntest('Evaluate fails on function parentheses after non-symbol', () => {\n expect(() => parseFhirPath('1()').eval(0)).toThrowError('Unexpected parentheses');\n});\n\ntest('Evaluate fails on unrecognized function', () => {\n expect(() => parseFhirPath('asdf()').eval(0)).toThrowError('Unrecognized function');\n});\n\ntest('Evaluate FHIRPath where function', () => {\n const result = parseFhirPath('Patient.telecom.where(system=\\'email\\')').eval({\n resourceType: 'Patient',\n name: [{\n given: ['Alice'],\n family: 'Smith'\n }],\n telecom: [\n {\n system: 'a',\n value: 'a'\n },\n {\n system: 'b',\n value: 'b'\n },\n {\n system: 'email',\n value: 'alice@example.com'\n },\n {\n system: 'c',\n value: 'c'\n },\n ]\n });\n expect(result).toMatchObject([{\n system: 'email',\n value: 'alice@example.com'\n }]);\n});\n\ntest('Eval all SearchParameter expressions', () => {\n const searchParams = readJson('fhir/r4/search-parameters.json') as Bundle;\n for (const entry of searchParams.entry as BundleEntry[]) {\n const resource = entry.resource as SearchParameter;\n const { expression } = resource;\n if (expression) {\n expect(() => parseFhirPath((expression))).not.toThrow();\n }\n }\n});\n\ntest('Eval FHIRPath resolve function', () => {\n const observation: Observation = {\n resourceType: 'Observation',\n subject: {\n reference: 'Patient/123'\n }\n };\n\n const result = parseFhirPath('Observation.subject.resolve()').eval(observation);\n\n expect(result).toMatchObject([{\n resourceType: 'Patient',\n id: '123'\n }]);\n});\n\ntest('Resolve is resourceType', () => {\n const auditEvent: AuditEvent = {\n resourceType: 'AuditEvent',\n entity: [{\n what: {\n reference: 'Patient/123'\n }\n }]\n };\n\n const result = parseFhirPath('AuditEvent.entity.what.where(resolve() is Patient)').eval(auditEvent);\n expect(result).toEqual([{ reference: 'Patient/123' }]);\n});\n\ntest('Resolve is not resourceType', () => {\n const auditEvent: AuditEvent = {\n resourceType: 'AuditEvent',\n entity: [{\n what: {\n reference: 'Subscription/123'\n }\n }]\n };\n\n const result = parseFhirPath('AuditEvent.entity.what.where(resolve() is Patient)').eval(auditEvent);\n expect(result).toEqual([]);\n});\n"]}
@@ -1,13 +0,0 @@
1
- export interface TokenMatcher {
2
- id: string;
3
- pattern: RegExp;
4
- }
5
- export interface Token extends TokenMatcher {
6
- value: string;
7
- }
8
- export declare class Tokenizer {
9
- private matchAll;
10
- constructor();
11
- tokenize(str: string): Token[];
12
- }
13
- export declare const tokenizer: Tokenizer;
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tokenizer = exports.Tokenizer = void 0;
4
- const matchers = [
5
- { id: 'Comment', pattern: /\/\/.*$/ },
6
- { id: 'StringLiteral', pattern: /'[^']*'/ },
7
- { id: '(', pattern: /\(/ },
8
- { id: ')', pattern: /\)/ },
9
- { id: '*', pattern: /\*/ },
10
- { id: '/', pattern: /\// },
11
- { id: '+', pattern: /\+/ },
12
- { id: '-', pattern: /-/ },
13
- { id: '^', pattern: /\^/ },
14
- { id: '!', pattern: /!/ },
15
- { id: '.', pattern: /\./ },
16
- { id: '|', pattern: /\|/ },
17
- { id: '=', pattern: /=/ },
18
- { id: 'Number', pattern: /\d+/ },
19
- { id: 'Symbol', pattern: /\w+/ },
20
- ];
21
- class Tokenizer {
22
- matchAll;
23
- constructor() {
24
- this.matchAll = new RegExp(matchers.map(matcher => matcher.pattern.source).join('|'), 'g');
25
- }
26
- tokenize(str) {
27
- // Double-execing the RegExp is actually not that slow. Faster than my attempted alternative implementation.
28
- // https://jsperf.com/tokenization-strategies-jkearl-pratt/1
29
- const tokens = str.match(this.matchAll);
30
- if (!tokens) {
31
- throw new Error('Could not tokenize');
32
- }
33
- return tokens.map(value => {
34
- return {
35
- ...matchers.find(matcher => matcher.pattern.test(value)),
36
- value
37
- };
38
- });
39
- }
40
- }
41
- exports.Tokenizer = Tokenizer;
42
- exports.tokenizer = new Tokenizer();
43
- //# sourceMappingURL=tokenize.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tokenize.js","sourceRoot":"","sources":["../../src/fhirpath/tokenize.ts"],"names":[],"mappings":";;;AAUA,MAAM,QAAQ,GAAmB;IAC/B,EAAE,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE;IACrC,EAAE,EAAE,EAAE,eAAe,EAAE,OAAO,EAAE,SAAS,EAAE;IAC3C,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE;IAC1B,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE;IAC1B,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE;IAC1B,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE;IAC1B,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE;IAC1B,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE;IACzB,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE;IAC1B,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE;IACzB,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE;IAC1B,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE;IAC1B,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE;IACzB,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE;IAChC,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE;CACjC,CAAC;AAEF,MAAa,SAAS;IACZ,QAAQ,CAAQ;IAExB;QACE,IAAI,CAAC,QAAQ,GAAG,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IAC7F,CAAC;IAEM,QAAQ,CAAC,GAAW;QACzB,4GAA4G;QAC5G,4DAA4D;QAE5D,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;SACvC;QAED,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;YACxB,OAAO;gBACL,GAAI,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAkB;gBAC1E,KAAK;aACN,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAvBD,8BAuBC;AAEY,QAAA,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC","sourcesContent":["\nexport interface TokenMatcher {\n id: string;\n pattern: RegExp;\n}\n\nexport interface Token extends TokenMatcher {\n value: string\n}\n\nconst matchers: TokenMatcher[] = [\n { id: 'Comment', pattern: /\\/\\/.*$/ },\n { id: 'StringLiteral', pattern: /'[^']*'/ },\n { id: '(', pattern: /\\(/ },\n { id: ')', pattern: /\\)/ },\n { id: '*', pattern: /\\*/ },\n { id: '/', pattern: /\\// },\n { id: '+', pattern: /\\+/ },\n { id: '-', pattern: /-/ },\n { id: '^', pattern: /\\^/ },\n { id: '!', pattern: /!/ },\n { id: '.', pattern: /\\./ },\n { id: '|', pattern: /\\|/ },\n { id: '=', pattern: /=/ },\n { id: 'Number', pattern: /\\d+/ },\n { id: 'Symbol', pattern: /\\w+/ },\n];\n\nexport class Tokenizer {\n private matchAll: RegExp\n\n public constructor() {\n this.matchAll = new RegExp(matchers.map(matcher => matcher.pattern.source).join('|'), 'g');\n }\n\n public tokenize(str: string): Token[] {\n // Double-execing the RegExp is actually not that slow. Faster than my attempted alternative implementation.\n // https://jsperf.com/tokenization-strategies-jkearl-pratt/1\n\n const tokens = str.match(this.matchAll);\n if (!tokens) {\n throw new Error('Could not tokenize');\n }\n\n return tokens.map(value => {\n return {\n ...(matchers.find(matcher => matcher.pattern.test(value)) as TokenMatcher),\n value\n };\n });\n }\n}\n\nexport const tokenizer = new Tokenizer();\n"]}
@@ -1 +0,0 @@
1
- export {};
@@ -1,69 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tokenize_1 = require("./tokenize");
4
- test('Tokenizer can tokenize with simple string matching', () => {
5
- const matches = tokenize_1.tokenizer.tokenize(' ( + ) / ( * ');
6
- expect(matches).toMatchObject([
7
- { id: '(', value: '(' },
8
- { id: '+', value: '+' },
9
- { id: ')', value: ')' },
10
- { id: '/', value: '/' },
11
- { id: '(', value: '(' },
12
- { id: '*', value: '*' }
13
- ]);
14
- });
15
- test('Tokenizer can tokenize with regular expression matching', () => {
16
- const matches = tokenize_1.tokenizer.tokenize('bc + dsf - // the comment + - dasdas');
17
- expect(matches).toMatchObject([
18
- { id: 'Symbol', value: 'bc' },
19
- { id: '+', value: '+' },
20
- { id: 'Symbol', value: 'dsf' },
21
- { id: '-', value: '-' },
22
- { id: 'Comment', value: '// the comment + - dasdas' }
23
- ]);
24
- });
25
- test('Tokenize throws on empty string', () => {
26
- expect(() => tokenize_1.tokenizer.tokenize('')).toThrowError('Could not tokenize');
27
- });
28
- test('Tokenizer can tokenize FHIR Path', () => {
29
- const matches = tokenize_1.tokenizer.tokenize('Patient.name.given');
30
- expect(matches).toMatchObject([
31
- { id: 'Symbol', value: 'Patient' },
32
- { id: '.', value: '.' },
33
- { id: 'Symbol', value: 'name' },
34
- { id: '.', value: '.' },
35
- { id: 'Symbol', value: 'given' }
36
- ]);
37
- });
38
- test('Tokenizer can tokenize FHIR Path union', () => {
39
- const matches = tokenize_1.tokenizer.tokenize('Practitioner.name.given | Patient.name.given');
40
- expect(matches).toMatchObject([
41
- { id: 'Symbol', value: 'Practitioner' },
42
- { id: '.', value: '.' },
43
- { id: 'Symbol', value: 'name' },
44
- { id: '.', value: '.' },
45
- { id: 'Symbol', value: 'given' },
46
- { id: '|', value: '|' },
47
- { id: 'Symbol', value: 'Patient' },
48
- { id: '.', value: '.' },
49
- { id: 'Symbol', value: 'name' },
50
- { id: '.', value: '.' },
51
- { id: 'Symbol', value: 'given' }
52
- ]);
53
- });
54
- test('Tokenizer can tokenize FHIR Path function', () => {
55
- const matches = tokenize_1.tokenizer.tokenize('Patient.telecom.where(system=\'email\')');
56
- expect(matches).toMatchObject([
57
- { id: 'Symbol', value: 'Patient' },
58
- { id: '.', value: '.' },
59
- { id: 'Symbol', value: 'telecom' },
60
- { id: '.', value: '.' },
61
- { id: 'Symbol', value: 'where' },
62
- { id: '(', value: '(' },
63
- { id: 'Symbol', value: 'system' },
64
- { id: '=', value: '=' },
65
- { id: 'StringLiteral', value: '\'email\'' },
66
- { id: ')', value: ')' }
67
- ]);
68
- });
69
- //# sourceMappingURL=tokenize.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tokenize.test.js","sourceRoot":"","sources":["../../src/fhirpath/tokenize.test.ts"],"names":[],"mappings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AAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE;QAC/B,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE;QACvB,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE;KACjC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,2CAA2C,EAAE,GAAG,EAAE;IACrD,MAAM,OAAO,GAAG,oBAAS,CAAC,QAAQ,CAAC,yCAAyC,CAAC,CAAC;IAC9E,MAAM,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC;QAC5B,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE;QAClC,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE;QACvB,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE;QAClC,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE;QACvB,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE;QAChC,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE;QACvB,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;QACjC,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE;QACvB,EAAE,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,WAAW,EAAE;QAC3C,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE;KACxB,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { tokenizer } from './tokenize';\n\ntest('Tokenizer can tokenize with simple string matching', () => {\n const matches = tokenizer.tokenize(' ( + ) / ( * ');\n expect(matches).toMatchObject([\n { id: '(', value: '(' },\n { id: '+', value: '+' },\n { id: ')', value: ')' },\n { id: '/', value: '/' },\n { id: '(', value: '(' },\n { id: '*', value: '*' }\n ]);\n});\n\ntest('Tokenizer can tokenize with regular expression matching', () => {\n const matches = tokenizer.tokenize('bc + dsf - // the comment + - dasdas');\n expect(matches).toMatchObject([\n { id: 'Symbol', value: 'bc' },\n { id: '+', value: '+' },\n { id: 'Symbol', value: 'dsf' },\n { id: '-', value: '-' },\n { id: 'Comment', value: '// the comment + - dasdas' }\n ]);\n});\n\ntest('Tokenize throws on empty string', () => {\n expect(() => tokenizer.tokenize('')).toThrowError('Could not tokenize');\n});\n\ntest('Tokenizer can tokenize FHIR Path', () => {\n const matches = tokenizer.tokenize('Patient.name.given');\n expect(matches).toMatchObject([\n { id: 'Symbol', value: 'Patient' },\n { id: '.', value: '.' },\n { id: 'Symbol', value: 'name' },\n { id: '.', value: '.' },\n { id: 'Symbol', value: 'given' }\n ]);\n});\n\ntest('Tokenizer can tokenize FHIR Path union', () => {\n const matches = tokenizer.tokenize('Practitioner.name.given | Patient.name.given');\n expect(matches).toMatchObject([\n { id: 'Symbol', value: 'Practitioner' },\n { id: '.', value: '.' },\n { id: 'Symbol', value: 'name' },\n { id: '.', value: '.' },\n { id: 'Symbol', value: 'given' },\n { id: '|', value: '|' },\n { id: 'Symbol', value: 'Patient' },\n { id: '.', value: '.' },\n { id: 'Symbol', value: 'name' },\n { id: '.', value: '.' },\n { id: 'Symbol', value: 'given' }\n ]);\n});\n\ntest('Tokenizer can tokenize FHIR Path function', () => {\n const matches = tokenizer.tokenize('Patient.telecom.where(system=\\'email\\')');\n expect(matches).toMatchObject([\n { id: 'Symbol', value: 'Patient' },\n { id: '.', value: '.' },\n { id: 'Symbol', value: 'telecom' },\n { id: '.', value: '.' },\n { id: 'Symbol', value: 'where' },\n { id: '(', value: '(' },\n { id: 'Symbol', value: 'system' },\n { id: '=', value: '=' },\n { id: 'StringLiteral', value: '\\'email\\'' },\n { id: ')', value: ')' }\n ]);\n});\n"]}
@@ -1,13 +0,0 @@
1
- /**
2
- * Applies a function to single value or an array of values.
3
- * @param context The context which will be passed to the function.
4
- * @param fn The function to apply.
5
- * @returns The result of the function.
6
- */
7
- export declare function applyMaybeArray(context: any, fn: (context: any) => any): any;
8
- /**
9
- * Converts any object into a boolean.
10
- * @param obj Any value or array of values.
11
- * @returns The converted boolean value according to FHIRPath rules.
12
- */
13
- export declare function toBoolean(obj: any): boolean;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toBoolean = exports.applyMaybeArray = void 0;
4
- /**
5
- * Applies a function to single value or an array of values.
6
- * @param context The context which will be passed to the function.
7
- * @param fn The function to apply.
8
- * @returns The result of the function.
9
- */
10
- function applyMaybeArray(context, fn) {
11
- if (context === undefined) {
12
- return undefined;
13
- }
14
- if (Array.isArray(context)) {
15
- return context.map(e => fn(e)).filter(e => !!e).flat();
16
- }
17
- else {
18
- return fn(context);
19
- }
20
- }
21
- exports.applyMaybeArray = applyMaybeArray;
22
- /**
23
- * Converts any object into a boolean.
24
- * @param obj Any value or array of values.
25
- * @returns The converted boolean value according to FHIRPath rules.
26
- */
27
- function toBoolean(obj) {
28
- if (Array.isArray(obj) && obj.length === 0) {
29
- return false;
30
- }
31
- return !!obj;
32
- }
33
- exports.toBoolean = toBoolean;
34
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/fhirpath/utils.ts"],"names":[],"mappings":";;;AACA;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,OAAY,EAAE,EAAyB;IACrE,IAAI,OAAO,KAAK,SAAS,EAAE;QACzB,OAAO,SAAS,CAAC;KAClB;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC1B,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;KACxD;SAAM;QACL,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC;KACpB;AACH,CAAC;AATD,0CASC;AAED;;;;GAIG;AACH,SAAgB,SAAS,CAAC,GAAQ;IAChC,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE;QAC1C,OAAO,KAAK,CAAC;KACd;IACD,OAAO,CAAC,CAAC,GAAG,CAAC;AACf,CAAC;AALD,8BAKC","sourcesContent":["\n/**\n * Applies a function to single value or an array of values.\n * @param context The context which will be passed to the function.\n * @param fn The function to apply.\n * @returns The result of the function.\n */\nexport function applyMaybeArray(context: any, fn: (context: any) => any): any {\n if (context === undefined) {\n return undefined;\n }\n if (Array.isArray(context)) {\n return context.map(e => fn(e)).filter(e => !!e).flat();\n } else {\n return fn(context);\n }\n}\n\n/**\n * Converts any object into a boolean.\n * @param obj Any value or array of values.\n * @returns The converted boolean value according to FHIRPath rules.\n */\nexport function toBoolean(obj: any): boolean {\n if (Array.isArray(obj) && obj.length === 0) {\n return false;\n }\n return !!obj;\n}\n"]}
@@ -1 +0,0 @@
1
- export {};
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const utils_1 = require("./utils");
4
- describe('FHIRPath utils', () => {
5
- test('applyMaybeArray', () => {
6
- expect((0, utils_1.applyMaybeArray)(undefined, e => e)).toBeUndefined();
7
- expect((0, utils_1.applyMaybeArray)(123, e => e)).toEqual(123);
8
- expect((0, utils_1.applyMaybeArray)([1, 2, 3], e => e)).toEqual([1, 2, 3]);
9
- expect((0, utils_1.applyMaybeArray)([1, undefined, 3], e => e)).toEqual([1, 3]);
10
- });
11
- test('toBoolean', () => {
12
- expect((0, utils_1.toBoolean)(undefined)).toEqual(false);
13
- expect((0, utils_1.toBoolean)(null)).toEqual(false);
14
- expect((0, utils_1.toBoolean)(false)).toEqual(false);
15
- expect((0, utils_1.toBoolean)(true)).toEqual(true);
16
- expect((0, utils_1.toBoolean)('')).toEqual(false);
17
- expect((0, utils_1.toBoolean)('hi')).toEqual(true);
18
- expect((0, utils_1.toBoolean)([])).toEqual(false);
19
- expect((0, utils_1.toBoolean)(['hi'])).toEqual(true);
20
- });
21
- });
22
- //# sourceMappingURL=utils.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.test.js","sourceRoot":"","sources":["../../src/fhirpath/utils.test.ts"],"names":[],"mappings":";;AAAA,mCAAqD;AAErD,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAE9B,IAAI,CAAC,iBAAiB,EAAE,GAAG,EAAE;QAC3B,MAAM,CAAC,IAAA,uBAAe,EAAC,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;QAC3D,MAAM,CAAC,IAAA,uBAAe,EAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAClD,MAAM,CAAC,IAAA,uBAAe,EAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC9D,MAAM,CAAC,IAAA,uBAAe,EAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,WAAW,EAAE,GAAG,EAAE;QACrB,MAAM,CAAC,IAAA,iBAAS,EAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC5C,MAAM,CAAC,IAAA,iBAAS,EAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACvC,MAAM,CAAC,IAAA,iBAAS,EAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACxC,MAAM,CAAC,IAAA,iBAAS,EAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACtC,MAAM,CAAC,IAAA,iBAAS,EAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACrC,MAAM,CAAC,IAAA,iBAAS,EAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACtC,MAAM,CAAC,IAAA,iBAAS,EAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACrC,MAAM,CAAC,IAAA,iBAAS,EAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { applyMaybeArray, toBoolean } from './utils';\n\ndescribe('FHIRPath utils', () => {\n\n test('applyMaybeArray', () => {\n expect(applyMaybeArray(undefined, e => e)).toBeUndefined();\n expect(applyMaybeArray(123, e => e)).toEqual(123);\n expect(applyMaybeArray([1, 2, 3], e => e)).toEqual([1, 2, 3]);\n expect(applyMaybeArray([1, undefined, 3], e => e)).toEqual([1, 3]);\n });\n\n test('toBoolean', () => {\n expect(toBoolean(undefined)).toEqual(false);\n expect(toBoolean(null)).toEqual(false);\n expect(toBoolean(false)).toEqual(false);\n expect(toBoolean(true)).toEqual(true);\n expect(toBoolean('')).toEqual(false);\n expect(toBoolean('hi')).toEqual(true);\n expect(toBoolean([])).toEqual(false);\n expect(toBoolean(['hi'])).toEqual(true);\n });\n});\n"]}
package/dist/format.js DELETED
@@ -1,56 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatFamilyName = exports.formatGivenName = exports.formatHumanName = exports.formatAddress = void 0;
4
- function formatAddress(address, options) {
5
- const builder = [];
6
- if (address.line) {
7
- builder.push(...address.line);
8
- }
9
- if (address.city) {
10
- builder.push(address.city);
11
- }
12
- if (address.state) {
13
- builder.push(address.state);
14
- }
15
- if (address.postalCode) {
16
- builder.push(address.postalCode);
17
- }
18
- if (address.use && (options?.all || options?.use)) {
19
- builder.push('[' + address.use + ']');
20
- }
21
- return builder.join(', ').trim();
22
- }
23
- exports.formatAddress = formatAddress;
24
- function formatHumanName(name, options) {
25
- const builder = [];
26
- if (name.prefix && (options?.all || options?.prefix)) {
27
- builder.push(...name.prefix);
28
- }
29
- if (name.given) {
30
- builder.push(...name.given);
31
- }
32
- if (name.family) {
33
- builder.push(name.family);
34
- }
35
- if (name.suffix && (options?.all || options?.suffix)) {
36
- builder.push(...name.suffix);
37
- }
38
- if (name.use && (options?.all || options?.use)) {
39
- builder.push('[' + name.use + ']');
40
- }
41
- return builder.join(' ').trim();
42
- }
43
- exports.formatHumanName = formatHumanName;
44
- function formatGivenName(name) {
45
- const builder = [];
46
- if (name.given) {
47
- builder.push(...name.given);
48
- }
49
- return builder.join(' ').trim();
50
- }
51
- exports.formatGivenName = formatGivenName;
52
- function formatFamilyName(name) {
53
- return name.family || '';
54
- }
55
- exports.formatFamilyName = formatFamilyName;
56
- //# sourceMappingURL=format.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"format.js","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":";;;AAcA,SAAgB,aAAa,CAAC,OAAgB,EAAE,OAA8B;IAC5E,MAAM,OAAO,GAAG,EAAE,CAAC;IAEnB,IAAI,OAAO,CAAC,IAAI,EAAE;QAChB,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;KAC/B;IAED,IAAI,OAAO,CAAC,IAAI,EAAE;QAChB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CA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C,OAAO,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;KACpC;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAClC,CAAC;AAxBD,0CAwBC;AAED,SAAgB,eAAe,CAAC,IAAe;IAC7C,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,IAAI,IAAI,CAAC,KAAK,EAAE;QACd,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;KAC7B;IACD,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAClC,CAAC;AAND,0CAMC;AAED,SAAgB,gBAAgB,CAAC,IAAe;IAC9C,OAAO,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;AAC3B,CAAC;AAFD,4CAEC","sourcesContent":["import { Address, HumanName } from './fhir';\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"]}
@@ -1 +0,0 @@
1
- export {};