@medplum/fhir-router 2.0.10 → 2.0.12
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.cjs +38 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.min.cjs +1 -1
- package/dist/cjs/index.min.cjs.map +1 -1
- package/dist/esm/index.min.mjs +1 -1
- package/dist/esm/index.min.mjs.map +1 -1
- package/dist/esm/index.mjs +38 -3
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/repo.d.ts +72 -1
- package/package.json +1 -1
package/dist/types/repo.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { OperationOutcomeError, SearchRequest } from '@medplum/core';
|
|
2
2
|
import { Bundle, Reference, Resource } from '@medplum/fhirtypes';
|
|
3
3
|
import { Operation } from 'rfc6902';
|
|
4
|
+
/**
|
|
5
|
+
* The FhirRepository interface defines the methods that are required to implement a FHIR repository.
|
|
6
|
+
* A FHIR repository is responsible for storing and retrieving FHIR resources.
|
|
7
|
+
* It is used by the FHIR router to implement the FHIR REST API.
|
|
8
|
+
* The primary implementations at this time are:
|
|
9
|
+
* 1. MemoryRepository - A repository that stores resources in memory.
|
|
10
|
+
* 2. Server Repository - A repository that stores resources in a relational database.
|
|
11
|
+
*/
|
|
4
12
|
export interface FhirRepository {
|
|
5
13
|
/**
|
|
6
14
|
* Creates a FHIR resource.
|
|
@@ -99,8 +107,71 @@ export interface FhirRepository {
|
|
|
99
107
|
* @returns The search results.
|
|
100
108
|
*/
|
|
101
109
|
search<T extends Resource>(searchRequest: SearchRequest): Promise<Bundle<T>>;
|
|
110
|
+
/**
|
|
111
|
+
* Searches for a single FHIR resource.
|
|
112
|
+
*
|
|
113
|
+
* This is a convenience method for `search()` that returns the first resource rather than a `Bundle`.
|
|
114
|
+
*
|
|
115
|
+
* The return value is the resource, if available; otherwise, undefined.
|
|
116
|
+
*
|
|
117
|
+
* See FHIR search for full details: https://www.hl7.org/fhir/search.html
|
|
118
|
+
*
|
|
119
|
+
* @param searchRequest The FHIR search request.
|
|
120
|
+
* @returns Promise to the first search result or undefined.
|
|
121
|
+
*/
|
|
122
|
+
searchOne<T extends Resource>(searchRequest: SearchRequest<T>): Promise<T | undefined>;
|
|
123
|
+
/**
|
|
124
|
+
* Sends a FHIR search request for an array of resources.
|
|
125
|
+
*
|
|
126
|
+
* This is a convenience method for `search()` that returns the resources as an array rather than a `Bundle`.
|
|
127
|
+
*
|
|
128
|
+
* The return value is an array of resources.
|
|
129
|
+
*
|
|
130
|
+
* See FHIR search for full details: https://www.hl7.org/fhir/search.html
|
|
131
|
+
*
|
|
132
|
+
* @param searchRequest The FHIR search request.
|
|
133
|
+
* @returns Promise to the array of search results.
|
|
134
|
+
*/
|
|
135
|
+
searchResources<T extends Resource>(searchRequest: SearchRequest<T>): Promise<T[]>;
|
|
136
|
+
}
|
|
137
|
+
export declare abstract class BaseRepository {
|
|
138
|
+
/**
|
|
139
|
+
* Searches for FHIR resources.
|
|
140
|
+
*
|
|
141
|
+
* See: https://www.hl7.org/fhir/http.html#search
|
|
142
|
+
*
|
|
143
|
+
* @param searchRequest The FHIR search request.
|
|
144
|
+
* @returns The search results.
|
|
145
|
+
*/
|
|
146
|
+
abstract search<T extends Resource>(searchRequest: SearchRequest<T>): Promise<Bundle<T>>;
|
|
147
|
+
/**
|
|
148
|
+
* Searches for a single FHIR resource.
|
|
149
|
+
*
|
|
150
|
+
* This is a convenience method for `search()` that returns the first resource rather than a `Bundle`.
|
|
151
|
+
*
|
|
152
|
+
* The return value is the resource, if available; otherwise, undefined.
|
|
153
|
+
*
|
|
154
|
+
* See FHIR search for full details: https://www.hl7.org/fhir/search.html
|
|
155
|
+
*
|
|
156
|
+
* @param searchRequest The FHIR search request.
|
|
157
|
+
* @returns Promise to the first search result or undefined.
|
|
158
|
+
*/
|
|
159
|
+
searchOne<T extends Resource>(searchRequest: SearchRequest<T>): Promise<T | undefined>;
|
|
160
|
+
/**
|
|
161
|
+
* Sends a FHIR search request for an array of resources.
|
|
162
|
+
*
|
|
163
|
+
* This is a convenience method for `search()` that returns the resources as an array rather than a `Bundle`.
|
|
164
|
+
*
|
|
165
|
+
* The return value is an array of resources.
|
|
166
|
+
*
|
|
167
|
+
* See FHIR search for full details: https://www.hl7.org/fhir/search.html
|
|
168
|
+
*
|
|
169
|
+
* @param searchRequest The FHIR search request.
|
|
170
|
+
* @returns Promise to the array of search results.
|
|
171
|
+
*/
|
|
172
|
+
searchResources<T extends Resource>(searchRequest: SearchRequest<T>): Promise<T[]>;
|
|
102
173
|
}
|
|
103
|
-
export declare class MemoryRepository implements FhirRepository {
|
|
174
|
+
export declare class MemoryRepository extends BaseRepository implements FhirRepository {
|
|
104
175
|
#private;
|
|
105
176
|
constructor();
|
|
106
177
|
createResource<T extends Resource>(resource: T): Promise<T>;
|