@medplum/mock 2.0.3 → 2.0.4

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.min.mjs","sources":["../../../src/mocks/accesspolicy.ts","../../../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/workflow.ts","../../../src/mocks/smart.ts","../../../../node_modules/tslib/tslib.es6.js","../../../src/repo.ts","../../../src/client.ts"],"sourcesContent":["import { AccessPolicy, UserConfiguration, ValueSet } from '@medplum/fhirtypes';\n\nexport const ExampleAccessPolicy: AccessPolicy = {\n resourceType: 'AccessPolicy',\n id: '123',\n name: 'Example Access Policy',\n};\n\nexport const ExampleStatusValueSet: ValueSet = {\n resourceType: 'ValueSet',\n id: 'example-statuses',\n compose: {\n include: [\n {\n concept: [\n { code: 'ORDERED' },\n { code: 'SENT_TO_CUSTOMER' },\n { code: 'SENT_BACK_TO_LAB' },\n { code: 'LAB_PROCESSED' },\n { code: 'LAB_COMPLETE' },\n ],\n },\n ],\n },\n};\n\nexport const ExampleUserConfiguration: UserConfiguration = {\n resourceType: 'UserConfiguration',\n id: '123',\n name: 'Example User Configuration',\n option: [\n {\n id: 'statusValueSet',\n valueString: 'ValueSet/example-statuses',\n },\n ],\n};\n","import { createReference } from '@medplum/core';\nimport { Organization, Practitioner, Schedule, Slot } 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 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 photo: [\n {\n contentType: 'image/png',\n url: 'https://www.medplum.com/img/cdc-femaledoc.png',\n },\n ],\n};\n\nexport const DrAliceSmithPreviousVersion: Practitioner = {\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\nexport const DrAliceSmithSchedule: Schedule = {\n resourceType: 'Schedule',\n id: 'alice-smith-schedule',\n actor: [\n {\n reference: 'Practitioner/123',\n display: 'Dr. Alice Smith',\n },\n ],\n};\n\nexport const DrAliceSmithSlots: Slot[] = (() => {\n const schedule = createReference(DrAliceSmithSchedule);\n const result: Slot[] = [];\n const slotDate = new Date();\n for (let day = 0; day < 60; day++) {\n for (const hour of [9, 10, 11, 13, 14, 15]) {\n slotDate.setHours(hour, 0, 0, 0);\n result.push({\n resourceType: 'Slot',\n id: `slot-${day}-${hour}`,\n start: slotDate.toISOString(),\n schedule,\n });\n }\n slotDate.setDate(slotDate.getDate() + 1);\n }\n return result;\n})();\n","import { Bot, ClientApplication } 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\nexport const ExampleClient: ClientApplication = {\n resourceType: 'ClientApplication',\n id: '123',\n name: 'Test Client',\n};\n","import { Questionnaire, QuestionnaireResponse } from '@medplum/fhirtypes';\n\nexport const ExampleQuestionnaire: Questionnaire = {\n resourceType: 'Questionnaire',\n id: '123',\n name: 'Vitals',\n title: 'Vitals',\n subjectType: ['Patient'],\n item: [\n {\n linkId: '1',\n text: 'First question',\n type: 'string',\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 { createReference } from '@medplum/core';\nimport {\n Address,\n Communication,\n DiagnosticReport,\n Encounter,\n Group,\n Media,\n Observation,\n Patient,\n RelatedPerson,\n ServiceRequest,\n Specimen,\n} from '@medplum/fhirtypes';\nimport { DrAliceSmith } from './alice';\n\nconst SIMPSONS_ADDRESS: Address = {\n use: 'home',\n line: ['742 Evergreen Terrace'],\n city: 'Springfield',\n state: 'IL',\n postalCode: '12345',\n};\n\nexport const LisaSimpson: Patient = {\n resourceType: 'Patient',\n id: 'lisa-simpson',\n meta: {\n versionId: '1',\n lastUpdated: '2020-01-01T12:00:00Z',\n author: {\n reference: 'Practitioner/123',\n },\n },\n birthDate: '1981-05-09',\n name: [\n {\n given: ['Lisa'],\n family: 'Simpson',\n },\n ],\n photo: [\n {\n contentType: 'image/jpeg',\n url: 'https://example.com/picture.jpg',\n },\n ],\n contact: [\n {\n name: { given: ['Homer'], family: 'Simpson' },\n address: {\n use: 'home',\n line: ['742 Evergreen Terrace'],\n city: 'Springfield',\n state: 'IL',\n postalCode: '12345',\n },\n telecom: [\n {\n system: 'phone',\n use: 'home',\n value: '555-1239',\n },\n {\n system: 'email',\n use: 'home',\n value: 'homer@thesimpsons.com',\n },\n ],\n },\n {\n name: { given: ['Marge'], family: 'Simpson' },\n address: {\n use: 'home',\n line: ['742 Evergreen Terrace'],\n city: 'Springfield',\n state: 'IL',\n postalCode: '12345',\n },\n telecom: [\n {\n system: 'phone',\n use: 'mobile',\n value: '139-1928',\n },\n {\n system: 'email',\n use: 'home',\n value: 'marge@thesimpsons.com',\n },\n ],\n },\n ],\n\n telecom: [\n {\n system: 'phone',\n use: 'home',\n value: '555-1239',\n },\n {\n system: 'email',\n use: 'home',\n value: 'lisa@thesimpsons.com',\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 birthDate: '1979-12-17',\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 telecom: [\n {\n system: 'phone',\n use: 'home',\n value: '555-1239',\n },\n {\n system: 'email',\n use: 'home',\n value: 'bart@thesimpsons.com',\n },\n ],\n};\n\nexport const HomerLisaRelatedPerson: RelatedPerson = {\n resourceType: 'RelatedPerson',\n id: 'homer-lisa-related-person',\n patient: createReference(LisaSimpson),\n address: [SIMPSONS_ADDRESS],\n telecom: [\n {\n system: 'phone',\n use: 'home',\n value: '555-7334',\n },\n {\n system: 'email',\n use: 'home',\n value: 'chunkylover53@aol.com',\n },\n ],\n relationship: [\n {\n text: 'father',\n coding: [{ system: 'http://terminology.hl7.org/CodeSystem/v3-RoleCode', code: 'FTH', display: 'father' }],\n },\n ],\n};\n\nexport const HomerBartRelatedPerson: RelatedPerson = {\n resourceType: 'RelatedPerson',\n id: 'homer-bart-related-person',\n patient: createReference(BartSimpson),\n address: [SIMPSONS_ADDRESS],\n telecom: [\n {\n system: 'phone',\n use: 'home',\n value: '555-7334',\n },\n {\n system: 'email',\n use: 'home',\n value: 'chunkylover53@aol.com',\n },\n ],\n relationship: [\n {\n text: 'father',\n coding: [{ system: 'http://terminology.hl7.org/CodeSystem/v3-RoleCode', code: 'FTH', display: 'father' }],\n },\n ],\n};\n\nexport const HomerSimpson: Patient = {\n resourceType: 'Patient',\n id: '123',\n gender: 'male',\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 active: true,\n birthDate: '1956-05-12',\n name: [\n {\n given: ['Homer'],\n family: 'Simpson',\n },\n ],\n photo: [\n {\n contentType: 'image/png',\n url: 'https://www.medplum.com/img/homer-simpson.png',\n },\n ],\n telecom: [\n {\n system: 'phone',\n use: 'home',\n value: '555-7334',\n },\n {\n system: 'email',\n use: 'home',\n value: 'chunkylover53@aol.com',\n },\n ],\n address: [\n {\n use: 'home',\n line: ['742 Evergreen Terrace'],\n city: 'Springfield',\n state: 'IL',\n postalCode: '12345',\n },\n ],\n link: [\n { other: createReference(HomerLisaRelatedPerson), type: 'seealso' },\n { other: createReference(HomerBartRelatedPerson), type: 'seealso' },\n ],\n};\n\nexport const MargeSimpson: Patient = {\n resourceType: 'Patient',\n id: 'marge-simpson',\n gender: 'female',\n\n active: true,\n birthDate: '1961-08-23',\n name: [\n {\n given: ['Marge'],\n family: 'Simpson',\n },\n ],\n telecom: [\n {\n system: 'phone',\n use: 'home',\n value: '555-7334',\n },\n {\n system: 'email',\n use: 'home',\n value: 'margesimpson@aol.com',\n },\n ],\n address: [SIMPSONS_ADDRESS],\n};\n\nexport const HomerSimpsonPreviousVersion: Patient = {\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/png',\n url: 'https://www.medplum.com/img/homer-simpson.png',\n },\n ],\n};\n\nexport const HomerEncounter: Encounter = {\n resourceType: 'Encounter',\n id: '123',\n meta: {\n versionId: '456',\n lastUpdated: '2020-01-01T00:00:00.000Z',\n author: {\n reference: 'Practitioner/123',\n },\n },\n};\n\nexport const HomerCommunication: Communication = {\n resourceType: 'Communication',\n id: '123',\n meta: {\n lastUpdated: '2020-01-01T12:00:00Z',\n author: {\n reference: 'Practitioner/123',\n },\n },\n encounter: createReference(HomerEncounter),\n payload: [\n {\n contentString: 'Hello world',\n },\n ],\n};\n\nexport const HomerMedia: Media = {\n resourceType: 'Media',\n id: '123',\n meta: {\n lastUpdated: '2020-01-01T12:00:00Z',\n author: {\n reference: 'Practitioner/123',\n },\n },\n encounter: createReference(HomerEncounter),\n content: {\n contentType: 'text/plain',\n url: 'https://example.com/test.txt',\n },\n};\n\nexport const HomerObservation1: Observation = {\n resourceType: 'Observation',\n id: '1',\n status: 'final',\n subject: {\n reference: 'Patient/123',\n display: 'Homer Simpson',\n },\n code: {\n text: 'Test 1',\n },\n valueString: 'test',\n};\n\nexport const HomerObservation2: Observation = {\n resourceType: 'Observation',\n id: '2',\n status: 'corrected',\n subject: {\n reference: 'Patient/123',\n display: 'Homer Simpson',\n },\n code: {\n text: 'Test 2',\n },\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 status: 'final',\n subject: {\n reference: 'Patient/123',\n display: 'Homer Simpson',\n },\n code: {\n text: 'Test 3',\n },\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 status: 'final',\n subject: {\n reference: 'Patient/123',\n display: 'Homer Simpson',\n },\n code: {\n text: 'Test 4',\n },\n valueQuantity: {\n value: 50,\n unit: 'x',\n comparator: '>',\n },\n referenceRange: [\n {\n low: {\n value: 10,\n unit: 'x',\n },\n high: {\n value: 50,\n unit: 'x',\n },\n },\n ],\n interpretation: [\n {\n text: 'HIGH',\n },\n ],\n};\n\nexport const HomerObservation5: Observation = {\n resourceType: 'Observation',\n id: '5',\n status: 'final',\n subject: {\n reference: 'Patient/123',\n display: 'Homer Simpson',\n },\n code: {\n text: 'Test 5',\n },\n valueQuantity: {\n value: 100,\n unit: 'x',\n },\n referenceRange: [{}],\n interpretation: [{}],\n};\n\nexport const HomerObservation6: Observation = {\n resourceType: 'Observation',\n id: '6',\n status: 'final',\n subject: {\n reference: 'Patient/123',\n display: 'Homer Simpson',\n },\n code: {\n text: 'Test 6',\n },\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 HomerObservation7: Observation = {\n resourceType: 'Observation',\n id: '7',\n status: 'final',\n subject: {\n reference: 'Patient/123',\n display: 'Homer Simpson',\n },\n code: {\n text: 'Test 7',\n },\n component: [\n {\n valueQuantity: {\n value: 1000,\n unit: 'mg/dL',\n system: 'http://unitsofmeasure.org',\n },\n },\n ],\n interpretation: [\n {\n coding: [\n {\n system: 'http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation',\n code: 'HH',\n display: 'Critical high',\n },\n ],\n },\n ],\n};\n\nexport const HomerObservation8: Observation = {\n resourceType: 'Observation',\n id: '8',\n status: 'final',\n subject: {\n reference: 'Patient/123',\n display: 'Homer Simpson',\n },\n code: {\n text: 'Test 8',\n },\n component: [\n {\n valueString: 'REACTIVE',\n },\n ],\n referenceRange: [\n {\n text: 'NEGATIVE',\n },\n ],\n interpretation: [\n {\n coding: [\n {\n system: 'http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation',\n code: 'RR',\n display: 'Reactive',\n },\n ],\n },\n ],\n};\n\nexport const HomerSimpsonSpecimen: Specimen = {\n id: '123',\n resourceType: 'Specimen',\n subject: createReference(HomerSimpson),\n collection: {\n collectedDateTime: '2020-01-01T12:00:00Z',\n },\n note: [\n { text: 'Specimen hemolyzed. Results may be affected.' },\n { text: 'Specimen lipemic. Results may be affected.' },\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 identifier: [\n {\n system: 'https://example.com',\n value: '9001',\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 status: 'active',\n orderDetail: [\n {\n text: 'ORDERED',\n },\n ],\n specimen: [createReference(HomerSimpsonSpecimen)],\n authoredOn: '2020-01-01T12:00:00Z',\n};\n\nexport const HomerDiagnosticReport: DiagnosticReport = {\n resourceType: 'DiagnosticReport',\n id: '123',\n meta: {\n versionId: '1',\n lastUpdated: '2020-01-02T12:00:00Z',\n author: {\n reference: 'Practitioner/123',\n },\n },\n subject: createReference(HomerSimpson),\n basedOn: [createReference(HomerServiceRequest)],\n specimen: [createReference(HomerSimpsonSpecimen)],\n resultsInterpreter: [createReference(DrAliceSmith)],\n result: [\n createReference(HomerObservation1),\n createReference(HomerObservation2),\n createReference(HomerObservation3),\n createReference(HomerObservation4),\n createReference(HomerObservation5),\n createReference(HomerObservation6),\n createReference(HomerObservation7),\n createReference(HomerObservation8),\n ],\n};\n\nexport const SimpsonsFamily: Group = {\n resourceType: 'Group',\n id: 'simpsons-family',\n type: 'person',\n actual: true,\n member: [\n { entity: createReference(HomerSimpson) },\n { entity: createReference(MargeSimpson) },\n { entity: createReference(BartSimpson) },\n { entity: createReference(LisaSimpson) },\n ],\n};\n","import { AuditEvent, 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 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","import SearchParameterList from './searchparameters.json';\nimport StructureDefinitionList from './structuredefinitions.json';\n\nexport const GraphQLSchemaResponse = {\n data: {\n StructureDefinitionList,\n SearchParameterList,\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 { createReference, getReferenceString } from '@medplum/core';\nimport { PlanDefinition, Questionnaire, QuestionnaireResponse, RequestGroup, Task } from '@medplum/fhirtypes';\nimport { DrAliceSmith } from './alice';\nimport { HomerSimpson } from './simpsons';\n\nexport const ExampleWorkflowQuestionnaire1: Questionnaire = {\n resourceType: 'Questionnaire',\n id: 'workflow-questionnaire-1',\n name: 'Patient Registration',\n title: 'Patient Registration',\n subjectType: ['Patient'],\n item: [\n {\n linkId: '1',\n text: 'First question',\n type: 'string',\n },\n ],\n};\n\nexport const ExampleWorkflowQuestionnaire2: Questionnaire = {\n resourceType: 'Questionnaire',\n id: 'workflow-questionnaire-2',\n name: 'Surgery History',\n title: 'Surgery History',\n subjectType: ['Patient'],\n item: [\n {\n linkId: '1',\n text: 'First question',\n type: 'string',\n },\n ],\n};\n\nexport const ExampleWorkflowQuestionnaire3: Questionnaire = {\n resourceType: 'Questionnaire',\n id: 'workflow-questionnaire-3',\n name: 'Family Health History',\n title: 'Family Health History',\n subjectType: ['Patient'],\n item: [\n {\n linkId: '1',\n text: 'First question',\n type: 'string',\n },\n ],\n};\n\nexport const ExampleWorkflowPlanDefinition: PlanDefinition = {\n resourceType: 'PlanDefinition',\n id: 'workflow-plan-definition-1',\n title: 'Example Plan Definition',\n action: [\n {\n title: ExampleWorkflowQuestionnaire1.title,\n definitionCanonical: getReferenceString(ExampleWorkflowQuestionnaire1),\n },\n {\n title: ExampleWorkflowQuestionnaire2.title,\n definitionCanonical: getReferenceString(ExampleWorkflowQuestionnaire2),\n },\n {\n title: ExampleWorkflowQuestionnaire3.title,\n definitionCanonical: getReferenceString(ExampleWorkflowQuestionnaire3),\n },\n ],\n};\n\nexport const ExampleWorkflowQuestionnaireResponse1: QuestionnaireResponse = {\n resourceType: 'QuestionnaireResponse',\n id: 'workflow-questionnaire-response-1',\n questionnaire: getReferenceString(ExampleWorkflowQuestionnaire1),\n subject: createReference(HomerSimpson),\n source: createReference(HomerSimpson),\n};\n\n// Based on: http://build.fhir.org/ig/HL7/sdc/Task-example.json.html\nexport const ExampleWorkflowTask1: Task = {\n resourceType: 'Task',\n id: 'workflow-task-1',\n status: 'completed',\n meta: { author: createReference(HomerSimpson) },\n requester: createReference(DrAliceSmith),\n input: [{ valueReference: createReference(ExampleWorkflowQuestionnaire1) }],\n output: [{ valueReference: createReference(ExampleWorkflowQuestionnaireResponse1) }],\n};\n\nexport const ExampleWorkflowTask2: Task = {\n resourceType: 'Task',\n id: 'workflow-task-2',\n status: 'requested',\n meta: { author: createReference(DrAliceSmith) },\n requester: createReference(DrAliceSmith),\n input: [{ valueReference: createReference(ExampleWorkflowQuestionnaire2) }],\n};\n\nexport const ExampleWorkflowTask3: Task = {\n resourceType: 'Task',\n id: 'workflow-task-3',\n status: 'requested',\n meta: { author: createReference(DrAliceSmith) },\n requester: createReference(DrAliceSmith),\n input: [{ valueReference: createReference(ExampleWorkflowQuestionnaire3) }],\n};\n\nexport const ExampleWorkflowRequestGroup: RequestGroup = {\n resourceType: 'RequestGroup',\n id: 'workflow-request-group-1',\n instantiatesCanonical: [getReferenceString(ExampleWorkflowPlanDefinition)],\n status: 'active',\n action: [\n {\n title: ExampleWorkflowQuestionnaire1.title,\n resource: createReference(ExampleWorkflowTask1),\n },\n {\n title: ExampleWorkflowQuestionnaire2.title,\n resource: createReference(ExampleWorkflowTask2),\n },\n {\n title: ExampleWorkflowQuestionnaire3.title,\n resource: createReference(ExampleWorkflowTask3),\n },\n ],\n};\n","import { ClientApplication } from '@medplum/fhirtypes';\n\nexport const ExampleSmartClientApplication: ClientApplication = {\n resourceType: 'ClientApplication',\n id: 'smart-client-app',\n name: 'Inferno Client',\n description: 'Client application used for Inferno ONC compliance testing',\n redirectUri: 'https://inferno.healthit.gov/suites/custom/smart/redirect',\n launchUri: 'https://inferno.healthit.gov/suites/custom/smart/launch',\n};\n","/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.push(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.push(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n","import { badRequest, deepClone, matchesSearchRequest, notFound, SearchRequest } from '@medplum/core';\nimport { Bundle, BundleEntry, Resource } from '@medplum/fhirtypes';\nimport { applyPatch, Operation } from 'rfc6902';\n\nexport class MemoryRepository {\n readonly #resources: Record<string, Record<string, Resource>>;\n readonly #history: Record<string, Record<string, Resource[]>>;\n\n constructor() {\n this.#resources = {};\n this.#history = {};\n }\n\n createResource<T extends Resource>(resource: T): T {\n const result = deepClone(resource);\n\n if (!result.id) {\n result.id = this.generateId();\n }\n\n if (!result.meta) {\n result.meta = {};\n }\n\n if (!result.meta?.versionId) {\n result.meta.versionId = this.generateId();\n }\n\n if (!result.meta?.lastUpdated) {\n result.meta.lastUpdated = new Date().toISOString();\n }\n\n const { resourceType, id } = result as { resourceType: string; id: string };\n\n if (!(resourceType in this.#resources)) {\n this.#resources[resourceType] = {};\n }\n\n if (!(resourceType in this.#history)) {\n this.#history[resourceType] = {};\n }\n\n if (!(id in this.#history[resourceType])) {\n this.#history[resourceType][id] = [];\n }\n\n this.#resources[resourceType][id] = result;\n this.#history[resourceType][id].push(result);\n return deepClone(result);\n }\n\n updateResource<T extends Resource>(resource: T): T {\n const result = JSON.parse(JSON.stringify(resource)) as T;\n if (result.meta) {\n if (result.meta.versionId) {\n delete result.meta.versionId;\n }\n if (result.meta.lastUpdated) {\n delete result.meta.lastUpdated;\n }\n }\n return this.createResource(result);\n }\n\n async patchResource(resourceType: string, id: string, patch: Operation[]): Promise<Resource> {\n const resource = this.readResource(resourceType, id);\n const patchErrors = applyPatch(resource, patch);\n for (const error of patchErrors) {\n if (error) {\n const message = error.message?.split('\\n')?.[0] || 'JSONPatch error';\n throw badRequest(message);\n }\n }\n return this.updateResource(resource);\n }\n\n readResource<T extends Resource>(resourceType: string, id: string): T {\n const resource = this.#resources?.[resourceType]?.[id] as T | undefined;\n if (!resource) {\n throw notFound;\n }\n return deepClone(resource);\n }\n\n readHistory<T extends Resource>(resourceType: string, id: string): Bundle<T> {\n this.readResource(resourceType, id);\n return {\n resourceType: 'Bundle',\n type: 'history',\n entry: ((this.#history?.[resourceType]?.[id] ?? []) as T[])\n .reverse()\n .map((version) => ({ resource: deepClone(version) })),\n };\n }\n\n readVersion<T extends Resource>(resourceType: string, id: string, versionId: string): T {\n this.readResource(resourceType, id);\n const version = this.#history?.[resourceType]?.[id]?.find((v) => v.meta?.versionId === versionId) as T | undefined;\n if (!version) {\n throw notFound;\n }\n return deepClone(version);\n }\n\n search<T extends Resource>(searchRequest: SearchRequest): Bundle<T> {\n const { resourceType } = searchRequest;\n const resources = this.#resources[resourceType] ?? {};\n const result = Object.values(resources).filter((resource) => matchesSearchRequest(resource, searchRequest));\n return {\n resourceType: 'Bundle',\n type: 'searchset',\n entry: result.map((resource) => ({ resource: deepClone(resource) })) as BundleEntry<T>[],\n total: result.length,\n };\n }\n\n deleteResource(resourceType: string, id: string): void {\n if (this.#resources?.[resourceType]?.[id]) {\n delete this.#resources[resourceType][id];\n }\n }\n\n private generateId(): string {\n // Cross platform random UUID generator\n // Note that this is not intended for production use, but rather for testing\n // This should be replaced when crypto.randomUUID is fully supported\n // https://stackoverflow.com/revisions/2117523/28\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n }\n}\n","import {\n allOk,\n badRequest,\n getStatus,\n isOk,\n LoginState,\n MedplumClient,\n notFound,\n parseSearchDefinition,\n ProfileResource,\n} from '@medplum/core';\nimport { Binary, Bundle, BundleEntry, OperationOutcome, Resource, UserConfiguration } from '@medplum/fhirtypes';\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n/** @ts-ignore */\nimport type { CustomTableLayout, TDocumentDefinitions, TFontDictionary } from 'pdfmake/interfaces';\nimport {\n BartSimpson,\n DifferentOrganization,\n DrAliceSmith,\n DrAliceSmithPreviousVersion,\n DrAliceSmithSchedule,\n DrAliceSmithSlots,\n ExampleBot,\n ExampleClient,\n ExampleQuestionnaire,\n ExampleQuestionnaireResponse,\n ExampleSubscription,\n exampleValueSet,\n GraphQLSchemaResponse,\n HomerCommunication,\n HomerDiagnosticReport,\n HomerEncounter,\n HomerMedia,\n HomerObservation1,\n HomerObservation2,\n HomerObservation3,\n HomerObservation4,\n HomerObservation5,\n HomerObservation6,\n HomerObservation7,\n HomerObservation8,\n HomerServiceRequest,\n HomerSimpson,\n HomerSimpsonPreviousVersion,\n HomerSimpsonSpecimen,\n TestOrganization,\n} from './mocks';\nimport { ExampleAccessPolicy, ExampleStatusValueSet, ExampleUserConfiguration } from './mocks/accesspolicy';\nimport { ExampleSmartClientApplication } from './mocks/smart';\nimport {\n ExampleWorkflowPlanDefinition,\n ExampleWorkflowQuestionnaire1,\n ExampleWorkflowQuestionnaire2,\n ExampleWorkflowQuestionnaire3,\n ExampleWorkflowQuestionnaireResponse1,\n ExampleWorkflowRequestGroup,\n ExampleWorkflowTask1,\n ExampleWorkflowTask2,\n ExampleWorkflowTask3,\n} from './mocks/workflow';\n\nimport { MemoryRepository } from './repo';\n\nexport interface MockClientOptions {\n readonly debug?: boolean;\n}\n\nexport class MockClient extends MedplumClient {\n readonly debug: boolean;\n activeLoginOverride?: LoginState;\n\n constructor(clientOptions?: MockClientOptions) {\n const mockFetchClient = new MockFetchClient(clientOptions?.debug);\n\n super({\n baseUrl: 'https://example.com/',\n clientId: 'my-client-id',\n createPdf: (\n docDefinition: TDocumentDefinitions,\n tableLayouts?: { [name: string]: CustomTableLayout },\n fonts?: TFontDictionary | undefined\n ) => mockFetchClient.mockCreatePdf(docDefinition, tableLayouts, fonts),\n fetch: (url: string, options: any) => {\n return mockFetchClient.mockFetch(url, options);\n },\n });\n this.debug = !!clientOptions?.debug;\n }\n\n clear(): void {\n super.clear();\n this.activeLoginOverride = undefined;\n }\n\n getProfile(): ProfileResource {\n return DrAliceSmith;\n }\n\n getUserConfiguration(): UserConfiguration | undefined {\n return {\n resourceType: 'UserConfiguration',\n menu: [\n {\n title: 'Favorites',\n link: [\n { name: 'Patients', target: '/Patient' },\n { name: 'Active Orders', target: '/ServiceRequest?status=active' },\n { name: 'Completed Orders', target: '/ServiceRequest?status=completed' },\n ],\n },\n {\n title: 'Admin',\n link: [\n { name: 'Project', target: '/admin/project' },\n { name: 'Batch', target: '/batch' },\n ],\n },\n ],\n };\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 async createBinary(\n data: string | File | Blob | Uint8Array,\n filename: string | undefined,\n contentType: string,\n onProgress?: (e: ProgressEvent) => void\n ): Promise<Binary> {\n if (filename?.endsWith('.exe')) {\n return Promise.reject(badRequest('Invalid file type'));\n }\n\n if (onProgress) {\n onProgress({ loaded: 0, lengthComputable: false } as ProgressEvent);\n onProgress({ loaded: 0, total: 100, lengthComputable: true } as ProgressEvent);\n onProgress({ loaded: 100, total: 100, lengthComputable: true } as ProgressEvent);\n }\n\n return {\n resourceType: 'Binary',\n contentType,\n url: 'https://example.com/binary/123',\n };\n }\n}\n\nclass MockFetchClient {\n readonly mockRepo: MemoryRepository;\n\n constructor(readonly debug = false) {\n this.mockRepo = new MemoryRepository();\n this.initMockRepo();\n }\n\n async mockFetch(url: string, options: any): Promise<any> {\n const method = options.method || 'GET';\n const path = url.replace('https://example.com/', '');\n\n if (this.debug) {\n console.log('MockClient', method, path);\n }\n\n const response = await this.mockHandler(method, path, options);\n\n if (this.debug && !response) {\n console.log('MockClient: not found', method, path);\n }\n\n if (this.debug) {\n console.log('MockClient', JSON.stringify(response, null, 2));\n }\n\n if (response?.resourceType === 'OperationOutcome' && !isOk(response)) {\n return Promise.reject(response);\n }\n\n return Promise.resolve({\n ok: true,\n status: response?.resourceType === 'OperationOutcome' ? getStatus(response) : 200,\n blob: () => Promise.resolve(response),\n json: () => Promise.resolve(response),\n });\n }\n\n mockCreatePdf(\n docDefinition: TDocumentDefinitions,\n tableLayouts?: { [name: string]: CustomTableLayout },\n fonts?: TFontDictionary | undefined\n ): Promise<any> {\n if (this.debug) {\n console.log(`Mock Client: createPdf(`);\n console.log(` ${JSON.stringify(docDefinition, null, 2)},`);\n console.log(` ${JSON.stringify(tableLayouts, null, 2)},`);\n console.log(` ${JSON.stringify(fonts, null, 2)});`);\n }\n return Promise.resolve({});\n }\n\n private async mockHandler(method: string, path: string, options: any): Promise<any> {\n if (path.startsWith('admin/')) {\n return this.mockAdminHandler(method, path);\n } else if (path.startsWith('auth/')) {\n return this.mockAuthHandler(method, path, options);\n } else if (path.startsWith('oauth2/')) {\n return this.mockOAuthHandler(method, path, options);\n } else if (path.startsWith('fhir/R4')) {\n return this.mockFhirHandler(method, path, options);\n } else {\n return null;\n }\n }\n\n private mockAdminHandler(_method: string, path: string): any {\n if (path.startsWith('admin/projects/123')) {\n return {\n project: { id: '123', name: 'Project 123' },\n members: [\n { id: '123', profile: { reference: 'Practitioner/123', display: 'Alice Smith' }, role: 'owner' },\n { id: '888', profile: { reference: 'ClientApplication/123', display: 'Test Client' }, role: 'client' },\n { id: '999', profile: { reference: 'Bot/123', display: 'Test Bot' }, role: 'bot' },\n ],\n };\n }\n\n return {\n ok: true,\n };\n }\n\n private mockAuthHandler(method: string, path: string, options: any): any {\n if (path.startsWith('auth/method')) {\n return {};\n }\n\n if (path.startsWith('auth/changepassword')) {\n return this.mockChangePasswordHandler(method, path, options);\n }\n\n if (path.startsWith('auth/login')) {\n return this.mockLoginHandler(method, path, options);\n }\n\n if (path.startsWith('auth/setpassword')) {\n return this.mockSetPasswordHandler(method, path, options);\n }\n\n if (path.startsWith('auth/newuser')) {\n return this.mockNewUserHandler(method, path, options);\n }\n\n if (path.startsWith('auth/newproject') || path.startsWith('auth/newpatient') || path.startsWith('auth/scope')) {\n return {\n login: '123',\n code: 'xyz',\n };\n }\n\n if (path.startsWith('auth/resetpassword')) {\n return this.mockResetPasswordHandler(method, path, options);\n }\n\n if (path.startsWith('auth/me')) {\n return {\n profile: DrAliceSmith,\n security: {\n mfaEnrolled: false,\n sessions: [\n {\n id: '123',\n lastUpdated: new Date().toISOString(),\n authMethod: 'password',\n remoteAddress: '5.5.5.5',\n browser: 'Chrome',\n os: 'Linux',\n },\n {\n id: '456',\n lastUpdated: new Date().toISOString(),\n authMethod: 'password',\n remoteAddress: '6.6.6.6',\n browser: 'Chrome',\n os: 'Android',\n },\n ],\n },\n };\n }\n\n if (path.startsWith('auth/mfa/status')) {\n return {\n enrolled: false,\n enrollUri: 'otpauth://totp/medplum.com:alice.smith%40example',\n };\n }\n\n if (path.startsWith('auth/mfa/enroll')) {\n return allOk;\n }\n\n return null;\n }\n\n private mockChangePasswordHandler(_method: string, _path: string, options: any): any {\n const { body } = options;\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 private mockLoginHandler(_method: string, _path: string, options: any): any {\n const { body } = options;\n const { password } = JSON.parse(body);\n if (password === 'password') {\n return {\n login: '123',\n code: 'xyz',\n };\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 private mockSetPasswordHandler(_method: string, _path: string, options: any): any {\n const { body } = options;\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 private mockNewUserHandler(_method: string, _path: string, options: any): any {\n const { body } = options;\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 private mockResetPasswordHandler(_method: string, _path: string, options: any): any {\n const { body } = options;\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 private mockOAuthHandler(_method: string, path: string, _options: any): any {\n if (path.startsWith('oauth2/token')) {\n return {\n access_token: 'header.' + window.btoa(JSON.stringify({ client_id: 'my-client-id' })) + '.signature',\n };\n }\n\n return null;\n }\n\n private initMockRepo(): void {\n this.mockRepo.createResource(HomerSimpsonPreviousVersion);\n this.mockRepo.createResource(HomerSimpson);\n this.mockRepo.createResource(ExampleAccessPolicy);\n this.mockRepo.createResource(ExampleStatusValueSet);\n this.mockRepo.createResource(ExampleUserConfiguration);\n this.mockRepo.createResource(ExampleBot);\n this.mockRepo.createResource(ExampleClient);\n this.mockRepo.createResource(HomerDiagnosticReport);\n this.mockRepo.createResource(HomerEncounter);\n this.mockRepo.createResource(HomerCommunication);\n this.mockRepo.createResource(HomerMedia);\n this.mockRepo.createResource(HomerObservation1);\n this.mockRepo.createResource(HomerObservation2);\n this.mockRepo.createResource(HomerObservation3);\n this.mockRepo.createResource(HomerObservation4);\n this.mockRepo.createResource(HomerObservation5);\n this.mockRepo.createResource(HomerObservation6);\n this.mockRepo.createResource(HomerObservation7);\n this.mockRepo.createResource(HomerObservation8);\n this.mockRepo.createResource(HomerSimpsonSpecimen);\n this.mockRepo.createResource(TestOrganization);\n this.mockRepo.createResource(DifferentOrganization);\n this.mockRepo.createResource(ExampleQuestionnaire);\n this.mockRepo.createResource(ExampleQuestionnaireResponse);\n this.mockRepo.createResource(HomerServiceRequest);\n this.mockRepo.createResource(ExampleSubscription);\n this.mockRepo.createResource(BartSimpson);\n this.mockRepo.createResource(DrAliceSmithPreviousVersion);\n this.mockRepo.createResource(DrAliceSmith);\n this.mockRepo.createResource(DrAliceSmithSchedule);\n this.mockRepo.createResource(ExampleWorkflowQuestionnaire1);\n this.mockRepo.createResource(ExampleWorkflowQuestionnaire2);\n this.mockRepo.createResource(ExampleWorkflowQuestionnaire3);\n this.mockRepo.createResource(ExampleWorkflowPlanDefinition);\n this.mockRepo.createResource(ExampleWorkflowQuestionnaireResponse1);\n this.mockRepo.createResource(ExampleWorkflowTask1);\n this.mockRepo.createResource(ExampleWorkflowTask2);\n this.mockRepo.createResource(ExampleWorkflowTask3);\n this.mockRepo.createResource(ExampleWorkflowRequestGroup);\n this.mockRepo.createResource(ExampleSmartClientApplication);\n\n DrAliceSmithSlots.forEach((slot) => this.mockRepo.createResource(slot));\n }\n\n private async mockFhirHandler(method: string, url: string, options: any): Promise<Resource> {\n const path = url.includes('?') ? url.substring(0, url.indexOf('?')) : url;\n const match = /fhir\\/R4\\/?([^/]+)?\\/?([^/]+)?\\/?([^/]+)?\\/?([^/]+)?/.exec(path);\n const resourceType = match?.[1];\n const id = match?.[2];\n const operation = match?.[3];\n const versionId = match?.[4];\n if (path.startsWith('fhir/R4/ValueSet/$expand')) {\n return exampleValueSet;\n } else if (path === 'fhir/R4/$graphql') {\n return this.mockFhirGraphqlHandler(method, path, options);\n } else if (path === 'not-found' || id === 'not-found') {\n return notFound;\n } else if (method === 'POST') {\n if (resourceType && id && operation) {\n return allOk;\n } else if (resourceType) {\n return this.mockRepo.createResource(JSON.parse(options.body));\n } else {\n return this.mockFhirBatchHandler(method, path, options);\n }\n } else if (method === 'GET') {\n if (resourceType && id && versionId) {\n return this.mockRepo.readVersion(resourceType, id, versionId);\n } else if (resourceType && id && operation === '_history') {\n return this.mockRepo.readHistory(resourceType, id);\n } else if (resourceType && id === '$csv') {\n return allOk;\n } else if (resourceType && id) {\n return this.mockRepo.readResource(resourceType, id);\n } else if (resourceType) {\n return this.mockRepo.search(parseSearchDefinition(url));\n }\n } else if (method === 'PUT') {\n return this.mockRepo.updateResource(JSON.parse(options.body));\n } else if (method === 'PATCH') {\n if (resourceType && id) {\n return this.mockRepo.patchResource(resourceType, id, JSON.parse(options.body));\n }\n } else if (method === 'DELETE') {\n if (resourceType && id) {\n this.mockRepo.deleteResource(resourceType, id);\n return allOk;\n }\n }\n throw notFound;\n }\n\n private mockFhirGraphqlHandler(_method: string, _path: string, options: any): any {\n const { body } = options;\n if (body.includes('ResourceList: ServiceRequestList')) {\n return {\n data: {\n ResourceList: [\n {\n ...HomerServiceRequest,\n ObservationList: [\n HomerObservation1,\n HomerObservation2,\n HomerObservation3,\n HomerObservation4,\n HomerObservation5,\n HomerObservation6,\n ],\n },\n ],\n },\n };\n }\n return GraphQLSchemaResponse;\n }\n\n private async mockFhirBatchHandler(_method: string, _path: string, options: any): Promise<Bundle> {\n const { body } = options;\n const request = JSON.parse(body) as Bundle;\n let entry: BundleEntry[] | undefined;\n\n if (request.entry) {\n entry = [];\n for (const input of request.entry) {\n entry.push(await this.handleBatchEntry(input));\n }\n }\n\n return {\n resourceType: 'Bundle',\n type: 'batch-response',\n entry,\n };\n }\n\n private async handleBatchEntry(input: BundleEntry): Promise<BundleEntry> {\n try {\n const url = 'fhir/R4/' + input.request?.url;\n const method = input.request?.method as string;\n const resource = await this.mockHandler(method, url, {\n body: input.resource ? JSON.stringify(input.resource) : undefined,\n });\n if (resource?.resourceType === 'OperationOutcome') {\n return {\n resource,\n response: { status: getStatus(resource).toString() },\n };\n } else if (resource) {\n return { resource, response: { status: '200' } };\n } else {\n return { resource: notFound, response: { status: '404' } };\n }\n } catch (err) {\n const outcome = err as OperationOutcome;\n return {\n response: {\n status: getStatus(outcome).toString(),\n outcome,\n },\n };\n }\n }\n}\n"],"names":["ExampleAccessPolicy","resourceType","id","name","ExampleStatusValueSet","compose","include","concept","code","ExampleUserConfiguration","option","valueString","TestOrganization","meta","versionId","DifferentOrganization","DrAliceSmith","lastUpdated","author","reference","given","family","photo","contentType","url","DrAliceSmithPreviousVersion","DrAliceSmithSchedule","actor","display","DrAliceSmithSlots","schedule","createReference","result","slotDate","Date","day","hour","setHours","push","start","toISOString","setDate","getDate","ExampleBot","ExampleClient","ExampleQuestionnaire","title","subjectType","item","linkId","text","type","ExampleQuestionnaireResponse","questionnaire","subject","source","SIMPSONS_ADDRESS","use","line","city","state","postalCode","LisaSimpson","birthDate","contact","address","telecom","system","value","BartSimpson","HomerLisaRelatedPerson","patient","relationship","coding","HomerBartRelatedPerson","HomerSimpson","gender","identifier","active","link","other","MargeSimpson","HomerSimpsonPreviousVersion","HomerEncounter","HomerCommunication","encounter","payload","contentString","HomerMedia","content","HomerObservation1","status","HomerObservation2","valueQuantity","unit","referenceRange","low","HomerObservation3","high","HomerObservation4","comparator","interpretation","HomerObservation5","HomerObservation6","component","HomerObservation7","HomerObservation8","HomerSimpsonSpecimen","collection","collectedDateTime","note","HomerServiceRequest","orderDetail","specimen","authoredOn","HomerDiagnosticReport","basedOn","resultsInterpreter","SimpsonsFamily","actual","member","entity","ExampleSubscription","ExampleAuditEvent","GraphQLSchemaResponse","data","StructureDefinitionList","SearchParameterList","exampleValueSet","expansion","contains","ExampleWorkflowQuestionnaire1","ExampleWorkflowQuestionnaire2","ExampleWorkflowQuestionnaire3","ExampleWorkflowPlanDefinition","action","definitionCanonical","getReferenceString","ExampleWorkflowQuestionnaireResponse1","ExampleWorkflowTask1","requester","input","valueReference","output","ExampleWorkflowTask2","ExampleWorkflowTask3","ExampleWorkflowRequestGroup","instantiatesCanonical","resource","ExampleSmartClientApplication","description","redirectUri","launchUri","__classPrivateFieldGet","receiver","kind","f","TypeError","has","call","get","__classPrivateFieldSet","set","MemoryRepository","constructor","_MemoryRepository_resources","this","_MemoryRepository_history","createResource","deepClone","generateId","updateResource","JSON","parse","stringify","async","patch","readResource","patchErrors","applyPatch","error","message","split","badRequest","notFound","readHistory","entry","reverse","map","version","readVersion","find","v","search","searchRequest","resources","Object","values","filter","matchesSearchRequest","total","length","deleteResource","replace","c","r","Math","random","toString","MockClient","MedplumClient","clientOptions","mockFetchClient","MockFetchClient","debug","super","baseUrl","clientId","createPdf","docDefinition","tableLayouts","fonts","mockCreatePdf","fetch","options","mockFetch","clear","activeLoginOverride","undefined","getProfile","getUserConfiguration","menu","target","setActiveLoginOverride","getActiveLogin","filename","onProgress","endsWith","Promise","reject","loaded","lengthComputable","mockRepo","initMockRepo","method","path","console","log","response","mockHandler","isOk","resolve","ok","getStatus","blob","json","startsWith","mockAdminHandler","mockAuthHandler","mockOAuthHandler","mockFhirHandler","_method","project","members","profile","role","mockChangePasswordHandler","mockLoginHandler","mockSetPasswordHandler","mockNewUserHandler","login","mockResetPasswordHandler","security","mfaEnrolled","sessions","authMethod","remoteAddress","browser","os","enrolled","enrollUri","allOk","_path","body","oldPassword","issue","expression","details","password","email","_options","access_token","window","btoa","client_id","forEach","slot","includes","substring","indexOf","match","exec","operation","mockFhirGraphqlHandler","mockFhirBatchHandler","parseSearchDefinition","patchResource","ResourceList","ObservationList","request","handleBatchEntry","err","outcome"],"mappings":"sQAEa,MAAAA,EAAoC,CAC/CC,aAAc,eACdC,GAAI,MACJC,KAAM,yBAGKC,EAAkC,CAC7CH,aAAc,WACdC,GAAI,mBACJG,QAAS,CACPC,QAAS,CACP,CACEC,QAAS,CACP,CAAEC,KAAM,WACR,CAAEA,KAAM,oBACR,CAAEA,KAAM,oBACR,CAAEA,KAAM,iBACR,CAAEA,KAAM,qBAOLC,EAA8C,CACzDR,aAAc,oBACdC,GAAI,MACJC,KAAM,6BACNO,OAAQ,CACN,CACER,GAAI,iBACJS,YAAa,+BC9BNC,EAAiC,CAC5CX,aAAc,eACdC,GAAI,MACJW,KAAM,CACJC,UAAW,KAEbX,KAAM,qBAGKY,EAAsC,CACjDd,aAAc,eACdC,GAAI,MACJW,KAAM,CACJC,UAAW,KAEbX,KAAM,aAGKa,EAA6B,CACxCf,aAAc,eACdC,GAAI,MACJW,KAAM,CACJC,UAAW,IACXG,YAAa,uBACbC,OAAQ,CACNC,UAAW,qBAGfhB,KAAM,CACJ,CACEiB,MAAO,CAAC,SACRC,OAAQ,UAGZC,MAAO,CACL,CACEC,YAAa,YACbC,IAAK,mDAKEC,EAA4C,CACvDxB,aAAc,eACdC,GAAI,MACJW,KAAM,CACJC,UAAW,IACXG,YAAa,uBACbC,OAAQ,CACNC,UAAW,qBAGfhB,KAAM,CAAC,CAAEiB,MAAO,CAAC,WAAYC,OAAQ,WAG1BK,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EyD,SAAUoC,EAAUgE,SAAU,CAAE7J,OAAQ,OAUpD,CARC,MAAO4N,GACP,MAAMC,EAAUD,EAChB,MAAO,CACL/D,SAAU,CACR7J,OAAQkK,EAAU2D,GAASxG,WAC3BwG,WAGL,CACF"}
1
+ {"version":3,"file":"index.min.mjs","sources":["../../../src/mocks/accesspolicy.ts","../../../src/mocks/alice.ts","../../../src/mocks/bot.ts","../../../src/mocks/questionnaire.ts","../../../src/mocks/simpsons.ts","../../../src/mocks/subscription.ts","../../../src/mocks/valueset.ts","../../../src/mocks/workflow.ts","../../../src/mocks/smart.ts","../../../src/client.ts"],"sourcesContent":["import { AccessPolicy, UserConfiguration, ValueSet } from '@medplum/fhirtypes';\n\nexport const ExampleAccessPolicy: AccessPolicy = {\n resourceType: 'AccessPolicy',\n id: '123',\n name: 'Example Access Policy',\n};\n\nexport const ExampleStatusValueSet: ValueSet = {\n resourceType: 'ValueSet',\n id: 'example-statuses',\n compose: {\n include: [\n {\n concept: [\n { code: 'ORDERED' },\n { code: 'SENT_TO_CUSTOMER' },\n { code: 'SENT_BACK_TO_LAB' },\n { code: 'LAB_PROCESSED' },\n { code: 'LAB_COMPLETE' },\n ],\n },\n ],\n },\n};\n\nexport const ExampleUserConfiguration: UserConfiguration = {\n resourceType: 'UserConfiguration',\n id: '123',\n name: 'Example User Configuration',\n option: [\n {\n id: 'statusValueSet',\n valueString: 'ValueSet/example-statuses',\n },\n ],\n};\n","import { createReference } from '@medplum/core';\nimport { Organization, Practitioner, Schedule, Slot } 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 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 photo: [\n {\n contentType: 'image/png',\n url: 'https://www.medplum.com/img/cdc-femaledoc.png',\n },\n ],\n};\n\nexport const DrAliceSmithPreviousVersion: Practitioner = {\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\nexport const DrAliceSmithSchedule: Schedule = {\n resourceType: 'Schedule',\n id: 'alice-smith-schedule',\n actor: [\n {\n reference: 'Practitioner/123',\n display: 'Dr. Alice Smith',\n },\n ],\n};\n\nexport const DrAliceSmithSlots: Slot[] = (() => {\n const schedule = createReference(DrAliceSmithSchedule);\n const result: Slot[] = [];\n const slotDate = new Date();\n for (let day = 0; day < 60; day++) {\n for (const hour of [9, 10, 11, 13, 14, 15]) {\n slotDate.setHours(hour, 0, 0, 0);\n result.push({\n resourceType: 'Slot',\n id: `slot-${day}-${hour}`,\n start: slotDate.toISOString(),\n schedule,\n });\n }\n slotDate.setDate(slotDate.getDate() + 1);\n }\n return result;\n})();\n","import { Bot, ClientApplication } 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\nexport const ExampleClient: ClientApplication = {\n resourceType: 'ClientApplication',\n id: '123',\n name: 'Test Client',\n};\n","import { Questionnaire, QuestionnaireResponse } from '@medplum/fhirtypes';\n\nexport const ExampleQuestionnaire: Questionnaire = {\n resourceType: 'Questionnaire',\n id: '123',\n name: 'Vitals',\n title: 'Vitals',\n subjectType: ['Patient'],\n item: [\n {\n linkId: '1',\n text: 'First question',\n type: 'string',\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 { createReference } from '@medplum/core';\nimport {\n Address,\n Communication,\n DiagnosticReport,\n Encounter,\n Group,\n Media,\n Observation,\n Patient,\n RelatedPerson,\n ServiceRequest,\n Specimen,\n} from '@medplum/fhirtypes';\nimport { DrAliceSmith } from './alice';\n\nconst SIMPSONS_ADDRESS: Address = {\n use: 'home',\n line: ['742 Evergreen Terrace'],\n city: 'Springfield',\n state: 'IL',\n postalCode: '12345',\n};\n\nexport const LisaSimpson: Patient = {\n resourceType: 'Patient',\n id: 'lisa-simpson',\n meta: {\n versionId: '1',\n lastUpdated: '2020-01-01T12:00:00Z',\n author: {\n reference: 'Practitioner/123',\n },\n },\n birthDate: '1981-05-09',\n name: [\n {\n given: ['Lisa'],\n family: 'Simpson',\n },\n ],\n photo: [\n {\n contentType: 'image/jpeg',\n url: 'https://example.com/picture.jpg',\n },\n ],\n contact: [\n {\n name: { given: ['Homer'], family: 'Simpson' },\n address: {\n use: 'home',\n line: ['742 Evergreen Terrace'],\n city: 'Springfield',\n state: 'IL',\n postalCode: '12345',\n },\n telecom: [\n {\n system: 'phone',\n use: 'home',\n value: '555-1239',\n },\n {\n system: 'email',\n use: 'home',\n value: 'homer@thesimpsons.com',\n },\n ],\n },\n {\n name: { given: ['Marge'], family: 'Simpson' },\n address: {\n use: 'home',\n line: ['742 Evergreen Terrace'],\n city: 'Springfield',\n state: 'IL',\n postalCode: '12345',\n },\n telecom: [\n {\n system: 'phone',\n use: 'mobile',\n value: '139-1928',\n },\n {\n system: 'email',\n use: 'home',\n value: 'marge@thesimpsons.com',\n },\n ],\n },\n ],\n\n telecom: [\n {\n system: 'phone',\n use: 'home',\n value: '555-1239',\n },\n {\n system: 'email',\n use: 'home',\n value: 'lisa@thesimpsons.com',\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 birthDate: '1979-12-17',\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 telecom: [\n {\n system: 'phone',\n use: 'home',\n value: '555-1239',\n },\n {\n system: 'email',\n use: 'home',\n value: 'bart@thesimpsons.com',\n },\n ],\n};\n\nexport const HomerLisaRelatedPerson: RelatedPerson = {\n resourceType: 'RelatedPerson',\n id: 'homer-lisa-related-person',\n patient: createReference(LisaSimpson),\n address: [SIMPSONS_ADDRESS],\n telecom: [\n {\n system: 'phone',\n use: 'home',\n value: '555-7334',\n },\n {\n system: 'email',\n use: 'home',\n value: 'chunkylover53@aol.com',\n },\n ],\n relationship: [\n {\n text: 'father',\n coding: [{ system: 'http://terminology.hl7.org/CodeSystem/v3-RoleCode', code: 'FTH', display: 'father' }],\n },\n ],\n};\n\nexport const HomerBartRelatedPerson: RelatedPerson = {\n resourceType: 'RelatedPerson',\n id: 'homer-bart-related-person',\n patient: createReference(BartSimpson),\n address: [SIMPSONS_ADDRESS],\n telecom: [\n {\n system: 'phone',\n use: 'home',\n value: '555-7334',\n },\n {\n system: 'email',\n use: 'home',\n value: 'chunkylover53@aol.com',\n },\n ],\n relationship: [\n {\n text: 'father',\n coding: [{ system: 'http://terminology.hl7.org/CodeSystem/v3-RoleCode', code: 'FTH', display: 'father' }],\n },\n ],\n};\n\nexport const HomerSimpson: Patient = {\n resourceType: 'Patient',\n id: '123',\n gender: 'male',\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 active: true,\n birthDate: '1956-05-12',\n name: [\n {\n given: ['Homer'],\n family: 'Simpson',\n },\n ],\n photo: [\n {\n contentType: 'image/png',\n url: 'https://www.medplum.com/img/homer-simpson.png',\n },\n ],\n telecom: [\n {\n system: 'phone',\n use: 'home',\n value: '555-7334',\n },\n {\n system: 'email',\n use: 'home',\n value: 'chunkylover53@aol.com',\n },\n ],\n address: [\n {\n use: 'home',\n line: ['742 Evergreen Terrace'],\n city: 'Springfield',\n state: 'IL',\n postalCode: '12345',\n },\n ],\n link: [\n { other: createReference(HomerLisaRelatedPerson), type: 'seealso' },\n { other: createReference(HomerBartRelatedPerson), type: 'seealso' },\n ],\n};\n\nexport const MargeSimpson: Patient = {\n resourceType: 'Patient',\n id: 'marge-simpson',\n gender: 'female',\n\n active: true,\n birthDate: '1961-08-23',\n name: [\n {\n given: ['Marge'],\n family: 'Simpson',\n },\n ],\n telecom: [\n {\n system: 'phone',\n use: 'home',\n value: '555-7334',\n },\n {\n system: 'email',\n use: 'home',\n value: 'margesimpson@aol.com',\n },\n ],\n address: [SIMPSONS_ADDRESS],\n};\n\nexport const HomerSimpsonPreviousVersion: Patient = {\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/png',\n url: 'https://www.medplum.com/img/homer-simpson.png',\n },\n ],\n};\n\nexport const HomerEncounter: Encounter = {\n resourceType: 'Encounter',\n id: '123',\n meta: {\n versionId: '456',\n lastUpdated: '2020-01-01T00:00:00.000Z',\n author: {\n reference: 'Practitioner/123',\n },\n },\n};\n\nexport const HomerCommunication: Communication = {\n resourceType: 'Communication',\n id: '123',\n meta: {\n lastUpdated: '2020-01-01T12:00:00Z',\n author: {\n reference: 'Practitioner/123',\n },\n },\n encounter: createReference(HomerEncounter),\n payload: [\n {\n contentString: 'Hello world',\n },\n ],\n};\n\nexport const HomerMedia: Media = {\n resourceType: 'Media',\n id: '123',\n meta: {\n lastUpdated: '2020-01-01T12:00:00Z',\n author: {\n reference: 'Practitioner/123',\n },\n },\n encounter: createReference(HomerEncounter),\n content: {\n contentType: 'text/plain',\n url: 'https://example.com/test.txt',\n },\n};\n\nexport const HomerObservation1: Observation = {\n resourceType: 'Observation',\n id: '1',\n status: 'final',\n subject: {\n reference: 'Patient/123',\n display: 'Homer Simpson',\n },\n code: {\n text: 'Test 1',\n },\n valueString: 'test',\n};\n\nexport const HomerObservation2: Observation = {\n resourceType: 'Observation',\n id: '2',\n status: 'corrected',\n subject: {\n reference: 'Patient/123',\n display: 'Homer Simpson',\n },\n code: {\n text: 'Test 2',\n },\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 status: 'final',\n subject: {\n reference: 'Patient/123',\n display: 'Homer Simpson',\n },\n code: {\n text: 'Test 3',\n },\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 status: 'final',\n subject: {\n reference: 'Patient/123',\n display: 'Homer Simpson',\n },\n code: {\n text: 'Test 4',\n },\n valueQuantity: {\n value: 50,\n unit: 'x',\n comparator: '>',\n },\n referenceRange: [\n {\n low: {\n value: 10,\n unit: 'x',\n },\n high: {\n value: 50,\n unit: 'x',\n },\n },\n ],\n interpretation: [\n {\n text: 'HIGH',\n },\n ],\n};\n\nexport const HomerObservation5: Observation = {\n resourceType: 'Observation',\n id: '5',\n status: 'final',\n subject: {\n reference: 'Patient/123',\n display: 'Homer Simpson',\n },\n code: {\n text: 'Test 5',\n },\n valueQuantity: {\n value: 100,\n unit: 'x',\n },\n referenceRange: [{}],\n interpretation: [{}],\n};\n\nexport const HomerObservation6: Observation = {\n resourceType: 'Observation',\n id: '6',\n status: 'final',\n subject: {\n reference: 'Patient/123',\n display: 'Homer Simpson',\n },\n code: {\n text: 'Test 6',\n },\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 HomerObservation7: Observation = {\n resourceType: 'Observation',\n id: '7',\n status: 'final',\n subject: {\n reference: 'Patient/123',\n display: 'Homer Simpson',\n },\n code: {\n text: 'Test 7',\n },\n component: [\n {\n valueQuantity: {\n value: 1000,\n unit: 'mg/dL',\n system: 'http://unitsofmeasure.org',\n },\n },\n ],\n interpretation: [\n {\n coding: [\n {\n system: 'http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation',\n code: 'HH',\n display: 'Critical high',\n },\n ],\n },\n ],\n};\n\nexport const HomerObservation8: Observation = {\n resourceType: 'Observation',\n id: '8',\n status: 'final',\n subject: {\n reference: 'Patient/123',\n display: 'Homer Simpson',\n },\n code: {\n text: 'Test 8',\n },\n component: [\n {\n valueString: 'REACTIVE',\n },\n ],\n referenceRange: [\n {\n text: 'NEGATIVE',\n },\n ],\n interpretation: [\n {\n coding: [\n {\n system: 'http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation',\n code: 'RR',\n display: 'Reactive',\n },\n ],\n },\n ],\n};\n\nexport const HomerSimpsonSpecimen: Specimen = {\n id: '123',\n resourceType: 'Specimen',\n subject: createReference(HomerSimpson),\n collection: {\n collectedDateTime: '2020-01-01T12:00:00Z',\n },\n note: [\n { text: 'Specimen hemolyzed. Results may be affected.' },\n { text: 'Specimen lipemic. Results may be affected.' },\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 identifier: [\n {\n system: 'https://example.com',\n value: '9001',\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 status: 'active',\n orderDetail: [\n {\n text: 'ORDERED',\n },\n ],\n specimen: [createReference(HomerSimpsonSpecimen)],\n authoredOn: '2020-01-01T12:00:00Z',\n};\n\nexport const HomerDiagnosticReport: DiagnosticReport = {\n resourceType: 'DiagnosticReport',\n id: '123',\n meta: {\n versionId: '1',\n lastUpdated: '2020-01-02T12:00:00Z',\n author: {\n reference: 'Practitioner/123',\n },\n },\n subject: createReference(HomerSimpson),\n basedOn: [createReference(HomerServiceRequest)],\n specimen: [createReference(HomerSimpsonSpecimen)],\n resultsInterpreter: [createReference(DrAliceSmith)],\n result: [\n createReference(HomerObservation1),\n createReference(HomerObservation2),\n createReference(HomerObservation3),\n createReference(HomerObservation4),\n createReference(HomerObservation5),\n createReference(HomerObservation6),\n createReference(HomerObservation7),\n createReference(HomerObservation8),\n ],\n};\n\nexport const SimpsonsFamily: Group = {\n resourceType: 'Group',\n id: 'simpsons-family',\n type: 'person',\n actual: true,\n member: [\n { entity: createReference(HomerSimpson) },\n { entity: createReference(MargeSimpson) },\n { entity: createReference(BartSimpson) },\n { entity: createReference(LisaSimpson) },\n ],\n};\n","import { AuditEvent, 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 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","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 { createReference, getReferenceString } from '@medplum/core';\nimport { PlanDefinition, Questionnaire, QuestionnaireResponse, RequestGroup, Task } from '@medplum/fhirtypes';\nimport { DrAliceSmith } from './alice';\nimport { HomerSimpson } from './simpsons';\n\nexport const ExampleWorkflowQuestionnaire1: Questionnaire = {\n resourceType: 'Questionnaire',\n id: 'workflow-questionnaire-1',\n name: 'Patient Registration',\n title: 'Patient Registration',\n subjectType: ['Patient'],\n item: [\n {\n linkId: '1',\n text: 'First question',\n type: 'string',\n },\n ],\n};\n\nexport const ExampleWorkflowQuestionnaire2: Questionnaire = {\n resourceType: 'Questionnaire',\n id: 'workflow-questionnaire-2',\n name: 'Surgery History',\n title: 'Surgery History',\n subjectType: ['Patient'],\n item: [\n {\n linkId: '1',\n text: 'First question',\n type: 'string',\n },\n ],\n};\n\nexport const ExampleWorkflowQuestionnaire3: Questionnaire = {\n resourceType: 'Questionnaire',\n id: 'workflow-questionnaire-3',\n name: 'Family Health History',\n title: 'Family Health History',\n subjectType: ['Patient'],\n item: [\n {\n linkId: '1',\n text: 'First question',\n type: 'string',\n },\n ],\n};\n\nexport const ExampleWorkflowPlanDefinition: PlanDefinition = {\n resourceType: 'PlanDefinition',\n id: 'workflow-plan-definition-1',\n title: 'Example Plan Definition',\n action: [\n {\n title: ExampleWorkflowQuestionnaire1.title,\n definitionCanonical: getReferenceString(ExampleWorkflowQuestionnaire1),\n },\n {\n title: ExampleWorkflowQuestionnaire2.title,\n definitionCanonical: getReferenceString(ExampleWorkflowQuestionnaire2),\n },\n {\n title: ExampleWorkflowQuestionnaire3.title,\n definitionCanonical: getReferenceString(ExampleWorkflowQuestionnaire3),\n },\n ],\n};\n\nexport const ExampleWorkflowQuestionnaireResponse1: QuestionnaireResponse = {\n resourceType: 'QuestionnaireResponse',\n id: 'workflow-questionnaire-response-1',\n questionnaire: getReferenceString(ExampleWorkflowQuestionnaire1),\n subject: createReference(HomerSimpson),\n source: createReference(HomerSimpson),\n};\n\n// Based on: http://build.fhir.org/ig/HL7/sdc/Task-example.json.html\nexport const ExampleWorkflowTask1: Task = {\n resourceType: 'Task',\n id: 'workflow-task-1',\n status: 'completed',\n meta: { author: createReference(HomerSimpson) },\n requester: createReference(DrAliceSmith),\n input: [{ valueReference: createReference(ExampleWorkflowQuestionnaire1) }],\n output: [{ valueReference: createReference(ExampleWorkflowQuestionnaireResponse1) }],\n};\n\nexport const ExampleWorkflowTask2: Task = {\n resourceType: 'Task',\n id: 'workflow-task-2',\n status: 'requested',\n meta: { author: createReference(DrAliceSmith) },\n requester: createReference(DrAliceSmith),\n input: [{ valueReference: createReference(ExampleWorkflowQuestionnaire2) }],\n};\n\nexport const ExampleWorkflowTask3: Task = {\n resourceType: 'Task',\n id: 'workflow-task-3',\n status: 'requested',\n meta: { author: createReference(DrAliceSmith) },\n requester: createReference(DrAliceSmith),\n input: [{ valueReference: createReference(ExampleWorkflowQuestionnaire3) }],\n};\n\nexport const ExampleWorkflowRequestGroup: RequestGroup = {\n resourceType: 'RequestGroup',\n id: 'workflow-request-group-1',\n instantiatesCanonical: [getReferenceString(ExampleWorkflowPlanDefinition)],\n status: 'active',\n action: [\n {\n title: ExampleWorkflowQuestionnaire1.title,\n resource: createReference(ExampleWorkflowTask1),\n },\n {\n title: ExampleWorkflowQuestionnaire2.title,\n resource: createReference(ExampleWorkflowTask2),\n },\n {\n title: ExampleWorkflowQuestionnaire3.title,\n resource: createReference(ExampleWorkflowTask3),\n },\n ],\n};\n","import { ClientApplication } from '@medplum/fhirtypes';\n\nexport const ExampleSmartClientApplication: ClientApplication = {\n resourceType: 'ClientApplication',\n id: 'smart-client-app',\n name: 'Inferno Client',\n description: 'Client application used for Inferno ONC compliance testing',\n redirectUri: 'https://inferno.healthit.gov/suites/custom/smart/redirect',\n launchUri: 'https://inferno.healthit.gov/suites/custom/smart/launch',\n};\n","import {\n allOk,\n badRequest,\n getStatus,\n indexStructureDefinition,\n isOk,\n LoginState,\n MedplumClient,\n ProfileResource,\n} from '@medplum/core';\nimport { FhirRequest, FhirRouter, HttpMethod, MemoryRepository } from '@medplum/fhir-router';\nimport { Binary, Resource, SearchParameter, StructureDefinition, UserConfiguration } from '@medplum/fhirtypes';\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n/** @ts-ignore */\nimport type { CustomTableLayout, TDocumentDefinitions, TFontDictionary } from 'pdfmake/interfaces';\nimport {\n BartSimpson,\n DifferentOrganization,\n DrAliceSmith,\n DrAliceSmithPreviousVersion,\n DrAliceSmithSchedule,\n DrAliceSmithSlots,\n ExampleBot,\n ExampleClient,\n ExampleQuestionnaire,\n ExampleQuestionnaireResponse,\n ExampleSubscription,\n exampleValueSet,\n HomerCommunication,\n HomerDiagnosticReport,\n HomerEncounter,\n HomerMedia,\n HomerObservation1,\n HomerObservation2,\n HomerObservation3,\n HomerObservation4,\n HomerObservation5,\n HomerObservation6,\n HomerObservation7,\n HomerObservation8,\n HomerServiceRequest,\n HomerSimpson,\n HomerSimpsonPreviousVersion,\n HomerSimpsonSpecimen,\n TestOrganization,\n} from './mocks';\nimport { ExampleAccessPolicy, ExampleStatusValueSet, ExampleUserConfiguration } from './mocks/accesspolicy';\nimport SearchParameterList from './mocks/searchparameters.json';\nimport { ExampleSmartClientApplication } from './mocks/smart';\nimport StructureDefinitionList from './mocks/structuredefinitions.json';\nimport {\n ExampleWorkflowPlanDefinition,\n ExampleWorkflowQuestionnaire1,\n ExampleWorkflowQuestionnaire2,\n ExampleWorkflowQuestionnaire3,\n ExampleWorkflowQuestionnaireResponse1,\n ExampleWorkflowRequestGroup,\n ExampleWorkflowTask1,\n ExampleWorkflowTask2,\n ExampleWorkflowTask3,\n} from './mocks/workflow';\n\nexport interface MockClientOptions {\n readonly debug?: boolean;\n}\n\nexport class MockClient extends MedplumClient {\n readonly router: FhirRouter;\n readonly repo: MemoryRepository;\n readonly client: MockFetchClient;\n readonly debug: boolean;\n activeLoginOverride?: LoginState;\n\n constructor(clientOptions?: MockClientOptions) {\n const router = new FhirRouter();\n const repo = new MemoryRepository();\n const client = new MockFetchClient(router, repo, clientOptions?.debug);\n\n super({\n baseUrl: 'https://example.com/',\n clientId: 'my-client-id',\n createPdf: (\n docDefinition: TDocumentDefinitions,\n tableLayouts?: { [name: string]: CustomTableLayout },\n fonts?: TFontDictionary | undefined\n ) => client.mockCreatePdf(docDefinition, tableLayouts, fonts),\n fetch: (url: string, options: any) => {\n return client.mockFetch(url, options);\n },\n });\n\n this.router = router;\n this.repo = repo;\n this.client = client;\n this.debug = !!clientOptions?.debug;\n }\n\n clear(): void {\n super.clear();\n this.activeLoginOverride = undefined;\n }\n\n getProfile(): ProfileResource {\n return DrAliceSmith;\n }\n\n getUserConfiguration(): UserConfiguration | undefined {\n return {\n resourceType: 'UserConfiguration',\n menu: [\n {\n title: 'Favorites',\n link: [\n { name: 'Patients', target: '/Patient' },\n { name: 'Active Orders', target: '/ServiceRequest?status=active' },\n { name: 'Completed Orders', target: '/ServiceRequest?status=completed' },\n ],\n },\n {\n title: 'Admin',\n link: [\n { name: 'Project', target: '/admin/project' },\n { name: 'Batch', target: '/batch' },\n ],\n },\n ],\n };\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 async createBinary(\n data: string | File | Blob | Uint8Array,\n filename: string | undefined,\n contentType: string,\n onProgress?: (e: ProgressEvent) => void\n ): Promise<Binary> {\n if (filename?.endsWith('.exe')) {\n return Promise.reject(badRequest('Invalid file type'));\n }\n\n if (onProgress) {\n onProgress({ loaded: 0, lengthComputable: false } as ProgressEvent);\n onProgress({ loaded: 0, total: 100, lengthComputable: true } as ProgressEvent);\n onProgress({ loaded: 100, total: 100, lengthComputable: true } as ProgressEvent);\n }\n\n return {\n resourceType: 'Binary',\n contentType,\n url: 'https://example.com/binary/123',\n };\n }\n}\n\nclass MockFetchClient {\n readonly router: FhirRouter;\n readonly repo: MemoryRepository;\n initialized = false;\n initPromise?: Promise<void>;\n\n constructor(router: FhirRouter, repo: MemoryRepository, readonly debug = false) {\n this.router = router;\n this.repo = new MemoryRepository();\n }\n\n async mockFetch(url: string, options: any): Promise<any> {\n if (!this.initialized) {\n if (!this.initPromise) {\n this.initPromise = this.initMockRepo();\n }\n await this.initPromise;\n this.initialized = true;\n }\n\n const method = options.method || 'GET';\n const path = url.replace('https://example.com/', '');\n\n if (this.debug) {\n console.log('MockClient', method, path);\n }\n\n const response = await this.mockHandler(method, path, options);\n\n if (this.debug && !response) {\n console.log('MockClient: not found', method, path);\n }\n\n if (this.debug) {\n console.log('MockClient', JSON.stringify(response, null, 2));\n }\n\n if (response?.resourceType === 'OperationOutcome' && !isOk(response)) {\n return Promise.reject(response);\n }\n\n return Promise.resolve({\n ok: true,\n status: response?.resourceType === 'OperationOutcome' ? getStatus(response) : 200,\n blob: () => Promise.resolve(response),\n json: () => Promise.resolve(response),\n });\n }\n\n mockCreatePdf(\n docDefinition: TDocumentDefinitions,\n tableLayouts?: { [name: string]: CustomTableLayout },\n fonts?: TFontDictionary | undefined\n ): Promise<any> {\n if (this.debug) {\n console.log(`Mock Client: createPdf(`);\n console.log(` ${JSON.stringify(docDefinition, null, 2)},`);\n console.log(` ${JSON.stringify(tableLayouts, null, 2)},`);\n console.log(` ${JSON.stringify(fonts, null, 2)});`);\n }\n return Promise.resolve({});\n }\n\n private async mockHandler(method: HttpMethod, path: string, options: any): Promise<any> {\n if (path.startsWith('admin/')) {\n return this.mockAdminHandler(method, path);\n } else if (path.startsWith('auth/')) {\n return this.mockAuthHandler(method, path, options);\n } else if (path.startsWith('oauth2/')) {\n return this.mockOAuthHandler(method, path, options);\n } else if (path.startsWith('fhir/R4')) {\n return this.mockFhirHandler(method, path, options);\n } else {\n return null;\n }\n }\n\n private mockAdminHandler(_method: string, path: string): any {\n if (path.startsWith('admin/projects/123')) {\n return {\n project: { id: '123', name: 'Project 123' },\n members: [\n { id: '123', profile: { reference: 'Practitioner/123', display: 'Alice Smith' }, role: 'owner' },\n { id: '888', profile: { reference: 'ClientApplication/123', display: 'Test Client' }, role: 'client' },\n { id: '999', profile: { reference: 'Bot/123', display: 'Test Bot' }, role: 'bot' },\n ],\n };\n }\n\n return {\n ok: true,\n };\n }\n\n private mockAuthHandler(method: HttpMethod, path: string, options: any): any {\n if (path.startsWith('auth/method')) {\n return {};\n }\n\n if (path.startsWith('auth/changepassword')) {\n return this.mockChangePasswordHandler(method, path, options);\n }\n\n if (path.startsWith('auth/login')) {\n return this.mockLoginHandler(method, path, options);\n }\n\n if (path.startsWith('auth/setpassword')) {\n return this.mockSetPasswordHandler(method, path, options);\n }\n\n if (path.startsWith('auth/newuser')) {\n return this.mockNewUserHandler(method, path, options);\n }\n\n if (path.startsWith('auth/newproject') || path.startsWith('auth/newpatient') || path.startsWith('auth/scope')) {\n return {\n login: '123',\n code: 'xyz',\n };\n }\n\n if (path.startsWith('auth/resetpassword')) {\n return this.mockResetPasswordHandler(method, path, options);\n }\n\n if (path.startsWith('auth/me')) {\n return {\n profile: DrAliceSmith,\n security: {\n mfaEnrolled: false,\n sessions: [\n {\n id: '123',\n lastUpdated: new Date().toISOString(),\n authMethod: 'password',\n remoteAddress: '5.5.5.5',\n browser: 'Chrome',\n os: 'Linux',\n },\n {\n id: '456',\n lastUpdated: new Date().toISOString(),\n authMethod: 'password',\n remoteAddress: '6.6.6.6',\n browser: 'Chrome',\n os: 'Android',\n },\n ],\n },\n };\n }\n\n if (path.startsWith('auth/mfa/status')) {\n return {\n enrolled: false,\n enrollUri: 'otpauth://totp/medplum.com:alice.smith%40example',\n };\n }\n\n if (path.startsWith('auth/mfa/enroll')) {\n return allOk;\n }\n\n return null;\n }\n\n private mockChangePasswordHandler(_method: string, _path: string, options: any): any {\n const { body } = options;\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 private mockLoginHandler(_method: string, _path: string, options: any): any {\n const { body } = options;\n const { password } = JSON.parse(body);\n if (password === 'password') {\n return {\n login: '123',\n code: 'xyz',\n };\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 private mockSetPasswordHandler(_method: string, _path: string, options: any): any {\n const { body } = options;\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 private mockNewUserHandler(_method: string, _path: string, options: any): any {\n const { body } = options;\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 private mockResetPasswordHandler(_method: string, _path: string, options: any): any {\n const { body } = options;\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 private mockOAuthHandler(_method: string, path: string, _options: any): any {\n if (path.startsWith('oauth2/token')) {\n return {\n access_token: 'header.' + window.btoa(JSON.stringify({ client_id: 'my-client-id' })) + '.signature',\n };\n }\n\n return null;\n }\n\n private async initMockRepo(): Promise<void> {\n const defaultResources = [\n HomerSimpsonPreviousVersion,\n HomerSimpson,\n ExampleAccessPolicy,\n ExampleStatusValueSet,\n ExampleUserConfiguration,\n ExampleBot,\n ExampleClient,\n HomerDiagnosticReport,\n HomerEncounter,\n HomerCommunication,\n HomerMedia,\n HomerObservation1,\n HomerObservation2,\n HomerObservation3,\n HomerObservation4,\n HomerObservation5,\n HomerObservation6,\n HomerObservation7,\n HomerObservation8,\n HomerSimpsonSpecimen,\n TestOrganization,\n DifferentOrganization,\n ExampleQuestionnaire,\n ExampleQuestionnaireResponse,\n HomerServiceRequest,\n ExampleSubscription,\n BartSimpson,\n DrAliceSmithPreviousVersion,\n DrAliceSmith,\n DrAliceSmithSchedule,\n ExampleWorkflowQuestionnaire1,\n ExampleWorkflowQuestionnaire2,\n ExampleWorkflowQuestionnaire3,\n ExampleWorkflowPlanDefinition,\n ExampleWorkflowQuestionnaireResponse1,\n ExampleWorkflowTask1,\n ExampleWorkflowTask2,\n ExampleWorkflowTask3,\n ExampleWorkflowRequestGroup,\n ExampleSmartClientApplication,\n ];\n\n for (const resource of defaultResources) {\n await this.repo.createResource(resource);\n }\n\n for (const structureDefinition of StructureDefinitionList as StructureDefinition[]) {\n indexStructureDefinition(structureDefinition);\n await this.repo.createResource(structureDefinition);\n }\n\n for (const searchParameter of SearchParameterList) {\n await this.repo.createResource(searchParameter as SearchParameter);\n }\n\n DrAliceSmithSlots.forEach((slot) => this.repo.createResource(slot));\n }\n\n private async mockFhirHandler(method: HttpMethod, url: string, options: any): Promise<Resource> {\n if (url.startsWith('fhir/R4/ValueSet/$expand')) {\n return exampleValueSet;\n }\n\n const parsedUrl = new URL(url, 'https://example.com');\n\n let pathname = parsedUrl.pathname;\n if (pathname.includes('fhir/R4')) {\n pathname = pathname.substring(pathname.indexOf('fhir/R4') + 7);\n }\n\n let body = undefined;\n if (options.body) {\n body = JSON.parse(options.body);\n }\n\n const request: FhirRequest = {\n method,\n pathname,\n body,\n params: Object.create(null),\n query: Object.fromEntries(parsedUrl.searchParams),\n };\n\n const result = await this.router.handleRequest(request, this.repo);\n if (result.length === 1) {\n if (!isOk(result[0])) {\n throw result[0];\n }\n return result[0];\n } else {\n return result[1];\n }\n }\n}\n"],"names":["ExampleAccessPolicy","resourceType","id","name","ExampleStatusValueSet","compose","include","concept","code","ExampleUserConfiguration","option","valueString","TestOrganization","meta","versionId","DifferentOrganization","DrAliceSmith","lastUpdated","author","reference","given","family","photo","contentType","url","DrAliceSmithPreviousVersion","DrAliceSmithSchedule","actor","display","DrAliceSmithSlots","schedule","createReference","result","slotDate","Date","day","hour","setHours","push","start","toISOString","setDate","getDate","ExampleBot","ExampleClient","ExampleQuestionnaire","title","subjectType","item","linkId","text","type","ExampleQuestionnaireResponse","questionnaire","subject","source","SIMPSONS_ADDRESS","use","line","city","state","postalCode","LisaSimpson","birthDate","contact","address","telecom","system","value","BartSimpson","HomerLisaRelatedPerson","patient","relationship","coding","HomerBartRelatedPerson","HomerSimpson","gender","identifier","active","link","other","MargeSimpson","HomerSimpsonPreviousVersion","HomerEncounter","HomerCommunication","encounter","payload","contentString","HomerMedia","content","HomerObservation1","status","HomerObservation2","valueQuantity","unit","referenceRange","low","HomerObservation3","high","HomerObservation4","comparator","interpretation","HomerObservation5","HomerObservation6","component","HomerObservation7","HomerObservation8","HomerSimpsonSpecimen","collection","collectedDateTime","note","HomerServiceRequest","orderDetail","specimen","authoredOn","HomerDiagnosticReport","basedOn","resultsInterpreter","SimpsonsFamily","actual","member","entity","ExampleSubscription","ExampleAuditEvent","exampleValueSet","expansion","contains","ExampleWorkflowQuestionnaire1","ExampleWorkflowQuestionnaire2","ExampleWorkflowQuestionnaire3","ExampleWorkflowPlanDefinition","action","definitionCanonical","getReferenceString","ExampleWorkflowQuestionnaireResponse1","ExampleWorkflowTask1","requester","input","valueReference","output","ExampleWorkflowTask2","ExampleWorkflowTask3","ExampleWorkflowRequestGroup","instantiatesCanonical","resource","ExampleSmartClientApplication","description","redirectUri","launchUri","MockClient","MedplumClient","constructor","clientOptions","router","FhirRouter","repo","MemoryRepository","client","MockFetchClient","debug","super","baseUrl","clientId","createPdf","docDefinition","tableLayouts","fonts","mockCreatePdf","fetch","options","mockFetch","this","clear","activeLoginOverride","undefined","getProfile","getUserConfiguration","menu","target","setActiveLoginOverride","getActiveLogin","async","data","filename","onProgress","endsWith","Promise","reject","badRequest","loaded","lengthComputable","total","initialized","initPromise","initMockRepo","method","path","replace","console","log","response","mockHandler","JSON","stringify","isOk","resolve","ok","getStatus","blob","json","startsWith","mockAdminHandler","mockAuthHandler","mockOAuthHandler","mockFhirHandler","_method","project","members","profile","role","mockChangePasswordHandler","mockLoginHandler","mockSetPasswordHandler","mockNewUserHandler","login","mockResetPasswordHandler","security","mfaEnrolled","sessions","authMethod","remoteAddress","browser","os","enrolled","enrollUri","allOk","_path","body","oldPassword","parse","issue","expression","details","password","email","_options","access_token","window","btoa","client_id","defaultResources","createResource","structureDefinition","StructureDefinitionList","indexStructureDefinition","searchParameter","SearchParameterList","forEach","slot","parsedUrl","URL","pathname","includes","substring","indexOf","request","params","Object","create","query","fromEntries","searchParams","handleRequest","length"],"mappings":"qPAEa,MAAAA,EAAoC,CAC/CC,aAAc,eACdC,GAAI,MACJC,KAAM,yBAGKC,EAAkC,CAC7CH,aAAc,WACdC,GAAI,mBACJG,QAAS,CACPC,QAAS,CACP,CACEC,QAAS,CACP,CAAEC,KAAM,WACR,CAAEA,KAAM,oBACR,CAAEA,KAAM,oBACR,CAAEA,KAAM,iBACR,CAAEA,KAAM,qBAOLC,EAA8C,CACzDR,aAAc,oBACdC,GAAI,MACJC,KAAM,6BACNO,OAAQ,CACN,CACER,GAAI,iBACJS,YAAa,+BC9BNC,EAAiC,CAC5CX,aAAc,eACdC,GAAI,MACJW,KAAM,CACJC,UAAW,KAEbX,KAAM,qBAGKY,EAAsC,CACjDd,aAAc,eACdC,GAAI,MACJW,KAAM,CACJC,UAAW,KAEbX,KAAM,aAGKa,EAA6B,CACxCf,aAAc,eACdC,GAAI,MACJW,KAAM,CACJC,UAAW,IACXG,YAAa,uBACbC,OAAQ,CACNC,UAAW,qBAGfhB,KAAM,CACJ,CACEiB,MAAO,CAAC,SACRC,OAAQ,UAGZC,MAAO,CACL,CACEC,YAAa,YACbC,IAAK,mDAKEC,EAA4C,CACvDxB,aAAc,eACdC,GAAI,MACJW,KAAM,CACJC,UAAW,IACXG,YAAa,uBACbC,OAAQ,CACNC,UAAW,qBAGfhB,KAAM,CAAC,CAAEiB,MAAO,CAAC,WAAYC,OAAQ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