@medplum/mock 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/mocks/alice.ts","../../../src/mocks/bot.ts","../../../src/mocks/questionnaire.ts","../../../src/mocks/simpsons.ts","../../../src/mocks/subscription.ts","../../../src/mocks/types.ts","../../../src/mocks/valueset.ts","../../../src/mocks/accesspolicy.ts","../../../src/client.ts"],"sourcesContent":["import { Bundle, Organization, Practitioner } from '@medplum/fhirtypes';\n\nexport const TestOrganization: Organization = {\n resourceType: 'Organization',\n id: '123',\n meta: {\n versionId: '1',\n },\n name: 'Test Organization',\n};\n\nexport const DifferentOrganization: Organization = {\n resourceType: 'Organization',\n id: '456',\n meta: {\n versionId: '1',\n },\n name: 'Different',\n};\n\nexport const OrganizationSearchBundle: Bundle<Organization> = {\n resourceType: 'Bundle',\n type: 'searchset',\n entry: [\n {\n resource: DifferentOrganization,\n },\n ],\n};\n\nexport const DrAliceSmith: Practitioner = {\n resourceType: 'Practitioner',\n id: '123',\n meta: {\n versionId: '2',\n lastUpdated: '2021-01-02T12:00:00Z',\n author: {\n reference: 'Practitioner/123',\n },\n },\n name: [\n {\n given: ['Alice'],\n family: 'Smith',\n },\n ],\n};\n\nexport const DrAliceSmithHistoryBundle: Bundle<Practitioner> = {\n resourceType: 'Bundle',\n type: 'history',\n entry: [\n {\n resource: DrAliceSmith,\n },\n {\n resource: {\n resourceType: 'Practitioner',\n id: '123',\n meta: {\n versionId: '1',\n lastUpdated: '2021-01-01T12:00:00Z',\n author: {\n reference: 'Practitioner/123',\n },\n },\n name: [{ given: ['Medplum'], family: 'Admin' }],\n },\n },\n ],\n};\n","import { Bot } from '@medplum/fhirtypes';\n\nexport const ExampleBot: Bot = {\n resourceType: 'Bot',\n id: '123',\n name: 'Test Bot',\n code: 'console.log(\"hello world\");',\n};\n","import { Bundle, Questionnaire, QuestionnaireResponse } from '@medplum/fhirtypes';\n\nexport const ExampleQuestionnaire: Questionnaire = {\n resourceType: 'Questionnaire',\n id: '123',\n name: 'Vitals',\n title: 'Vitals',\n item: [\n {\n linkId: '1',\n text: 'First question',\n type: 'string',\n },\n ],\n};\n\nexport const ExampleQuestionnaireBundle: Bundle<Questionnaire> = {\n resourceType: 'Bundle',\n type: 'searchset',\n entry: [\n {\n resource: ExampleQuestionnaire,\n },\n ],\n};\n\nexport const ExampleQuestionnaireResponse: QuestionnaireResponse = {\n resourceType: 'QuestionnaireResponse',\n id: '123',\n questionnaire: 'Questionnaire/123',\n subject: {\n reference: 'Patient/123',\n },\n source: {\n reference: 'Practitioner/123',\n },\n};\n","import {\n Bundle,\n Communication,\n DiagnosticReport,\n Encounter,\n Media,\n Observation,\n Patient,\n ServiceRequest,\n} from '@medplum/fhirtypes';\n\nexport const HomerSimpson: Patient = {\n resourceType: 'Patient',\n id: '123',\n meta: {\n versionId: '2',\n lastUpdated: '2020-01-02T00:00:00.000Z',\n author: {\n reference: 'Practitioner/123',\n },\n },\n identifier: [\n { system: 'abc', value: '123' },\n { system: 'def', value: '456' },\n ],\n name: [\n {\n given: ['Homer'],\n family: 'Simpson',\n },\n ],\n photo: [\n {\n contentType: 'image/jpeg',\n url: 'https://example.com/picture.jpg',\n },\n ],\n};\n\nexport const HomerSimpsonHistory: Bundle<Patient> = {\n resourceType: 'Bundle',\n type: 'history',\n entry: [\n {\n resource: HomerSimpson,\n },\n {\n resource: {\n resourceType: 'Patient',\n id: '123',\n meta: {\n versionId: '1',\n lastUpdated: '2020-01-01T00:00:00.000Z',\n author: {\n reference: 'Practitioner/123',\n },\n },\n name: [\n {\n given: ['Homer'],\n family: 'Simpson',\n },\n ],\n photo: [\n {\n contentType: 'image/jpeg',\n url: 'https://example.com/picture.jpg',\n },\n ],\n },\n },\n ],\n};\n\nexport const HomerEncounter: Encounter = {\n resourceType: 'Encounter',\n id: '123',\n meta: {\n versionId: '456',\n },\n};\n\nexport const HomerEncounterHistory: Bundle<Encounter> = {\n resourceType: 'Bundle',\n type: 'history',\n entry: [\n {\n resource: HomerEncounter,\n },\n ],\n};\n\nexport const HomerCommunications: Bundle<Communication> = {\n resourceType: 'Bundle',\n entry: [\n {\n resource: {\n resourceType: 'Communication',\n id: '123',\n meta: {\n lastUpdated: '2020-01-01T12:00:00Z',\n author: {\n reference: 'Practitioner/123',\n },\n },\n payload: [\n {\n contentString: 'Hello world',\n },\n ],\n },\n },\n ],\n};\n\nexport const HomerMedia: Bundle<Media> = {\n resourceType: 'Bundle',\n entry: [\n {\n resource: {\n resourceType: 'Media',\n id: '123',\n meta: {\n lastUpdated: '2020-01-01T12:00:00Z',\n author: {\n reference: 'Practitioner/123',\n },\n },\n content: {\n contentType: 'text/plain',\n url: 'https://example.com/test.txt',\n },\n },\n },\n ],\n};\n\nexport const HomerDiagnosticReport: DiagnosticReport = {\n resourceType: 'DiagnosticReport',\n id: '123',\n subject: {\n reference: 'Patient/123',\n display: 'Homer Simpson',\n },\n resultsInterpreter: [\n {\n reference: 'Practitioner/123',\n display: 'Dr. Alice Smith',\n },\n ],\n result: [\n { reference: 'Observation/1' },\n { reference: 'Observation/2' },\n { reference: 'Observation/3' },\n { reference: 'Observation/4' },\n { reference: 'Observation/5' },\n { reference: 'Observation/6' },\n ],\n};\n\nexport const HomerDiagnosticReportBundle: Bundle<DiagnosticReport> = {\n resourceType: 'Bundle',\n type: 'searchset',\n entry: [\n {\n resource: HomerDiagnosticReport,\n },\n ],\n};\n\nexport const HomerObservation1: Observation = {\n resourceType: 'Observation',\n id: '1',\n valueString: 'test',\n};\n\nexport const HomerObservation2: Observation = {\n resourceType: 'Observation',\n id: '2',\n valueQuantity: {\n value: 20,\n unit: 'x',\n },\n referenceRange: [\n {\n low: {\n value: 10,\n },\n },\n ],\n};\n\nexport const HomerObservation3: Observation = {\n resourceType: 'Observation',\n id: '3',\n valueQuantity: {\n value: 30,\n unit: 'x',\n },\n referenceRange: [\n {\n high: {\n value: 50,\n },\n },\n ],\n};\n\nexport const HomerObservation4: Observation = {\n resourceType: 'Observation',\n id: '4',\n valueQuantity: {\n value: 50,\n unit: 'x',\n },\n referenceRange: [\n {\n low: {\n value: 10,\n },\n high: {\n value: 50,\n },\n },\n ],\n interpretation: [\n {\n text: 'HIGH',\n },\n ],\n};\n\nexport const HomerObservation5: Observation = {\n resourceType: 'Observation',\n id: '5',\n valueQuantity: {\n value: 100,\n unit: 'x',\n },\n referenceRange: [{}],\n interpretation: [{}],\n};\n\nexport const HomerObservation6: Observation = {\n resourceType: 'Observation',\n component: [\n {\n valueQuantity: {\n value: 110,\n unit: 'mmHg',\n system: 'http://unitsofmeasure.org',\n },\n },\n {\n valueQuantity: {\n value: 75,\n unit: 'mmHg',\n system: 'http://unitsofmeasure.org',\n },\n },\n ],\n};\n\nexport const HomerObservationSearchBundle: Bundle<Observation> = {\n resourceType: 'Bundle',\n total: 1,\n entry: [\n {\n resource: HomerObservation3,\n },\n ],\n};\n\nexport const HomerServiceRequest: ServiceRequest = {\n resourceType: 'ServiceRequest',\n id: '123',\n meta: {\n versionId: '1',\n lastUpdated: '2020-01-01T12:00:00Z',\n author: {\n reference: 'Practitioner/123',\n },\n },\n code: {\n coding: [\n {\n system: 'http://snomed.info/sct',\n code: 'SERVICE_REQUEST_CODE',\n },\n ],\n },\n subject: {\n reference: 'Patient/123',\n display: 'Homer Simpson',\n },\n};\n\nexport const HomerServiceRequestHistoryBundle: Bundle<ServiceRequest> = {\n resourceType: 'Bundle',\n type: 'history',\n entry: [\n {\n resource: HomerServiceRequest,\n },\n ],\n};\n\nexport const HomerServiceRequestSearchBundle: Bundle<ServiceRequest> = {\n resourceType: 'Bundle',\n type: 'searchset',\n entry: [\n {\n resource: HomerServiceRequest,\n },\n ],\n};\n\nexport const BartSimpson: Patient = {\n resourceType: 'Patient',\n id: '555',\n meta: {\n versionId: '1',\n lastUpdated: '2020-01-01T12:00:00Z',\n author: {\n reference: 'Practitioner/123',\n },\n },\n name: [\n {\n given: ['Bart'],\n family: 'Simpson',\n },\n ],\n photo: [\n {\n contentType: 'image/jpeg',\n url: 'https://example.com/picture.jpg',\n },\n ],\n};\n\nexport const SimpsonSearchBundle: Bundle<Patient> = {\n resourceType: 'Bundle',\n type: 'searchset',\n total: 2,\n entry: [\n {\n resource: HomerSimpson,\n },\n {\n resource: BartSimpson,\n },\n ],\n};\n","import { AuditEvent, Bundle, Subscription } from '@medplum/fhirtypes';\n\nexport const ExampleSubscription: Subscription = {\n resourceType: 'Subscription',\n id: '123',\n meta: {\n versionId: '456',\n },\n};\n\nexport const ExampleSubscriptionHistory: Bundle<Subscription> = {\n resourceType: 'Bundle',\n type: 'history',\n entry: [\n {\n resource: ExampleSubscription,\n },\n ],\n};\n\nexport const ExampleAuditEvent: AuditEvent = {\n resourceType: 'AuditEvent',\n id: '123',\n meta: {\n lastUpdated: new Date().toISOString(),\n versionId: '456',\n author: {\n reference: 'Practitioner/123',\n },\n },\n};\n\nexport const ExampleAuditEventBundle: Bundle<AuditEvent> = {\n resourceType: 'Bundle',\n entry: [\n {\n resource: ExampleAuditEvent,\n },\n ],\n};\n","import { Bundle, SearchParameter, StructureDefinition } from '@medplum/fhirtypes';\n\nexport const EmptySearchBundle: Bundle = {\n resourceType: 'Bundle',\n type: 'searchset',\n total: 0,\n entry: [],\n};\n\nexport const ObservationStructureDefinition: StructureDefinition = {\n resourceType: 'StructureDefinition',\n name: 'Observation',\n snapshot: {\n element: [\n {\n path: 'Observation.id',\n type: [\n {\n code: 'code',\n },\n ],\n },\n {\n path: 'Observation.value[x]',\n min: 0,\n max: '1',\n type: [\n {\n code: 'Quantity',\n },\n {\n code: 'CodeableConcept',\n },\n {\n code: 'string',\n },\n {\n code: 'boolean',\n },\n {\n code: 'integer',\n },\n {\n code: 'Range',\n },\n {\n code: 'Ratio',\n },\n {\n code: 'SampledData',\n },\n {\n code: 'time',\n },\n {\n code: 'dateTime',\n },\n {\n code: 'Period',\n },\n ],\n },\n ],\n },\n};\n\nexport const PatientStructureDefinition: StructureDefinition = {\n resourceType: 'StructureDefinition',\n id: '123',\n name: 'Patient',\n snapshot: {\n element: [\n {\n id: 'Patient.name',\n path: 'Patient.name',\n type: [\n {\n code: 'HumanName',\n },\n ],\n max: '*',\n },\n ],\n },\n};\n\nexport const PatientSearchParameters: SearchParameter[] = [\n {\n resourceType: 'SearchParameter',\n id: 'Patient-name',\n base: ['Patient'],\n code: 'name',\n name: 'name',\n type: 'string',\n expression: 'Patient.name',\n },\n {\n resourceType: 'SearchParameter',\n id: 'Patient-birthdate',\n base: ['Patient'],\n code: 'birthdate',\n name: 'birthdate',\n type: 'date',\n expression: 'Patient.birthdate',\n },\n {\n resourceType: 'SearchParameter',\n id: 'Patient-organization',\n base: ['Patient'],\n code: 'organization',\n name: 'organization',\n type: 'reference',\n expression: 'Patient.organization',\n target: ['Organization'],\n },\n];\n\nexport const PractitionerStructureDefinition: StructureDefinition = {\n resourceType: 'StructureDefinition',\n name: 'Practitioner',\n snapshot: {\n element: [\n {\n path: 'Practitioner.id',\n type: [\n {\n code: 'code',\n },\n ],\n },\n {\n path: 'Practitioner.name',\n type: [\n {\n code: 'HumanName',\n },\n ],\n max: '*',\n },\n {\n path: 'Practitioner.gender',\n type: [\n {\n code: 'code',\n },\n ],\n },\n ],\n },\n};\n\nexport const QuestionnaireStructureDefinition: StructureDefinition = {\n resourceType: 'StructureDefinition',\n name: 'Questionnaire',\n snapshot: {\n element: [\n {\n id: 'Questionnaire.item',\n path: 'Questionnaire.item',\n type: [\n {\n code: 'BackboneElement',\n },\n ],\n },\n {\n id: 'Questionnaire.item.answerOption',\n path: 'Questionnaire.item.answerOption',\n type: [\n {\n code: 'BackboneElement',\n },\n ],\n },\n {\n id: 'Questionnaire.item.answerOption.value[x]',\n path: 'Questionnaire.item.answerOption.value[x]',\n min: 1,\n max: '1',\n type: [\n {\n code: 'integer',\n },\n {\n code: 'date',\n },\n {\n code: 'time',\n },\n {\n code: 'string',\n },\n {\n code: 'Coding',\n },\n {\n code: 'Reference',\n targetProfile: ['http://hl7.org/fhir/StructureDefinition/Resource'],\n },\n ],\n },\n ],\n },\n};\n\nexport const ServiceRequestServiceDefinition: StructureDefinition = {\n resourceType: 'StructureDefinition',\n name: 'ServiceRequest',\n snapshot: {\n element: [\n {\n path: 'ServiceRequest.id',\n type: [\n {\n code: 'code',\n },\n ],\n },\n {\n path: 'ServiceRequest.code',\n type: [\n {\n code: 'CodeableConcept',\n },\n ],\n },\n ],\n },\n};\n\nexport const GraphQLSchemaResponse = {\n data: {\n StructureDefinitionList: [\n ObservationStructureDefinition,\n PatientStructureDefinition,\n PractitionerStructureDefinition,\n QuestionnaireStructureDefinition,\n ServiceRequestServiceDefinition,\n ],\n SearchParameterList: [...PatientSearchParameters],\n },\n};\n","import { ValueSet } from '@medplum/fhirtypes';\n\nexport const exampleValueSet: ValueSet = {\n resourceType: 'ValueSet',\n expansion: {\n contains: [\n {\n system: 'x',\n code: 'test-code',\n display: 'Test Display',\n },\n ],\n },\n};\n","import { AccessPolicy, Bundle } from '@medplum/fhirtypes';\n\nexport const ExampleAccessPolicy: AccessPolicy = {\n resourceType: 'AccessPolicy',\n id: '123',\n name: 'Example Access Policy',\n};\n\nexport const ExampleAccessPolicySearchBundle: Bundle<AccessPolicy> = {\n resourceType: 'Bundle',\n type: 'searchset',\n entry: [\n {\n resource: ExampleAccessPolicy,\n },\n ],\n};\n","import { allOk, badRequest, getStatus, LoginState, MedplumClient, notFound, ProfileResource } from '@medplum/core';\nimport { Bundle, BundleEntry, Communication, Media, Practitioner } from '@medplum/fhirtypes';\nimport {\n DifferentOrganization,\n DrAliceSmith,\n DrAliceSmithHistoryBundle,\n EmptySearchBundle,\n ExampleAuditEventBundle,\n ExampleBot,\n ExampleQuestionnaire,\n ExampleQuestionnaireBundle,\n ExampleQuestionnaireResponse,\n ExampleSubscription,\n ExampleSubscriptionHistory,\n exampleValueSet,\n GraphQLSchemaResponse,\n HomerCommunications,\n HomerDiagnosticReport,\n HomerDiagnosticReportBundle,\n HomerEncounter,\n HomerEncounterHistory,\n HomerMedia,\n HomerObservation1,\n HomerObservation2,\n HomerObservation3,\n HomerObservation4,\n HomerObservation5,\n HomerObservation6,\n HomerObservationSearchBundle,\n HomerServiceRequest,\n HomerServiceRequestHistoryBundle,\n HomerServiceRequestSearchBundle,\n HomerSimpson,\n HomerSimpsonHistory,\n OrganizationSearchBundle,\n SimpsonSearchBundle,\n TestOrganization,\n} from './mocks';\nimport { ExampleAccessPolicy, ExampleAccessPolicySearchBundle } from './mocks/accesspolicy';\n\nconst newComment: Communication = {\n resourceType: 'Communication',\n id: 'new-comment',\n payload: [\n {\n contentString: 'Test comment',\n },\n ],\n};\n\nconst newMedia: Media = {\n resourceType: 'Media',\n id: 'new-media',\n content: {\n contentType: 'text/plain',\n url: 'https://example.com/test2.txt',\n },\n};\n\nconst routes: Record<string, Record<string, any>> = {\n 'admin/projects/123': {\n GET: {\n project: { id: '123', name: 'Project 123' },\n members: [{ profile: 'Practitioner/123', name: 'Alice Smith' }],\n },\n },\n 'admin/super/structuredefinitions': {\n POST: {\n ok: true,\n },\n },\n 'admin/super/valuesets': {\n POST: {\n ok: true,\n },\n },\n 'admin/super/reindex': {\n POST: {\n ok: true,\n },\n },\n 'auth/changepassword': {\n POST: (body: string) => {\n const { oldPassword } = JSON.parse(body);\n if (oldPassword === 'orange') {\n return allOk;\n } else {\n return {\n resourceType: 'OperationOutcome',\n issue: [\n {\n expression: ['oldPassword'],\n details: {\n text: 'Incorrect password',\n },\n },\n ],\n };\n }\n },\n },\n 'auth/login': {\n POST: {\n profile: { reference: 'Practitioner/123' },\n },\n },\n 'auth/setpassword': {\n POST: (body: string) => {\n const { password } = JSON.parse(body);\n if (password === 'orange') {\n return allOk;\n } else {\n return {\n resourceType: 'OperationOutcome',\n issue: [\n {\n expression: ['password'],\n details: {\n text: 'Invalid password',\n },\n },\n ],\n };\n }\n },\n },\n 'auth/register': {\n POST: (body: string) => {\n const { email, password } = JSON.parse(body);\n if (email === 'george@example.com' && password === 'password') {\n return allOk;\n } else {\n return {\n resourceType: 'OperationOutcome',\n issue: [\n {\n details: {\n text: 'Invalid',\n },\n },\n ],\n };\n }\n },\n },\n 'auth/resetpassword': {\n POST: (body: string) => {\n const { email } = JSON.parse(body);\n if (email === 'admin@example.com') {\n return allOk;\n } else {\n return {\n resourceType: 'OperationOutcome',\n issue: [\n {\n expression: ['email'],\n details: {\n text: 'Email not found',\n },\n },\n ],\n };\n }\n },\n },\n 'fhir/R4/AccessPolicy?name=Example%20Access%20Policy': {\n GET: ExampleAccessPolicySearchBundle,\n },\n 'fhir/R4/AccessPolicy/123': {\n GET: ExampleAccessPolicy,\n },\n 'fhir/R4/AuditEvent?entity=Subscription/123&_count=20&_sort=-_lastUpdated': {\n GET: ExampleAuditEventBundle,\n },\n 'fhir/R4/Binary?_filename=hello.exe': {\n POST: badRequest('Invalid file type'),\n },\n 'fhir/R4/Bot/123': {\n GET: ExampleBot,\n },\n 'fhir/R4/Communication': {\n POST: newComment,\n },\n 'fhir/R4/Communication?based-on=ServiceRequest/123': {\n GET: HomerCommunications,\n },\n 'fhir/R4/Communication?encounter=Encounter/123': {\n GET: HomerCommunications,\n },\n 'fhir/R4/Communication?subject=Patient/123': {\n GET: HomerCommunications,\n },\n 'fhir/R4/Device?subject=Patient/123': {\n GET: EmptySearchBundle,\n },\n 'fhir/R4/DeviceRequest?patient=Patient/123': {\n GET: EmptySearchBundle,\n },\n 'fhir/R4/DiagnosticReport/123': {\n GET: HomerDiagnosticReport,\n },\n 'fhir/R4/DiagnosticReport/123/_history': {\n GET: HomerDiagnosticReportBundle,\n },\n 'fhir/R4/DiagnosticReport?based-on=ServiceRequest/123': {\n GET: HomerDiagnosticReportBundle,\n },\n 'fhir/R4/DiagnosticReport?subject=Patient/123': {\n GET: HomerDiagnosticReportBundle,\n },\n 'fhir/R4/Encounter/123': {\n GET: HomerEncounter,\n },\n 'fhir/R4/Encounter/123/_history': {\n GET: HomerEncounterHistory,\n },\n 'fhir/R4/Media': {\n POST: newMedia,\n },\n 'fhir/R4/Media?based-on=ServiceRequest/123': {\n GET: HomerMedia,\n },\n 'fhir/R4/Media?encounter=Encounter/123': {\n GET: HomerMedia,\n },\n 'fhir/R4/Media?subject=Patient/123': {\n GET: HomerMedia,\n },\n 'fhir/R4/Observation?_fields=value[x]': {\n GET: HomerObservationSearchBundle,\n },\n 'fhir/R4/Observation/1': {\n GET: HomerObservation1,\n },\n 'fhir/R4/Observation/2': {\n GET: HomerObservation2,\n },\n 'fhir/R4/Observation/3': {\n GET: HomerObservation3,\n },\n 'fhir/R4/Observation/4': {\n GET: HomerObservation4,\n },\n 'fhir/R4/Observation/5': {\n GET: HomerObservation5,\n },\n 'fhir/R4/Observation/6': {\n GET: HomerObservation6,\n },\n 'fhir/R4/Organization?name=Different': {\n GET: OrganizationSearchBundle,\n },\n 'fhir/R4/Organization/123': {\n GET: TestOrganization,\n },\n 'fhir/R4/Organization/456': {\n GET: DifferentOrganization,\n },\n 'fhir/R4/Patient?name=Simpson': {\n GET: SimpsonSearchBundle,\n },\n 'fhir/R4/Patient?_fields=id,_lastUpdated,name&name=Simpson': {\n GET: SimpsonSearchBundle,\n },\n 'fhir/R4/Patient?_count=20&_fields=id,_lastUpdated,name,birthDate,gender&_sort=-_lastUpdated': {\n GET: SimpsonSearchBundle,\n },\n 'fhir/R4/Patient?_fields=id,_lastUpdated,name&_lastUpdated=ge2021-12-01T00%3A00%3A00.000Z': {\n GET: SimpsonSearchBundle,\n },\n 'fhir/R4/Patient?name=Bob': {\n GET: EmptySearchBundle,\n },\n 'fhir/R4/Patient/123': {\n GET: HomerSimpson,\n },\n 'fhir/R4/Patient/123/_history': {\n GET: HomerSimpsonHistory,\n },\n 'fhir/R4/Practitioner': {\n POST: HomerSimpson,\n },\n 'fhir/R4/Practitioner/123': {\n GET: DrAliceSmith,\n },\n 'fhir/R4/Practitioner/123/_history': {\n GET: DrAliceSmithHistoryBundle,\n },\n 'fhir/R4/Practitioner/123/_history/1': {\n GET: DrAliceSmith,\n },\n 'fhir/R4/Practitioner/not-found/_history': {\n GET: notFound,\n },\n 'fhir/R4/Questionnaire?subject-type=Patient': {\n GET: ExampleQuestionnaireBundle,\n },\n 'fhir/R4/Questionnaire/not-found': {\n GET: notFound,\n },\n 'fhir/R4/Questionnaire/123': {\n GET: ExampleQuestionnaire,\n },\n 'fhir/R4/QuestionnaireResponse': {\n POST: ExampleQuestionnaireResponse,\n },\n 'fhir/R4/QuestionnaireResponse/123': {\n GET: ExampleQuestionnaireResponse,\n },\n 'fhir/R4/ServiceRequest/123': {\n GET: HomerServiceRequest,\n },\n 'fhir/R4/ServiceRequest/123/_history': {\n GET: HomerServiceRequestHistoryBundle,\n },\n 'fhir/R4/ServiceRequest?subject=Patient/123': {\n GET: HomerServiceRequestSearchBundle,\n },\n 'fhir/R4/Subscription/123': {\n GET: ExampleSubscription,\n },\n 'fhir/R4/Subscription/123/_history': {\n GET: ExampleSubscriptionHistory,\n },\n 'fhir/R4/ValueSet/%24expand?url=https%3A%2F%2Fexample.com%2Ftest&filter=xyz': {\n GET: exampleValueSet,\n },\n 'fhir/R4/%24graphql': {\n POST: GraphQLSchemaResponse,\n },\n 'fhir/R4': {\n POST: (body: string) => {\n const request = JSON.parse(body) as Bundle;\n return {\n resourceType: 'Bundle',\n type: 'batch-response',\n entry: request.entry?.map((e: BundleEntry) => {\n const url = 'fhir/R4/' + e?.request?.url;\n const method = e?.request?.method as string;\n const resource = routes[url]?.[method];\n if (resource?.resourceType === 'OperationOutcome') {\n return { resource, response: { status: getStatus(resource).toString() } };\n } else if (resource) {\n return { resource, response: { status: '200' } };\n } else {\n return { resource: notFound, response: { status: '404' } };\n }\n }),\n };\n },\n },\n};\n\nexport interface MockClientOptions {\n readonly debug?: boolean;\n}\n\nexport class MockClient extends MedplumClient {\n activeLoginOverride?: LoginState;\n\n constructor(clientOptions?: MockClientOptions) {\n super({\n baseUrl: 'https://example.com/',\n clientId: 'my-client-id',\n fetch: (url: string, options: any) => {\n const method = options.method;\n const path = url.replace('https://example.com/', '');\n\n if (clientOptions?.debug) {\n console.log('MockClient', method, path);\n }\n\n let result = routes[path]?.[method];\n if (typeof result === 'function') {\n result = result(options.body);\n }\n\n if (clientOptions?.debug && !result) {\n console.log('MockClient: not found', method, path);\n }\n\n const response: any = {\n request: {\n url,\n options,\n },\n ...result,\n };\n\n if (clientOptions?.debug) {\n console.log('MockClient', JSON.stringify(response, null, 2));\n }\n\n return Promise.resolve({\n json: () => Promise.resolve(response),\n });\n },\n });\n }\n\n clear(): void {\n super.clear();\n this.activeLoginOverride = undefined;\n }\n\n getProfile(): ProfileResource {\n return {\n resourceType: 'Practitioner',\n id: '123',\n meta: {\n versionId: '456',\n },\n } as Practitioner;\n }\n\n setActiveLoginOverride(activeLoginOverride: LoginState): void {\n this.activeLoginOverride = activeLoginOverride;\n }\n\n getActiveLogin(): LoginState | undefined {\n if (this.activeLoginOverride !== undefined) {\n return this.activeLoginOverride;\n }\n return super.getActiveLogin();\n }\n}\n"],"names":[],"mappings":";;MAEa,gBAAgB,GAAiB;IAC5C,YAAY,EAAE,cAAc;IAC5B,EAAE,EAAE,KAAK;IACT,IAAI,EAAE;QACJ,SAAS,EAAE,GAAG;KACf;IACD,IAAI,EAAE,mBAAmB;EACzB;MAEW,qBAAqB,GAAiB;IACjD,YAAY,EAAE,cAAc;IAC5B,EAAE,EAAE,KAAK;IACT,IAAI,EAAE;QACJ,SAAS,EAAE,GAAG;KACf;IACD,IAAI,EAAE,WAAW;EACjB;MAEW,wBAAwB,GAAyB;IAC5D,YAAY,EAAE,QAAQ;IACtB,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE;QACL;YACE,QAAQ,EAAE,qBAAqB;SAChC;KACF;EACD;MAEW,YAAY,GAAiB;IACxC,YAAY,EAAE,cAAc;IAC5B,EAAE,EAAE,KAAK;IACT,IAAI,EAAE;QACJ,SAAS,EAAE,GAAG;QACd,WAAW,EAAE,sBAAsB;QACnC,MAAM,EAAE;YACN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AY,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;iBAC9D;gBAED,OAAO,OAAO,CAAC,OAAO,CAAC;oBACrB,IAAI,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC;iBACtC,CAAC,CAAC;aACJ;SACF,CAAC,CAAC;KACJ;IAED,KAAK;QACH,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,IAAI,CAAC,mBAAmB,GAAG,SAAS,CAAC;KACtC;IAED,UAAU;QACR,OAAO;YACL,YAAY,EAAE,cAAc;YAC5B,EAAE,EAAE,KAAK;YACT,IAAI,EAAE;gBACJ,SAAS,EAAE,KAAK;aACjB;SACc,CAAC;KACnB;IAED,sBAAsB,CAAC,mBAA+B;QACpD,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;KAChD;IAED,cAAc;QACZ,IAAI,IAAI,CAAC,mBAAmB,KAAK,SAAS,EAAE;YAC1C,OAAO,IAAI,CAAC,mBAAmB,CAAC;SACjC;QACD,OAAO,KAAK,CAAC,cAAc,EAAE,CAAC;KAC/B;;;;;"}
@@ -0,0 +1,2 @@
1
+ import{allOk as e,badRequest as t,notFound as r,getStatus as i,MedplumClient as n}from"@medplum/core";const o={resourceType:"Organization",id:"123",meta:{versionId:"1"},name:"Test Organization"},a={resourceType:"Organization",id:"456",meta:{versionId:"1"},name:"Different"},s={resourceType:"Bundle",type:"searchset",entry:[{resource:a}]},c={resourceType:"Practitioner",id:"123",meta:{versionId:"2",lastUpdated:"2021-01-02T12:00:00Z",author:{reference:"Practitioner/123"}},name:[{given:["Alice"],family:"Smith"}]},u={resourceType:"Bundle",type:"history",entry:[{resource:c},{resource:{resourceType:"Practitioner",id:"123",meta:{versionId:"1",lastUpdated:"2021-01-01T12:00:00Z",author:{reference:"Practitioner/123"}},name:[{given:["Medplum"],family:"Admin"}]}}]},d={resourceType:"Bot",id:"123",name:"Test Bot",code:'console.log("hello world");'},p={resourceType:"Questionnaire",id:"123",name:"Vitals",title:"Vitals",item:[{linkId:"1",text:"First question",type:"string"}]},l={resourceType:"Bundle",type:"searchset",entry:[{resource:p}]},m={resourceType:"QuestionnaireResponse",id:"123",questionnaire:"Questionnaire/123",subject:{reference:"Patient/123"},source:{reference:"Practitioner/123"}},y={resourceType:"Patient",id:"123",meta:{versionId:"2",lastUpdated:"2020-01-02T00:00:00.000Z",author:{reference:"Practitioner/123"}},identifier:[{system:"abc",value:"123"},{system:"def",value:"456"}],name:[{given:["Homer"],family:"Simpson"}],photo:[{contentType:"image/jpeg",url:"https://example.com/picture.jpg"}]},h={resourceType:"Bundle",type:"history",entry:[{resource:y},{resource:{resourceType:"Patient",id:"123",meta:{versionId:"1",lastUpdated:"2020-01-01T00:00:00.000Z",author:{reference:"Practitioner/123"}},name:[{given:["Homer"],family:"Simpson"}],photo:[{contentType:"image/jpeg",url:"https://example.com/picture.jpg"}]}}]},T={resourceType:"Encounter",id:"123",meta:{versionId:"456"}},f={resourceType:"Bundle",type:"history",entry:[{resource:T}]},v={resourceType:"Bundle",entry:[{resource:{resourceType:"Communication",id:"123",meta:{lastUpdated:"2020-01-01T12:00:00Z",author:{reference:"Practitioner/123"}},payload:[{contentString:"Hello world"}]}}]},P={resourceType:"Bundle",entry:[{resource:{resourceType:"Media",id:"123",meta:{lastUpdated:"2020-01-01T12:00:00Z",author:{reference:"Practitioner/123"}},content:{contentType:"text/plain",url:"https://example.com/test.txt"}}}]},g={resourceType:"DiagnosticReport",id:"123",subject:{reference:"Patient/123",display:"Homer Simpson"},resultsInterpreter:[{reference:"Practitioner/123",display:"Dr. Alice Smith"}],result:[{reference:"Observation/1"},{reference:"Observation/2"},{reference:"Observation/3"},{reference:"Observation/4"},{reference:"Observation/5"},{reference:"Observation/6"}]},R={resourceType:"Bundle",type:"searchset",entry:[{resource:g}]},O={resourceType:"Observation",id:"1",valueString:"test"},E={resourceType:"Observation",id:"2",valueQuantity:{value:20,unit:"x"},referenceRange:[{low:{value:10}}]},S={resourceType:"Observation",id:"3",valueQuantity:{value:30,unit:"x"},referenceRange:[{high:{value:50}}]},b={resourceType:"Observation",id:"4",valueQuantity:{value:50,unit:"x"},referenceRange:[{low:{value:10},high:{value:50}}],interpretation:[{text:"HIGH"}]},G={resourceType:"Observation",id:"5",valueQuantity:{value:100,unit:"x"},referenceRange:[{}],interpretation:[{}]},x={resourceType:"Observation",component:[{valueQuantity:{value:110,unit:"mmHg",system:"http://unitsofmeasure.org"}},{valueQuantity:{value:75,unit:"mmHg",system:"http://unitsofmeasure.org"}}]},B={resourceType:"Bundle",total:1,entry:[{resource:S}]},_={resourceType:"ServiceRequest",id:"123",meta:{versionId:"1",lastUpdated:"2020-01-01T12:00:00Z",author:{reference:"Practitioner/123"}},code:{coding:[{system:"http://snomed.info/sct",code:"SERVICE_REQUEST_CODE"}]},subject:{reference:"Patient/123",display:"Homer Simpson"}},Q={resourceType:"Bundle",type:"history",entry:[{resource:_}]},w={resourceType:"Bundle",type:"searchset",entry:[{resource:_}]},D={resourceType:"Patient",id:"555",meta:{versionId:"1",lastUpdated:"2020-01-01T12:00:00Z",author:{reference:"Practitioner/123"}},name:[{given:["Bart"],family:"Simpson"}],photo:[{contentType:"image/jpeg",url:"https://example.com/picture.jpg"}]},I={resourceType:"Bundle",type:"searchset",total:2,entry:[{resource:y},{resource:D}]},j={resourceType:"Subscription",id:"123",meta:{versionId:"456"}},q={resourceType:"Bundle",type:"history",entry:[{resource:j}]},A={resourceType:"AuditEvent",id:"123",meta:{lastUpdated:(new Date).toISOString(),versionId:"456",author:{reference:"Practitioner/123"}}},U={resourceType:"Bundle",entry:[{resource:A}]},C={resourceType:"Bundle",type:"searchset",total:0,entry:[]},z={resourceType:"StructureDefinition",name:"Observation",snapshot:{element:[{path:"Observation.id",type:[{code:"code"}]},{path:"Observation.value[x]",min:0,max:"1",type:[{code:"Quantity"},{code:"CodeableConcept"},{code:"string"},{code:"boolean"},{code:"integer"},{code:"Range"},{code:"Ratio"},{code:"SampledData"},{code:"time"},{code:"dateTime"},{code:"Period"}]}]}},H={resourceType:"StructureDefinition",id:"123",name:"Patient",snapshot:{element:[{id:"Patient.name",path:"Patient.name",type:[{code:"HumanName"}],max:"*"}]}},M=[{resourceType:"SearchParameter",id:"Patient-name",base:["Patient"],code:"name",name:"name",type:"string",expression:"Patient.name"},{resourceType:"SearchParameter",id:"Patient-birthdate",base:["Patient"],code:"birthdate",name:"birthdate",type:"date",expression:"Patient.birthdate"},{resourceType:"SearchParameter",id:"Patient-organization",base:["Patient"],code:"organization",name:"organization",type:"reference",expression:"Patient.organization",target:["Organization"]}],k={resourceType:"StructureDefinition",name:"Practitioner",snapshot:{element:[{path:"Practitioner.id",type:[{code:"code"}]},{path:"Practitioner.name",type:[{code:"HumanName"}],max:"*"},{path:"Practitioner.gender",type:[{code:"code"}]}]}},L={resourceType:"StructureDefinition",name:"Questionnaire",snapshot:{element:[{id:"Questionnaire.item",path:"Questionnaire.item",type:[{code:"BackboneElement"}]},{id:"Questionnaire.item.answerOption",path:"Questionnaire.item.answerOption",type:[{code:"BackboneElement"}]},{id:"Questionnaire.item.answerOption.value[x]",path:"Questionnaire.item.answerOption.value[x]",min:1,max:"1",type:[{code:"integer"},{code:"date"},{code:"time"},{code:"string"},{code:"Coding"},{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/Resource"]}]}]}},Z={resourceType:"StructureDefinition",name:"ServiceRequest",snapshot:{element:[{path:"ServiceRequest.id",type:[{code:"code"}]},{path:"ServiceRequest.code",type:[{code:"CodeableConcept"}]}]}},N={data:{StructureDefinitionList:[z,H,k,L,Z],SearchParameterList:[...M]}},J={resourceType:"ValueSet",expansion:{contains:[{system:"x",code:"test-code",display:"Test Display"}]}},V={resourceType:"AccessPolicy",id:"123",name:"Example Access Policy"},F={"admin/projects/123":{GET:{project:{id:"123",name:"Project 123"},members:[{profile:"Practitioner/123",name:"Alice Smith"}]}},"admin/super/structuredefinitions":{POST:{ok:!0}},"admin/super/valuesets":{POST:{ok:!0}},"admin/super/reindex":{POST:{ok:!0}},"auth/changepassword":{POST:t=>{const{oldPassword:r}=JSON.parse(t);return"orange"===r?e:{resourceType:"OperationOutcome",issue:[{expression:["oldPassword"],details:{text:"Incorrect password"}}]}}},"auth/login":{POST:{profile:{reference:"Practitioner/123"}}},"auth/setpassword":{POST:t=>{const{password:r}=JSON.parse(t);return"orange"===r?e:{resourceType:"OperationOutcome",issue:[{expression:["password"],details:{text:"Invalid password"}}]}}},"auth/register":{POST:t=>{const{email:r,password:i}=JSON.parse(t);return"george@example.com"===r&&"password"===i?e:{resourceType:"OperationOutcome",issue:[{details:{text:"Invalid"}}]}}},"auth/resetpassword":{POST:t=>{const{email:r}=JSON.parse(t);return"admin@example.com"===r?e:{resourceType:"OperationOutcome",issue:[{expression:["email"],details:{text:"Email not found"}}]}}},"fhir/R4/AccessPolicy?name=Example%20Access%20Policy":{GET:{resourceType:"Bundle",type:"searchset",entry:[{resource:V}]}},"fhir/R4/AccessPolicy/123":{GET:V},"fhir/R4/AuditEvent?entity=Subscription/123&_count=20&_sort=-_lastUpdated":{GET:U},"fhir/R4/Binary?_filename=hello.exe":{POST:t("Invalid file type")},"fhir/R4/Bot/123":{GET:d},"fhir/R4/Communication":{POST:{resourceType:"Communication",id:"new-comment",payload:[{contentString:"Test comment"}]}},"fhir/R4/Communication?based-on=ServiceRequest/123":{GET:v},"fhir/R4/Communication?encounter=Encounter/123":{GET:v},"fhir/R4/Communication?subject=Patient/123":{GET:v},"fhir/R4/Device?subject=Patient/123":{GET:C},"fhir/R4/DeviceRequest?patient=Patient/123":{GET:C},"fhir/R4/DiagnosticReport/123":{GET:g},"fhir/R4/DiagnosticReport/123/_history":{GET:R},"fhir/R4/DiagnosticReport?based-on=ServiceRequest/123":{GET:R},"fhir/R4/DiagnosticReport?subject=Patient/123":{GET:R},"fhir/R4/Encounter/123":{GET:T},"fhir/R4/Encounter/123/_history":{GET:f},"fhir/R4/Media":{POST:{resourceType:"Media",id:"new-media",content:{contentType:"text/plain",url:"https://example.com/test2.txt"}}},"fhir/R4/Media?based-on=ServiceRequest/123":{GET:P},"fhir/R4/Media?encounter=Encounter/123":{GET:P},"fhir/R4/Media?subject=Patient/123":{GET:P},"fhir/R4/Observation?_fields=value[x]":{GET:B},"fhir/R4/Observation/1":{GET:O},"fhir/R4/Observation/2":{GET:E},"fhir/R4/Observation/3":{GET:S},"fhir/R4/Observation/4":{GET:b},"fhir/R4/Observation/5":{GET:G},"fhir/R4/Observation/6":{GET:x},"fhir/R4/Organization?name=Different":{GET:s},"fhir/R4/Organization/123":{GET:o},"fhir/R4/Organization/456":{GET:a},"fhir/R4/Patient?name=Simpson":{GET:I},"fhir/R4/Patient?_fields=id,_lastUpdated,name&name=Simpson":{GET:I},"fhir/R4/Patient?_count=20&_fields=id,_lastUpdated,name,birthDate,gender&_sort=-_lastUpdated":{GET:I},"fhir/R4/Patient?_fields=id,_lastUpdated,name&_lastUpdated=ge2021-12-01T00%3A00%3A00.000Z":{GET:I},"fhir/R4/Patient?name=Bob":{GET:C},"fhir/R4/Patient/123":{GET:y},"fhir/R4/Patient/123/_history":{GET:h},"fhir/R4/Practitioner":{POST:y},"fhir/R4/Practitioner/123":{GET:c},"fhir/R4/Practitioner/123/_history":{GET:u},"fhir/R4/Practitioner/123/_history/1":{GET:c},"fhir/R4/Practitioner/not-found/_history":{GET:r},"fhir/R4/Questionnaire?subject-type=Patient":{GET:l},"fhir/R4/Questionnaire/not-found":{GET:r},"fhir/R4/Questionnaire/123":{GET:p},"fhir/R4/QuestionnaireResponse":{POST:m},"fhir/R4/QuestionnaireResponse/123":{GET:m},"fhir/R4/ServiceRequest/123":{GET:_},"fhir/R4/ServiceRequest/123/_history":{GET:Q},"fhir/R4/ServiceRequest?subject=Patient/123":{GET:w},"fhir/R4/Subscription/123":{GET:j},"fhir/R4/Subscription/123/_history":{GET:q},"fhir/R4/ValueSet/%24expand?url=https%3A%2F%2Fexample.com%2Ftest&filter=xyz":{GET:J},"fhir/R4/%24graphql":{POST:N},"fhir/R4":{POST:e=>{var t;return{resourceType:"Bundle",type:"batch-response",entry:null===(t=JSON.parse(e).entry)||void 0===t?void 0:t.map((e=>{var t,n,o;const a="fhir/R4/"+(null===(t=null==e?void 0:e.request)||void 0===t?void 0:t.url),s=null===(n=null==e?void 0:e.request)||void 0===n?void 0:n.method,c=null===(o=F[a])||void 0===o?void 0:o[s];return"OperationOutcome"===(null==c?void 0:c.resourceType)?{resource:c,response:{status:i(c).toString()}}:c?{resource:c,response:{status:"200"}}:{resource:r,response:{status:"404"}}}))}}}};class K extends n{constructor(e){super({baseUrl:"https://example.com/",clientId:"my-client-id",fetch:(t,r)=>{var i;const n=r.method,o=t.replace("https://example.com/","");(null==e?void 0:e.debug)&&console.log("MockClient",n,o);let a=null===(i=F[o])||void 0===i?void 0:i[n];"function"==typeof a&&(a=a(r.body)),(null==e?void 0:e.debug)&&!a&&console.log("MockClient: not found",n,o);const s=Object.assign({request:{url:t,options:r}},a);return(null==e?void 0:e.debug)&&console.log("MockClient",JSON.stringify(s,null,2)),Promise.resolve({json:()=>Promise.resolve(s)})}})}clear(){super.clear(),this.activeLoginOverride=void 0}getProfile(){return{resourceType:"Practitioner",id:"123",meta:{versionId:"456"}}}setActiveLoginOverride(e){this.activeLoginOverride=e}getActiveLogin(){return void 0!==this.activeLoginOverride?this.activeLoginOverride:super.getActiveLogin()}}export{D as BartSimpson,a as DifferentOrganization,c as DrAliceSmith,u as DrAliceSmithHistoryBundle,C as EmptySearchBundle,A as ExampleAuditEvent,U as ExampleAuditEventBundle,d as ExampleBot,p as ExampleQuestionnaire,l as ExampleQuestionnaireBundle,m as ExampleQuestionnaireResponse,j as ExampleSubscription,q as ExampleSubscriptionHistory,N as GraphQLSchemaResponse,v as HomerCommunications,g as HomerDiagnosticReport,R as HomerDiagnosticReportBundle,T as HomerEncounter,f as HomerEncounterHistory,P as HomerMedia,O as HomerObservation1,E as HomerObservation2,S as HomerObservation3,b as HomerObservation4,G as HomerObservation5,x as HomerObservation6,B as HomerObservationSearchBundle,_ as HomerServiceRequest,Q as HomerServiceRequestHistoryBundle,w as HomerServiceRequestSearchBundle,y as HomerSimpson,h as HomerSimpsonHistory,K as MockClient,z as ObservationStructureDefinition,s as OrganizationSearchBundle,M as PatientSearchParameters,H as PatientStructureDefinition,k as PractitionerStructureDefinition,L as QuestionnaireStructureDefinition,Z as ServiceRequestServiceDefinition,I as SimpsonSearchBundle,o as TestOrganization,J as exampleValueSet};
2
+ //# sourceMappingURL=index.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.min.js","sources":["../../../src/mocks/alice.ts","../../../src/mocks/bot.ts","../../../src/mocks/questionnaire.ts","../../../src/mocks/simpsons.ts","../../../src/mocks/subscription.ts","../../../src/mocks/types.ts","../../../src/mocks/valueset.ts","../../../src/mocks/accesspolicy.ts","../../../src/client.ts"],"sourcesContent":["import { Bundle, Organization, Practitioner } from '@medplum/fhirtypes';\n\nexport const TestOrganization: Organization = {\n resourceType: 'Organization',\n id: '123',\n meta: {\n versionId: '1',\n },\n name: 'Test Organization',\n};\n\nexport const DifferentOrganization: Organization = {\n resourceType: 'Organization',\n id: '456',\n meta: {\n versionId: '1',\n },\n name: 'Different',\n};\n\nexport const OrganizationSearchBundle: Bundle<Organization> = {\n resourceType: 'Bundle',\n type: 'searchset',\n entry: [\n {\n resource: DifferentOrganization,\n },\n ],\n};\n\nexport const DrAliceSmith: Practitioner = {\n resourceType: 'Practitioner',\n id: '123',\n meta: {\n versionId: '2',\n lastUpdated: '2021-01-02T12:00:00Z',\n author: {\n reference: 'Practitioner/123',\n },\n },\n name: [\n {\n given: ['Alice'],\n family: 'Smith',\n },\n ],\n};\n\nexport const DrAliceSmithHistoryBundle: Bundle<Practitioner> = {\n resourceType: 'Bundle',\n type: 'history',\n entry: [\n {\n resource: DrAliceSmith,\n },\n {\n resource: {\n resourceType: 'Practitioner',\n id: '123',\n meta: {\n versionId: '1',\n lastUpdated: '2021-01-01T12:00:00Z',\n author: {\n reference: 'Practitioner/123',\n },\n },\n name: [{ given: ['Medplum'], family: 'Admin' }],\n },\n },\n ],\n};\n","import { Bot } from '@medplum/fhirtypes';\n\nexport const ExampleBot: Bot = {\n resourceType: 'Bot',\n id: '123',\n name: 'Test Bot',\n code: 'console.log(\"hello world\");',\n};\n","import { Bundle, Questionnaire, QuestionnaireResponse } from '@medplum/fhirtypes';\n\nexport const ExampleQuestionnaire: Questionnaire = {\n resourceType: 'Questionnaire',\n id: '123',\n name: 'Vitals',\n title: 'Vitals',\n item: [\n {\n linkId: '1',\n text: 'First question',\n type: 'string',\n },\n ],\n};\n\nexport const ExampleQuestionnaireBundle: Bundle<Questionnaire> = {\n resourceType: 'Bundle',\n type: 'searchset',\n entry: [\n {\n resource: ExampleQuestionnaire,\n },\n ],\n};\n\nexport const ExampleQuestionnaireResponse: QuestionnaireResponse = {\n resourceType: 'QuestionnaireResponse',\n id: '123',\n questionnaire: 'Questionnaire/123',\n subject: {\n reference: 'Patient/123',\n },\n source: {\n reference: 'Practitioner/123',\n },\n};\n","import {\n Bundle,\n Communication,\n DiagnosticReport,\n Encounter,\n Media,\n Observation,\n Patient,\n ServiceRequest,\n} from '@medplum/fhirtypes';\n\nexport const HomerSimpson: Patient = {\n resourceType: 'Patient',\n id: '123',\n meta: {\n versionId: '2',\n lastUpdated: '2020-01-02T00:00:00.000Z',\n author: {\n reference: 'Practitioner/123',\n },\n },\n identifier: [\n { system: 'abc', value: '123' },\n { system: 'def', value: '456' },\n ],\n name: [\n {\n given: ['Homer'],\n family: 'Simpson',\n },\n ],\n photo: [\n {\n contentType: 'image/jpeg',\n url: 'https://example.com/picture.jpg',\n },\n ],\n};\n\nexport const HomerSimpsonHistory: Bundle<Patient> = {\n resourceType: 'Bundle',\n type: 'history',\n entry: [\n {\n resource: HomerSimpson,\n },\n {\n resource: {\n resourceType: 'Patient',\n id: '123',\n meta: {\n versionId: '1',\n lastUpdated: '2020-01-01T00:00:00.000Z',\n author: {\n reference: 'Practitioner/123',\n },\n },\n name: [\n {\n given: ['Homer'],\n family: 'Simpson',\n },\n ],\n photo: [\n {\n contentType: 'image/jpeg',\n url: 'https://example.com/picture.jpg',\n },\n ],\n },\n },\n ],\n};\n\nexport const HomerEncounter: Encounter = {\n resourceType: 'Encounter',\n id: '123',\n meta: {\n versionId: '456',\n },\n};\n\nexport const HomerEncounterHistory: Bundle<Encounter> = {\n resourceType: 'Bundle',\n type: 'history',\n entry: [\n {\n resource: HomerEncounter,\n },\n ],\n};\n\nexport const HomerCommunications: Bundle<Communication> = {\n resourceType: 'Bundle',\n entry: [\n {\n resource: {\n resourceType: 'Communication',\n id: '123',\n meta: {\n lastUpdated: '2020-01-01T12:00:00Z',\n author: {\n reference: 'Practitioner/123',\n },\n },\n payload: [\n {\n contentString: 'Hello world',\n },\n ],\n },\n },\n ],\n};\n\nexport const HomerMedia: Bundle<Media> = {\n resourceType: 'Bundle',\n entry: [\n {\n resource: {\n resourceType: 'Media',\n id: '123',\n meta: {\n lastUpdated: '2020-01-01T12:00:00Z',\n author: {\n reference: 'Practitioner/123',\n },\n },\n content: {\n contentType: 'text/plain',\n url: 'https://example.com/test.txt',\n },\n },\n },\n ],\n};\n\nexport const HomerDiagnosticReport: DiagnosticReport = {\n resourceType: 'DiagnosticReport',\n id: '123',\n subject: {\n reference: 'Patient/123',\n display: 'Homer Simpson',\n },\n resultsInterpreter: [\n {\n reference: 'Practitioner/123',\n display: 'Dr. Alice Smith',\n },\n ],\n result: [\n { reference: 'Observation/1' },\n { reference: 'Observation/2' },\n { reference: 'Observation/3' },\n { reference: 'Observation/4' },\n { reference: 'Observation/5' },\n { reference: 'Observation/6' },\n ],\n};\n\nexport const HomerDiagnosticReportBundle: Bundle<DiagnosticReport> = {\n resourceType: 'Bundle',\n type: 'searchset',\n entry: [\n {\n resource: HomerDiagnosticReport,\n },\n ],\n};\n\nexport const HomerObservation1: Observation = {\n resourceType: 'Observation',\n id: '1',\n valueString: 'test',\n};\n\nexport const HomerObservation2: Observation = {\n resourceType: 'Observation',\n id: '2',\n valueQuantity: {\n value: 20,\n unit: 'x',\n },\n referenceRange: [\n {\n low: {\n value: 10,\n },\n },\n ],\n};\n\nexport const HomerObservation3: Observation = {\n resourceType: 'Observation',\n id: '3',\n valueQuantity: {\n value: 30,\n unit: 'x',\n },\n referenceRange: [\n {\n high: {\n value: 50,\n },\n },\n ],\n};\n\nexport const HomerObservation4: Observation = {\n resourceType: 'Observation',\n id: '4',\n valueQuantity: {\n value: 50,\n unit: 'x',\n },\n referenceRange: [\n {\n low: {\n value: 10,\n },\n high: {\n value: 50,\n },\n },\n ],\n interpretation: [\n {\n text: 'HIGH',\n },\n ],\n};\n\nexport const HomerObservation5: Observation = {\n resourceType: 'Observation',\n id: '5',\n valueQuantity: {\n value: 100,\n unit: 'x',\n },\n referenceRange: [{}],\n interpretation: [{}],\n};\n\nexport const HomerObservation6: Observation = {\n resourceType: 'Observation',\n component: [\n {\n valueQuantity: {\n value: 110,\n unit: 'mmHg',\n system: 'http://unitsofmeasure.org',\n },\n },\n {\n valueQuantity: {\n value: 75,\n unit: 'mmHg',\n system: 'http://unitsofmeasure.org',\n },\n },\n ],\n};\n\nexport const HomerObservationSearchBundle: Bundle<Observation> = {\n resourceType: 'Bundle',\n total: 1,\n entry: [\n {\n resource: HomerObservation3,\n },\n ],\n};\n\nexport const HomerServiceRequest: ServiceRequest = {\n resourceType: 'ServiceRequest',\n id: '123',\n meta: {\n versionId: '1',\n lastUpdated: '2020-01-01T12:00:00Z',\n author: {\n reference: 'Practitioner/123',\n },\n },\n code: {\n coding: [\n {\n system: 'http://snomed.info/sct',\n code: 'SERVICE_REQUEST_CODE',\n },\n ],\n },\n subject: {\n reference: 'Patient/123',\n display: 'Homer Simpson',\n },\n};\n\nexport const HomerServiceRequestHistoryBundle: Bundle<ServiceRequest> = {\n resourceType: 'Bundle',\n type: 'history',\n entry: [\n {\n resource: HomerServiceRequest,\n },\n ],\n};\n\nexport const HomerServiceRequestSearchBundle: Bundle<ServiceRequest> = {\n resourceType: 'Bundle',\n type: 'searchset',\n entry: [\n {\n resource: HomerServiceRequest,\n },\n ],\n};\n\nexport const BartSimpson: Patient = {\n resourceType: 'Patient',\n id: '555',\n meta: {\n versionId: '1',\n lastUpdated: '2020-01-01T12:00:00Z',\n author: {\n reference: 'Practitioner/123',\n },\n },\n name: [\n {\n given: ['Bart'],\n family: 'Simpson',\n },\n ],\n photo: [\n {\n contentType: 'image/jpeg',\n url: 'https://example.com/picture.jpg',\n },\n ],\n};\n\nexport const SimpsonSearchBundle: Bundle<Patient> = {\n resourceType: 'Bundle',\n type: 'searchset',\n total: 2,\n entry: [\n {\n resource: HomerSimpson,\n },\n {\n resource: BartSimpson,\n },\n ],\n};\n","import { AuditEvent, Bundle, Subscription } from '@medplum/fhirtypes';\n\nexport const ExampleSubscription: Subscription = {\n resourceType: 'Subscription',\n id: '123',\n meta: {\n versionId: '456',\n },\n};\n\nexport const ExampleSubscriptionHistory: Bundle<Subscription> = {\n resourceType: 'Bundle',\n type: 'history',\n entry: [\n {\n resource: ExampleSubscription,\n },\n ],\n};\n\nexport const ExampleAuditEvent: AuditEvent = {\n resourceType: 'AuditEvent',\n id: '123',\n meta: {\n lastUpdated: new Date().toISOString(),\n versionId: '456',\n author: {\n reference: 'Practitioner/123',\n },\n },\n};\n\nexport const ExampleAuditEventBundle: Bundle<AuditEvent> = {\n resourceType: 'Bundle',\n entry: [\n {\n resource: ExampleAuditEvent,\n },\n ],\n};\n","import { Bundle, SearchParameter, StructureDefinition } from '@medplum/fhirtypes';\n\nexport const EmptySearchBundle: Bundle = {\n resourceType: 'Bundle',\n type: 'searchset',\n total: 0,\n entry: [],\n};\n\nexport const ObservationStructureDefinition: StructureDefinition = {\n resourceType: 'StructureDefinition',\n name: 'Observation',\n snapshot: {\n element: [\n {\n path: 'Observation.id',\n type: [\n {\n code: 'code',\n },\n ],\n },\n {\n path: 'Observation.value[x]',\n min: 0,\n max: '1',\n type: [\n {\n code: 'Quantity',\n },\n {\n code: 'CodeableConcept',\n },\n {\n code: 'string',\n },\n {\n code: 'boolean',\n },\n {\n code: 'integer',\n },\n {\n code: 'Range',\n },\n {\n code: 'Ratio',\n },\n {\n code: 'SampledData',\n },\n {\n code: 'time',\n },\n {\n code: 'dateTime',\n },\n {\n code: 'Period',\n },\n ],\n },\n ],\n },\n};\n\nexport const PatientStructureDefinition: StructureDefinition = {\n resourceType: 'StructureDefinition',\n id: '123',\n name: 'Patient',\n snapshot: {\n element: [\n {\n id: 'Patient.name',\n path: 'Patient.name',\n type: [\n {\n code: 'HumanName',\n },\n ],\n max: '*',\n },\n ],\n },\n};\n\nexport const PatientSearchParameters: SearchParameter[] = [\n {\n resourceType: 'SearchParameter',\n id: 'Patient-name',\n base: ['Patient'],\n code: 'name',\n name: 'name',\n type: 'string',\n expression: 'Patient.name',\n },\n {\n resourceType: 'SearchParameter',\n id: 'Patient-birthdate',\n base: ['Patient'],\n code: 'birthdate',\n name: 'birthdate',\n type: 'date',\n expression: 'Patient.birthdate',\n },\n {\n resourceType: 'SearchParameter',\n id: 'Patient-organization',\n base: ['Patient'],\n code: 'organization',\n name: 'organization',\n type: 'reference',\n expression: 'Patient.organization',\n target: ['Organization'],\n },\n];\n\nexport const PractitionerStructureDefinition: StructureDefinition = {\n resourceType: 'StructureDefinition',\n name: 'Practitioner',\n snapshot: {\n element: [\n {\n path: 'Practitioner.id',\n type: [\n {\n code: 'code',\n },\n ],\n },\n {\n path: 'Practitioner.name',\n type: [\n {\n code: 'HumanName',\n },\n ],\n max: '*',\n },\n {\n path: 'Practitioner.gender',\n type: [\n {\n code: 'code',\n },\n ],\n },\n ],\n },\n};\n\nexport const QuestionnaireStructureDefinition: StructureDefinition = {\n resourceType: 'StructureDefinition',\n name: 'Questionnaire',\n snapshot: {\n element: [\n {\n id: 'Questionnaire.item',\n path: 'Questionnaire.item',\n type: [\n {\n code: 'BackboneElement',\n },\n ],\n },\n {\n id: 'Questionnaire.item.answerOption',\n path: 'Questionnaire.item.answerOption',\n type: [\n {\n code: 'BackboneElement',\n },\n ],\n },\n {\n id: 'Questionnaire.item.answerOption.value[x]',\n path: 'Questionnaire.item.answerOption.value[x]',\n min: 1,\n max: '1',\n type: [\n {\n code: 'integer',\n },\n {\n code: 'date',\n },\n {\n code: 'time',\n },\n {\n code: 'string',\n },\n {\n code: 'Coding',\n },\n {\n code: 'Reference',\n targetProfile: ['http://hl7.org/fhir/StructureDefinition/Resource'],\n },\n ],\n },\n ],\n },\n};\n\nexport const ServiceRequestServiceDefinition: StructureDefinition = {\n resourceType: 'StructureDefinition',\n name: 'ServiceRequest',\n snapshot: {\n element: [\n {\n path: 'ServiceRequest.id',\n type: [\n {\n code: 'code',\n },\n ],\n },\n {\n path: 'ServiceRequest.code',\n type: [\n {\n code: 'CodeableConcept',\n },\n ],\n },\n ],\n },\n};\n\nexport const GraphQLSchemaResponse = {\n data: {\n StructureDefinitionList: [\n ObservationStructureDefinition,\n PatientStructureDefinition,\n PractitionerStructureDefinition,\n QuestionnaireStructureDefinition,\n ServiceRequestServiceDefinition,\n ],\n SearchParameterList: [...PatientSearchParameters],\n },\n};\n","import { ValueSet } from '@medplum/fhirtypes';\n\nexport const exampleValueSet: ValueSet = {\n resourceType: 'ValueSet',\n expansion: {\n contains: [\n {\n system: 'x',\n code: 'test-code',\n display: 'Test Display',\n },\n ],\n },\n};\n","import { AccessPolicy, Bundle } from '@medplum/fhirtypes';\n\nexport const ExampleAccessPolicy: AccessPolicy = {\n resourceType: 'AccessPolicy',\n id: '123',\n name: 'Example Access Policy',\n};\n\nexport const ExampleAccessPolicySearchBundle: Bundle<AccessPolicy> = {\n resourceType: 'Bundle',\n type: 'searchset',\n entry: [\n {\n resource: ExampleAccessPolicy,\n },\n ],\n};\n","import { allOk, badRequest, getStatus, LoginState, MedplumClient, notFound, ProfileResource } from '@medplum/core';\nimport { Bundle, BundleEntry, Communication, Media, Practitioner } from '@medplum/fhirtypes';\nimport {\n DifferentOrganization,\n DrAliceSmith,\n DrAliceSmithHistoryBundle,\n EmptySearchBundle,\n ExampleAuditEventBundle,\n ExampleBot,\n ExampleQuestionnaire,\n ExampleQuestionnaireBundle,\n ExampleQuestionnaireResponse,\n ExampleSubscription,\n ExampleSubscriptionHistory,\n exampleValueSet,\n GraphQLSchemaResponse,\n HomerCommunications,\n HomerDiagnosticReport,\n HomerDiagnosticReportBundle,\n HomerEncounter,\n HomerEncounterHistory,\n HomerMedia,\n HomerObservation1,\n HomerObservation2,\n HomerObservation3,\n HomerObservation4,\n HomerObservation5,\n HomerObservation6,\n HomerObservationSearchBundle,\n HomerServiceRequest,\n HomerServiceRequestHistoryBundle,\n HomerServiceRequestSearchBundle,\n HomerSimpson,\n HomerSimpsonHistory,\n OrganizationSearchBundle,\n SimpsonSearchBundle,\n TestOrganization,\n} from './mocks';\nimport { ExampleAccessPolicy, ExampleAccessPolicySearchBundle } from './mocks/accesspolicy';\n\nconst newComment: Communication = {\n resourceType: 'Communication',\n id: 'new-comment',\n payload: [\n {\n contentString: 'Test comment',\n },\n ],\n};\n\nconst newMedia: Media = {\n resourceType: 'Media',\n id: 'new-media',\n content: {\n contentType: 'text/plain',\n url: 'https://example.com/test2.txt',\n },\n};\n\nconst routes: Record<string, Record<string, any>> = {\n 'admin/projects/123': {\n GET: {\n project: { id: '123', name: 'Project 123' },\n members: [{ profile: 'Practitioner/123', name: 'Alice Smith' }],\n },\n },\n 'admin/super/structuredefinitions': {\n POST: {\n ok: true,\n },\n },\n 'admin/super/valuesets': {\n POST: {\n ok: true,\n },\n },\n 'admin/super/reindex': {\n POST: {\n ok: true,\n },\n },\n 'auth/changepassword': {\n POST: (body: string) => {\n const { oldPassword } = JSON.parse(body);\n if (oldPassword === 'orange') {\n return allOk;\n } else {\n return {\n resourceType: 'OperationOutcome',\n issue: [\n {\n expression: ['oldPassword'],\n details: {\n text: 'Incorrect password',\n },\n },\n ],\n };\n }\n },\n },\n 'auth/login': {\n POST: {\n profile: { reference: 'Practitioner/123' },\n },\n },\n 'auth/setpassword': {\n POST: (body: string) => {\n const { password } = JSON.parse(body);\n if (password === 'orange') {\n return allOk;\n } else {\n return {\n resourceType: 'OperationOutcome',\n issue: [\n {\n expression: ['password'],\n details: {\n text: 'Invalid password',\n },\n },\n ],\n };\n }\n },\n },\n 'auth/register': {\n POST: (body: string) => {\n const { email, password } = JSON.parse(body);\n if (email === 'george@example.com' && password === 'password') {\n return allOk;\n } else {\n return {\n resourceType: 'OperationOutcome',\n issue: [\n {\n details: {\n text: 'Invalid',\n },\n },\n ],\n };\n }\n },\n },\n 'auth/resetpassword': {\n POST: (body: string) => {\n const { email } = JSON.parse(body);\n if (email === 'admin@example.com') {\n return allOk;\n } else {\n return {\n resourceType: 'OperationOutcome',\n issue: [\n {\n expression: ['email'],\n details: {\n text: 'Email not found',\n },\n },\n ],\n };\n }\n },\n },\n 'fhir/R4/AccessPolicy?name=Example%20Access%20Policy': {\n GET: ExampleAccessPolicySearchBundle,\n },\n 'fhir/R4/AccessPolicy/123': {\n GET: ExampleAccessPolicy,\n },\n 'fhir/R4/AuditEvent?entity=Subscription/123&_count=20&_sort=-_lastUpdated': {\n GET: ExampleAuditEventBundle,\n },\n 'fhir/R4/Binary?_filename=hello.exe': {\n POST: badRequest('Invalid file type'),\n },\n 'fhir/R4/Bot/123': {\n GET: ExampleBot,\n },\n 'fhir/R4/Communication': {\n POST: newComment,\n },\n 'fhir/R4/Communication?based-on=ServiceRequest/123': {\n GET: HomerCommunications,\n },\n 'fhir/R4/Communication?encounter=Encounter/123': {\n GET: HomerCommunications,\n },\n 'fhir/R4/Communication?subject=Patient/123': {\n GET: HomerCommunications,\n },\n 'fhir/R4/Device?subject=Patient/123': {\n GET: EmptySearchBundle,\n },\n 'fhir/R4/DeviceRequest?patient=Patient/123': {\n GET: EmptySearchBundle,\n },\n 'fhir/R4/DiagnosticReport/123': {\n GET: HomerDiagnosticReport,\n },\n 'fhir/R4/DiagnosticReport/123/_history': {\n GET: HomerDiagnosticReportBundle,\n },\n 'fhir/R4/DiagnosticReport?based-on=ServiceRequest/123': {\n GET: HomerDiagnosticReportBundle,\n },\n 'fhir/R4/DiagnosticReport?subject=Patient/123': {\n GET: HomerDiagnosticReportBundle,\n },\n 'fhir/R4/Encounter/123': {\n GET: HomerEncounter,\n },\n 'fhir/R4/Encounter/123/_history': {\n GET: HomerEncounterHistory,\n },\n 'fhir/R4/Media': {\n POST: newMedia,\n },\n 'fhir/R4/Media?based-on=ServiceRequest/123': {\n GET: HomerMedia,\n },\n 'fhir/R4/Media?encounter=Encounter/123': {\n GET: HomerMedia,\n },\n 'fhir/R4/Media?subject=Patient/123': {\n GET: HomerMedia,\n },\n 'fhir/R4/Observation?_fields=value[x]': {\n GET: HomerObservationSearchBundle,\n },\n 'fhir/R4/Observation/1': {\n GET: HomerObservation1,\n },\n 'fhir/R4/Observation/2': {\n GET: HomerObservation2,\n },\n 'fhir/R4/Observation/3': {\n GET: HomerObservation3,\n },\n 'fhir/R4/Observation/4': {\n GET: HomerObservation4,\n },\n 'fhir/R4/Observation/5': {\n GET: HomerObservation5,\n },\n 'fhir/R4/Observation/6': {\n GET: HomerObservation6,\n },\n 'fhir/R4/Organization?name=Different': {\n GET: OrganizationSearchBundle,\n },\n 'fhir/R4/Organization/123': {\n GET: TestOrganization,\n },\n 'fhir/R4/Organization/456': {\n GET: DifferentOrganization,\n },\n 'fhir/R4/Patient?name=Simpson': {\n GET: SimpsonSearchBundle,\n },\n 'fhir/R4/Patient?_fields=id,_lastUpdated,name&name=Simpson': {\n GET: SimpsonSearchBundle,\n },\n 'fhir/R4/Patient?_count=20&_fields=id,_lastUpdated,name,birthDate,gender&_sort=-_lastUpdated': {\n GET: SimpsonSearchBundle,\n },\n 'fhir/R4/Patient?_fields=id,_lastUpdated,name&_lastUpdated=ge2021-12-01T00%3A00%3A00.000Z': {\n GET: SimpsonSearchBundle,\n },\n 'fhir/R4/Patient?name=Bob': {\n GET: EmptySearchBundle,\n },\n 'fhir/R4/Patient/123': {\n GET: HomerSimpson,\n },\n 'fhir/R4/Patient/123/_history': {\n GET: HomerSimpsonHistory,\n },\n 'fhir/R4/Practitioner': {\n POST: HomerSimpson,\n },\n 'fhir/R4/Practitioner/123': {\n GET: DrAliceSmith,\n },\n 'fhir/R4/Practitioner/123/_history': {\n GET: DrAliceSmithHistoryBundle,\n },\n 'fhir/R4/Practitioner/123/_history/1': {\n GET: DrAliceSmith,\n },\n 'fhir/R4/Practitioner/not-found/_history': {\n GET: notFound,\n },\n 'fhir/R4/Questionnaire?subject-type=Patient': {\n GET: ExampleQuestionnaireBundle,\n },\n 'fhir/R4/Questionnaire/not-found': {\n GET: notFound,\n },\n 'fhir/R4/Questionnaire/123': {\n GET: ExampleQuestionnaire,\n },\n 'fhir/R4/QuestionnaireResponse': {\n POST: ExampleQuestionnaireResponse,\n },\n 'fhir/R4/QuestionnaireResponse/123': {\n GET: ExampleQuestionnaireResponse,\n },\n 'fhir/R4/ServiceRequest/123': {\n GET: HomerServiceRequest,\n },\n 'fhir/R4/ServiceRequest/123/_history': {\n GET: HomerServiceRequestHistoryBundle,\n },\n 'fhir/R4/ServiceRequest?subject=Patient/123': {\n GET: HomerServiceRequestSearchBundle,\n },\n 'fhir/R4/Subscription/123': {\n GET: ExampleSubscription,\n },\n 'fhir/R4/Subscription/123/_history': {\n GET: ExampleSubscriptionHistory,\n },\n 'fhir/R4/ValueSet/%24expand?url=https%3A%2F%2Fexample.com%2Ftest&filter=xyz': {\n GET: exampleValueSet,\n },\n 'fhir/R4/%24graphql': {\n POST: GraphQLSchemaResponse,\n },\n 'fhir/R4': {\n POST: (body: string) => {\n const request = JSON.parse(body) as Bundle;\n return {\n resourceType: 'Bundle',\n type: 'batch-response',\n entry: request.entry?.map((e: BundleEntry) => {\n const url = 'fhir/R4/' + e?.request?.url;\n const method = e?.request?.method as string;\n const resource = routes[url]?.[method];\n if (resource?.resourceType === 'OperationOutcome') {\n return { resource, response: { status: getStatus(resource).toString() } };\n } else if (resource) {\n return { resource, response: { status: '200' } };\n } else {\n return { resource: notFound, response: { status: '404' } };\n }\n }),\n };\n },\n },\n};\n\nexport interface MockClientOptions {\n readonly debug?: boolean;\n}\n\nexport class MockClient extends MedplumClient {\n activeLoginOverride?: LoginState;\n\n constructor(clientOptions?: MockClientOptions) {\n super({\n baseUrl: 'https://example.com/',\n clientId: 'my-client-id',\n fetch: (url: string, options: any) => {\n const method = options.method;\n const path = url.replace('https://example.com/', '');\n\n if (clientOptions?.debug) {\n console.log('MockClient', method, path);\n }\n\n let result = routes[path]?.[method];\n if (typeof result === 'function') {\n result = result(options.body);\n }\n\n if (clientOptions?.debug && !result) {\n console.log('MockClient: not found', method, path);\n }\n\n const response: any = {\n request: {\n url,\n options,\n },\n ...result,\n };\n\n if (clientOptions?.debug) {\n console.log('MockClient', JSON.stringify(response, null, 2));\n }\n\n return Promise.resolve({\n json: () => Promise.resolve(response),\n });\n },\n });\n }\n\n clear(): void {\n super.clear();\n this.activeLoginOverride = undefined;\n }\n\n getProfile(): ProfileResource {\n return {\n resourceType: 'Practitioner',\n id: '123',\n meta: {\n versionId: '456',\n },\n } as Practitioner;\n }\n\n setActiveLoginOverride(activeLoginOverride: LoginState): void {\n this.activeLoginOverride = activeLoginOverride;\n }\n\n getActiveLogin(): LoginState | undefined {\n if (this.activeLoginOverride !== undefined) {\n return this.activeLoginOverride;\n }\n return super.getActiveLogin();\n }\n}\n"],"names":["TestOrganization","resourceType","id","meta","versionId","name","DifferentOrganization","OrganizationSearchBundle","type","entry","resource","DrAliceSmith","lastUpdated","author","reference","given","family","DrAliceSmithHistoryBundle","ExampleBot","code","ExampleQuestionnaire","title","item","linkId","text","ExampleQuestionnaireBundle","ExampleQuestionnaireResponse","questionnaire","subject","source","HomerSimpson","identifier","system","value","photo","contentType","url","HomerSimpsonHistory","HomerEncounter","HomerEncounterHistory","HomerCommunications","payload","contentString","HomerMedia","content","HomerDiagnosticReport","display","resultsInterpreter","result","HomerDiagnosticReportBundle","HomerObservation1","valueString","HomerObservation2","valueQuantity","unit","referenceRange","low","HomerObservation3","high","HomerObservation4","interpretation","HomerObservation5","HomerObservation6","component","HomerObservationSearchBundle","total","HomerServiceRequest","coding","HomerServiceRequestHistoryBundle","HomerServiceRequestSearchBundle","BartSimpson","SimpsonSearchBundle","ExampleSubscription","ExampleSubscriptionHistory","ExampleAuditEvent","Date","toISOString","ExampleAuditEventBundle","EmptySearchBundle","ObservationStructureDefinition","snapshot","element","path","min","max","PatientStructureDefinition","PatientSearchParameters","base","expression","target","PractitionerStructureDefinition","QuestionnaireStructureDefinition","targetProfile","ServiceRequestServiceDefinition","GraphQLSchemaResponse","data","StructureDefinitionList","SearchParameterList","exampleValueSet","expansion","contains","ExampleAccessPolicy","routes","GET","project","members","profile","POST","ok","body","oldPassword","JSON","parse","allOk","issue","details","password","email","badRequest","notFound","map","e","request","method","response","status","getStatus","toString","MockClient","MedplumClient","constructor","clientOptions","super","baseUrl","clientId","fetch","options","replace","debug","console","log","stringify","Promise","resolve","json","clear","this","activeLoginOverride","undefined","getProfile","setActiveLoginOverride","getActiveLogin"],"mappings":"4GAEaA,EAAiC,CAC5CC,aAAc,eACdC,GAAI,MACJC,KAAM,CACJC,UAAW,KAEbC,KAAM,qBAGKC,EAAsC,CACjDL,aAAc,eACdC,GAAI,MACJC,KAAM,CACJC,UAAW,KAEbC,KAAM,aAGKE,EAAiD,CAC5DN,aAAc,SACdO,KAAM,YACNC,MAAO,CACL,CACEC,SAAUJ,KAKHK,EAA6B,CACxCV,aAAc,eACdC,GAAI,MACJC,KAAM,CACJC,UAAW,IACXQ,YAAa,uBACbC,OAAQ,CACNC,UAAW,qBAGfT,KAAM,CACJ,CACEU,MAAO,CAAC,SACRC,OAAQ,WAKDC,EAAkD,CAC7DhB,aAAc,SACdO,KAAM,UACNC,MAAO,CACL,CACEC,SAAUC,GAEZ,CACED,SAAU,CACRT,aAAc,eACdC,GAAI,MACJC,KAAM,CACJC,UAAW,IACXQ,YAAa,uBACbC,OAAQ,CACNC,UA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AM,CACJC,UAAW,QAKjBkJ,uBAAuBH,GACrBD,KAAKC,oBAAsBA,EAG7BI,iBACE,YAAiCH,IAA7BF,KAAKC,oBACAD,KAAKC,oBAEPf,MAAMmB"}
@@ -0,0 +1,12 @@
1
+ import { LoginState, MedplumClient, ProfileResource } from '@medplum/core';
2
+ export interface MockClientOptions {
3
+ readonly debug?: boolean;
4
+ }
5
+ export declare class MockClient extends MedplumClient {
6
+ activeLoginOverride?: LoginState;
7
+ constructor(clientOptions?: MockClientOptions);
8
+ clear(): void;
9
+ getProfile(): ProfileResource;
10
+ setActiveLoginOverride(activeLoginOverride: LoginState): void;
11
+ getActiveLogin(): LoginState | undefined;
12
+ }
@@ -0,0 +1,2 @@
1
+ export * from './client';
2
+ export * from './mocks';
@@ -0,0 +1,3 @@
1
+ import { AccessPolicy, Bundle } from '@medplum/fhirtypes';
2
+ export declare const ExampleAccessPolicy: AccessPolicy;
3
+ export declare const ExampleAccessPolicySearchBundle: Bundle<AccessPolicy>;
@@ -0,0 +1,6 @@
1
+ import { Bundle, Organization, Practitioner } from '@medplum/fhirtypes';
2
+ export declare const TestOrganization: Organization;
3
+ export declare const DifferentOrganization: Organization;
4
+ export declare const OrganizationSearchBundle: Bundle<Organization>;
5
+ export declare const DrAliceSmith: Practitioner;
6
+ export declare const DrAliceSmithHistoryBundle: Bundle<Practitioner>;
@@ -0,0 +1,2 @@
1
+ import { Bot } from '@medplum/fhirtypes';
2
+ export declare const ExampleBot: Bot;
@@ -0,0 +1,7 @@
1
+ export * from './alice';
2
+ export * from './bot';
3
+ export * from './questionnaire';
4
+ export * from './simpsons';
5
+ export * from './subscription';
6
+ export * from './types';
7
+ export * from './valueset';
@@ -0,0 +1,4 @@
1
+ import { Bundle, Questionnaire, QuestionnaireResponse } from '@medplum/fhirtypes';
2
+ export declare const ExampleQuestionnaire: Questionnaire;
3
+ export declare const ExampleQuestionnaireBundle: Bundle<Questionnaire>;
4
+ export declare const ExampleQuestionnaireResponse: QuestionnaireResponse;
@@ -0,0 +1,21 @@
1
+ import { Bundle, Communication, DiagnosticReport, Encounter, Media, Observation, Patient, ServiceRequest } from '@medplum/fhirtypes';
2
+ export declare const HomerSimpson: Patient;
3
+ export declare const HomerSimpsonHistory: Bundle<Patient>;
4
+ export declare const HomerEncounter: Encounter;
5
+ export declare const HomerEncounterHistory: Bundle<Encounter>;
6
+ export declare const HomerCommunications: Bundle<Communication>;
7
+ export declare const HomerMedia: Bundle<Media>;
8
+ export declare const HomerDiagnosticReport: DiagnosticReport;
9
+ export declare const HomerDiagnosticReportBundle: Bundle<DiagnosticReport>;
10
+ export declare const HomerObservation1: Observation;
11
+ export declare const HomerObservation2: Observation;
12
+ export declare const HomerObservation3: Observation;
13
+ export declare const HomerObservation4: Observation;
14
+ export declare const HomerObservation5: Observation;
15
+ export declare const HomerObservation6: Observation;
16
+ export declare const HomerObservationSearchBundle: Bundle<Observation>;
17
+ export declare const HomerServiceRequest: ServiceRequest;
18
+ export declare const HomerServiceRequestHistoryBundle: Bundle<ServiceRequest>;
19
+ export declare const HomerServiceRequestSearchBundle: Bundle<ServiceRequest>;
20
+ export declare const BartSimpson: Patient;
21
+ export declare const SimpsonSearchBundle: Bundle<Patient>;
@@ -0,0 +1,5 @@
1
+ import { AuditEvent, Bundle, Subscription } from '@medplum/fhirtypes';
2
+ export declare const ExampleSubscription: Subscription;
3
+ export declare const ExampleSubscriptionHistory: Bundle<Subscription>;
4
+ export declare const ExampleAuditEvent: AuditEvent;
5
+ export declare const ExampleAuditEventBundle: Bundle<AuditEvent>;
@@ -0,0 +1,14 @@
1
+ import { Bundle, SearchParameter, StructureDefinition } from '@medplum/fhirtypes';
2
+ export declare const EmptySearchBundle: Bundle;
3
+ export declare const ObservationStructureDefinition: StructureDefinition;
4
+ export declare const PatientStructureDefinition: StructureDefinition;
5
+ export declare const PatientSearchParameters: SearchParameter[];
6
+ export declare const PractitionerStructureDefinition: StructureDefinition;
7
+ export declare const QuestionnaireStructureDefinition: StructureDefinition;
8
+ export declare const ServiceRequestServiceDefinition: StructureDefinition;
9
+ export declare const GraphQLSchemaResponse: {
10
+ data: {
11
+ StructureDefinitionList: StructureDefinition[];
12
+ SearchParameterList: SearchParameter[];
13
+ };
14
+ };
@@ -0,0 +1,2 @@
1
+ import { ValueSet } from '@medplum/fhirtypes';
2
+ export declare const exampleValueSet: ValueSet;
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@medplum/mock",
3
+ "version": "0.4.0",
4
+ "description": "Medplum Mock Client",
5
+ "author": "Medplum <hello@medplum.com>",
6
+ "license": "Apache-2.0",
7
+ "homepage": "https://www.medplum.com/",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/medplum/medplum.git",
11
+ "directory": "packages/mock"
12
+ },
13
+ "scripts": {
14
+ "clean": "rimraf dist",
15
+ "build": "npm run clean && tsc && npm run rollup",
16
+ "rollup": "rollup --config rollup.config.js",
17
+ "test": "jest"
18
+ },
19
+ "devDependencies": {
20
+ "@medplum/core": "0.4.0"
21
+ },
22
+ "peerDependencies": {
23
+ "@medplum/core": "0.4.0"
24
+ },
25
+ "main": "dist/cjs/index.js",
26
+ "module": "dist/esm/index.js",
27
+ "exports": {
28
+ "require": "./dist/cjs/index.js",
29
+ "import": "./dist/esm/index.js"
30
+ },
31
+ "types": "dist/types/index.d.ts",
32
+ "sideEffects": false,
33
+ "keywords": [
34
+ "medplum",
35
+ "fhir",
36
+ "healthcare",
37
+ "interoperability",
38
+ "json",
39
+ "serialization",
40
+ "hl7",
41
+ "standards",
42
+ "clinical",
43
+ "dstu2",
44
+ "stu3",
45
+ "r4",
46
+ "normative"
47
+ ]
48
+ }
@@ -0,0 +1,43 @@
1
+ import resolve from '@rollup/plugin-node-resolve';
2
+ import typescript from '@rollup/plugin-typescript';
3
+ import { terser } from 'rollup-plugin-terser';
4
+
5
+ const extensions = ['.ts'];
6
+
7
+ export default {
8
+ input: 'src/index.ts',
9
+ output: [
10
+ {
11
+ file: 'dist/esm/index.js',
12
+ format: 'esm',
13
+ sourcemap: true,
14
+ },
15
+ {
16
+ file: 'dist/esm/index.min.js',
17
+ format: 'esm',
18
+ plugins: [terser()],
19
+ sourcemap: true,
20
+ },
21
+ {
22
+ file: 'dist/cjs/index.js',
23
+ format: 'umd',
24
+ name: 'medplum.mock',
25
+ sourcemap: true,
26
+ globals: {
27
+ '@medplum/core': 'medplum.core',
28
+ },
29
+ },
30
+ {
31
+ file: 'dist/cjs/index.min.js',
32
+ format: 'umd',
33
+ name: 'medplum.mock',
34
+ plugins: [terser()],
35
+ sourcemap: true,
36
+ globals: {
37
+ '@medplum/core': 'medplum.core',
38
+ },
39
+ },
40
+ ],
41
+ plugins: [resolve({ extensions }), typescript()],
42
+ external: ['@medplum/core'],
43
+ };