@medplum/core 0.2.1 → 0.4.1
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.
- package/README.md +32 -26
- package/dist/cjs/index.js +1818 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/index.min.js +16 -0
- package/dist/cjs/index.min.js.map +1 -0
- package/dist/esm/index.js +1769 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/index.min.js +16 -0
- package/dist/esm/index.min.js.map +1 -0
- package/dist/{cache.d.ts → types/cache.d.ts} +2 -3
- package/dist/types/client.d.ts +230 -0
- package/dist/{crypto.d.ts → types/crypto.d.ts} +0 -0
- package/dist/{eventtarget.d.ts → types/eventtarget.d.ts} +3 -3
- package/dist/{format.d.ts → types/format.d.ts} +1 -1
- package/dist/{index.d.ts → types/index.d.ts} +0 -2
- package/dist/types/jwt.d.ts +5 -0
- package/dist/{outcomes.d.ts → types/outcomes.d.ts} +7 -2
- package/dist/{search.d.ts → types/search.d.ts} +4 -0
- package/dist/{searchparams.d.ts → types/searchparams.d.ts} +1 -1
- package/dist/{storage.d.ts → types/storage.d.ts} +2 -2
- package/dist/{types.d.ts → types/types.d.ts} +18 -4
- package/dist/{utils.d.ts → types/utils.d.ts} +7 -1
- package/package.json +14 -9
- package/dist/cache.js +0 -36
- package/dist/cache.js.map +0 -1
- package/dist/client.d.ts +0 -233
- package/dist/client.js +0 -541
- package/dist/client.js.map +0 -1
- package/dist/crypto.js +0 -33
- package/dist/crypto.js.map +0 -1
- package/dist/eventtarget.js +0 -38
- package/dist/eventtarget.js.map +0 -1
- package/dist/fhir/AccessPolicy.d.ts +0 -75
- package/dist/fhir/AccessPolicy.js +0 -7
- package/dist/fhir/AccessPolicy.js.map +0 -1
- package/dist/fhir/Account.d.ts +0 -247
- package/dist/fhir/Account.js +0 -7
- package/dist/fhir/Account.js.map +0 -1
- package/dist/fhir/ActivityDefinition.d.ts +0 -500
- package/dist/fhir/ActivityDefinition.js +0 -7
- package/dist/fhir/ActivityDefinition.js.map +0 -1
- package/dist/fhir/Address.d.ts +0 -75
- package/dist/fhir/Address.js +0 -7
- package/dist/fhir/Address.js.map +0 -1
- package/dist/fhir/AdverseEvent.d.ts +0 -303
- package/dist/fhir/AdverseEvent.js +0 -7
- package/dist/fhir/AdverseEvent.js.map +0 -1
- package/dist/fhir/Age.d.ts +0 -47
- package/dist/fhir/Age.js +0 -7
- package/dist/fhir/Age.js.map +0 -1
- package/dist/fhir/AllergyIntolerance.d.ts +0 -283
- package/dist/fhir/AllergyIntolerance.js +0 -7
- package/dist/fhir/AllergyIntolerance.js.map +0 -1
- package/dist/fhir/Annotation.d.ts +0 -42
- package/dist/fhir/Annotation.js +0 -7
- package/dist/fhir/Annotation.js.map +0 -1
- package/dist/fhir/Appointment.d.ts +0 -284
- package/dist/fhir/Appointment.js +0 -7
- package/dist/fhir/Appointment.js.map +0 -1
- package/dist/fhir/AppointmentResponse.d.ts +0 -131
- package/dist/fhir/AppointmentResponse.js +0 -7
- package/dist/fhir/AppointmentResponse.js.map +0 -1
- package/dist/fhir/Attachment.d.ts +0 -58
- package/dist/fhir/Attachment.js +0 -7
- package/dist/fhir/Attachment.js.map +0 -1
- package/dist/fhir/AuditEvent.d.ts +0 -458
- package/dist/fhir/AuditEvent.js +0 -7
- package/dist/fhir/AuditEvent.js.map +0 -1
- package/dist/fhir/Basic.d.ts +0 -110
- package/dist/fhir/Basic.js +0 -7
- package/dist/fhir/Basic.js.map +0 -1
- package/dist/fhir/Binary.d.ts +0 -59
- package/dist/fhir/Binary.js +0 -7
- package/dist/fhir/Binary.js.map +0 -1
- package/dist/fhir/BiologicallyDerivedProduct.d.ts +0 -358
- package/dist/fhir/BiologicallyDerivedProduct.js +0 -7
- package/dist/fhir/BiologicallyDerivedProduct.js.map +0 -1
- package/dist/fhir/BodyStructure.d.ts +0 -119
- package/dist/fhir/BodyStructure.js +0 -7
- package/dist/fhir/BodyStructure.js.map +0 -1
- package/dist/fhir/Bot.d.ts +0 -49
- package/dist/fhir/Bot.js +0 -7
- package/dist/fhir/Bot.js.map +0 -1
- package/dist/fhir/Bundle.d.ts +0 -379
- package/dist/fhir/Bundle.js +0 -7
- package/dist/fhir/Bundle.js.map +0 -1
- package/dist/fhir/CapabilityStatement.d.ts +0 -1044
- package/dist/fhir/CapabilityStatement.js +0 -7
- package/dist/fhir/CapabilityStatement.js.map +0 -1
- package/dist/fhir/CarePlan.d.ts +0 -446
- package/dist/fhir/CarePlan.js +0 -7
- package/dist/fhir/CarePlan.js.map +0 -1
- package/dist/fhir/CareTeam.d.ts +0 -211
- package/dist/fhir/CareTeam.js +0 -7
- package/dist/fhir/CareTeam.js.map +0 -1
- package/dist/fhir/CatalogEntry.d.ts +0 -195
- package/dist/fhir/CatalogEntry.js +0 -7
- package/dist/fhir/CatalogEntry.js.map +0 -1
- package/dist/fhir/ChargeItem.d.ts +0 -287
- package/dist/fhir/ChargeItem.js +0 -7
- package/dist/fhir/ChargeItem.js.map +0 -1
- package/dist/fhir/ChargeItemDefinition.d.ts +0 -401
- package/dist/fhir/ChargeItemDefinition.js +0 -7
- package/dist/fhir/ChargeItemDefinition.js.map +0 -1
- package/dist/fhir/Claim.d.ts +0 -1092
- package/dist/fhir/Claim.js +0 -7
- package/dist/fhir/Claim.js.map +0 -1
- package/dist/fhir/ClaimResponse.d.ts +0 -1040
- package/dist/fhir/ClaimResponse.js +0 -7
- package/dist/fhir/ClaimResponse.js.map +0 -1
- package/dist/fhir/ClientApplication.d.ts +0 -46
- package/dist/fhir/ClientApplication.js +0 -7
- package/dist/fhir/ClientApplication.js.map +0 -1
- package/dist/fhir/ClinicalImpression.d.ts +0 -306
- package/dist/fhir/ClinicalImpression.js +0 -7
- package/dist/fhir/ClinicalImpression.js.map +0 -1
- package/dist/fhir/CodeSystem.d.ts +0 -541
- package/dist/fhir/CodeSystem.js +0 -7
- package/dist/fhir/CodeSystem.js.map +0 -1
- package/dist/fhir/CodeableConcept.d.ts +0 -33
- package/dist/fhir/CodeableConcept.js +0 -7
- package/dist/fhir/CodeableConcept.js.map +0 -1
- package/dist/fhir/Coding.d.ts +0 -50
- package/dist/fhir/Coding.js +0 -7
- package/dist/fhir/Coding.js.map +0 -1
- package/dist/fhir/Communication.d.ts +0 -264
- package/dist/fhir/Communication.js +0 -7
- package/dist/fhir/Communication.js.map +0 -1
- package/dist/fhir/CommunicationRequest.d.ts +0 -261
- package/dist/fhir/CommunicationRequest.js +0 -7
- package/dist/fhir/CommunicationRequest.js.map +0 -1
- package/dist/fhir/CompartmentDefinition.d.ts +0 -217
- package/dist/fhir/CompartmentDefinition.js +0 -7
- package/dist/fhir/CompartmentDefinition.js.map +0 -1
- package/dist/fhir/Composition.d.ts +0 -429
- package/dist/fhir/Composition.js +0 -7
- package/dist/fhir/Composition.js.map +0 -1
- package/dist/fhir/ConceptMap.d.ts +0 -518
- package/dist/fhir/ConceptMap.js +0 -7
- package/dist/fhir/ConceptMap.js.map +0 -1
- package/dist/fhir/Condition.d.ts +0 -326
- package/dist/fhir/Condition.js +0 -7
- package/dist/fhir/Condition.js.map +0 -1
- package/dist/fhir/Consent.d.ts +0 -460
- package/dist/fhir/Consent.js +0 -7
- package/dist/fhir/Consent.js.map +0 -1
- package/dist/fhir/ContactDetail.d.ts +0 -31
- package/dist/fhir/ContactDetail.js +0 -7
- package/dist/fhir/ContactDetail.js.map +0 -1
- package/dist/fhir/ContactPoint.d.ts +0 -47
- package/dist/fhir/ContactPoint.js +0 -7
- package/dist/fhir/ContactPoint.js.map +0 -1
- package/dist/fhir/Contract.d.ts +0 -1452
- package/dist/fhir/Contract.js +0 -7
- package/dist/fhir/Contract.js.map +0 -1
- package/dist/fhir/Contributor.d.ts +0 -37
- package/dist/fhir/Contributor.js +0 -7
- package/dist/fhir/Contributor.js.map +0 -1
- package/dist/fhir/Count.d.ts +0 -49
- package/dist/fhir/Count.js +0 -7
- package/dist/fhir/Count.js.map +0 -1
- package/dist/fhir/Coverage.d.ts +0 -327
- package/dist/fhir/Coverage.js +0 -7
- package/dist/fhir/Coverage.js.map +0 -1
- package/dist/fhir/CoverageEligibilityRequest.d.ts +0 -404
- package/dist/fhir/CoverageEligibilityRequest.js +0 -7
- package/dist/fhir/CoverageEligibilityRequest.js.map +0 -1
- package/dist/fhir/CoverageEligibilityResponse.d.ts +0 -434
- package/dist/fhir/CoverageEligibilityResponse.js +0 -7
- package/dist/fhir/CoverageEligibilityResponse.js.map +0 -1
- package/dist/fhir/DataRequirement.d.ts +0 -239
- package/dist/fhir/DataRequirement.js +0 -7
- package/dist/fhir/DataRequirement.js.map +0 -1
- package/dist/fhir/DetectedIssue.d.ts +0 -252
- package/dist/fhir/DetectedIssue.js +0 -7
- package/dist/fhir/DetectedIssue.js.map +0 -1
- package/dist/fhir/Device.d.ts +0 -493
- package/dist/fhir/Device.js +0 -7
- package/dist/fhir/Device.js.map +0 -1
- package/dist/fhir/DeviceDefinition.d.ts +0 -486
- package/dist/fhir/DeviceDefinition.js +0 -7
- package/dist/fhir/DeviceDefinition.js.map +0 -1
- package/dist/fhir/DeviceMetric.d.ts +0 -199
- package/dist/fhir/DeviceMetric.js +0 -7
- package/dist/fhir/DeviceMetric.js.map +0 -1
- package/dist/fhir/DeviceRequest.d.ts +0 -296
- package/dist/fhir/DeviceRequest.js +0 -7
- package/dist/fhir/DeviceRequest.js.map +0 -1
- package/dist/fhir/DeviceUseStatement.d.ts +0 -168
- package/dist/fhir/DeviceUseStatement.js +0 -7
- package/dist/fhir/DeviceUseStatement.js.map +0 -1
- package/dist/fhir/DiagnosticReport.d.ts +0 -254
- package/dist/fhir/DiagnosticReport.js +0 -7
- package/dist/fhir/DiagnosticReport.js.map +0 -1
- package/dist/fhir/Distance.d.ts +0 -47
- package/dist/fhir/Distance.js +0 -7
- package/dist/fhir/Distance.js.map +0 -1
- package/dist/fhir/DocumentManifest.d.ts +0 -196
- package/dist/fhir/DocumentManifest.js +0 -7
- package/dist/fhir/DocumentManifest.js.map +0 -1
- package/dist/fhir/DocumentReference.d.ts +0 -349
- package/dist/fhir/DocumentReference.js +0 -7
- package/dist/fhir/DocumentReference.js.map +0 -1
- package/dist/fhir/Dosage.d.ts +0 -152
- package/dist/fhir/Dosage.js +0 -7
- package/dist/fhir/Dosage.js.map +0 -1
- package/dist/fhir/Duration.d.ts +0 -46
- package/dist/fhir/Duration.js +0 -7
- package/dist/fhir/Duration.js.map +0 -1
- package/dist/fhir/EffectEvidenceSynthesis.d.ts +0 -591
- package/dist/fhir/EffectEvidenceSynthesis.js +0 -7
- package/dist/fhir/EffectEvidenceSynthesis.js.map +0 -1
- package/dist/fhir/Element.d.ts +0 -21
- package/dist/fhir/Element.js +0 -7
- package/dist/fhir/Element.js.map +0 -1
- package/dist/fhir/ElementDefinition.d.ts +0 -2701
- package/dist/fhir/ElementDefinition.js +0 -7
- package/dist/fhir/ElementDefinition.js.map +0 -1
- package/dist/fhir/Encounter.d.ts +0 -558
- package/dist/fhir/Encounter.js +0 -7
- package/dist/fhir/Encounter.js.map +0 -1
- package/dist/fhir/Endpoint.d.ts +0 -140
- package/dist/fhir/Endpoint.js +0 -7
- package/dist/fhir/Endpoint.js.map +0 -1
- package/dist/fhir/EnrollmentRequest.d.ts +0 -113
- package/dist/fhir/EnrollmentRequest.js +0 -7
- package/dist/fhir/EnrollmentRequest.js.map +0 -1
- package/dist/fhir/EnrollmentResponse.d.ts +0 -117
- package/dist/fhir/EnrollmentResponse.js +0 -7
- package/dist/fhir/EnrollmentResponse.js.map +0 -1
- package/dist/fhir/EpisodeOfCare.d.ts +0 -246
- package/dist/fhir/EpisodeOfCare.js +0 -7
- package/dist/fhir/EpisodeOfCare.js.map +0 -1
- package/dist/fhir/EventDefinition.d.ts +0 -253
- package/dist/fhir/EventDefinition.js +0 -7
- package/dist/fhir/EventDefinition.js.map +0 -1
- package/dist/fhir/Evidence.d.ts +0 -252
- package/dist/fhir/Evidence.js +0 -7
- package/dist/fhir/Evidence.js.map +0 -1
- package/dist/fhir/EvidenceVariable.d.ts +0 -370
- package/dist/fhir/EvidenceVariable.js +0 -7
- package/dist/fhir/EvidenceVariable.js.map +0 -1
- package/dist/fhir/ExampleScenario.d.ts +0 -628
- package/dist/fhir/ExampleScenario.js +0 -7
- package/dist/fhir/ExampleScenario.js.map +0 -1
- package/dist/fhir/ExplanationOfBenefit.d.ts +0 -1841
- package/dist/fhir/ExplanationOfBenefit.js +0 -7
- package/dist/fhir/ExplanationOfBenefit.js.map +0 -1
- package/dist/fhir/Expression.d.ts +0 -45
- package/dist/fhir/Expression.js +0 -7
- package/dist/fhir/Expression.js.map +0 -1
- package/dist/fhir/Extension.d.ts +0 -306
- package/dist/fhir/Extension.js +0 -7
- package/dist/fhir/Extension.js.map +0 -1
- package/dist/fhir/FamilyMemberHistory.d.ts +0 -306
- package/dist/fhir/FamilyMemberHistory.js +0 -7
- package/dist/fhir/FamilyMemberHistory.js.map +0 -1
- package/dist/fhir/Flag.d.ts +0 -132
- package/dist/fhir/Flag.js +0 -7
- package/dist/fhir/Flag.js.map +0 -1
- package/dist/fhir/Goal.d.ts +0 -299
- package/dist/fhir/Goal.js +0 -7
- package/dist/fhir/Goal.js.map +0 -1
- package/dist/fhir/GraphDefinition.d.ts +0 -350
- package/dist/fhir/GraphDefinition.js +0 -7
- package/dist/fhir/GraphDefinition.js.map +0 -1
- package/dist/fhir/Group.d.ts +0 -271
- package/dist/fhir/Group.js +0 -7
- package/dist/fhir/Group.js.map +0 -1
- package/dist/fhir/GuidanceResponse.d.ts +0 -196
- package/dist/fhir/GuidanceResponse.js +0 -7
- package/dist/fhir/GuidanceResponse.js.map +0 -1
- package/dist/fhir/HealthcareService.d.ts +0 -356
- package/dist/fhir/HealthcareService.js +0 -7
- package/dist/fhir/HealthcareService.js.map +0 -1
- package/dist/fhir/HumanName.d.ts +0 -58
- package/dist/fhir/HumanName.js +0 -7
- package/dist/fhir/HumanName.js.map +0 -1
- package/dist/fhir/Identifier.d.ts +0 -53
- package/dist/fhir/Identifier.js +0 -7
- package/dist/fhir/Identifier.js.map +0 -1
- package/dist/fhir/ImagingStudy.d.ts +0 -407
- package/dist/fhir/ImagingStudy.js +0 -7
- package/dist/fhir/ImagingStudy.js.map +0 -1
- package/dist/fhir/Immunization.d.ts +0 -444
- package/dist/fhir/Immunization.js +0 -7
- package/dist/fhir/Immunization.js.map +0 -1
- package/dist/fhir/ImmunizationEvaluation.d.ts +0 -149
- package/dist/fhir/ImmunizationEvaluation.js +0 -7
- package/dist/fhir/ImmunizationEvaluation.js.map +0 -1
- package/dist/fhir/ImmunizationRecommendation.d.ts +0 -254
- package/dist/fhir/ImmunizationRecommendation.js +0 -7
- package/dist/fhir/ImmunizationRecommendation.js.map +0 -1
- package/dist/fhir/ImplementationGuide.d.ts +0 -824
- package/dist/fhir/ImplementationGuide.js +0 -7
- package/dist/fhir/ImplementationGuide.js.map +0 -1
- package/dist/fhir/InsurancePlan.d.ts +0 -624
- package/dist/fhir/InsurancePlan.js +0 -7
- package/dist/fhir/InsurancePlan.js.map +0 -1
- package/dist/fhir/Invoice.d.ts +0 -346
- package/dist/fhir/Invoice.js +0 -7
- package/dist/fhir/Invoice.js.map +0 -1
- package/dist/fhir/JsonWebKey.d.ts +0 -99
- package/dist/fhir/JsonWebKey.js +0 -7
- package/dist/fhir/JsonWebKey.js.map +0 -1
- package/dist/fhir/Library.d.ts +0 -277
- package/dist/fhir/Library.js +0 -7
- package/dist/fhir/Library.js.map +0 -1
- package/dist/fhir/Linkage.d.ts +0 -146
- package/dist/fhir/Linkage.js +0 -7
- package/dist/fhir/Linkage.js.map +0 -1
- package/dist/fhir/List.d.ts +0 -200
- package/dist/fhir/List.js +0 -7
- package/dist/fhir/List.js.map +0 -1
- package/dist/fhir/Location.d.ts +0 -277
- package/dist/fhir/Location.js +0 -7
- package/dist/fhir/Location.js.map +0 -1
- package/dist/fhir/Login.d.ts +0 -119
- package/dist/fhir/Login.js +0 -7
- package/dist/fhir/Login.js.map +0 -1
- package/dist/fhir/MarketingStatus.d.ts +0 -82
- package/dist/fhir/MarketingStatus.js +0 -7
- package/dist/fhir/MarketingStatus.js.map +0 -1
- package/dist/fhir/Measure.d.ts +0 -620
- package/dist/fhir/Measure.js +0 -7
- package/dist/fhir/Measure.js.map +0 -1
- package/dist/fhir/MeasureReport.d.ts +0 -463
- package/dist/fhir/MeasureReport.js +0 -7
- package/dist/fhir/MeasureReport.js.map +0 -1
- package/dist/fhir/Media.d.ts +0 -205
- package/dist/fhir/Media.js +0 -7
- package/dist/fhir/Media.js.map +0 -1
- package/dist/fhir/Medication.d.ts +0 -230
- package/dist/fhir/Medication.js +0 -7
- package/dist/fhir/Medication.js.map +0 -1
- package/dist/fhir/MedicationAdministration.d.ts +0 -352
- package/dist/fhir/MedicationAdministration.js +0 -7
- package/dist/fhir/MedicationAdministration.js.map +0 -1
- package/dist/fhir/MedicationDispense.d.ts +0 -343
- package/dist/fhir/MedicationDispense.js +0 -7
- package/dist/fhir/MedicationDispense.js.map +0 -1
- package/dist/fhir/MedicationKnowledge.d.ts +0 -992
- package/dist/fhir/MedicationKnowledge.js +0 -7
- package/dist/fhir/MedicationKnowledge.js.map +0 -1
- package/dist/fhir/MedicationRequest.d.ts +0 -481
- package/dist/fhir/MedicationRequest.js +0 -7
- package/dist/fhir/MedicationRequest.js.map +0 -1
- package/dist/fhir/MedicationStatement.d.ts +0 -228
- package/dist/fhir/MedicationStatement.js +0 -7
- package/dist/fhir/MedicationStatement.js.map +0 -1
- package/dist/fhir/MedicinalProduct.d.ts +0 -453
- package/dist/fhir/MedicinalProduct.js +0 -7
- package/dist/fhir/MedicinalProduct.js.map +0 -1
- package/dist/fhir/MedicinalProductAuthorization.d.ts +0 -271
- package/dist/fhir/MedicinalProductAuthorization.js +0 -7
- package/dist/fhir/MedicinalProductAuthorization.js.map +0 -1
- package/dist/fhir/MedicinalProductContraindication.d.ts +0 -170
- package/dist/fhir/MedicinalProductContraindication.js +0 -7
- package/dist/fhir/MedicinalProductContraindication.js.map +0 -1
- package/dist/fhir/MedicinalProductIndication.d.ts +0 -179
- package/dist/fhir/MedicinalProductIndication.js +0 -7
- package/dist/fhir/MedicinalProductIndication.js.map +0 -1
- package/dist/fhir/MedicinalProductIngredient.d.ts +0 -336
- package/dist/fhir/MedicinalProductIngredient.js +0 -7
- package/dist/fhir/MedicinalProductIngredient.js.map +0 -1
- package/dist/fhir/MedicinalProductInteraction.d.ts +0 -158
- package/dist/fhir/MedicinalProductInteraction.js +0 -7
- package/dist/fhir/MedicinalProductInteraction.js.map +0 -1
- package/dist/fhir/MedicinalProductManufactured.d.ts +0 -113
- package/dist/fhir/MedicinalProductManufactured.js +0 -7
- package/dist/fhir/MedicinalProductManufactured.js.map +0 -1
- package/dist/fhir/MedicinalProductPackaged.d.ts +0 -259
- package/dist/fhir/MedicinalProductPackaged.js +0 -7
- package/dist/fhir/MedicinalProductPackaged.js.map +0 -1
- package/dist/fhir/MedicinalProductPharmaceutical.d.ts +0 -331
- package/dist/fhir/MedicinalProductPharmaceutical.js +0 -7
- package/dist/fhir/MedicinalProductPharmaceutical.js.map +0 -1
- package/dist/fhir/MedicinalProductUndesirableEffect.d.ts +0 -101
- package/dist/fhir/MedicinalProductUndesirableEffect.js +0 -7
- package/dist/fhir/MedicinalProductUndesirableEffect.js.map +0 -1
- package/dist/fhir/MessageDefinition.d.ts +0 -330
- package/dist/fhir/MessageDefinition.js +0 -7
- package/dist/fhir/MessageDefinition.js.map +0 -1
- package/dist/fhir/MessageHeader.d.ts +0 -323
- package/dist/fhir/MessageHeader.js +0 -7
- package/dist/fhir/MessageHeader.js.map +0 -1
- package/dist/fhir/Meta.d.ts +0 -75
- package/dist/fhir/Meta.js +0 -7
- package/dist/fhir/Meta.js.map +0 -1
- package/dist/fhir/MolecularSequence.d.ts +0 -760
- package/dist/fhir/MolecularSequence.js +0 -7
- package/dist/fhir/MolecularSequence.js.map +0 -1
- package/dist/fhir/Money.d.ts +0 -29
- package/dist/fhir/Money.js +0 -7
- package/dist/fhir/Money.js.map +0 -1
- package/dist/fhir/NamingSystem.d.ts +0 -218
- package/dist/fhir/NamingSystem.js +0 -7
- package/dist/fhir/NamingSystem.js.map +0 -1
- package/dist/fhir/Narrative.d.ts +0 -32
- package/dist/fhir/Narrative.js +0 -7
- package/dist/fhir/Narrative.js.map +0 -1
- package/dist/fhir/NutritionOrder.d.ts +0 -566
- package/dist/fhir/NutritionOrder.js +0 -7
- package/dist/fhir/NutritionOrder.js.map +0 -1
- package/dist/fhir/Observation.d.ts +0 -520
- package/dist/fhir/Observation.js +0 -7
- package/dist/fhir/Observation.js.map +0 -1
- package/dist/fhir/ObservationDefinition.d.ts +0 -278
- package/dist/fhir/ObservationDefinition.js +0 -7
- package/dist/fhir/ObservationDefinition.js.map +0 -1
- package/dist/fhir/OperationDefinition.d.ts +0 -468
- package/dist/fhir/OperationDefinition.js +0 -7
- package/dist/fhir/OperationDefinition.js.map +0 -1
- package/dist/fhir/OperationOutcome.d.ts +0 -160
- package/dist/fhir/OperationOutcome.js +0 -7
- package/dist/fhir/OperationOutcome.js.map +0 -1
- package/dist/fhir/Organization.d.ts +0 -184
- package/dist/fhir/Organization.js +0 -7
- package/dist/fhir/Organization.js.map +0 -1
- package/dist/fhir/OrganizationAffiliation.d.ts +0 -145
- package/dist/fhir/OrganizationAffiliation.js +0 -7
- package/dist/fhir/OrganizationAffiliation.js.map +0 -1
- package/dist/fhir/ParameterDefinition.d.ts +0 -57
- package/dist/fhir/ParameterDefinition.js +0 -7
- package/dist/fhir/ParameterDefinition.js.map +0 -1
- package/dist/fhir/Parameters.d.ts +0 -319
- package/dist/fhir/Parameters.js +0 -7
- package/dist/fhir/Parameters.js.map +0 -1
- package/dist/fhir/PasswordChangeRequest.d.ts +0 -51
- package/dist/fhir/PasswordChangeRequest.js +0 -7
- package/dist/fhir/PasswordChangeRequest.js.map +0 -1
- package/dist/fhir/Patient.d.ts +0 -342
- package/dist/fhir/Patient.js +0 -7
- package/dist/fhir/Patient.js.map +0 -1
- package/dist/fhir/PaymentNotice.d.ts +0 -135
- package/dist/fhir/PaymentNotice.js +0 -7
- package/dist/fhir/PaymentNotice.js.map +0 -1
- package/dist/fhir/PaymentReconciliation.d.ts +0 -280
- package/dist/fhir/PaymentReconciliation.js +0 -7
- package/dist/fhir/PaymentReconciliation.js.map +0 -1
- package/dist/fhir/Period.d.ts +0 -32
- package/dist/fhir/Period.js +0 -7
- package/dist/fhir/Period.js.map +0 -1
- package/dist/fhir/Person.d.ts +0 -175
- package/dist/fhir/Person.js +0 -7
- package/dist/fhir/Person.js.map +0 -1
- package/dist/fhir/PlanDefinition.d.ts +0 -837
- package/dist/fhir/PlanDefinition.js +0 -7
- package/dist/fhir/PlanDefinition.js.map +0 -1
- package/dist/fhir/Population.d.ts +0 -62
- package/dist/fhir/Population.js +0 -7
- package/dist/fhir/Population.js.map +0 -1
- package/dist/fhir/Practitioner.d.ts +0 -191
- package/dist/fhir/Practitioner.js +0 -7
- package/dist/fhir/Practitioner.js.map +0 -1
- package/dist/fhir/PractitionerRole.d.ts +0 -259
- package/dist/fhir/PractitionerRole.js +0 -7
- package/dist/fhir/PractitionerRole.js.map +0 -1
- package/dist/fhir/Procedure.d.ts +0 -372
- package/dist/fhir/Procedure.js +0 -7
- package/dist/fhir/Procedure.js.map +0 -1
- package/dist/fhir/ProdCharacteristic.d.ts +0 -112
- package/dist/fhir/ProdCharacteristic.js +0 -7
- package/dist/fhir/ProdCharacteristic.js.map +0 -1
- package/dist/fhir/ProductShelfLife.d.ts +0 -70
- package/dist/fhir/ProductShelfLife.js +0 -7
- package/dist/fhir/ProductShelfLife.js.map +0 -1
- package/dist/fhir/Project.d.ts +0 -43
- package/dist/fhir/Project.js +0 -7
- package/dist/fhir/Project.js.map +0 -1
- package/dist/fhir/ProjectMembership.d.ts +0 -66
- package/dist/fhir/ProjectMembership.js +0 -7
- package/dist/fhir/ProjectMembership.js.map +0 -1
- package/dist/fhir/Provenance.d.ts +0 -258
- package/dist/fhir/Provenance.js +0 -7
- package/dist/fhir/Provenance.js.map +0 -1
- package/dist/fhir/Quantity.d.ts +0 -46
- package/dist/fhir/Quantity.js +0 -7
- package/dist/fhir/Quantity.js.map +0 -1
- package/dist/fhir/Questionnaire.d.ts +0 -603
- package/dist/fhir/Questionnaire.js +0 -7
- package/dist/fhir/Questionnaire.js.map +0 -1
- package/dist/fhir/QuestionnaireResponse.d.ts +0 -313
- package/dist/fhir/QuestionnaireResponse.js +0 -7
- package/dist/fhir/QuestionnaireResponse.js.map +0 -1
- package/dist/fhir/Range.d.ts +0 -30
- package/dist/fhir/Range.js +0 -7
- package/dist/fhir/Range.js.map +0 -1
- package/dist/fhir/Ratio.d.ts +0 -30
- package/dist/fhir/Ratio.js +0 -7
- package/dist/fhir/Ratio.js.map +0 -1
- package/dist/fhir/Reference.d.ts +0 -67
- package/dist/fhir/Reference.js +0 -7
- package/dist/fhir/Reference.js.map +0 -1
- package/dist/fhir/RefreshToken.d.ts +0 -45
- package/dist/fhir/RefreshToken.js +0 -7
- package/dist/fhir/RefreshToken.js.map +0 -1
- package/dist/fhir/RelatedArtifact.d.ts +0 -57
- package/dist/fhir/RelatedArtifact.js +0 -7
- package/dist/fhir/RelatedArtifact.js.map +0 -1
- package/dist/fhir/RelatedPerson.d.ts +0 -190
- package/dist/fhir/RelatedPerson.js +0 -7
- package/dist/fhir/RelatedPerson.js.map +0 -1
- package/dist/fhir/RequestGroup.d.ts +0 -434
- package/dist/fhir/RequestGroup.js +0 -7
- package/dist/fhir/RequestGroup.js.map +0 -1
- package/dist/fhir/ResearchDefinition.d.ts +0 -291
- package/dist/fhir/ResearchDefinition.js +0 -7
- package/dist/fhir/ResearchDefinition.js.map +0 -1
- package/dist/fhir/ResearchElementDefinition.d.ts +0 -431
- package/dist/fhir/ResearchElementDefinition.js +0 -7
- package/dist/fhir/ResearchElementDefinition.js.map +0 -1
- package/dist/fhir/ResearchStudy.d.ts +0 -318
- package/dist/fhir/ResearchStudy.js +0 -7
- package/dist/fhir/ResearchStudy.js.map +0 -1
- package/dist/fhir/ResearchSubject.d.ts +0 -119
- package/dist/fhir/ResearchSubject.js +0 -7
- package/dist/fhir/ResearchSubject.js.map +0 -1
- package/dist/fhir/Resource.d.ts +0 -156
- package/dist/fhir/Resource.js +0 -7
- package/dist/fhir/Resource.js.map +0 -1
- package/dist/fhir/RiskAssessment.d.ts +0 -246
- package/dist/fhir/RiskAssessment.js +0 -7
- package/dist/fhir/RiskAssessment.js.map +0 -1
- package/dist/fhir/RiskEvidenceSynthesis.d.ts +0 -530
- package/dist/fhir/RiskEvidenceSynthesis.js +0 -7
- package/dist/fhir/RiskEvidenceSynthesis.js.map +0 -1
- package/dist/fhir/SampledData.d.ts +0 -62
- package/dist/fhir/SampledData.js +0 -7
- package/dist/fhir/SampledData.js.map +0 -1
- package/dist/fhir/Schedule.d.ts +0 -129
- package/dist/fhir/Schedule.js +0 -7
- package/dist/fhir/Schedule.js.map +0 -1
- package/dist/fhir/SearchParameter.d.ts +0 -277
- package/dist/fhir/SearchParameter.js +0 -7
- package/dist/fhir/SearchParameter.js.map +0 -1
- package/dist/fhir/ServiceRequest.d.ts +0 -309
- package/dist/fhir/ServiceRequest.js +0 -7
- package/dist/fhir/ServiceRequest.js.map +0 -1
- package/dist/fhir/Signature.d.ts +0 -71
- package/dist/fhir/Signature.js +0 -7
- package/dist/fhir/Signature.js.map +0 -1
- package/dist/fhir/Slot.d.ts +0 -134
- package/dist/fhir/Slot.js +0 -7
- package/dist/fhir/Slot.js.map +0 -1
- package/dist/fhir/Specimen.d.ts +0 -366
- package/dist/fhir/Specimen.js +0 -7
- package/dist/fhir/Specimen.js.map +0 -1
- package/dist/fhir/SpecimenDefinition.d.ts +0 -363
- package/dist/fhir/SpecimenDefinition.js +0 -7
- package/dist/fhir/SpecimenDefinition.js.map +0 -1
- package/dist/fhir/StructureDefinition.d.ts +0 -438
- package/dist/fhir/StructureDefinition.js +0 -7
- package/dist/fhir/StructureDefinition.js.map +0 -1
- package/dist/fhir/StructureMap.d.ts +0 -904
- package/dist/fhir/StructureMap.js +0 -7
- package/dist/fhir/StructureMap.js.map +0 -1
- package/dist/fhir/Subscription.d.ts +0 -172
- package/dist/fhir/Subscription.js +0 -7
- package/dist/fhir/Subscription.js.map +0 -1
- package/dist/fhir/Substance.d.ts +0 -213
- package/dist/fhir/Substance.js +0 -7
- package/dist/fhir/Substance.js.map +0 -1
- package/dist/fhir/SubstanceAmount.d.ts +0 -115
- package/dist/fhir/SubstanceAmount.js +0 -7
- package/dist/fhir/SubstanceAmount.js.map +0 -1
- package/dist/fhir/SubstanceNucleicAcid.d.ts +0 -309
- package/dist/fhir/SubstanceNucleicAcid.js +0 -7
- package/dist/fhir/SubstanceNucleicAcid.js.map +0 -1
- package/dist/fhir/SubstancePolymer.d.ts +0 -405
- package/dist/fhir/SubstancePolymer.js +0 -7
- package/dist/fhir/SubstancePolymer.js.map +0 -1
- package/dist/fhir/SubstanceProtein.d.ts +0 -218
- package/dist/fhir/SubstanceProtein.js +0 -7
- package/dist/fhir/SubstanceProtein.js.map +0 -1
- package/dist/fhir/SubstanceReferenceInformation.d.ts +0 -330
- package/dist/fhir/SubstanceReferenceInformation.js +0 -7
- package/dist/fhir/SubstanceReferenceInformation.js.map +0 -1
- package/dist/fhir/SubstanceSourceMaterial.d.ts +0 -521
- package/dist/fhir/SubstanceSourceMaterial.js +0 -7
- package/dist/fhir/SubstanceSourceMaterial.js.map +0 -1
- package/dist/fhir/SubstanceSpecification.d.ts +0 -827
- package/dist/fhir/SubstanceSpecification.js +0 -7
- package/dist/fhir/SubstanceSpecification.js.map +0 -1
- package/dist/fhir/SupplyDelivery.d.ts +0 -205
- package/dist/fhir/SupplyDelivery.js +0 -7
- package/dist/fhir/SupplyDelivery.js.map +0 -1
- package/dist/fhir/SupplyRequest.d.ts +0 -237
- package/dist/fhir/SupplyRequest.js +0 -7
- package/dist/fhir/SupplyRequest.js.map +0 -1
- package/dist/fhir/Task.d.ts +0 -807
- package/dist/fhir/Task.js +0 -7
- package/dist/fhir/Task.js.map +0 -1
- package/dist/fhir/TerminologyCapabilities.d.ts +0 -716
- package/dist/fhir/TerminologyCapabilities.js +0 -7
- package/dist/fhir/TerminologyCapabilities.js.map +0 -1
- package/dist/fhir/TestReport.d.ts +0 -549
- package/dist/fhir/TestReport.js +0 -7
- package/dist/fhir/TestReport.js.map +0 -1
- package/dist/fhir/TestScript.d.ts +0 -1184
- package/dist/fhir/TestScript.js +0 -7
- package/dist/fhir/TestScript.js.map +0 -1
- package/dist/fhir/Timing.d.ts +0 -178
- package/dist/fhir/Timing.js +0 -7
- package/dist/fhir/Timing.js.map +0 -1
- package/dist/fhir/TriggerDefinition.d.ts +0 -65
- package/dist/fhir/TriggerDefinition.js +0 -7
- package/dist/fhir/TriggerDefinition.js.map +0 -1
- package/dist/fhir/UsageContext.d.ts +0 -61
- package/dist/fhir/UsageContext.js +0 -7
- package/dist/fhir/UsageContext.js.map +0 -1
- package/dist/fhir/User.d.ts +0 -45
- package/dist/fhir/User.js +0 -7
- package/dist/fhir/User.js.map +0 -1
- package/dist/fhir/ValueSet.d.ts +0 -725
- package/dist/fhir/ValueSet.js +0 -7
- package/dist/fhir/ValueSet.js.map +0 -1
- package/dist/fhir/VerificationResult.d.ts +0 -340
- package/dist/fhir/VerificationResult.js +0 -7
- package/dist/fhir/VerificationResult.js.map +0 -1
- package/dist/fhir/VisionPrescription.d.ts +0 -264
- package/dist/fhir/VisionPrescription.js +0 -7
- package/dist/fhir/VisionPrescription.js.map +0 -1
- package/dist/fhir/index.d.ts +0 -196
- package/dist/fhir/index.js +0 -213
- package/dist/fhir/index.js.map +0 -1
- package/dist/fhirpath/functions.d.ts +0 -6
- package/dist/fhirpath/functions.js +0 -349
- package/dist/fhirpath/functions.js.map +0 -1
- package/dist/fhirpath/index.d.ts +0 -2
- package/dist/fhirpath/index.js +0 -15
- package/dist/fhirpath/index.js.map +0 -1
- package/dist/fhirpath/parse.d.ts +0 -10
- package/dist/fhirpath/parse.js +0 -266
- package/dist/fhirpath/parse.js.map +0 -1
- package/dist/fhirpath/tokenize.d.ts +0 -13
- package/dist/fhirpath/tokenize.js +0 -39
- package/dist/fhirpath/tokenize.js.map +0 -1
- package/dist/fhirpath/utils.d.ts +0 -13
- package/dist/fhirpath/utils.js +0 -34
- package/dist/fhirpath/utils.js.map +0 -1
- package/dist/format.js +0 -56
- package/dist/format.js.map +0 -1
- package/dist/index.js +0 -22
- package/dist/index.js.map +0 -1
- package/dist/jwt.d.ts +0 -5
- package/dist/jwt.js +0 -28
- package/dist/jwt.js.map +0 -1
- package/dist/outcomes.js +0 -140
- package/dist/outcomes.js.map +0 -1
- package/dist/search.js +0 -120
- package/dist/search.js.map +0 -1
- package/dist/searchparams.js +0 -129
- package/dist/searchparams.js.map +0 -1
- package/dist/storage.js +0 -90
- package/dist/storage.js.map +0 -1
- package/dist/types.js +0 -171
- package/dist/types.js.map +0 -1
- package/dist/utils.js +0 -234
- package/dist/utils.js.map +0 -1
package/dist/outcomes.js
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OperationOutcomeError = exports.assertOk = exports.getStatus = exports.isGone = exports.isNotFound = exports.isOk = exports.badRequest = exports.accessDenied = exports.gone = exports.notFound = exports.notModified = exports.created = exports.allOk = void 0;
|
|
4
|
-
const OK_ID = 'ok';
|
|
5
|
-
const CREATED_ID = 'created';
|
|
6
|
-
const GONE_ID = 'gone';
|
|
7
|
-
const NOT_MODIFIED_ID = 'not-modified';
|
|
8
|
-
const NOT_FOUND_ID = 'not-found';
|
|
9
|
-
const ACCESS_DENIED = 'access-denied';
|
|
10
|
-
exports.allOk = {
|
|
11
|
-
resourceType: 'OperationOutcome',
|
|
12
|
-
id: OK_ID,
|
|
13
|
-
issue: [{
|
|
14
|
-
severity: 'information',
|
|
15
|
-
code: 'information',
|
|
16
|
-
details: {
|
|
17
|
-
text: 'All OK'
|
|
18
|
-
}
|
|
19
|
-
}]
|
|
20
|
-
};
|
|
21
|
-
exports.created = {
|
|
22
|
-
resourceType: 'OperationOutcome',
|
|
23
|
-
id: CREATED_ID,
|
|
24
|
-
issue: [{
|
|
25
|
-
severity: 'information',
|
|
26
|
-
code: 'information',
|
|
27
|
-
details: {
|
|
28
|
-
text: 'Created'
|
|
29
|
-
}
|
|
30
|
-
}]
|
|
31
|
-
};
|
|
32
|
-
exports.notModified = {
|
|
33
|
-
resourceType: 'OperationOutcome',
|
|
34
|
-
id: NOT_MODIFIED_ID,
|
|
35
|
-
issue: [{
|
|
36
|
-
severity: 'information',
|
|
37
|
-
code: 'information',
|
|
38
|
-
details: {
|
|
39
|
-
text: 'Not Modified'
|
|
40
|
-
}
|
|
41
|
-
}]
|
|
42
|
-
};
|
|
43
|
-
exports.notFound = {
|
|
44
|
-
resourceType: 'OperationOutcome',
|
|
45
|
-
id: NOT_FOUND_ID,
|
|
46
|
-
issue: [{
|
|
47
|
-
severity: 'error',
|
|
48
|
-
code: 'not-found',
|
|
49
|
-
details: {
|
|
50
|
-
text: 'Not found'
|
|
51
|
-
}
|
|
52
|
-
}]
|
|
53
|
-
};
|
|
54
|
-
exports.gone = {
|
|
55
|
-
resourceType: 'OperationOutcome',
|
|
56
|
-
id: GONE_ID,
|
|
57
|
-
issue: [{
|
|
58
|
-
severity: 'error',
|
|
59
|
-
code: 'gone',
|
|
60
|
-
details: {
|
|
61
|
-
text: 'Gone'
|
|
62
|
-
}
|
|
63
|
-
}]
|
|
64
|
-
};
|
|
65
|
-
exports.accessDenied = {
|
|
66
|
-
resourceType: 'OperationOutcome',
|
|
67
|
-
id: ACCESS_DENIED,
|
|
68
|
-
issue: [{
|
|
69
|
-
severity: 'error',
|
|
70
|
-
code: 'access-denied',
|
|
71
|
-
details: {
|
|
72
|
-
text: 'Access Denied'
|
|
73
|
-
}
|
|
74
|
-
}]
|
|
75
|
-
};
|
|
76
|
-
function badRequest(details, expression) {
|
|
77
|
-
return {
|
|
78
|
-
resourceType: 'OperationOutcome',
|
|
79
|
-
issue: [{
|
|
80
|
-
severity: 'error',
|
|
81
|
-
code: 'invalid',
|
|
82
|
-
details: {
|
|
83
|
-
text: details
|
|
84
|
-
},
|
|
85
|
-
expression: (expression ? [expression] : undefined)
|
|
86
|
-
}]
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
exports.badRequest = badRequest;
|
|
90
|
-
function isOk(outcome) {
|
|
91
|
-
return outcome.id === OK_ID || outcome.id === CREATED_ID || outcome.id === NOT_MODIFIED_ID;
|
|
92
|
-
}
|
|
93
|
-
exports.isOk = isOk;
|
|
94
|
-
function isNotFound(outcome) {
|
|
95
|
-
return outcome.id === NOT_FOUND_ID;
|
|
96
|
-
}
|
|
97
|
-
exports.isNotFound = isNotFound;
|
|
98
|
-
function isGone(outcome) {
|
|
99
|
-
return outcome.id === GONE_ID;
|
|
100
|
-
}
|
|
101
|
-
exports.isGone = isGone;
|
|
102
|
-
function getStatus(outcome) {
|
|
103
|
-
if (outcome.id === OK_ID) {
|
|
104
|
-
return 200;
|
|
105
|
-
}
|
|
106
|
-
else if (outcome.id === CREATED_ID) {
|
|
107
|
-
return 201;
|
|
108
|
-
}
|
|
109
|
-
else if (outcome.id === NOT_MODIFIED_ID) {
|
|
110
|
-
return 304;
|
|
111
|
-
}
|
|
112
|
-
else if (outcome.id === ACCESS_DENIED) {
|
|
113
|
-
return 403;
|
|
114
|
-
}
|
|
115
|
-
else if (outcome.id === NOT_FOUND_ID) {
|
|
116
|
-
return 404;
|
|
117
|
-
}
|
|
118
|
-
else if (outcome.id === GONE_ID) {
|
|
119
|
-
return 410;
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
return 400;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
exports.getStatus = getStatus;
|
|
126
|
-
function assertOk(outcome) {
|
|
127
|
-
if (!isOk(outcome)) {
|
|
128
|
-
throw new OperationOutcomeError(outcome);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
exports.assertOk = assertOk;
|
|
132
|
-
class OperationOutcomeError extends Error {
|
|
133
|
-
constructor(outcome) {
|
|
134
|
-
var _a, _b;
|
|
135
|
-
super((_b = (_a = outcome === null || outcome === void 0 ? void 0 : outcome.issue) === null || _a === void 0 ? void 0 : _a[0].details) === null || _b === void 0 ? void 0 : _b.text);
|
|
136
|
-
this.outcome = outcome;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
exports.OperationOutcomeError = OperationOutcomeError;
|
|
140
|
-
//# sourceMappingURL=outcomes.js.map
|
package/dist/outcomes.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"outcomes.js","sourceRoot":"","sources":["../src/outcomes.ts"],"names":[],"mappings":";;;AAEA,MAAM,KAAK,GAAG,IAAI,CAAC;AACnB,MAAM,UAAU,GAAG,SAAS,CAAC;AAC7B,MAAM,OAAO,GAAG,MAAM,CAAC;AACvB,MAAM,eAAe,GAAG,cAAc,CAAC;AACvC,MAAM,YAAY,GAAG,WAAW,CAAC;AACjC,MAAM,aAAa,GAAG,eAAe,CAAC;AAEzB,QAAA,KAAK,GAAqB;IACrC,YAAY,EAAE,kBAAkB;IAChC,EAAE,EAAE,KAAK;IACT,KAAK,EAAE,CAAC;YACN,QAAQ,EAAE,aAAa;YACvB,IAAI,EAAE,aAAa;YACnB,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;aACf;SACF,CAAC;CACH,CAAC;AAEW,QAAA,OAAO,GAAqB;IACvC,YAAY,EAAE,kBAAkB;IAChC,EAAE,EAAE,UAAU;IACd,KAAK,EAAE,CAAC;YACN,QAAQ,EAAE,aAAa;YACvB,IAAI,EAAE,aAAa;YACnB,OAAO,EAAE;gBACP,IAAI,EAAE,SAAS;aAChB;SACF,CAAC;CACH,CAAC;AAEW,QAAA,WAAW,GAAqB;IAC3C,YAAY,EAAE,kBAAkB;IAChC,EAAE,EAAE,eAAe;IACnB,KAAK,EAAE,CAAC;YACN,QAAQ,EAAE,aAAa;YACvB,I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{ OperationOutcome } from './fhir';\n\nconst OK_ID = 'ok';\nconst CREATED_ID = 'created';\nconst GONE_ID = 'gone';\nconst NOT_MODIFIED_ID = 'not-modified';\nconst NOT_FOUND_ID = 'not-found';\nconst ACCESS_DENIED = 'access-denied';\n\nexport const allOk: OperationOutcome = {\n resourceType: 'OperationOutcome',\n id: OK_ID,\n issue: [{\n severity: 'information',\n code: 'information',\n details: {\n text: 'All OK'\n }\n }]\n};\n\nexport const created: OperationOutcome = {\n resourceType: 'OperationOutcome',\n id: CREATED_ID,\n issue: [{\n severity: 'information',\n code: 'information',\n details: {\n text: 'Created'\n }\n }]\n};\n\nexport const notModified: OperationOutcome = {\n resourceType: 'OperationOutcome',\n id: NOT_MODIFIED_ID,\n issue: [{\n severity: 'information',\n code: 'information',\n details: {\n text: 'Not Modified'\n }\n }]\n};\n\nexport const notFound: OperationOutcome = {\n resourceType: 'OperationOutcome',\n id: NOT_FOUND_ID,\n issue: [{\n severity: 'error',\n code: 'not-found',\n details: {\n text: 'Not found'\n }\n }]\n};\n\nexport const gone: OperationOutcome = {\n resourceType: 'OperationOutcome',\n id: GONE_ID,\n issue: [{\n severity: 'error',\n code: 'gone',\n details: {\n text: 'Gone'\n }\n }]\n};\n\nexport const accessDenied: OperationOutcome = {\n resourceType: 'OperationOutcome',\n id: ACCESS_DENIED,\n issue: [{\n severity: 'error',\n code: 'access-denied',\n details: {\n text: 'Access Denied'\n }\n }]\n}\n\nexport function badRequest(details: string, expression?: string): OperationOutcome {\n return {\n resourceType: 'OperationOutcome',\n issue: [{\n severity: 'error',\n code: 'invalid',\n details: {\n text: details\n },\n expression: (expression ? [expression] : undefined)\n }]\n };\n}\n\nexport function isOk(outcome: OperationOutcome): boolean {\n return outcome.id === OK_ID || outcome.id === CREATED_ID || outcome.id === NOT_MODIFIED_ID;\n}\n\nexport function isNotFound(outcome: OperationOutcome): boolean {\n return outcome.id === NOT_FOUND_ID;\n}\n\nexport function isGone(outcome: OperationOutcome): boolean {\n return outcome.id === GONE_ID;\n}\n\nexport function getStatus(outcome: OperationOutcome): number {\n if (outcome.id === OK_ID) {\n return 200;\n } else if (outcome.id === CREATED_ID) {\n return 201;\n } else if (outcome.id === NOT_MODIFIED_ID) {\n return 304;\n } else if (outcome.id === ACCESS_DENIED) {\n return 403;\n } else if (outcome.id === NOT_FOUND_ID) {\n return 404;\n } else if (outcome.id === GONE_ID) {\n return 410;\n } else {\n return 400;\n }\n}\n\nexport function assertOk(outcome: OperationOutcome): void {\n if (!isOk(outcome)) {\n throw new OperationOutcomeError(outcome);\n }\n}\n\nexport class OperationOutcomeError extends Error {\n readonly outcome: OperationOutcome;\n\n constructor(outcome: OperationOutcome) {\n super(outcome?.issue?.[0].details?.text);\n this.outcome = outcome;\n }\n}\n"]}
|
package/dist/search.js
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatSearchQuery = exports.parseSearchDefinition = exports.Operator = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Search operators.
|
|
6
|
-
* These operators represent "modifiers" and "prefixes" in FHIR search.
|
|
7
|
-
* See: https://www.hl7.org/fhir/search.html
|
|
8
|
-
*/
|
|
9
|
-
var Operator;
|
|
10
|
-
(function (Operator) {
|
|
11
|
-
Operator["EQUALS"] = "eq";
|
|
12
|
-
Operator["NOT_EQUALS"] = "ne";
|
|
13
|
-
// Numbers
|
|
14
|
-
Operator["GREATER_THAN"] = "gt";
|
|
15
|
-
Operator["LESS_THAN"] = "lt";
|
|
16
|
-
Operator["GREATER_THAN_OR_EQUALS"] = "ge";
|
|
17
|
-
Operator["LESS_THAN_OR_EQUALS"] = "le";
|
|
18
|
-
// Dates
|
|
19
|
-
Operator["STARTS_AFTER"] = "sa";
|
|
20
|
-
Operator["ENDS_BEFORE"] = "eb";
|
|
21
|
-
Operator["APPROXIMATELY"] = "ap";
|
|
22
|
-
// String
|
|
23
|
-
Operator["CONTAINS"] = "contains";
|
|
24
|
-
Operator["EXACT"] = "exact";
|
|
25
|
-
// Token
|
|
26
|
-
Operator["TEXT"] = "text";
|
|
27
|
-
Operator["ABOVE"] = "above";
|
|
28
|
-
Operator["BELOW"] = "below";
|
|
29
|
-
Operator["IN"] = "in";
|
|
30
|
-
Operator["NOT_IN"] = "not-in";
|
|
31
|
-
Operator["OF_TYPE"] = "of-type";
|
|
32
|
-
})(Operator = exports.Operator || (exports.Operator = {}));
|
|
33
|
-
/**
|
|
34
|
-
* Parses a URL into a SearchRequest.
|
|
35
|
-
* @param location The URL to parse.
|
|
36
|
-
* @returns Parsed search definition.
|
|
37
|
-
*/
|
|
38
|
-
function parseSearchDefinition(location) {
|
|
39
|
-
const resourceType = location.pathname.split('/').pop();
|
|
40
|
-
const params = new URLSearchParams(location.search);
|
|
41
|
-
const filters = [];
|
|
42
|
-
const sortRules = [];
|
|
43
|
-
let fields;
|
|
44
|
-
let page = 0;
|
|
45
|
-
let count = 10;
|
|
46
|
-
params.forEach((value, key) => {
|
|
47
|
-
if (key === '_fields') {
|
|
48
|
-
fields = value.split(',');
|
|
49
|
-
}
|
|
50
|
-
else if (key === '_sort') {
|
|
51
|
-
if (value.startsWith('-')) {
|
|
52
|
-
sortRules.push({ code: value.substr(1), descending: true });
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
sortRules.push({ code: value });
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
else if (key === '_page') {
|
|
59
|
-
page = parseInt(value);
|
|
60
|
-
}
|
|
61
|
-
else if (key === '_count') {
|
|
62
|
-
count = parseInt(value);
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
filters.push({
|
|
66
|
-
code: key,
|
|
67
|
-
operator: Operator.EQUALS,
|
|
68
|
-
value: value
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
return {
|
|
73
|
-
resourceType,
|
|
74
|
-
filters,
|
|
75
|
-
fields,
|
|
76
|
-
page,
|
|
77
|
-
count,
|
|
78
|
-
sortRules
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
exports.parseSearchDefinition = parseSearchDefinition;
|
|
82
|
-
/**
|
|
83
|
-
* Formats a search definition object into a query string.
|
|
84
|
-
* Note: The return value does not include the resource type.
|
|
85
|
-
* @param {!SearchRequest} definition The search definition.
|
|
86
|
-
* @returns Formatted URL.
|
|
87
|
-
*/
|
|
88
|
-
function formatSearchQuery(definition) {
|
|
89
|
-
const params = [];
|
|
90
|
-
if (definition.fields) {
|
|
91
|
-
params.push('_fields=' + definition.fields.join(','));
|
|
92
|
-
}
|
|
93
|
-
if (definition.filters) {
|
|
94
|
-
definition.filters.forEach(filter => {
|
|
95
|
-
params.push(filter.code + '=' + filter.value);
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
if (definition.sortRules) {
|
|
99
|
-
params.push(formatSortRules(definition.sortRules));
|
|
100
|
-
}
|
|
101
|
-
if (definition.page && definition.page > 0) {
|
|
102
|
-
params.push('_page=' + definition.page);
|
|
103
|
-
}
|
|
104
|
-
if (definition.count && definition.count > 0) {
|
|
105
|
-
params.push('_count=' + definition.count);
|
|
106
|
-
}
|
|
107
|
-
if (params.length === 0) {
|
|
108
|
-
return '';
|
|
109
|
-
}
|
|
110
|
-
params.sort();
|
|
111
|
-
return '?' + params.join('&');
|
|
112
|
-
}
|
|
113
|
-
exports.formatSearchQuery = formatSearchQuery;
|
|
114
|
-
function formatSortRules(sortRules) {
|
|
115
|
-
if (!sortRules || sortRules.length === 0) {
|
|
116
|
-
return '';
|
|
117
|
-
}
|
|
118
|
-
return '_sort=' + sortRules.map(sr => sr.descending ? '-' + sr.code : sr.code).join(',');
|
|
119
|
-
}
|
|
120
|
-
//# sourceMappingURL=search.js.map
|
package/dist/search.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","sourceRoot":"","sources":["../src/search.ts"],"names":[],"mappings":";;;AAwBA;;;;GAIG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AG,CAAC,EAAE;QAC1C,MAAM,CAAC,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;KACzC;IAED,IAAI,UAAU,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,GAAG,CAAC,EAAE;QAC5C,MAAM,CAAC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;KAC3C;IAED,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;QACvB,OAAO,EAAE,CAAC;KACX;IAED,MAAM,CAAC,IAAI,EAAE,CAAC;IACd,OAAO,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAChC,CAAC;AA/BD,8CA+BC;AAED,SAAS,eAAe,CAAC,SAAiC;IACxD,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;QACxC,OAAO,EAAE,CAAC;KACX;IACD,OAAO,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC3F,CAAC","sourcesContent":["\nexport interface SearchRequest {\n readonly resourceType: string;\n readonly filters?: Filter[];\n readonly sortRules?: SortRule[];\n readonly page?: number;\n readonly count?: number;\n readonly fields?: string[];\n readonly name?: string;\n}\n\nexport interface Filter {\n code: string;\n operator: Operator;\n value: string;\n unitSystem?: string;\n unitCode?: string;\n}\n\nexport interface SortRule {\n code: string;\n descending?: boolean;\n}\n\n/**\n * Search operators.\n * These operators represent \"modifiers\" and \"prefixes\" in FHIR search.\n * See: https://www.hl7.org/fhir/search.html\n */\nexport enum Operator {\n EQUALS = 'eq',\n NOT_EQUALS = 'ne',\n\n // Numbers\n GREATER_THAN = 'gt',\n LESS_THAN = 'lt',\n GREATER_THAN_OR_EQUALS = 'ge',\n LESS_THAN_OR_EQUALS = 'le',\n\n // Dates\n STARTS_AFTER = 'sa',\n ENDS_BEFORE = 'eb',\n APPROXIMATELY = 'ap',\n\n // String\n CONTAINS = 'contains',\n EXACT = 'exact',\n\n // Token\n TEXT = 'text',\n ABOVE = 'above',\n BELOW = 'below',\n IN = 'in',\n NOT_IN = 'not-in',\n OF_TYPE = 'of-type',\n}\n\n\n/**\n * Parses a URL into a SearchRequest.\n * @param location The URL to parse.\n * @returns Parsed search definition.\n */\nexport function parseSearchDefinition(location: { pathname: string, search?: string }): SearchRequest {\n const resourceType = location.pathname.split('/').pop() as string;\n const params = new URLSearchParams(location.search);\n const filters: Filter[] = [];\n const sortRules: SortRule[] = [];\n let fields;\n let page = 0;\n let count = 10;\n\n params.forEach((value, key) => {\n if (key === '_fields') {\n fields = value.split(',');\n } else if (key === '_sort') {\n if (value.startsWith('-')) {\n sortRules.push({ code: value.substr(1), descending: true });\n } else {\n sortRules.push({ code: value });\n }\n } else if (key === '_page') {\n page = parseInt(value);\n } else if (key === '_count') {\n count = parseInt(value);\n } else {\n filters.push({\n code: key,\n operator: Operator.EQUALS,\n value: value\n });\n }\n });\n\n return {\n resourceType,\n filters,\n fields,\n page,\n count,\n sortRules\n };\n}\n\n/**\n * Formats a search definition object into a query string.\n * Note: The return value does not include the resource type.\n * @param {!SearchRequest} definition The search definition.\n * @returns Formatted URL.\n */\nexport function formatSearchQuery(definition: SearchRequest): string {\n const params: string[] = [];\n\n if (definition.fields) {\n params.push('_fields=' + definition.fields.join(','));\n }\n\n if (definition.filters) {\n definition.filters.forEach(filter => {\n params.push(filter.code + '=' + filter.value);\n });\n }\n\n if (definition.sortRules) {\n params.push(formatSortRules(definition.sortRules));\n }\n\n if (definition.page && definition.page > 0) {\n params.push('_page=' + definition.page);\n }\n\n if (definition.count && definition.count > 0) {\n params.push('_count=' + definition.count);\n }\n\n if (params.length === 0) {\n return '';\n }\n\n params.sort();\n return '?' + params.join('&');\n}\n\nfunction formatSortRules(sortRules: SortRule[] | undefined): string {\n if (!sortRules || sortRules.length === 0) {\n return '';\n }\n return '_sort=' + sortRules.map(sr => sr.descending ? '-' + sr.code : sr.code).join(',');\n}\n"]}
|
package/dist/searchparams.js
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getExpressionForResourceType = exports.getSearchParameterDetails = exports.SearchParameterType = void 0;
|
|
4
|
-
const utils_1 = require("./utils");
|
|
5
|
-
var SearchParameterType;
|
|
6
|
-
(function (SearchParameterType) {
|
|
7
|
-
SearchParameterType["BOOLEAN"] = "BOOLEAN";
|
|
8
|
-
SearchParameterType["NUMBER"] = "NUMBER";
|
|
9
|
-
SearchParameterType["QUANTITY"] = "QUANTITY";
|
|
10
|
-
SearchParameterType["TEXT"] = "TEXT";
|
|
11
|
-
SearchParameterType["REFERENCE"] = "REFERENCE";
|
|
12
|
-
SearchParameterType["DATE"] = "DATE";
|
|
13
|
-
SearchParameterType["DATETIME"] = "DATETIME";
|
|
14
|
-
SearchParameterType["PERIOD"] = "PERIOD";
|
|
15
|
-
})(SearchParameterType = exports.SearchParameterType || (exports.SearchParameterType = {}));
|
|
16
|
-
/**
|
|
17
|
-
* Returns the type details of a SearchParameter.
|
|
18
|
-
*
|
|
19
|
-
* The SearchParameter resource has a "type" parameter, but that is missing some critical information.
|
|
20
|
-
*
|
|
21
|
-
* For example:
|
|
22
|
-
* 1) The "date" type includes "date", "datetime", and "period".
|
|
23
|
-
* 2) The "token" type includes enums and booleans.
|
|
24
|
-
* 3) Arrays/multiple values are not reflected at all.
|
|
25
|
-
*
|
|
26
|
-
* @param structureDefinitions Collection of StructureDefinition resources indexed by name.
|
|
27
|
-
* @param resourceType The root resource type.
|
|
28
|
-
* @param searchParam The search parameter.
|
|
29
|
-
* @returns The search parameter type details.
|
|
30
|
-
*/
|
|
31
|
-
function getSearchParameterDetails(structureDefinitions, resourceType, searchParam) {
|
|
32
|
-
var _a, _b, _c, _d;
|
|
33
|
-
const columnName = convertCodeToColumnName(searchParam.code);
|
|
34
|
-
const expression = (_a = getExpressionForResourceType(resourceType, searchParam.expression)) === null || _a === void 0 ? void 0 : _a.split('.');
|
|
35
|
-
if (!expression) {
|
|
36
|
-
// This happens on compound types
|
|
37
|
-
// In the future, explore returning multiple column definitions
|
|
38
|
-
return { columnName, type: SearchParameterType.TEXT };
|
|
39
|
-
}
|
|
40
|
-
let baseType = resourceType;
|
|
41
|
-
let propertyType = undefined;
|
|
42
|
-
let array = false;
|
|
43
|
-
for (let i = 1; i < expression.length; i++) {
|
|
44
|
-
const propertyName = expression[i];
|
|
45
|
-
const propertyDef = (_c = (_b = structureDefinitions.types[baseType]) === null || _b === void 0 ? void 0 : _b.properties) === null || _c === void 0 ? void 0 : _c[propertyName];
|
|
46
|
-
if (!propertyDef) {
|
|
47
|
-
// This happens on complex properties such as "collected[x]"/"collectedDateTime"/"collectedPeriod"
|
|
48
|
-
// In the future, explore returning multiple column definitions
|
|
49
|
-
return { columnName, type: SearchParameterType.TEXT, array };
|
|
50
|
-
}
|
|
51
|
-
if (propertyDef.max === '*') {
|
|
52
|
-
array = true;
|
|
53
|
-
}
|
|
54
|
-
propertyType = (_d = propertyDef.type) === null || _d === void 0 ? void 0 : _d[0].code;
|
|
55
|
-
if (!propertyType) {
|
|
56
|
-
// This happens when one of parent properties uses contentReference
|
|
57
|
-
// In the future, explore following the reference
|
|
58
|
-
return { columnName, type: SearchParameterType.TEXT, array };
|
|
59
|
-
}
|
|
60
|
-
if (i < expression.length - 1) {
|
|
61
|
-
if (propertyType === 'Element' || propertyType === 'BackboneElement') {
|
|
62
|
-
baseType = baseType + (0, utils_1.capitalize)(propertyName);
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
baseType = propertyType;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
const type = getSearchParameterType(searchParam, propertyType);
|
|
70
|
-
return { columnName, type, array };
|
|
71
|
-
}
|
|
72
|
-
exports.getSearchParameterDetails = getSearchParameterDetails;
|
|
73
|
-
/**
|
|
74
|
-
* Converts a hyphen-delimited code to camelCase string.
|
|
75
|
-
* @param code The search parameter code.
|
|
76
|
-
* @returns The SQL column name.
|
|
77
|
-
*/
|
|
78
|
-
function convertCodeToColumnName(code) {
|
|
79
|
-
return code.split('-')
|
|
80
|
-
.reduce((result, word, index) => result + (index ? (0, utils_1.capitalize)(word) : word), '');
|
|
81
|
-
}
|
|
82
|
-
function getSearchParameterType(searchParam, propertyType) {
|
|
83
|
-
let type = SearchParameterType.TEXT;
|
|
84
|
-
switch (searchParam.type) {
|
|
85
|
-
case 'date':
|
|
86
|
-
type = SearchParameterType.DATE;
|
|
87
|
-
break;
|
|
88
|
-
case 'number':
|
|
89
|
-
type = SearchParameterType.NUMBER;
|
|
90
|
-
break;
|
|
91
|
-
case 'quantity':
|
|
92
|
-
type = SearchParameterType.QUANTITY;
|
|
93
|
-
break;
|
|
94
|
-
case 'reference':
|
|
95
|
-
type = SearchParameterType.REFERENCE;
|
|
96
|
-
break;
|
|
97
|
-
case 'token':
|
|
98
|
-
if (propertyType === 'boolean') {
|
|
99
|
-
type = SearchParameterType.BOOLEAN;
|
|
100
|
-
}
|
|
101
|
-
break;
|
|
102
|
-
}
|
|
103
|
-
return type;
|
|
104
|
-
}
|
|
105
|
-
function getExpressionForResourceType(resourceType, expression) {
|
|
106
|
-
const expressions = expression.split(' | ');
|
|
107
|
-
for (const e of expressions) {
|
|
108
|
-
const simplified = simplifyExpression(e);
|
|
109
|
-
if (simplified.startsWith(resourceType + '.')) {
|
|
110
|
-
return simplified;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
return undefined;
|
|
114
|
-
}
|
|
115
|
-
exports.getExpressionForResourceType = getExpressionForResourceType;
|
|
116
|
-
function simplifyExpression(input) {
|
|
117
|
-
let result = input.trim();
|
|
118
|
-
if (result.startsWith('(') && result.endsWith(')')) {
|
|
119
|
-
result = result.substring(1, result.length - 1);
|
|
120
|
-
}
|
|
121
|
-
if (result.includes(' as ')) {
|
|
122
|
-
result = result.substring(0, result.indexOf(' as '));
|
|
123
|
-
}
|
|
124
|
-
if (result.includes('.where(')) {
|
|
125
|
-
result = result.substring(0, result.indexOf('.where('));
|
|
126
|
-
}
|
|
127
|
-
return result;
|
|
128
|
-
}
|
|
129
|
-
//# sourceMappingURL=searchparams.js.map
|
package/dist/searchparams.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"searchparams.js","sourceRoot":"","sources":["../src/searchparams.ts"],"names":[],"mappings":";;;AAEA,mCAAqC;AAErC,IAAY,mBASX;AATD,WAAY,mBAAmB;IAC7B,0CAAmB,CAAA;IACnB,wCAAiB,CAAA;IACjB,4CAAqB,CAAA;IACrB,oCAAa,CAAA;IACb,8CAAuB,CAAA;IACvB,oCAAa,CAAA;IACb,4CAAqB,CAAA;IACrB,wCAAiB,CAAA;AACnB,CAAC,EATW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAS9B;AAQD;;;;;;;;;;;;;;GAcG;AACH,SAAgB,yBAAyB,CACvC,oBAAgD,EAChD,YAAoB,EACpB,WAA4B;;IAE5B,MAAM,UAAU,GAAG,uBAAuB,CAAC,WAAW,CAAC,IAAc,CAAC,CAAC;IACvE,MAAM,UAAU,GAAG,MAAA,4BAA4B,CAAC,YAAY,EAAE,WAAW,CAAC,UAAoB,CAAC,0CAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAC5G,IAAI,CAAC,UAAU,EAAE;QACf,iCAAiC;QACjC,+DAA+D;QAC/D,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,mBAAmB,CAAC,IAAI,EAAE,CAAC;KACvD;IAED,IAAI,QAAQ,GAAG,YAAY,CAAC;IAC5B,IAAI,YAAY,GAAG,SAAS,CAAC;IAC7B,IAAI,KAAK,GAAG,KAAK,CAAC;IAElB,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AC;IAE1B,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QAClD,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;KACjD;IAED,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QAC3B,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;KACtD;IAED,IAAI,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;QAC9B,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;KACzD;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { SearchParameter } from './fhir';\nimport { IndexedStructureDefinition } from './types';\nimport { capitalize } from './utils';\n\nexport enum SearchParameterType {\n BOOLEAN = 'BOOLEAN',\n NUMBER = 'NUMBER',\n QUANTITY = 'QUANTITY',\n TEXT = 'TEXT',\n REFERENCE = 'REFERENCE',\n DATE = 'DATE',\n DATETIME = 'DATETIME',\n PERIOD = 'PERIOD'\n}\n\nexport interface SearchParameterDetails {\n readonly columnName: string;\n readonly type: SearchParameterType;\n readonly array?: boolean;\n}\n\n/**\n * Returns the type details of a SearchParameter.\n *\n * The SearchParameter resource has a \"type\" parameter, but that is missing some critical information.\n *\n * For example:\n * 1) The \"date\" type includes \"date\", \"datetime\", and \"period\".\n * 2) The \"token\" type includes enums and booleans.\n * 3) Arrays/multiple values are not reflected at all.\n *\n * @param structureDefinitions Collection of StructureDefinition resources indexed by name.\n * @param resourceType The root resource type.\n * @param searchParam The search parameter.\n * @returns The search parameter type details.\n */\nexport function getSearchParameterDetails(\n structureDefinitions: IndexedStructureDefinition,\n resourceType: string,\n searchParam: SearchParameter): SearchParameterDetails {\n\n const columnName = convertCodeToColumnName(searchParam.code as string);\n const expression = getExpressionForResourceType(resourceType, searchParam.expression as string)?.split('.');\n if (!expression) {\n // This happens on compound types\n // In the future, explore returning multiple column definitions\n return { columnName, type: SearchParameterType.TEXT };\n }\n\n let baseType = resourceType;\n let propertyType = undefined;\n let array = false;\n\n for (let i = 1; i < expression.length; i++) {\n const propertyName = expression[i];\n const propertyDef = structureDefinitions.types[baseType]?.properties?.[propertyName];\n if (!propertyDef) {\n // This happens on complex properties such as \"collected[x]\"/\"collectedDateTime\"/\"collectedPeriod\"\n // In the future, explore returning multiple column definitions\n return { columnName, type: SearchParameterType.TEXT, array };\n }\n\n if (propertyDef.max === '*') {\n array = true;\n }\n\n propertyType = propertyDef.type?.[0].code;\n if (!propertyType) {\n // This happens when one of parent properties uses contentReference\n // In the future, explore following the reference\n return { columnName, type: SearchParameterType.TEXT, array };\n }\n\n if (i < expression.length - 1) {\n if (propertyType === 'Element' || propertyType === 'BackboneElement') {\n baseType = baseType + capitalize(propertyName);\n } else {\n baseType = propertyType;\n }\n }\n }\n\n const type = getSearchParameterType(searchParam, propertyType as string);\n return { columnName, type, array };\n}\n\n/**\n * Converts a hyphen-delimited code to camelCase string.\n * @param code The search parameter code.\n * @returns The SQL column name.\n */\nfunction convertCodeToColumnName(code: string): string {\n return code.split('-')\n .reduce((result, word, index) => result + (index ? capitalize(word) : word), '');\n}\n\nfunction getSearchParameterType(searchParam: SearchParameter, propertyType: string): SearchParameterType {\n let type = SearchParameterType.TEXT;\n switch (searchParam.type) {\n case 'date':\n type = SearchParameterType.DATE;\n break;\n case 'number':\n type = SearchParameterType.NUMBER;\n break;\n case 'quantity':\n type = SearchParameterType.QUANTITY;\n break;\n case 'reference':\n type = SearchParameterType.REFERENCE;\n break;\n case 'token':\n if (propertyType === 'boolean') {\n type = SearchParameterType.BOOLEAN;\n }\n break;\n }\n return type;\n}\n\nexport function getExpressionForResourceType(resourceType: string, expression: string): string | undefined {\n const expressions = expression.split(' | ');\n for (const e of expressions) {\n const simplified = simplifyExpression(e);\n if (simplified.startsWith(resourceType + '.')) {\n return simplified;\n }\n }\n return undefined;\n}\n\nfunction simplifyExpression(input: string): string {\n let result = input.trim();\n\n if (result.startsWith('(') && result.endsWith(')')) {\n result = result.substring(1, result.length - 1);\n }\n\n if (result.includes(' as ')) {\n result = result.substring(0, result.indexOf(' as '));\n }\n\n if (result.includes('.where(')) {\n result = result.substring(0, result.indexOf('.where('));\n }\n\n return result;\n}\n"]}
|
package/dist/storage.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MemoryStorage = exports.ClientStorage = void 0;
|
|
4
|
-
const utils_1 = require("./utils");
|
|
5
|
-
/**
|
|
6
|
-
* The ClientStorage class is a utility class for storing strings and objects.
|
|
7
|
-
*
|
|
8
|
-
* When using MedplumClient in the browser, it will be backed by browser localStorage.
|
|
9
|
-
*
|
|
10
|
-
* When Using MedplumClient in the server, it will be backed by the MemoryStorage class.
|
|
11
|
-
*/
|
|
12
|
-
class ClientStorage {
|
|
13
|
-
constructor() {
|
|
14
|
-
this.storage = typeof localStorage !== 'undefined' ? localStorage : new MemoryStorage();
|
|
15
|
-
}
|
|
16
|
-
clear() {
|
|
17
|
-
this.storage.clear();
|
|
18
|
-
}
|
|
19
|
-
getString(key) {
|
|
20
|
-
return this.storage.getItem(key) || undefined;
|
|
21
|
-
}
|
|
22
|
-
setString(key, value) {
|
|
23
|
-
if (value) {
|
|
24
|
-
this.storage.setItem(key, value);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
this.storage.removeItem(key);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
getObject(key) {
|
|
31
|
-
const str = this.getString(key);
|
|
32
|
-
return str ? JSON.parse(str) : undefined;
|
|
33
|
-
}
|
|
34
|
-
setObject(key, value) {
|
|
35
|
-
this.setString(key, value ? (0, utils_1.stringify)(value) : undefined);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
exports.ClientStorage = ClientStorage;
|
|
39
|
-
/**
|
|
40
|
-
* The MemoryStorage class is a minimal in-memory implementation of the Storage interface.
|
|
41
|
-
*/
|
|
42
|
-
class MemoryStorage {
|
|
43
|
-
constructor() {
|
|
44
|
-
this.data = new Map();
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Returns the number of key/value pairs.
|
|
48
|
-
*/
|
|
49
|
-
get length() {
|
|
50
|
-
return this.data.size;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Removes all key/value pairs, if there are any.
|
|
54
|
-
*/
|
|
55
|
-
clear() {
|
|
56
|
-
this.data.clear();
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Returns the current value associated with the given key, or null if the given key does not exist.
|
|
60
|
-
*/
|
|
61
|
-
getItem(key) {
|
|
62
|
-
var _a;
|
|
63
|
-
return (_a = this.data.get(key)) !== null && _a !== void 0 ? _a : null;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.
|
|
67
|
-
*/
|
|
68
|
-
setItem(key, value) {
|
|
69
|
-
if (value) {
|
|
70
|
-
this.data.set(key, value);
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
this.data.delete(key);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Removes the key/value pair with the given key, if a key/value pair with the given key exists.
|
|
78
|
-
*/
|
|
79
|
-
removeItem(key) {
|
|
80
|
-
this.data.delete(key);
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Returns the name of the nth key, or null if n is greater than or equal to the number of key/value pairs.
|
|
84
|
-
*/
|
|
85
|
-
key(index) {
|
|
86
|
-
return Array.from(this.data.keys())[index];
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
exports.MemoryStorage = MemoryStorage;
|
|
90
|
-
//# sourceMappingURL=storage.js.map
|
package/dist/storage.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":";;;AAAA,mCAAoC;AAEpC;;;;;;GAMG;AACH,MAAa,aAAa;IAGxB;QACE,IAAI,CAAC,OAAO,GAAG,OAAO,YAAY,KAAK,WAAW,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,aAAa,EAAE,CAAC;IAC1F,CAAC;IAED,KAAK;QACH,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;IAED,SAAS,CAAC,GAAW;QACnB,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC;IAChD,CAAC;IAED,SAAS,CAAC,GAAW,EAAE,KAAyB;QAC9C,IAAI,KAAK,EAAE;YACT,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;SAClC;aAAM;YACL,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;SAC9B;IACH,CAAC;IAED,SAAS,CAAI,GAAW;QACtB,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QAChC,OAAO,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IAChD,CAAC;IAED,SAAS,CAAI,GAAW,EAAE,KAAQ;QAChC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,IAAA,iBAAS,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAC5D,CAAC;CACF;AA/BD,sCA+BC;AAED;;GAEG;AACH,MAAa,aAAa;IAGxB;QACE,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,EAAkB,CAAC;IACxC,CAAC;IAED;;OAEG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,GAAW;;QACjB,OAAO,MAAA,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,mCAAI,IAAI,CAAC;IACpC,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,GAAW,EAAE,KAAoB;QACvC,IAAI,KAAK,EAAE;YACT,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;SAC3B;aAAM;YACL,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SACvB;IACH,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,GAAW;QACpB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,KAAa;QACf,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;CACF;AApDD,sCAoDC","sourcesContent":["import { stringify } from './utils';\n\n/**\n * The ClientStorage class is a utility class for storing strings and objects.\n *\n * When using MedplumClient in the browser, it will be backed by browser localStorage.\n *\n * When Using MedplumClient in the server, it will be backed by the MemoryStorage class.\n */\nexport class ClientStorage {\n private readonly storage: Storage;\n\n constructor() {\n this.storage = typeof localStorage !== 'undefined' ? localStorage : new MemoryStorage();\n }\n\n clear(): void {\n this.storage.clear();\n }\n\n getString(key: string): string | undefined {\n return this.storage.getItem(key) || undefined;\n }\n\n setString(key: string, value: string | undefined): void {\n if (value) {\n this.storage.setItem(key, value);\n } else {\n this.storage.removeItem(key);\n }\n }\n\n getObject<T>(key: string): T | undefined {\n const str = this.getString(key);\n return str ? JSON.parse(str) as T : undefined;\n }\n\n setObject<T>(key: string, value: T) {\n this.setString(key, value ? stringify(value) : undefined);\n }\n}\n\n/**\n * The MemoryStorage class is a minimal in-memory implementation of the Storage interface.\n */\nexport class MemoryStorage implements Storage {\n private data: Map<string, string>;\n\n constructor() {\n this.data = new Map<string, string>();\n }\n\n /**\n * Returns the number of key/value pairs.\n */\n get length(): number {\n return this.data.size;\n }\n\n /**\n * Removes all key/value pairs, if there are any.\n */\n clear(): void {\n this.data.clear();\n }\n\n /**\n * Returns the current value associated with the given key, or null if the given key does not exist.\n */\n getItem(key: string): string | null {\n return this.data.get(key) ?? null;\n }\n\n /**\n * Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.\n */\n setItem(key: string, value: string | null): void {\n if (value) {\n this.data.set(key, value);\n } else {\n this.data.delete(key);\n }\n }\n\n /**\n * Removes the key/value pair with the given key, if a key/value pair with the given key exists.\n */\n removeItem(key: string): void {\n this.data.delete(key);\n }\n\n /**\n * Returns the name of the nth key, or null if n is greater than or equal to the number of key/value pairs.\n */\n key(index: number): string | null {\n return Array.from(this.data.keys())[index];\n }\n}\n"]}
|