@medplum/mock 0.9.3 → 0.9.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.
- package/dist/cjs/index.js +48 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.min.js +1 -1
- package/dist/cjs/index.min.js.map +1 -1
- package/dist/esm/index.js +48 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +1 -1
- package/dist/esm/index.min.js.map +1 -1
- package/dist/types/mocks/bot.d.ts +2 -1
- package/dist/types/repo.d.ts +1 -0
- package/package.json +6 -6
package/dist/esm/index.js
CHANGED
|
@@ -119,6 +119,11 @@ const ExampleBot = {
|
|
|
119
119
|
id: '123',
|
|
120
120
|
name: 'Test Bot',
|
|
121
121
|
code: 'console.log("hello world");',
|
|
122
|
+
};
|
|
123
|
+
const ExampleClient = {
|
|
124
|
+
resourceType: 'ClientApplication',
|
|
125
|
+
id: '123',
|
|
126
|
+
name: 'Test Client',
|
|
122
127
|
};
|
|
123
128
|
|
|
124
129
|
const ExampleQuestionnaire = {
|
|
@@ -8467,7 +8472,11 @@ function resolve(input) {
|
|
|
8467
8472
|
refStr = e;
|
|
8468
8473
|
}
|
|
8469
8474
|
else if (typeof e === 'object') {
|
|
8470
|
-
|
|
8475
|
+
const ref = e;
|
|
8476
|
+
if (ref.resource) {
|
|
8477
|
+
return ref.resource;
|
|
8478
|
+
}
|
|
8479
|
+
refStr = ref.reference;
|
|
8471
8480
|
}
|
|
8472
8481
|
if (!refStr) {
|
|
8473
8482
|
return undefined;
|
|
@@ -9114,6 +9123,12 @@ class MemoryRepository {
|
|
|
9114
9123
|
total: result.length,
|
|
9115
9124
|
};
|
|
9116
9125
|
}
|
|
9126
|
+
deleteResource(resourceType, id) {
|
|
9127
|
+
var _a, _b;
|
|
9128
|
+
if ((_b = (_a = __classPrivateFieldGet$1(this, _MemoryRepository_resources, "f")) === null || _a === void 0 ? void 0 : _a[resourceType]) === null || _b === void 0 ? void 0 : _b[id]) {
|
|
9129
|
+
delete __classPrivateFieldGet$1(this, _MemoryRepository_resources, "f")[resourceType][id];
|
|
9130
|
+
}
|
|
9131
|
+
}
|
|
9117
9132
|
generateId() {
|
|
9118
9133
|
return Date.now().toString(36);
|
|
9119
9134
|
}
|
|
@@ -9231,6 +9246,7 @@ function mockAdminHandler(_method, path) {
|
|
|
9231
9246
|
members: [
|
|
9232
9247
|
{ id: '123', profile: { reference: 'Practitioner/123', display: 'Alice Smith' }, role: 'owner' },
|
|
9233
9248
|
{ id: '888', profile: { reference: 'ClientApplication/123', display: 'Test Client' }, role: 'client' },
|
|
9249
|
+
{ id: '999', profile: { reference: 'Bot/123', display: 'Test Bot' }, role: 'bot' },
|
|
9234
9250
|
],
|
|
9235
9251
|
};
|
|
9236
9252
|
}
|
|
@@ -9369,6 +9385,7 @@ mockRepo.createResource(ExampleAccessPolicy);
|
|
|
9369
9385
|
mockRepo.createResource(ExampleStatusValueSet);
|
|
9370
9386
|
mockRepo.createResource(ExampleUserConfiguration);
|
|
9371
9387
|
mockRepo.createResource(ExampleBot);
|
|
9388
|
+
mockRepo.createResource(ExampleClient);
|
|
9372
9389
|
mockRepo.createResource(HomerDiagnosticReport);
|
|
9373
9390
|
mockRepo.createResource(HomerEncounter);
|
|
9374
9391
|
mockRepo.createResource(HomerCommunication);
|
|
@@ -9402,7 +9419,7 @@ function mockFhirHandler(method, url, options) {
|
|
|
9402
9419
|
return exampleValueSet;
|
|
9403
9420
|
}
|
|
9404
9421
|
else if (path === 'fhir/R4/%24graphql') {
|
|
9405
|
-
return
|
|
9422
|
+
return mockFhirGraphqlHandler(method, path, options);
|
|
9406
9423
|
}
|
|
9407
9424
|
else if (path === 'not-found' || id === 'not-found') {
|
|
9408
9425
|
return notFound;
|
|
@@ -9432,6 +9449,34 @@ function mockFhirHandler(method, url, options) {
|
|
|
9432
9449
|
else if (method === 'PUT') {
|
|
9433
9450
|
return mockRepo.createResource(JSON.parse(options.body));
|
|
9434
9451
|
}
|
|
9452
|
+
else if (method === 'DELETE') {
|
|
9453
|
+
if (resourceType && id) {
|
|
9454
|
+
return mockRepo.deleteResource(resourceType, id);
|
|
9455
|
+
}
|
|
9456
|
+
else {
|
|
9457
|
+
return notFound;
|
|
9458
|
+
}
|
|
9459
|
+
}
|
|
9460
|
+
}
|
|
9461
|
+
function mockFhirGraphqlHandler(_method, _path, options) {
|
|
9462
|
+
const { body } = options;
|
|
9463
|
+
if (body.includes('ResourceList: ServiceRequestList')) {
|
|
9464
|
+
return {
|
|
9465
|
+
data: {
|
|
9466
|
+
ResourceList: [
|
|
9467
|
+
Object.assign(Object.assign({}, HomerServiceRequest), { ObservationList: [
|
|
9468
|
+
HomerObservation1,
|
|
9469
|
+
HomerObservation2,
|
|
9470
|
+
HomerObservation3,
|
|
9471
|
+
HomerObservation4,
|
|
9472
|
+
HomerObservation5,
|
|
9473
|
+
HomerObservation6,
|
|
9474
|
+
] }),
|
|
9475
|
+
],
|
|
9476
|
+
},
|
|
9477
|
+
};
|
|
9478
|
+
}
|
|
9479
|
+
return GraphQLSchemaResponse;
|
|
9435
9480
|
}
|
|
9436
9481
|
function mockFhirBatchHandler(_method, _path, options) {
|
|
9437
9482
|
var _a;
|
|
@@ -9458,5 +9503,5 @@ function mockFhirBatchHandler(_method, _path, options) {
|
|
|
9458
9503
|
};
|
|
9459
9504
|
}
|
|
9460
9505
|
|
|
9461
|
-
export { BartSimpson, DifferentOrganization, DrAliceSmith, DrAliceSmithPreviousVersion, DrAliceSmithSchedule, DrAliceSmithSlots, ExampleAccessPolicy, ExampleAuditEvent, ExampleBot, ExampleQuestionnaire, ExampleQuestionnaireResponse, ExampleStatusValueSet, ExampleSubscription, ExampleUserConfiguration, GraphQLSchemaResponse, HomerCommunication, HomerDiagnosticReport, HomerEncounter, HomerMedia, HomerObservation1, HomerObservation2, HomerObservation3, HomerObservation4, HomerObservation5, HomerObservation6, HomerServiceRequest, HomerSimpson, HomerSimpsonPreviousVersion, HomerSimpsonSpecimen, MockClient, PatientSearchParameters, TestOrganization, exampleValueSet };
|
|
9506
|
+
export { BartSimpson, DifferentOrganization, DrAliceSmith, DrAliceSmithPreviousVersion, DrAliceSmithSchedule, DrAliceSmithSlots, ExampleAccessPolicy, ExampleAuditEvent, ExampleBot, ExampleClient, ExampleQuestionnaire, ExampleQuestionnaireResponse, ExampleStatusValueSet, ExampleSubscription, ExampleUserConfiguration, GraphQLSchemaResponse, HomerCommunication, HomerDiagnosticReport, HomerEncounter, HomerMedia, HomerObservation1, HomerObservation2, HomerObservation3, HomerObservation4, HomerObservation5, HomerObservation6, HomerServiceRequest, HomerSimpson, HomerSimpsonPreviousVersion, HomerSimpsonSpecimen, MockClient, PatientSearchParameters, TestOrganization, exampleValueSet };
|
|
9462
9507
|
//# sourceMappingURL=index.js.map
|