@medplum/core 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 +45 -1
- 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 +45 -1
- 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/client.d.ts +44 -0
- package/package.json +2 -2
package/dist/types/client.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Binary, Bundle, Project, ProjectMembership, Reference, Resource, UserConfiguration, ValueSet } from '@medplum/fhirtypes';
|
|
2
2
|
import type { Operation } from 'fast-json-patch';
|
|
3
3
|
import { EventTarget } from './eventtarget';
|
|
4
|
+
import { Hl7Message } from './hl7';
|
|
4
5
|
import { ReadablePromise } from './readablepromise';
|
|
5
6
|
import { SearchRequest } from './search';
|
|
6
7
|
import { IndexedStructureDefinition } from './types';
|
|
@@ -99,6 +100,10 @@ export interface TokenResponse {
|
|
|
99
100
|
readonly project: Reference<Project>;
|
|
100
101
|
readonly profile: Reference<ProfileResource>;
|
|
101
102
|
}
|
|
103
|
+
export interface BotEvent {
|
|
104
|
+
readonly contentType: string;
|
|
105
|
+
readonly input: Resource | Hl7Message | string;
|
|
106
|
+
}
|
|
102
107
|
/**
|
|
103
108
|
* The MedplumClient class provides a client for the Medplum FHIR server.
|
|
104
109
|
*
|
|
@@ -533,6 +538,45 @@ export declare class MedplumClient extends EventTarget {
|
|
|
533
538
|
* @returns The result of the create operation.
|
|
534
539
|
*/
|
|
535
540
|
createResource<T extends Resource>(resource: T): Promise<T>;
|
|
541
|
+
/**
|
|
542
|
+
* Conditionally create a new FHIR resource only if some equivalent resource does not already exist on the server.
|
|
543
|
+
*
|
|
544
|
+
* The return value is the existing resource or the newly created resource, including the ID and meta.
|
|
545
|
+
*
|
|
546
|
+
* Example:
|
|
547
|
+
*
|
|
548
|
+
* ```typescript
|
|
549
|
+
* const result = await medplum.createResourceIfNoneExist(
|
|
550
|
+
* 'Patient?identifier=123',
|
|
551
|
+
* {
|
|
552
|
+
* resourceType: 'Patient',
|
|
553
|
+
* identifier: [{
|
|
554
|
+
* system: 'http://example.com/mrn',
|
|
555
|
+
* value: '123'
|
|
556
|
+
* }]
|
|
557
|
+
* name: [{
|
|
558
|
+
* family: 'Smith',
|
|
559
|
+
* given: ['John']
|
|
560
|
+
* }]
|
|
561
|
+
* });
|
|
562
|
+
* console.log(result.id);
|
|
563
|
+
* ```
|
|
564
|
+
*
|
|
565
|
+
* This method is syntactic sugar for:
|
|
566
|
+
*
|
|
567
|
+
* ```typescript
|
|
568
|
+
* return searchOne(query) ?? createResource(resource);
|
|
569
|
+
* ```
|
|
570
|
+
*
|
|
571
|
+
* The query parameter only contains the search parameters (what would be in the URL following the "?").
|
|
572
|
+
*
|
|
573
|
+
* See the FHIR "conditional create" operation for full details: https://www.hl7.org/fhir/http.html#ccreate
|
|
574
|
+
*
|
|
575
|
+
* @param resource The FHIR resource to create.
|
|
576
|
+
* @param query The search query for an equivalent resource.
|
|
577
|
+
* @returns The result of the create operation.
|
|
578
|
+
*/
|
|
579
|
+
createResourceIfNoneExist<T extends Resource>(resource: T, query: string): Promise<T>;
|
|
536
580
|
/**
|
|
537
581
|
* Creates a FHIR `Binary` resource with the provided data content.
|
|
538
582
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medplum/core",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.4",
|
|
4
4
|
"description": "Medplum TS/JS Library",
|
|
5
5
|
"author": "Medplum <hello@medplum.com>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"test": "jest"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@medplum/fhirtypes": "0.9.
|
|
20
|
+
"@medplum/fhirtypes": "0.9.4",
|
|
21
21
|
"fast-json-patch": "3.1.1"
|
|
22
22
|
},
|
|
23
23
|
"main": "dist/cjs/index.js",
|