@smile-cdr/fhirts 2.3.0 → 2.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 (306) hide show
  1. package/.claude/settings.local.json +12 -0
  2. package/.github/workflows/npm-publish.yml +12 -6
  3. package/.github/workflows/pr-build.yml +7 -3
  4. package/.prettierignore +22 -0
  5. package/.prettierrc +10 -0
  6. package/GETTINGSTARTED.md +57 -15
  7. package/dist/FHIR-DSTU2.js +1 -1
  8. package/dist/FHIR-R3.js +3 -1
  9. package/dist/FHIR-R4/classes/account.js +1 -1
  10. package/dist/FHIR-R4/classes/activityDefinition.js +1 -1
  11. package/dist/FHIR-R4/classes/address.js +1 -1
  12. package/dist/FHIR-R4/classes/adverseEvent.js +1 -1
  13. package/dist/FHIR-R4/classes/age.js +1 -1
  14. package/dist/FHIR-R4/classes/allergyIntolerance.js +1 -1
  15. package/dist/FHIR-R4/classes/allergyIntoleranceReaction.js +1 -1
  16. package/dist/FHIR-R4/classes/appointment.js +1 -1
  17. package/dist/FHIR-R4/classes/appointmentParticipant.js +1 -1
  18. package/dist/FHIR-R4/classes/auditEvent.js +1 -1
  19. package/dist/FHIR-R4/classes/auditEventNetwork.js +1 -1
  20. package/dist/FHIR-R4/classes/biologicallyDerivedProduct.js +1 -1
  21. package/dist/FHIR-R4/classes/biologicallyDerivedProductStorage.js +1 -1
  22. package/dist/FHIR-R4/classes/bundle.js +1 -1
  23. package/dist/FHIR-R4/classes/capabilityStatement.js +1 -1
  24. package/dist/FHIR-R4/classes/capabilityStatementDocument.js +1 -1
  25. package/dist/FHIR-R4/classes/capabilityStatementInteraction.js +1 -1
  26. package/dist/FHIR-R4/classes/capabilityStatementInteraction1.js +1 -1
  27. package/dist/FHIR-R4/classes/capabilityStatementResource.js +1 -1
  28. package/dist/FHIR-R4/classes/capabilityStatementRest.js +1 -1
  29. package/dist/FHIR-R4/classes/capabilityStatementSearchParam.js +1 -1
  30. package/dist/FHIR-R4/classes/capabilityStatementSupportedMessage.js +1 -1
  31. package/dist/FHIR-R4/classes/carePlanDetail.js +1 -1
  32. package/dist/FHIR-R4/classes/careTeam.js +1 -1
  33. package/dist/FHIR-R4/classes/catalogEntry.js +1 -1
  34. package/dist/FHIR-R4/classes/catalogEntryRelatedEntry.js +1 -1
  35. package/dist/FHIR-R4/classes/chargeItem.js +1 -1
  36. package/dist/FHIR-R4/classes/chargeItemDefinition.js +1 -1
  37. package/dist/FHIR-R4/classes/claim.js +1 -1
  38. package/dist/FHIR-R4/classes/claimResponseProcessNote.js +1 -1
  39. package/dist/FHIR-R4/classes/codeSystem.js +1 -1
  40. package/dist/FHIR-R4/classes/codeSystemProperty.js +1 -1
  41. package/dist/FHIR-R4/classes/compartmentDefinition.js +1 -1
  42. package/dist/FHIR-R4/classes/composition.js +1 -1
  43. package/dist/FHIR-R4/classes/compositionAttester.js +1 -1
  44. package/dist/FHIR-R4/classes/conceptMap.js +1 -1
  45. package/dist/FHIR-R4/classes/conceptMapTarget.js +1 -1
  46. package/dist/FHIR-R4/classes/conceptMapUnmapped.js +1 -1
  47. package/dist/FHIR-R4/classes/consent.js +1 -1
  48. package/dist/FHIR-R4/classes/consentData.js +1 -1
  49. package/dist/FHIR-R4/classes/consentProvision.js +1 -1
  50. package/dist/FHIR-R4/classes/contactPoint.js +1 -1
  51. package/dist/FHIR-R4/classes/contributor.js +1 -1
  52. package/dist/FHIR-R4/classes/count.js +1 -1
  53. package/dist/FHIR-R4/classes/coverageEligibilityResponse.js +1 -1
  54. package/dist/FHIR-R4/classes/dataRequirementSort.js +1 -1
  55. package/dist/FHIR-R4/classes/detectedIssue.js +1 -1
  56. package/dist/FHIR-R4/classes/device.js +1 -1
  57. package/dist/FHIR-R4/classes/deviceDefinitionDeviceName.js +1 -1
  58. package/dist/FHIR-R4/classes/deviceDeviceName.js +1 -1
  59. package/dist/FHIR-R4/classes/deviceMetric.js +1 -1
  60. package/dist/FHIR-R4/classes/deviceMetricCalibration.js +1 -1
  61. package/dist/FHIR-R4/classes/deviceUdiCarrier.js +1 -1
  62. package/dist/FHIR-R4/classes/deviceUseStatement.js +1 -1
  63. package/dist/FHIR-R4/classes/diagnosticReport.js +1 -1
  64. package/dist/FHIR-R4/classes/distance.js +1 -1
  65. package/dist/FHIR-R4/classes/documentManifest.js +1 -1
  66. package/dist/FHIR-R4/classes/documentReference.js +1 -1
  67. package/dist/FHIR-R4/classes/documentReferenceRelatesTo.js +1 -1
  68. package/dist/FHIR-R4/classes/duration.js +1 -1
  69. package/dist/FHIR-R4/classes/effectEvidenceSynthesis.js +1 -1
  70. package/dist/FHIR-R4/classes/effectEvidenceSynthesisResultsByExposure.js +1 -1
  71. package/dist/FHIR-R4/classes/elementDefinitionBinding.js +1 -1
  72. package/dist/FHIR-R4/classes/elementDefinitionConstraint.js +1 -1
  73. package/dist/FHIR-R4/classes/elementDefinitionDiscriminator.js +1 -1
  74. package/dist/FHIR-R4/classes/elementDefinitionSlicing.js +1 -1
  75. package/dist/FHIR-R4/classes/elementDefinitionType.js +1 -1
  76. package/dist/FHIR-R4/classes/encounter.js +1 -1
  77. package/dist/FHIR-R4/classes/encounterLocation.js +1 -1
  78. package/dist/FHIR-R4/classes/encounterStatusHistory.js +1 -1
  79. package/dist/FHIR-R4/classes/endpoint.js +1 -1
  80. package/dist/FHIR-R4/classes/enrollmentResponse.js +1 -1
  81. package/dist/FHIR-R4/classes/episodeOfCare.js +1 -1
  82. package/dist/FHIR-R4/classes/episodeOfCareStatusHistory.js +1 -1
  83. package/dist/FHIR-R4/classes/eventDefinition.js +1 -1
  84. package/dist/FHIR-R4/classes/evidence.js +1 -1
  85. package/dist/FHIR-R4/classes/evidenceVariable.js +1 -1
  86. package/dist/FHIR-R4/classes/evidenceVariableCharacteristic.js +1 -1
  87. package/dist/FHIR-R4/classes/exampleScenario.js +1 -1
  88. package/dist/FHIR-R4/classes/exampleScenarioActor.js +1 -1
  89. package/dist/FHIR-R4/classes/explanationOfBenefit.js +1 -1
  90. package/dist/FHIR-R4/classes/explanationOfBenefitProcessNote.js +1 -1
  91. package/dist/FHIR-R4/classes/expression.js +1 -1
  92. package/dist/FHIR-R4/classes/familyMemberHistory.js +1 -1
  93. package/dist/FHIR-R4/classes/flag.js +1 -1
  94. package/dist/FHIR-R4/classes/goal.js +1 -1
  95. package/dist/FHIR-R4/classes/graphDefinition.js +1 -1
  96. package/dist/FHIR-R4/classes/graphDefinitionCompartment.js +1 -1
  97. package/dist/FHIR-R4/classes/group.js +1 -1
  98. package/dist/FHIR-R4/classes/guidanceResponse.js +1 -1
  99. package/dist/FHIR-R4/classes/humanName.js +1 -1
  100. package/dist/FHIR-R4/classes/identifier.js +1 -1
  101. package/dist/FHIR-R4/classes/imagingStudy.js +1 -1
  102. package/dist/FHIR-R4/classes/implementationGuide.js +1 -1
  103. package/dist/FHIR-R4/classes/implementationGuidePage.js +1 -1
  104. package/dist/FHIR-R4/classes/implementationGuideParameter.js +1 -1
  105. package/dist/FHIR-R4/classes/insurancePlan.js +1 -1
  106. package/dist/FHIR-R4/classes/invoice.js +1 -1
  107. package/dist/FHIR-R4/classes/invoicePriceComponent.js +1 -1
  108. package/dist/FHIR-R4/classes/library.js +1 -1
  109. package/dist/FHIR-R4/classes/linkageItem.js +1 -1
  110. package/dist/FHIR-R4/classes/list.js +1 -1
  111. package/dist/FHIR-R4/classes/location.js +1 -1
  112. package/dist/FHIR-R4/classes/measure.js +1 -1
  113. package/dist/FHIR-R4/classes/measureReport.js +1 -1
  114. package/dist/FHIR-R4/classes/messageDefinition.js +1 -1
  115. package/dist/FHIR-R4/classes/messageHeaderResponse.js +1 -1
  116. package/dist/FHIR-R4/classes/molecularSequence.js +1 -1
  117. package/dist/FHIR-R4/classes/molecularSequenceQuality.js +1 -1
  118. package/dist/FHIR-R4/classes/molecularSequenceReferenceSeq.js +1 -1
  119. package/dist/FHIR-R4/classes/molecularSequenceRepository.js +1 -1
  120. package/dist/FHIR-R4/classes/namingSystem.js +1 -1
  121. package/dist/FHIR-R4/classes/namingSystemUniqueId.js +1 -1
  122. package/dist/FHIR-R4/classes/narrative.js +1 -1
  123. package/dist/FHIR-R4/classes/observation.js +1 -1
  124. package/dist/FHIR-R4/classes/observationDefinitionQualifiedInterval.js +1 -1
  125. package/dist/FHIR-R4/classes/operationDefinition.js +1 -1
  126. package/dist/FHIR-R4/classes/operationDefinitionBinding.js +1 -1
  127. package/dist/FHIR-R4/classes/operationDefinitionParameter.js +1 -1
  128. package/dist/FHIR-R4/classes/patient.js +1 -1
  129. package/dist/FHIR-R4/classes/patientContact.js +1 -1
  130. package/dist/FHIR-R4/classes/patientLink.js +1 -1
  131. package/dist/FHIR-R4/classes/paymentReconciliation.js +1 -1
  132. package/dist/FHIR-R4/classes/paymentReconciliationProcessNote.js +1 -1
  133. package/dist/FHIR-R4/classes/person.js +1 -1
  134. package/dist/FHIR-R4/classes/personLink.js +1 -1
  135. package/dist/FHIR-R4/classes/planDefinition.js +1 -1
  136. package/dist/FHIR-R4/classes/planDefinitionAction.js +1 -1
  137. package/dist/FHIR-R4/classes/planDefinitionCondition.js +1 -1
  138. package/dist/FHIR-R4/classes/planDefinitionParticipant.js +1 -1
  139. package/dist/FHIR-R4/classes/planDefinitionRelatedAction.js +1 -1
  140. package/dist/FHIR-R4/classes/practitioner.js +1 -1
  141. package/dist/FHIR-R4/classes/provenanceEntity.js +1 -1
  142. package/dist/FHIR-R4/classes/quantity.js +1 -1
  143. package/dist/FHIR-R4/classes/questionnaire.js +1 -1
  144. package/dist/FHIR-R4/classes/questionnaireEnableWhen.js +1 -1
  145. package/dist/FHIR-R4/classes/questionnaireItem.js +1 -1
  146. package/dist/FHIR-R4/classes/questionnaireResponse.js +1 -1
  147. package/dist/FHIR-R4/classes/relatedArtifact.js +1 -1
  148. package/dist/FHIR-R4/classes/relatedPerson.js +1 -1
  149. package/dist/FHIR-R4/classes/researchDefinition.js +1 -1
  150. package/dist/FHIR-R4/classes/researchElementDefinition.js +1 -1
  151. package/dist/FHIR-R4/classes/researchElementDefinitionCharacteristic.js +1 -1
  152. package/dist/FHIR-R4/classes/researchStudy.js +1 -1
  153. package/dist/FHIR-R4/classes/researchSubject.js +1 -1
  154. package/dist/FHIR-R4/classes/riskEvidenceSynthesis.js +1 -1
  155. package/dist/FHIR-R4/classes/searchParameter.js +1 -1
  156. package/dist/FHIR-R4/classes/slot.js +1 -1
  157. package/dist/FHIR-R4/classes/specimen.js +1 -1
  158. package/dist/FHIR-R4/classes/specimenDefinitionTypeTested.js +1 -1
  159. package/dist/FHIR-R4/classes/structureDefinition.js +1 -1
  160. package/dist/FHIR-R4/classes/structureDefinitionContext.js +1 -1
  161. package/dist/FHIR-R4/classes/structureMap.js +1 -1
  162. package/dist/FHIR-R4/classes/structureMapGroup.js +1 -1
  163. package/dist/FHIR-R4/classes/structureMapInput.js +1 -1
  164. package/dist/FHIR-R4/classes/structureMapSource.js +1 -1
  165. package/dist/FHIR-R4/classes/structureMapStructure.js +1 -1
  166. package/dist/FHIR-R4/classes/structureMapTarget.js +1 -1
  167. package/dist/FHIR-R4/classes/subscription.js +1 -1
  168. package/dist/FHIR-R4/classes/subscriptionChannel.js +1 -1
  169. package/dist/FHIR-R4/classes/substance.js +1 -1
  170. package/dist/FHIR-R4/classes/supplyDelivery.js +1 -1
  171. package/dist/FHIR-R4/classes/supplyRequest.js +1 -1
  172. package/dist/FHIR-R4/classes/task.js +1 -1
  173. package/dist/FHIR-R4/classes/terminologyCapabilities.js +1 -1
  174. package/dist/FHIR-R4/classes/testReport.js +1 -1
  175. package/dist/FHIR-R4/classes/testReportAssert.js +1 -1
  176. package/dist/FHIR-R4/classes/testReportOperation.js +1 -1
  177. package/dist/FHIR-R4/classes/testReportParticipant.js +1 -1
  178. package/dist/FHIR-R4/classes/testScript.js +1 -1
  179. package/dist/FHIR-R4/classes/testScriptAssert.js +1 -1
  180. package/dist/FHIR-R4/classes/testScriptOperation.js +1 -1
  181. package/dist/FHIR-R4/classes/timingRepeat.js +1 -1
  182. package/dist/FHIR-R4/classes/triggerDefinition.js +1 -1
  183. package/dist/FHIR-R4/classes/valueSet.js +1 -1
  184. package/dist/FHIR-R4/classes/valueSetFilter.js +1 -1
  185. package/dist/FHIR-R4/classes/visionPrescriptionLensSpecification.js +1 -1
  186. package/dist/FHIR-R4/classes/visionPrescriptionPrism.js +1 -1
  187. package/dist/FHIR-R4/interfaces/IAccount.js +1 -1
  188. package/dist/FHIR-R4/interfaces/IActivityDefinition.js +1 -1
  189. package/dist/FHIR-R4/interfaces/IAdverseEvent.js +1 -1
  190. package/dist/FHIR-R4/interfaces/IAllergyIntolerance.js +1 -1
  191. package/dist/FHIR-R4/interfaces/IAppointment.js +1 -1
  192. package/dist/FHIR-R4/interfaces/IAuditEvent.js +1 -1
  193. package/dist/FHIR-R4/interfaces/IBiologicallyDerivedProduct.js +1 -1
  194. package/dist/FHIR-R4/interfaces/IBundle.js +1 -1
  195. package/dist/FHIR-R4/interfaces/ICapabilityStatement.js +1 -1
  196. package/dist/FHIR-R4/interfaces/ICareTeam.js +1 -1
  197. package/dist/FHIR-R4/interfaces/ICatalogEntry.js +1 -1
  198. package/dist/FHIR-R4/interfaces/IChargeItem.js +1 -1
  199. package/dist/FHIR-R4/interfaces/IChargeItemDefinition.js +1 -1
  200. package/dist/FHIR-R4/interfaces/IClaim.js +1 -1
  201. package/dist/FHIR-R4/interfaces/ICodeSystem.js +1 -1
  202. package/dist/FHIR-R4/interfaces/ICompartmentDefinition.js +1 -1
  203. package/dist/FHIR-R4/interfaces/IComposition.js +1 -1
  204. package/dist/FHIR-R4/interfaces/IConceptMap.js +1 -1
  205. package/dist/FHIR-R4/interfaces/IConsent.js +1 -1
  206. package/dist/FHIR-R4/interfaces/ICoverageEligibilityResponse.js +1 -1
  207. package/dist/FHIR-R4/interfaces/IDetectedIssue.js +1 -1
  208. package/dist/FHIR-R4/interfaces/IDevice.js +1 -1
  209. package/dist/FHIR-R4/interfaces/IDeviceMetric.js +1 -1
  210. package/dist/FHIR-R4/interfaces/IDeviceUseStatement.js +1 -1
  211. package/dist/FHIR-R4/interfaces/IDiagnosticReport.js +1 -1
  212. package/dist/FHIR-R4/interfaces/IDocumentManifest.js +1 -1
  213. package/dist/FHIR-R4/interfaces/IDocumentReference.js +1 -1
  214. package/dist/FHIR-R4/interfaces/IEffectEvidenceSynthesis.js +1 -1
  215. package/dist/FHIR-R4/interfaces/IEncounter.js +1 -1
  216. package/dist/FHIR-R4/interfaces/IEndpoint.js +1 -1
  217. package/dist/FHIR-R4/interfaces/IEnrollmentResponse.js +1 -1
  218. package/dist/FHIR-R4/interfaces/IEpisodeOfCare.js +1 -1
  219. package/dist/FHIR-R4/interfaces/IEventDefinition.js +1 -1
  220. package/dist/FHIR-R4/interfaces/IEvidence.js +1 -1
  221. package/dist/FHIR-R4/interfaces/IEvidenceVariable.js +1 -1
  222. package/dist/FHIR-R4/interfaces/IExampleScenario.js +1 -1
  223. package/dist/FHIR-R4/interfaces/IExplanationOfBenefit.js +1 -1
  224. package/dist/FHIR-R4/interfaces/IFamilyMemberHistory.js +1 -1
  225. package/dist/FHIR-R4/interfaces/IFlag.js +1 -1
  226. package/dist/FHIR-R4/interfaces/IGoal.js +1 -1
  227. package/dist/FHIR-R4/interfaces/IGraphDefinition.js +1 -1
  228. package/dist/FHIR-R4/interfaces/IGroup.js +1 -1
  229. package/dist/FHIR-R4/interfaces/IGuidanceResponse.js +1 -1
  230. package/dist/FHIR-R4/interfaces/IImagingStudy.js +1 -1
  231. package/dist/FHIR-R4/interfaces/IImplementationGuide.js +1 -1
  232. package/dist/FHIR-R4/interfaces/IInsurancePlan.js +1 -1
  233. package/dist/FHIR-R4/interfaces/IInvoice.js +1 -1
  234. package/dist/FHIR-R4/interfaces/ILibrary.js +1 -1
  235. package/dist/FHIR-R4/interfaces/IList.js +1 -1
  236. package/dist/FHIR-R4/interfaces/ILocation.js +1 -1
  237. package/dist/FHIR-R4/interfaces/IMeasure.js +1 -1
  238. package/dist/FHIR-R4/interfaces/IMeasureReport.js +1 -1
  239. package/dist/FHIR-R4/interfaces/IMessageDefinition.js +1 -1
  240. package/dist/FHIR-R4/interfaces/IMolecularSequence.js +1 -1
  241. package/dist/FHIR-R4/interfaces/INamingSystem.js +1 -1
  242. package/dist/FHIR-R4/interfaces/IObservation.js +1 -1
  243. package/dist/FHIR-R4/interfaces/IOperationDefinition.js +1 -1
  244. package/dist/FHIR-R4/interfaces/IPatient.js +1 -1
  245. package/dist/FHIR-R4/interfaces/IPaymentReconciliation.js +1 -1
  246. package/dist/FHIR-R4/interfaces/IPerson.js +1 -1
  247. package/dist/FHIR-R4/interfaces/IPlanDefinition.js +1 -1
  248. package/dist/FHIR-R4/interfaces/IPractitioner.js +1 -1
  249. package/dist/FHIR-R4/interfaces/IQuestionnaire.js +1 -1
  250. package/dist/FHIR-R4/interfaces/IQuestionnaireResponse.js +1 -1
  251. package/dist/FHIR-R4/interfaces/IRelatedPerson.js +1 -1
  252. package/dist/FHIR-R4/interfaces/IResearchDefinition.js +1 -1
  253. package/dist/FHIR-R4/interfaces/IResearchElementDefinition.js +1 -1
  254. package/dist/FHIR-R4/interfaces/IResearchStudy.js +1 -1
  255. package/dist/FHIR-R4/interfaces/IResearchSubject.js +1 -1
  256. package/dist/FHIR-R4/interfaces/IRiskEvidenceSynthesis.js +1 -1
  257. package/dist/FHIR-R4/interfaces/ISearchParameter.js +1 -1
  258. package/dist/FHIR-R4/interfaces/ISlot.js +1 -1
  259. package/dist/FHIR-R4/interfaces/ISpecimen.js +1 -1
  260. package/dist/FHIR-R4/interfaces/IStructureDefinition.js +1 -1
  261. package/dist/FHIR-R4/interfaces/IStructureMap.js +1 -1
  262. package/dist/FHIR-R4/interfaces/ISubscription.js +1 -1
  263. package/dist/FHIR-R4/interfaces/ISubstance.js +1 -1
  264. package/dist/FHIR-R4/interfaces/ISupplyDelivery.js +1 -1
  265. package/dist/FHIR-R4/interfaces/ISupplyRequest.js +1 -1
  266. package/dist/FHIR-R4/interfaces/ITask.js +1 -1
  267. package/dist/FHIR-R4/interfaces/ITerminologyCapabilities.js +1 -1
  268. package/dist/FHIR-R4/interfaces/ITestReport.js +1 -1
  269. package/dist/FHIR-R4/interfaces/ITestScript.js +1 -1
  270. package/dist/FHIR-R4/interfaces/IValueSet.js +1 -1
  271. package/dist/FHIR-R5/fHIRJSONRESOURCE.d.ts +172 -0
  272. package/dist/FHIR-R5/fHIRJSONRESOURCE.js +2 -0
  273. package/dist/FHIR-R5/openApiSchemaUpdated.d.ts +172 -0
  274. package/dist/FHIR-R5/openApiSchemaUpdated.js +2 -0
  275. package/dist/index.d.ts +1 -1
  276. package/dist/index.js +39 -6
  277. package/dist/library/BundleUtils/BundleUtils.d.ts +11 -5
  278. package/dist/library/BundleUtils/BundleUtils.js +23 -5
  279. package/dist/library/BundleUtils/BundleUtils.spec.js +24 -24
  280. package/dist/library/PatchUtils/PatchUtils.d.ts +1 -1
  281. package/dist/library/PatchUtils/PatchUtils.js +31 -31
  282. package/dist/library/PatchUtils/PatchUtils.spec.js +159 -124
  283. package/dist/library/QueryBuilder/QueryBuilder.d.ts +1 -1
  284. package/dist/library/QueryBuilder/QueryBuilder.js +25 -17
  285. package/dist/library/QueryBuilder/QueryBuilder.spec.js +44 -43
  286. package/dist/library/ResourceUtils/ResourceUtils.d.ts +15 -7
  287. package/dist/library/ResourceUtils/ResourceUtils.js +19 -11
  288. package/dist/library/ResourceUtils/ResourceUtils.spec.js +113 -112
  289. package/dist/library/constants.js +2 -2
  290. package/dist/library/dataTypes.d.ts +6 -6
  291. package/eslint.config.mjs +69 -0
  292. package/package.json +21 -7
  293. package/src/FHIR-DSTU2.ts +1 -1
  294. package/src/FHIR-R3.ts +3 -1
  295. package/src/index.ts +12 -1
  296. package/src/library/BundleUtils/BundleUtils.spec.ts +26 -39
  297. package/src/library/BundleUtils/BundleUtils.ts +43 -29
  298. package/src/library/PatchUtils/PatchUtils.spec.ts +173 -129
  299. package/src/library/PatchUtils/PatchUtils.ts +39 -52
  300. package/src/library/QueryBuilder/QueryBuilder.spec.ts +54 -51
  301. package/src/library/QueryBuilder/QueryBuilder.ts +41 -31
  302. package/src/library/ResourceUtils/ResourceUtils.spec.ts +133 -164
  303. package/src/library/ResourceUtils/ResourceUtils.ts +37 -27
  304. package/src/library/constants.ts +17 -17
  305. package/src/library/dataTypes.ts +7 -7
  306. package/tsconfig.json +25 -2
@@ -0,0 +1,172 @@
1
+ /**
2
+ * FHIR Version R5
3
+ * The following is auto generated resource definition.
4
+ *
5
+ * OpenAPI spec version: 3.0.1
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by the swagger code generator program.
9
+ * https://github.com/swagger-api/swagger-codegen.git
10
+ * Do not edit the class manually.
11
+ */
12
+ import { Account } from './account';
13
+ import { ActivityDefinition } from './activityDefinition';
14
+ import { ActorDefinition } from './actorDefinition';
15
+ import { AdministrableProductDefinition } from './administrableProductDefinition';
16
+ import { AdverseEvent } from './adverseEvent';
17
+ import { AllergyIntolerance } from './allergyIntolerance';
18
+ import { Appointment } from './appointment';
19
+ import { AppointmentResponse } from './appointmentResponse';
20
+ import { ArtifactAssessment } from './artifactAssessment';
21
+ import { AuditEvent } from './auditEvent';
22
+ import { Basic } from './basic';
23
+ import { Binary } from './binary';
24
+ import { BiologicallyDerivedProduct } from './biologicallyDerivedProduct';
25
+ import { BiologicallyDerivedProductDispense } from './biologicallyDerivedProductDispense';
26
+ import { BodyStructure } from './bodyStructure';
27
+ import { Bundle } from './bundle';
28
+ import { CapabilityStatement } from './capabilityStatement';
29
+ import { CarePlan } from './carePlan';
30
+ import { CareTeam } from './careTeam';
31
+ import { ChargeItem } from './chargeItem';
32
+ import { ChargeItemDefinition } from './chargeItemDefinition';
33
+ import { Citation } from './citation';
34
+ import { Claim } from './claim';
35
+ import { ClaimResponse } from './claimResponse';
36
+ import { ClinicalImpression } from './clinicalImpression';
37
+ import { ClinicalUseDefinition } from './clinicalUseDefinition';
38
+ import { CodeSystem } from './codeSystem';
39
+ import { Communication } from './communication';
40
+ import { CommunicationRequest } from './communicationRequest';
41
+ import { CompartmentDefinition } from './compartmentDefinition';
42
+ import { Composition } from './composition';
43
+ import { ConceptMap } from './conceptMap';
44
+ import { Condition } from './condition';
45
+ import { ConditionDefinition } from './conditionDefinition';
46
+ import { Consent } from './consent';
47
+ import { Contract } from './contract';
48
+ import { Coverage } from './coverage';
49
+ import { CoverageEligibilityRequest } from './coverageEligibilityRequest';
50
+ import { CoverageEligibilityResponse } from './coverageEligibilityResponse';
51
+ import { DetectedIssue } from './detectedIssue';
52
+ import { Device } from './device';
53
+ import { DeviceAssociation } from './deviceAssociation';
54
+ import { DeviceDefinition } from './deviceDefinition';
55
+ import { DeviceDispense } from './deviceDispense';
56
+ import { DeviceMetric } from './deviceMetric';
57
+ import { DeviceRequest } from './deviceRequest';
58
+ import { DeviceUsage } from './deviceUsage';
59
+ import { DiagnosticReport } from './diagnosticReport';
60
+ import { DocumentReference } from './documentReference';
61
+ import { Encounter } from './encounter';
62
+ import { EncounterHistory } from './encounterHistory';
63
+ import { Endpoint } from './endpoint';
64
+ import { EnrollmentRequest } from './enrollmentRequest';
65
+ import { EnrollmentResponse } from './enrollmentResponse';
66
+ import { EpisodeOfCare } from './episodeOfCare';
67
+ import { EventDefinition } from './eventDefinition';
68
+ import { Evidence } from './evidence';
69
+ import { EvidenceReport } from './evidenceReport';
70
+ import { EvidenceVariable } from './evidenceVariable';
71
+ import { ExampleScenario } from './exampleScenario';
72
+ import { ExplanationOfBenefit } from './explanationOfBenefit';
73
+ import { FamilyMemberHistory } from './familyMemberHistory';
74
+ import { Flag } from './flag';
75
+ import { FormularyItem } from './formularyItem';
76
+ import { GenomicStudy } from './genomicStudy';
77
+ import { Goal } from './goal';
78
+ import { GraphDefinition } from './graphDefinition';
79
+ import { Group } from './group';
80
+ import { GuidanceResponse } from './guidanceResponse';
81
+ import { HealthcareService } from './healthcareService';
82
+ import { ImagingSelection } from './imagingSelection';
83
+ import { ImagingStudy } from './imagingStudy';
84
+ import { Immunization } from './immunization';
85
+ import { ImmunizationEvaluation } from './immunizationEvaluation';
86
+ import { ImmunizationRecommendation } from './immunizationRecommendation';
87
+ import { ImplementationGuide } from './implementationGuide';
88
+ import { Ingredient } from './ingredient';
89
+ import { InsurancePlan } from './insurancePlan';
90
+ import { InventoryItem } from './inventoryItem';
91
+ import { InventoryReport } from './inventoryReport';
92
+ import { Invoice } from './invoice';
93
+ import { Library } from './library';
94
+ import { Linkage } from './linkage';
95
+ import { Location } from './location';
96
+ import { ManufacturedItemDefinition } from './manufacturedItemDefinition';
97
+ import { Measure } from './measure';
98
+ import { MeasureReport } from './measureReport';
99
+ import { Medication } from './medication';
100
+ import { MedicationAdministration } from './medicationAdministration';
101
+ import { MedicationDispense } from './medicationDispense';
102
+ import { MedicationKnowledge } from './medicationKnowledge';
103
+ import { MedicationRequest } from './medicationRequest';
104
+ import { MedicationStatement } from './medicationStatement';
105
+ import { MedicinalProductDefinition } from './medicinalProductDefinition';
106
+ import { MessageDefinition } from './messageDefinition';
107
+ import { MessageHeader } from './messageHeader';
108
+ import { MolecularSequence } from './molecularSequence';
109
+ import { NamingSystem } from './namingSystem';
110
+ import { NutritionIntake } from './nutritionIntake';
111
+ import { NutritionOrder } from './nutritionOrder';
112
+ import { NutritionProduct } from './nutritionProduct';
113
+ import { Observation } from './observation';
114
+ import { ObservationDefinition } from './observationDefinition';
115
+ import { OperationDefinition } from './operationDefinition';
116
+ import { OperationOutcome } from './operationOutcome';
117
+ import { Organization } from './organization';
118
+ import { OrganizationAffiliation } from './organizationAffiliation';
119
+ import { PackagedProductDefinition } from './packagedProductDefinition';
120
+ import { Parameters } from './parameters';
121
+ import { Patient } from './patient';
122
+ import { PaymentNotice } from './paymentNotice';
123
+ import { PaymentReconciliation } from './paymentReconciliation';
124
+ import { Permission } from './permission';
125
+ import { Person } from './person';
126
+ import { PlanDefinition } from './planDefinition';
127
+ import { Practitioner } from './practitioner';
128
+ import { PractitionerRole } from './practitionerRole';
129
+ import { Procedure } from './procedure';
130
+ import { Provenance } from './provenance';
131
+ import { Questionnaire } from './questionnaire';
132
+ import { QuestionnaireResponse } from './questionnaireResponse';
133
+ import { RegulatedAuthorization } from './regulatedAuthorization';
134
+ import { RelatedPerson } from './relatedPerson';
135
+ import { RequestOrchestration } from './requestOrchestration';
136
+ import { Requirements } from './requirements';
137
+ import { ResearchStudy } from './researchStudy';
138
+ import { ResearchSubject } from './researchSubject';
139
+ import { RiskAssessment } from './riskAssessment';
140
+ import { Schedule } from './schedule';
141
+ import { SearchParameter } from './searchParameter';
142
+ import { ServiceRequest } from './serviceRequest';
143
+ import { Slot } from './slot';
144
+ import { Specimen } from './specimen';
145
+ import { SpecimenDefinition } from './specimenDefinition';
146
+ import { StructureDefinition } from './structureDefinition';
147
+ import { StructureMap } from './structureMap';
148
+ import { Subscription } from './subscription';
149
+ import { SubscriptionStatus } from './subscriptionStatus';
150
+ import { SubscriptionTopic } from './subscriptionTopic';
151
+ import { Substance } from './substance';
152
+ import { SubstanceDefinition } from './substanceDefinition';
153
+ import { SubstanceNucleicAcid } from './substanceNucleicAcid';
154
+ import { SubstancePolymer } from './substancePolymer';
155
+ import { SubstanceProtein } from './substanceProtein';
156
+ import { SubstanceReferenceInformation } from './substanceReferenceInformation';
157
+ import { SubstanceSourceMaterial } from './substanceSourceMaterial';
158
+ import { SupplyDelivery } from './supplyDelivery';
159
+ import { SupplyRequest } from './supplyRequest';
160
+ import { Task } from './task';
161
+ import { TerminologyCapabilities } from './terminologyCapabilities';
162
+ import { TestPlan } from './testPlan';
163
+ import { TestReport } from './testReport';
164
+ import { TestScript } from './testScript';
165
+ import { Transport } from './transport';
166
+ import { ValueSet } from './valueSet';
167
+ import { VerificationResult } from './verificationResult';
168
+ import { VisionPrescription } from './visionPrescription';
169
+ /**
170
+ * see http://hl7.org/fhir/json.html#schema for information about the FHIR Json Schemas
171
+ */
172
+ export type OpenApiSchemaUpdated = Account | ActivityDefinition | ActorDefinition | AdministrableProductDefinition | AdverseEvent | AllergyIntolerance | Appointment | AppointmentResponse | ArtifactAssessment | AuditEvent | Basic | Binary | BiologicallyDerivedProduct | BiologicallyDerivedProductDispense | BodyStructure | Bundle | CapabilityStatement | CarePlan | CareTeam | ChargeItem | ChargeItemDefinition | Citation | Claim | ClaimResponse | ClinicalImpression | ClinicalUseDefinition | CodeSystem | Communication | CommunicationRequest | CompartmentDefinition | Composition | ConceptMap | Condition | ConditionDefinition | Consent | Contract | Coverage | CoverageEligibilityRequest | CoverageEligibilityResponse | DetectedIssue | Device | DeviceAssociation | DeviceDefinition | DeviceDispense | DeviceMetric | DeviceRequest | DeviceUsage | DiagnosticReport | DocumentReference | Encounter | EncounterHistory | Endpoint | EnrollmentRequest | EnrollmentResponse | EpisodeOfCare | EventDefinition | Evidence | EvidenceReport | EvidenceVariable | ExampleScenario | ExplanationOfBenefit | FamilyMemberHistory | Flag | FormularyItem | GenomicStudy | Goal | GraphDefinition | Group | GuidanceResponse | HealthcareService | ImagingSelection | ImagingStudy | Immunization | ImmunizationEvaluation | ImmunizationRecommendation | ImplementationGuide | Ingredient | InsurancePlan | InventoryItem | InventoryReport | Invoice | Library | Linkage | Array | Location | ManufacturedItemDefinition | Measure | MeasureReport | Medication | MedicationAdministration | MedicationDispense | MedicationKnowledge | MedicationRequest | MedicationStatement | MedicinalProductDefinition | MessageDefinition | MessageHeader | MolecularSequence | NamingSystem | NutritionIntake | NutritionOrder | NutritionProduct | Observation | ObservationDefinition | OperationDefinition | OperationOutcome | Organization | OrganizationAffiliation | PackagedProductDefinition | Parameters | Patient | PaymentNotice | PaymentReconciliation | Permission | Person | PlanDefinition | Practitioner | PractitionerRole | Procedure | Provenance | Questionnaire | QuestionnaireResponse | RegulatedAuthorization | RelatedPerson | RequestOrchestration | Requirements | ResearchStudy | ResearchSubject | RiskAssessment | Schedule | SearchParameter | ServiceRequest | Slot | Specimen | SpecimenDefinition | StructureDefinition | StructureMap | Subscription | SubscriptionStatus | SubscriptionTopic | Substance | SubstanceDefinition | SubstanceNucleicAcid | SubstancePolymer | SubstanceProtein | SubstanceReferenceInformation | SubstanceSourceMaterial | SupplyDelivery | SupplyRequest | Task | TerminologyCapabilities | TestPlan | TestReport | TestScript | Transport | ValueSet | VerificationResult | VisionPrescription;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/index.d.ts CHANGED
@@ -8,4 +8,4 @@ import { BundleUtils } from './library/BundleUtils/BundleUtils';
8
8
  import { QueryBuilder } from './library/QueryBuilder/QueryBuilder';
9
9
  import { PatchUtils } from './library/PatchUtils/PatchUtils';
10
10
  import * as fhirtsConstants from './library/constants';
11
- export { fhirR5, fhirR4, fhirR3, IfhirR4, dstu2, ResourceUtils, BundleUtils, QueryBuilder, PatchUtils, fhirtsConstants };
11
+ export { fhirR5, fhirR4, fhirR3, IfhirR4, dstu2, ResourceUtils, BundleUtils, QueryBuilder, PatchUtils, fhirtsConstants, };
package/dist/index.js CHANGED
@@ -1,15 +1,48 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.fhirtsConstants = exports.PatchUtils = exports.QueryBuilder = exports.BundleUtils = exports.ResourceUtils = exports.dstu2 = exports.IfhirR4 = exports.fhirR3 = exports.fhirR4 = exports.fhirR5 = void 0;
4
- const fhirR5 = require("./FHIR-R5/models");
37
+ const fhirR5 = __importStar(require("./FHIR-R5/models"));
5
38
  exports.fhirR5 = fhirR5;
6
- const fhirR4 = require("./FHIR-R4/classes/models-r4");
39
+ const fhirR4 = __importStar(require("./FHIR-R4/classes/models-r4"));
7
40
  exports.fhirR4 = fhirR4;
8
- const IfhirR4 = require("./FHIR-R4/interfaces/IModel");
41
+ const IfhirR4 = __importStar(require("./FHIR-R4/interfaces/IModel"));
9
42
  exports.IfhirR4 = IfhirR4;
10
- const fhirR3 = require("./FHIR-R3");
43
+ const fhirR3 = __importStar(require("./FHIR-R3"));
11
44
  exports.fhirR3 = fhirR3;
12
- const dstu2 = require("./FHIR-DSTU2");
45
+ const dstu2 = __importStar(require("./FHIR-DSTU2"));
13
46
  exports.dstu2 = dstu2;
14
47
  const ResourceUtils_1 = require("./library/ResourceUtils/ResourceUtils");
15
48
  Object.defineProperty(exports, "ResourceUtils", { enumerable: true, get: function () { return ResourceUtils_1.ResourceUtils; } });
@@ -19,5 +52,5 @@ const QueryBuilder_1 = require("./library/QueryBuilder/QueryBuilder");
19
52
  Object.defineProperty(exports, "QueryBuilder", { enumerable: true, get: function () { return QueryBuilder_1.QueryBuilder; } });
20
53
  const PatchUtils_1 = require("./library/PatchUtils/PatchUtils");
21
54
  Object.defineProperty(exports, "PatchUtils", { enumerable: true, get: function () { return PatchUtils_1.PatchUtils; } });
22
- const fhirtsConstants = require("./library/constants");
55
+ const fhirtsConstants = __importStar(require("./library/constants"));
23
56
  exports.fhirtsConstants = fhirtsConstants;
@@ -1,23 +1,29 @@
1
1
  export declare class BundleUtils {
2
2
  /**
3
+ * Get resources from bundle entries filtered by resource type
3
4
  *
5
+ * @template T - The resource type to return (defaults to any for backward compatibility)
4
6
  * @param bundleEntry Bundle.entry[] i.e. the bundle entries to filter
5
7
  * @param resourceTypeToFilter ResourceType to filter from bundle entries
6
8
  * @returns array of resources
7
9
  */
8
- getResources(bundleEntry: any[], resourceTypeToFilter: string): any[];
10
+ getResources<T = any>(bundleEntry: any[] | null, resourceTypeToFilter: string): T[];
9
11
  /**
12
+ * Get a single resource from bundle entries by resource ID
10
13
  *
14
+ * @template T - The resource type to return (defaults to any for backward compatibility)
11
15
  * @param bundleEntry Bundle.entry[] i.e. the bundle entries to filter
12
16
  * @param resourceId Resource ID to filter from bundle entries
13
- * @returns single resource
17
+ * @returns single resource, undefined if not found, or null if input is null
14
18
  */
15
- getResource(bundleEntry: any[], resourceId: string): any;
19
+ getResource<T = any>(bundleEntry: any[] | null, resourceId: string): T | null;
16
20
  /**
21
+ * Get a single resource from bundle entries by full URL
17
22
  *
23
+ * @template T - The resource type to return (defaults to any for backward compatibility)
18
24
  * @param bundleEntry Bundle.entry[] i.e. the bundle entries to filter
19
25
  * @param fullUrl Full Url to filter from bundle entries
20
- * @returns single resource
26
+ * @returns single resource if not found, or null if input is null
21
27
  */
22
- getResourceByFullUrl(bundleEntry: any[], fullUrl: string): any;
28
+ getResourceByFullUrl<T = any>(bundleEntry: any[] | null, fullUrl: string): T | null;
23
29
  }
@@ -3,31 +3,49 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BundleUtils = void 0;
4
4
  class BundleUtils {
5
5
  /**
6
+ * Get resources from bundle entries filtered by resource type
6
7
  *
8
+ * @template T - The resource type to return (defaults to any for backward compatibility)
7
9
  * @param bundleEntry Bundle.entry[] i.e. the bundle entries to filter
8
10
  * @param resourceTypeToFilter ResourceType to filter from bundle entries
9
11
  * @returns array of resources
10
12
  */
11
13
  getResources(bundleEntry, resourceTypeToFilter) {
12
- return (bundleEntry === null || bundleEntry === void 0 ? void 0 : bundleEntry.length) ? bundleEntry.filter(x => x['resource']['resourceType'] === resourceTypeToFilter) : [];
14
+ return (bundleEntry === null || bundleEntry === void 0 ? void 0 : bundleEntry.length)
15
+ ? bundleEntry
16
+ .filter((x) => x['resource']['resourceType'] === resourceTypeToFilter)
17
+ .map((x) => x['resource'])
18
+ : [];
13
19
  }
14
20
  /**
21
+ * Get a single resource from bundle entries by resource ID
15
22
  *
23
+ * @template T - The resource type to return (defaults to any for backward compatibility)
16
24
  * @param bundleEntry Bundle.entry[] i.e. the bundle entries to filter
17
25
  * @param resourceId Resource ID to filter from bundle entries
18
- * @returns single resource
26
+ * @returns single resource, undefined if not found, or null if input is null
19
27
  */
20
28
  getResource(bundleEntry, resourceId) {
21
- return (bundleEntry === null || bundleEntry === void 0 ? void 0 : bundleEntry.length) ? bundleEntry.find(x => x['resource']['id'] === resourceId) : null;
29
+ if (!bundleEntry) {
30
+ return null;
31
+ }
32
+ const entry = bundleEntry.find((x) => { var _a; return ((_a = x['resource']) === null || _a === void 0 ? void 0 : _a['id']) === resourceId; });
33
+ return entry === null || entry === void 0 ? void 0 : entry['resource'];
22
34
  }
23
35
  /**
36
+ * Get a single resource from bundle entries by full URL
24
37
  *
38
+ * @template T - The resource type to return (defaults to any for backward compatibility)
25
39
  * @param bundleEntry Bundle.entry[] i.e. the bundle entries to filter
26
40
  * @param fullUrl Full Url to filter from bundle entries
27
- * @returns single resource
41
+ * @returns single resource if not found, or null if input is null
28
42
  */
29
43
  getResourceByFullUrl(bundleEntry, fullUrl) {
30
- return (bundleEntry === null || bundleEntry === void 0 ? void 0 : bundleEntry.length) ? bundleEntry.find(x => x['fullUrl'] === fullUrl) : null;
44
+ if (!bundleEntry) {
45
+ return null;
46
+ }
47
+ const entry = bundleEntry.find((x) => x['fullUrl'] === fullUrl);
48
+ return entry === null || entry === void 0 ? void 0 : entry['resource'];
31
49
  }
32
50
  }
33
51
  exports.BundleUtils = BundleUtils;
@@ -1,65 +1,65 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const BundleUtils_1 = require("./BundleUtils");
4
- const inputPayload = require("./../../test-resources/Bundle-R4.json");
5
- describe("BundleUtils", () => {
6
- let bundleUtils = new BundleUtils_1.BundleUtils();
7
- describe("#getResources()", () => {
8
- it("should return empty array if null is passed as bundle entries", () => {
4
+ const inputPayload = require('./../../test-resources/Bundle-R4.json');
5
+ describe('BundleUtils', () => {
6
+ const bundleUtils = new BundleUtils_1.BundleUtils();
7
+ describe('#getResources()', () => {
8
+ it('should return empty array if null is passed as bundle entries', () => {
9
9
  // execute
10
- const actual = bundleUtils.getResources(null, "Patient");
10
+ const actual = bundleUtils.getResources(null, 'Patient');
11
11
  // validate
12
12
  expect(actual.length).toEqual(0);
13
13
  });
14
- it("should return empty array if invalid resourceType is passed", () => {
14
+ it('should return empty array if invalid resourceType is passed', () => {
15
15
  // execute
16
- const actual = bundleUtils.getResources(inputPayload.entry, "patient");
16
+ const actual = bundleUtils.getResources(inputPayload.entry, 'patient');
17
17
  // validate
18
18
  expect(actual.length).toEqual(0);
19
19
  });
20
- it("should return all matches array", () => {
20
+ it('should return all matches array', () => {
21
21
  // execute
22
- const actual = bundleUtils.getResources(inputPayload.entry, "Claim");
22
+ const actual = bundleUtils.getResources(inputPayload.entry, 'Claim');
23
23
  // validate
24
24
  expect(actual.length).toEqual(27);
25
25
  });
26
26
  });
27
- describe("#getResource()", () => {
28
- it("should return null if null is passed as bundle entries", () => {
27
+ describe('#getResource()', () => {
28
+ it('should return null if null is passed as bundle entries', () => {
29
29
  // execute
30
- const actual = bundleUtils.getResource(null, "123");
30
+ const actual = bundleUtils.getResource(null, '123');
31
31
  // validate
32
32
  expect(actual).toBeNull();
33
33
  });
34
- it("should return undefined if resourceId is not found", () => {
34
+ it('should return undefined if resourceId is not found', () => {
35
35
  // execute
36
- const actual = bundleUtils.getResource(inputPayload.entry, "123");
36
+ const actual = bundleUtils.getResource(inputPayload.entry, '123');
37
37
  // validate
38
38
  expect(actual).toBeUndefined();
39
39
  });
40
- it("should return resource if resource is found", () => {
40
+ it('should return resource if resource is found', () => {
41
41
  // execute
42
- const actual = bundleUtils.getResource(inputPayload.entry, "ec0bb1b3-b229-36cf-7e34-3f5fec9d3afe");
42
+ const actual = bundleUtils.getResource(inputPayload.entry, 'ec0bb1b3-b229-36cf-7e34-3f5fec9d3afe');
43
43
  // validate
44
44
  expect(actual).not.toBeUndefined();
45
45
  });
46
46
  });
47
- describe("#getResourceByFullUrl()", () => {
48
- it("should return null if null is passed as bundle entries", () => {
47
+ describe('#getResourceByFullUrl()', () => {
48
+ it('should return null if null is passed as bundle entries', () => {
49
49
  // execute
50
- const actual = bundleUtils.getResourceByFullUrl(null, "123");
50
+ const actual = bundleUtils.getResourceByFullUrl(null, '123');
51
51
  // validate
52
52
  expect(actual).toBeNull();
53
53
  });
54
- it("should return undefined if fullUrl is not found", () => {
54
+ it('should return undefined if fullUrl is not found', () => {
55
55
  // execute
56
- const actual = bundleUtils.getResourceByFullUrl(inputPayload.entry, "123");
56
+ const actual = bundleUtils.getResourceByFullUrl(inputPayload.entry, '123');
57
57
  // validate
58
58
  expect(actual).toBeUndefined();
59
59
  });
60
- it("should return resource if resource is found", () => {
60
+ it('should return resource if resource is found', () => {
61
61
  // execute
62
- const actual = bundleUtils.getResourceByFullUrl(inputPayload.entry, "urn:uuid:7c52dd91-73f8-83e1-cab2-2ffdd7a34601");
62
+ const actual = bundleUtils.getResourceByFullUrl(inputPayload.entry, 'urn:uuid:7c52dd91-73f8-83e1-cab2-2ffdd7a34601');
63
63
  // validate
64
64
  expect(actual).not.toBeUndefined();
65
65
  });
@@ -1,4 +1,4 @@
1
- import { PATCH_DATATYPE, PatchAddValueParams, PatchAddBackboneElementParams } from "../constants";
1
+ import { PATCH_DATATYPE, PatchAddValueParams, PatchAddBackboneElementParams } from '../constants';
2
2
  /**
3
3
  * This a simple utility to create Parameters resource for FHIR patch operation
4
4
  * https://www.hl7.org/fhir/fhirpatch.html
@@ -7,14 +7,14 @@ exports.PatchUtils = void 0;
7
7
  */
8
8
  class PatchUtils {
9
9
  constructor() {
10
- this.REPLACE_OPERATION_NAME = "replace";
11
- this.DELETE_OPERATION_NAME = "delete";
12
- this.MOVE_OPERATION_NAME = "move";
13
- this.ADD_OPERATION_NAME = "add";
14
- this.INSERT_OPERATION_NAME = "insert";
15
- this.PARAMETER_PROPERTY_NAME = "parameter";
10
+ this.REPLACE_OPERATION_NAME = 'replace';
11
+ this.DELETE_OPERATION_NAME = 'delete';
12
+ this.MOVE_OPERATION_NAME = 'move';
13
+ this.ADD_OPERATION_NAME = 'add';
14
+ this.INSERT_OPERATION_NAME = 'insert';
15
+ this.PARAMETER_PROPERTY_NAME = 'parameter';
16
16
  this.baseParameters = {
17
- resourceType: "Parameters",
17
+ resourceType: 'Parameters',
18
18
  parameter: [],
19
19
  };
20
20
  }
@@ -27,18 +27,18 @@ class PatchUtils {
27
27
  */
28
28
  createReplaceParameters(path, value, valueDataType) {
29
29
  const replaceParameters = {
30
- name: "operation",
30
+ name: 'operation',
31
31
  part: [
32
32
  {
33
- name: "type",
33
+ name: 'type',
34
34
  valueCode: this.REPLACE_OPERATION_NAME,
35
35
  },
36
36
  {
37
- name: "path",
37
+ name: 'path',
38
38
  valueString: path,
39
39
  },
40
40
  {
41
- name: "value",
41
+ name: 'value',
42
42
  [valueDataType]: value,
43
43
  },
44
44
  ],
@@ -53,14 +53,14 @@ class PatchUtils {
53
53
  */
54
54
  createDeleteParameters(path) {
55
55
  const deleteParameters = {
56
- name: "operation",
56
+ name: 'operation',
57
57
  part: [
58
58
  {
59
- name: "type",
59
+ name: 'type',
60
60
  valueCode: this.DELETE_OPERATION_NAME,
61
61
  },
62
62
  {
63
- name: "path",
63
+ name: 'path',
64
64
  valueString: path,
65
65
  },
66
66
  ],
@@ -77,22 +77,22 @@ class PatchUtils {
77
77
  */
78
78
  createMoveParameters(path, source, destination) {
79
79
  const moveParameters = {
80
- name: "operation",
80
+ name: 'operation',
81
81
  part: [
82
82
  {
83
- name: "type",
83
+ name: 'type',
84
84
  valueCode: this.MOVE_OPERATION_NAME,
85
85
  },
86
86
  {
87
- name: "path",
87
+ name: 'path',
88
88
  valueString: path,
89
89
  },
90
90
  {
91
- name: "source",
91
+ name: 'source',
92
92
  valueInteger: source,
93
93
  },
94
94
  {
95
- name: "destination",
95
+ name: 'destination',
96
96
  valueInteger: destination,
97
97
  },
98
98
  ],
@@ -108,11 +108,11 @@ class PatchUtils {
108
108
  */
109
109
  createAddParameters(path, name, patchAddValueParams) {
110
110
  const addParameters = {
111
- name: "operation",
111
+ name: 'operation',
112
112
  part: [
113
113
  ...this.getCommonAddParameters(path, name),
114
114
  {
115
- name: "value",
115
+ name: 'value',
116
116
  [patchAddValueParams.valueDataType]: patchAddValueParams.value,
117
117
  },
118
118
  ],
@@ -136,11 +136,11 @@ class PatchUtils {
136
136
  });
137
137
  });
138
138
  const addParameters = {
139
- name: "operation",
139
+ name: 'operation',
140
140
  part: [
141
141
  ...this.getCommonAddParameters(path, name),
142
142
  {
143
- name: "value",
143
+ name: 'value',
144
144
  part: parts,
145
145
  },
146
146
  ],
@@ -158,22 +158,22 @@ class PatchUtils {
158
158
  */
159
159
  createInsertParameters(path, value, valueDataType, index) {
160
160
  const insertParameters = {
161
- name: "operation",
161
+ name: 'operation',
162
162
  part: [
163
163
  {
164
- name: "type",
164
+ name: 'type',
165
165
  valueCode: this.INSERT_OPERATION_NAME,
166
166
  },
167
167
  {
168
- name: "path",
168
+ name: 'path',
169
169
  valueString: path,
170
170
  },
171
171
  {
172
- name: "index",
172
+ name: 'index',
173
173
  valueInteger: index,
174
174
  },
175
175
  {
176
- name: "value",
176
+ name: 'value',
177
177
  [valueDataType]: value,
178
178
  },
179
179
  ],
@@ -197,15 +197,15 @@ class PatchUtils {
197
197
  getCommonAddParameters(path, name) {
198
198
  return [
199
199
  {
200
- name: "type",
200
+ name: 'type',
201
201
  valueCode: this.ADD_OPERATION_NAME,
202
202
  },
203
203
  {
204
- name: "path",
204
+ name: 'path',
205
205
  valueString: path,
206
206
  },
207
207
  {
208
- name: "name",
208
+ name: 'name',
209
209
  valueString: name,
210
210
  },
211
211
  ];