@health-samurai/aidbox-client 0.0.0-alpha.1 → 0.0.0-alpha.3
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/README.md +233 -74
- package/dist/src/auth-providers.d.ts +23 -0
- package/dist/src/auth-providers.d.ts.map +1 -0
- package/dist/src/auth-providers.js +322 -0
- package/dist/src/client.d.ts +508 -11
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/client.js +1473 -759
- package/dist/src/fhir-types/hl7-fhir-r4-core/Address.d.ts +26 -0
- package/dist/src/fhir-types/hl7-fhir-r4-core/Address.d.ts.map +1 -0
- package/dist/src/fhir-types/hl7-fhir-r4-core/Address.js +5 -0
- package/dist/src/fhir-types/hl7-fhir-r4-core/ContactPoint.d.ts +16 -0
- package/dist/src/fhir-types/hl7-fhir-r4-core/ContactPoint.d.ts.map +1 -0
- package/dist/src/fhir-types/hl7-fhir-r4-core/ContactPoint.js +5 -0
- package/dist/src/fhir-types/hl7-fhir-r4-core/DomainResource.d.ts +1 -1
- package/dist/src/fhir-types/hl7-fhir-r4-core/DomainResource.d.ts.map +1 -1
- package/dist/src/fhir-types/hl7-fhir-r4-core/HumanName.d.ts +20 -0
- package/dist/src/fhir-types/hl7-fhir-r4-core/HumanName.d.ts.map +1 -0
- package/dist/src/fhir-types/hl7-fhir-r4-core/HumanName.js +5 -0
- package/dist/src/fhir-types/hl7-fhir-r4-core/Patient.d.ts +58 -0
- package/dist/src/fhir-types/hl7-fhir-r4-core/Patient.d.ts.map +1 -0
- package/dist/src/fhir-types/hl7-fhir-r4-core/Patient.js +10 -0
- package/dist/src/fhir-types/hl7-fhir-r4-core/Resource.d.ts +1 -1
- package/dist/src/fhir-types/hl7-fhir-r4-core/Resource.d.ts.map +1 -1
- package/dist/src/fhir-types/hl7-fhir-r4-core/index.d.ts +5 -0
- package/dist/src/fhir-types/hl7-fhir-r4-core/index.d.ts.map +1 -1
- package/dist/src/fhir-types/hl7-fhir-r4-core/index.js +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/result.d.ts +114 -3
- package/dist/src/result.d.ts.map +1 -1
- package/dist/src/result.js +6 -2
- package/dist/src/types.d.ts +110 -66
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +10 -2
- package/package.json +48 -46
- package/dist/src/fhir-http.d.ts +0 -72
- package/dist/src/fhir-http.d.ts.map +0 -1
- package/dist/src/fhir-http.js +0 -1
package/dist/src/client.d.ts
CHANGED
|
@@ -1,25 +1,522 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Bundle, OperationOutcome } from "./fhir-types/hl7-fhir-r4-core";
|
|
2
|
+
import { type Result } from "./result";
|
|
3
|
+
import type { AuthProvider, BatchOptions, CapabilitiesOptions, ConditionalCreateOptions, ConditionalDeleteOptions, ConditionalPatchOptions, ConditionalUpdateOptions, CreateOptions, DeleteHistoryVersionOptions, DeleteOptions, HistoryInstanceOptions, HistorySystemOptions, HistoryTypeOptions, OperationOptions, PatchOptions, ReadOptions, RequestParams, ResourceResponse, ResponseWithMeta, SearchCompartmentOptions, SearchSystemOptions, SearchTypeOptions, TransactionOptions, UpdateOptions, User, ValidateOptions, VReadOptions } from "./types";
|
|
2
4
|
/**
|
|
3
5
|
* Create a client to the FHIR server.
|
|
4
6
|
*
|
|
5
7
|
* ```typescript
|
|
6
|
-
*
|
|
8
|
+
* import type { User } from "@health-samurai/aidbox-client";
|
|
9
|
+
*
|
|
10
|
+
* const baseUrl = "https://fhir-server.address";
|
|
11
|
+
* const client = new AidboxClient(
|
|
12
|
+
* baseUrl,
|
|
13
|
+
* new BrowserAuthProvider(baseUrl);
|
|
14
|
+
* );
|
|
7
15
|
*
|
|
8
16
|
* // alternatively, specify different FHIR types:
|
|
9
17
|
* import type { Bundle, OperationOutcome } from "hl7-fhir-r5-core";
|
|
10
|
-
* const client =
|
|
18
|
+
* const client = new AidboxClient<Bundle, OperationOutcome, User>(
|
|
19
|
+
* baseUrl,
|
|
20
|
+
* authProvider: new BrowserAuthProvider(baseUrl);
|
|
21
|
+
* );
|
|
11
22
|
* ```
|
|
12
23
|
*
|
|
13
24
|
* Main client functions are `request` for typed interactions, and `rawRequest` for manual response processing.
|
|
14
25
|
*
|
|
15
|
-
* This client also provides a set of convenience methods for accessing FHIR operations
|
|
16
|
-
*
|
|
17
|
-
* - `read`
|
|
18
|
-
* - `search`
|
|
19
|
-
* - `create`
|
|
20
|
-
* - `operation`
|
|
21
|
-
* - `validate`
|
|
26
|
+
* This client also provides a set of convenience methods for accessing FHIR operations, provided below.
|
|
22
27
|
*
|
|
28
|
+
* @showGroups
|
|
23
29
|
*/
|
|
24
|
-
export declare
|
|
30
|
+
export declare class AidboxClient<TBundle = Bundle, TOperationOutcome = OperationOutcome, TUser = User> {
|
|
31
|
+
#private;
|
|
32
|
+
baseUrl: string;
|
|
33
|
+
authProvider: AuthProvider;
|
|
34
|
+
constructor(baseUrl: string, authProvider: AuthProvider);
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* Read the current state of the resource
|
|
38
|
+
*
|
|
39
|
+
* The interaction is performed by an HTTP GET command as shown:
|
|
40
|
+
*
|
|
41
|
+
* ```
|
|
42
|
+
* GET [base]/[type]/[id] {?_format=[mime-type]}
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* FHIR Reference: https://hl7.org/fhir/http.html#read
|
|
46
|
+
*
|
|
47
|
+
* Example usage:
|
|
48
|
+
*
|
|
49
|
+
* ```typescript
|
|
50
|
+
* const patient = await client.read<Patient>({
|
|
51
|
+
* type: "Patient",
|
|
52
|
+
* id: "patient-id",
|
|
53
|
+
* });
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @group Instance Level Interactions
|
|
57
|
+
*/
|
|
58
|
+
read<T>(opts: ReadOptions): Promise<Result<ResourceResponse<T>, ResourceResponse<TOperationOutcome>>>;
|
|
59
|
+
/**
|
|
60
|
+
* Read the state of a specific version of the resource
|
|
61
|
+
*
|
|
62
|
+
* The interaction is performed by an HTTP GET command as shown:
|
|
63
|
+
*
|
|
64
|
+
* ```
|
|
65
|
+
* GET [base]/[type]/[id]/_history/[vid] {?_format=[mime-type]}
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* FHIR Reference: https://hl7.org/fhir/http.html#vread
|
|
69
|
+
*
|
|
70
|
+
* Example usage:
|
|
71
|
+
*
|
|
72
|
+
* ```typescript
|
|
73
|
+
* const patient = await client.vread<Patient>({
|
|
74
|
+
* type: "Patient",
|
|
75
|
+
* id: "patient-id",
|
|
76
|
+
* vid: "version-id",
|
|
77
|
+
* });
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* @group Instance Level Interactions
|
|
81
|
+
*/
|
|
82
|
+
vread<T>(opts: VReadOptions): Promise<Result<ResourceResponse<T>, ResourceResponse<TOperationOutcome>>>;
|
|
83
|
+
/**
|
|
84
|
+
* Search the resource type based on some filter criteria.
|
|
85
|
+
*
|
|
86
|
+
* The interaction is performed by an HTTP GET command as shown:
|
|
87
|
+
*
|
|
88
|
+
* ```
|
|
89
|
+
* GET [base]/[resource-type]/?param1=value&...{&_format=[mime-type]}
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* FHIR Reference: https://hl7.org/fhir/http.html#search-get
|
|
93
|
+
*
|
|
94
|
+
* Example usage:
|
|
95
|
+
*
|
|
96
|
+
* ```typescript
|
|
97
|
+
* const searchset: Bundle = await client.searchType({
|
|
98
|
+
* type: "Patient",
|
|
99
|
+
* query: [["family", "Unknown"]],
|
|
100
|
+
* });
|
|
101
|
+
* ```
|
|
102
|
+
*
|
|
103
|
+
* @group Type Level Interactions
|
|
104
|
+
*/
|
|
105
|
+
searchType(opts: SearchTypeOptions): Promise<Result<ResourceResponse<TBundle>, ResourceResponse<TOperationOutcome>>>;
|
|
106
|
+
/**
|
|
107
|
+
* Search the system based on some filter criteria.
|
|
108
|
+
*
|
|
109
|
+
* The interaction is performed by an HTTP GET command as shown:
|
|
110
|
+
*
|
|
111
|
+
* ```
|
|
112
|
+
* GET [base]?param1=value&...{&_format=[mime-type]}
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* FHIR Reference: https://hl7.org/fhir/http.html#search-get
|
|
116
|
+
*
|
|
117
|
+
* Example usage:
|
|
118
|
+
*
|
|
119
|
+
* ```typescript
|
|
120
|
+
* const searchset: Bundle = await client.searchSystem({
|
|
121
|
+
* query: [["family", "Unknown"]]
|
|
122
|
+
* });
|
|
123
|
+
* ```
|
|
124
|
+
*
|
|
125
|
+
* @group Whole System Interactions
|
|
126
|
+
*/
|
|
127
|
+
searchSystem(opts: SearchSystemOptions): Promise<Result<ResourceResponse<TBundle>, ResourceResponse<TOperationOutcome>>>;
|
|
128
|
+
/**
|
|
129
|
+
* Search the resource type across the compartment based on some filter criteria.
|
|
130
|
+
*
|
|
131
|
+
* The interaction is performed by an HTTP GET command as shown:
|
|
132
|
+
*
|
|
133
|
+
* ```
|
|
134
|
+
* GET [base]/[compartment-type]/[compartment-id]/[resource-type]?param1=value&...{&_format=[mime-type]}
|
|
135
|
+
* ```
|
|
136
|
+
*
|
|
137
|
+
* FHIR Reference: https://hl7.org/fhir/http.html#search-get
|
|
138
|
+
*
|
|
139
|
+
* Example usage:
|
|
140
|
+
*
|
|
141
|
+
* ```typescript
|
|
142
|
+
* const result: Bundle = await client.searchCompartment({
|
|
143
|
+
* compartment: "Patient",
|
|
144
|
+
* compartmentId: "patient-id",
|
|
145
|
+
* type: "Observation",
|
|
146
|
+
* query: [["status", "final"]],
|
|
147
|
+
* });
|
|
148
|
+
* ```
|
|
149
|
+
*
|
|
150
|
+
* @group Compartment Interactions
|
|
151
|
+
*/
|
|
152
|
+
searchCompartment(opts: SearchCompartmentOptions): Promise<Result<ResourceResponse<TBundle>, ResourceResponse<TOperationOutcome>>>;
|
|
153
|
+
/**
|
|
154
|
+
* Create a new resource with a server assigned id.
|
|
155
|
+
*
|
|
156
|
+
* The `create` interaction is performed by an HTTP POST command as shown:
|
|
157
|
+
*
|
|
158
|
+
* ```
|
|
159
|
+
* POST [base]/[type] {?_format=[mime-type]}
|
|
160
|
+
* ```
|
|
161
|
+
*
|
|
162
|
+
* FHIR Reference: https://hl7.org/fhir/http.html#create
|
|
163
|
+
*
|
|
164
|
+
* Example usage:
|
|
165
|
+
*
|
|
166
|
+
* ```typescript
|
|
167
|
+
* const patient = await client.create<Patient>({
|
|
168
|
+
* type: "Patient",
|
|
169
|
+
* resource: {
|
|
170
|
+
* id: "patient-id",
|
|
171
|
+
* name: [{
|
|
172
|
+
* family: "Test",
|
|
173
|
+
* given: ["Patient"],
|
|
174
|
+
* }],
|
|
175
|
+
* },
|
|
176
|
+
* });
|
|
177
|
+
* ```
|
|
178
|
+
*
|
|
179
|
+
* @group Type Level Interactions
|
|
180
|
+
*/
|
|
181
|
+
create<T>(opts: CreateOptions<T>): Promise<Result<ResourceResponse<T>, ResourceResponse<TOperationOutcome>>>;
|
|
182
|
+
/**
|
|
183
|
+
* The conditional create interaction allows a client to create a new resource only if some equivalent resource does not already exist on the server.
|
|
184
|
+
* The client defines what equivalence means in this case by supplying a FHIR search query using an HL7 defined extension header `If-None-Exist`.
|
|
185
|
+
*
|
|
186
|
+
* The conditional `create` interaction is performed by an HTTP POST command as shown:
|
|
187
|
+
*
|
|
188
|
+
* ```
|
|
189
|
+
* POST [base]/[type]?param1=value&...{&_format=[mime-type]}
|
|
190
|
+
* ```
|
|
191
|
+
*
|
|
192
|
+
* FHIR Reference: https://hl7.org/fhir/http.html#ccreate
|
|
193
|
+
*
|
|
194
|
+
* @group Type Level Interactions
|
|
195
|
+
*/
|
|
196
|
+
conditionalCreate<T>(opts: ConditionalCreateOptions<T>): Promise<Result<ResourceResponse<T>, ResourceResponse<TOperationOutcome>>>;
|
|
197
|
+
/**
|
|
198
|
+
* Update an existing resource by its id (or create it if it is new)
|
|
199
|
+
*
|
|
200
|
+
* The `update` interaction is performed by an HTTP PUT command as shown:
|
|
201
|
+
*
|
|
202
|
+
* ```
|
|
203
|
+
* PUT [base]/[type]/[id] {?_format=[mime-type]}
|
|
204
|
+
* ```
|
|
205
|
+
*
|
|
206
|
+
* FHIR Reference: https://hl7.org/fhir/http.html#update
|
|
207
|
+
*
|
|
208
|
+
* Example usage:
|
|
209
|
+
*
|
|
210
|
+
* ```typescript
|
|
211
|
+
* const result = await client.update<Patient>({
|
|
212
|
+
* type: "Patient",
|
|
213
|
+
* id: patientId,
|
|
214
|
+
* resource: {
|
|
215
|
+
* resourceType: "Patient",
|
|
216
|
+
* name: [{
|
|
217
|
+
* family: "Smith",
|
|
218
|
+
* given: ["John"],
|
|
219
|
+
* }],
|
|
220
|
+
* },
|
|
221
|
+
* });
|
|
222
|
+
* ```
|
|
223
|
+
*
|
|
224
|
+
* @group Instance Level Interactions
|
|
225
|
+
*/
|
|
226
|
+
update<T>(opts: UpdateOptions<T>): Promise<Result<ResourceResponse<T>, ResourceResponse<TOperationOutcome>>>;
|
|
227
|
+
/**
|
|
228
|
+
* Conditional Update allows a client to update an existing resource based on some identification criteria, rather than by logical id.
|
|
229
|
+
*
|
|
230
|
+
* The conditional `update` interaction is performed by an HTTP PUT command as shown:
|
|
231
|
+
*
|
|
232
|
+
* ```
|
|
233
|
+
* PUT [base]/[type]?[search parameters]
|
|
234
|
+
* ```
|
|
235
|
+
*
|
|
236
|
+
* FHIR Reference: https://hl7.org/fhir/http.html#cond-update
|
|
237
|
+
*
|
|
238
|
+
* @group Instance Level Interactions
|
|
239
|
+
*/
|
|
240
|
+
conditionalUpdate<T>(opts: ConditionalUpdateOptions<T>): Promise<Result<ResourceResponse<T>, ResourceResponse<TOperationOutcome>>>;
|
|
241
|
+
/**
|
|
242
|
+
* Update an existing resource by posting a set of changes to it.
|
|
243
|
+
*
|
|
244
|
+
* The `patch` interaction is performed by an HTTP PATCH command as shown:
|
|
245
|
+
*
|
|
246
|
+
* ```
|
|
247
|
+
* PATCH [base]/[type]/[id] {?_format=[mime-type]}
|
|
248
|
+
* ```
|
|
249
|
+
*
|
|
250
|
+
* The body of a PATCH interaction is a JSON Patch icon document with a content type of `application/json-patch+json`.
|
|
251
|
+
*
|
|
252
|
+
* FHIR Reference: https://hl7.org/fhir/http.html#patch
|
|
253
|
+
*
|
|
254
|
+
* @group Instance Level Interactions
|
|
255
|
+
*/
|
|
256
|
+
patch<T>(opts: PatchOptions): Promise<Result<ResourceResponse<T>, ResourceResponse<TOperationOutcome>>>;
|
|
257
|
+
/**
|
|
258
|
+
* Conditional Patch performs a search using the standard search facilities for the resource type, with the goal of resolving a single logical id for this request.
|
|
259
|
+
* The action it takes depends on how many matches are found.
|
|
260
|
+
*
|
|
261
|
+
* The conditional `patch` interaction is performed by an HTTP PATCH command as shown:
|
|
262
|
+
*
|
|
263
|
+
* ```
|
|
264
|
+
* PATCH [base]/[type]?param1=value&...{&_format=[mime-type]}
|
|
265
|
+
* ```
|
|
266
|
+
*
|
|
267
|
+
* The body of a PATCH interaction is a JSON Patch icon document with a content type of `application/json-patch+json`.
|
|
268
|
+
*
|
|
269
|
+
* FHIR Reference: https://hl7.org/fhir/http.html#cond-patch
|
|
270
|
+
*
|
|
271
|
+
* @group Instance Level Interactions
|
|
272
|
+
*/
|
|
273
|
+
conditionalPatch<T>(opts: ConditionalPatchOptions): Promise<Result<ResourceResponse<T>, ResourceResponse<TOperationOutcome>>>;
|
|
274
|
+
/**
|
|
275
|
+
* Delete a resource.
|
|
276
|
+
*
|
|
277
|
+
* The interaction is performed by an HTTP DELETE command as shown:
|
|
278
|
+
*
|
|
279
|
+
* ```
|
|
280
|
+
* DELETE [base]/[type]/[id]
|
|
281
|
+
* ```
|
|
282
|
+
*
|
|
283
|
+
* FHIR Reference: https://hl7.org/fhir/http.html#delete
|
|
284
|
+
*
|
|
285
|
+
* Example usage:
|
|
286
|
+
*
|
|
287
|
+
* ```typescript
|
|
288
|
+
* const patient = await client.delete<Patient>({
|
|
289
|
+
* type: "Patient",
|
|
290
|
+
* id: "patient-id",
|
|
291
|
+
* });
|
|
292
|
+
* ```
|
|
293
|
+
*
|
|
294
|
+
* @group Instance Level Interactions
|
|
295
|
+
*/
|
|
296
|
+
delete<T>(opts: DeleteOptions): Promise<Result<ResourceResponse<T | undefined>, ResourceResponse<TOperationOutcome>>>;
|
|
297
|
+
/**
|
|
298
|
+
* Delete all historical versions of a resource.
|
|
299
|
+
*
|
|
300
|
+
* The interaction is performed by an HTTP DELETE command as shown:
|
|
301
|
+
*
|
|
302
|
+
* ```
|
|
303
|
+
* DELETE [base]/[type]/[id]/_history
|
|
304
|
+
* ```
|
|
305
|
+
*
|
|
306
|
+
* FHIR Reference: https://build.fhir.org/http.html#delete-history
|
|
307
|
+
*
|
|
308
|
+
* @group Instance Level Interactions
|
|
309
|
+
*/
|
|
310
|
+
deleteHistory<T>(opts: DeleteOptions): Promise<Result<ResourceResponse<T>, ResourceResponse<TOperationOutcome>>>;
|
|
311
|
+
/**
|
|
312
|
+
* Delete a specific version of a resource.
|
|
313
|
+
*
|
|
314
|
+
* The interaction is performed by an HTTP DELETE command as shown:
|
|
315
|
+
*
|
|
316
|
+
* ```
|
|
317
|
+
* DELETE [base]/[type]/[id]/_history/[vid]
|
|
318
|
+
* ```
|
|
319
|
+
*
|
|
320
|
+
* FHIR Reference: https://build.fhir.org/http.html#delete-history-version
|
|
321
|
+
*
|
|
322
|
+
* @group Instance Level Interactions
|
|
323
|
+
*/
|
|
324
|
+
deleteHistoryVersion<T>(opts: DeleteHistoryVersionOptions): Promise<Result<ResourceResponse<T>, ResourceResponse<TOperationOutcome>>>;
|
|
325
|
+
/**
|
|
326
|
+
* Conditional Delete across all resource types based on some filter criteria
|
|
327
|
+
*
|
|
328
|
+
* If type is provided, performs conditional delete across a particular resource type based on some filter criteria.
|
|
329
|
+
*
|
|
330
|
+
* To accomplish this, the client issues an HTTP DELETE as shown:
|
|
331
|
+
*
|
|
332
|
+
* ```
|
|
333
|
+
* DELETE [base]/[type]?[search parameters]
|
|
334
|
+
* DELETE [base]?[search parameters]
|
|
335
|
+
* ```
|
|
336
|
+
*
|
|
337
|
+
* FHIR Reference: https://hl7.org/fhir/http.html#cdelete
|
|
338
|
+
*
|
|
339
|
+
* @group Type Level Interactions
|
|
340
|
+
* @group Whole System Interactions
|
|
341
|
+
*/
|
|
342
|
+
conditionalDelete<T>(opts: ConditionalDeleteOptions): Promise<Result<ResourceResponse<T>, ResourceResponse<TOperationOutcome>>>;
|
|
343
|
+
/**
|
|
344
|
+
* Retrieve the change history for a particular resource.
|
|
345
|
+
*
|
|
346
|
+
* The interaction is performed by an HTTP GET command as shown:
|
|
347
|
+
*
|
|
348
|
+
* ```
|
|
349
|
+
* GET [base]/[type]/[id]/_history{?[parameters]&_format=[mime-type]}
|
|
350
|
+
* ```
|
|
351
|
+
*
|
|
352
|
+
* FHIR Reference: https://hl7.org/fhir/http.html#history
|
|
353
|
+
*
|
|
354
|
+
* @group Instance Level Interactions
|
|
355
|
+
*/
|
|
356
|
+
historyInstance(opts: HistoryInstanceOptions): Promise<Result<ResourceResponse<TBundle>, ResourceResponse<TOperationOutcome>>>;
|
|
357
|
+
/**
|
|
358
|
+
* Retrieve the change history for a particular resource type.
|
|
359
|
+
*
|
|
360
|
+
* The interaction is performed by an HTTP GET command as shown:
|
|
361
|
+
*
|
|
362
|
+
* ```
|
|
363
|
+
* GET [base]/[type]/_history{?[parameters]&_format=[mime-type]}
|
|
364
|
+
* ```
|
|
365
|
+
*
|
|
366
|
+
* FHIR Reference: https://hl7.org/fhir/http.html#history
|
|
367
|
+
*
|
|
368
|
+
* @group Whole System Interactions
|
|
369
|
+
*/
|
|
370
|
+
historySystem(_: HistorySystemOptions): Promise<Result<ResourceResponse<TBundle>, ResourceResponse<TOperationOutcome>>>;
|
|
371
|
+
/**
|
|
372
|
+
* Retrieve the change history for all resources.
|
|
373
|
+
*
|
|
374
|
+
* The interaction is performed by an HTTP GET command as shown:
|
|
375
|
+
*
|
|
376
|
+
* ```
|
|
377
|
+
* GET [base]/_history{?[parameters]&_format=[mime-type]}
|
|
378
|
+
* ```
|
|
379
|
+
*
|
|
380
|
+
* FHIR Reference: https://hl7.org/fhir/http.html#history
|
|
381
|
+
*
|
|
382
|
+
* @group Type Level Interactions
|
|
383
|
+
*/
|
|
384
|
+
historyType(opts: HistoryTypeOptions): Promise<Result<ResourceResponse<TBundle>, ResourceResponse<TOperationOutcome>>>;
|
|
385
|
+
/**
|
|
386
|
+
* Get a capability statement for the system.
|
|
387
|
+
*
|
|
388
|
+
* The interaction is performed by an HTTP GET command as shown:
|
|
389
|
+
*
|
|
390
|
+
* ```
|
|
391
|
+
* GET [base]/metadata{?mode=[mode]} {&_format=[mime-type]}
|
|
392
|
+
* ```
|
|
393
|
+
*
|
|
394
|
+
* The `mode` can be:
|
|
395
|
+
*
|
|
396
|
+
* | Mode | Description |
|
|
397
|
+
* |---------------|------------------------------------------------------------------------------------------------------------------------------|
|
|
398
|
+
* | `full` | A `CapabilityStatement` that specifies which resource types and interactions are supported |
|
|
399
|
+
* | `normative` | As above, but only the normative portions of the Capability Statement |
|
|
400
|
+
* | `terminology` | A `TerminologyCapabilities` resource that provides further information about terminologies which are supported by the server |
|
|
401
|
+
*
|
|
402
|
+
* FHIR Reference: https://hl7.org/fhir/http.html#capabilities
|
|
403
|
+
*
|
|
404
|
+
* @group Whole System Interactions
|
|
405
|
+
*/
|
|
406
|
+
capabilities(opts: CapabilitiesOptions): Promise<Result<ResourceResponse<unknown>, ResourceResponse<TOperationOutcome>>>;
|
|
407
|
+
/**
|
|
408
|
+
* Perform multiple operations in a batch request (e.g. create, read, update, delete, patch, and/or [extended operations])
|
|
409
|
+
*
|
|
410
|
+
* A batch interaction is performed by an HTTP POST command as shown:
|
|
411
|
+
*
|
|
412
|
+
* ```
|
|
413
|
+
* POST [base] {?_format=[mime-type]}
|
|
414
|
+
* ```
|
|
415
|
+
*
|
|
416
|
+
* FHIR Reference: https://hl7.org/fhir/http.html#transaction
|
|
417
|
+
*
|
|
418
|
+
* @group Whole System Interactions
|
|
419
|
+
*/
|
|
420
|
+
batch(opts: BatchOptions<TBundle>): Promise<Result<ResourceResponse<unknown>, ResourceResponse<TOperationOutcome>>>;
|
|
421
|
+
/**
|
|
422
|
+
* Perform multiple operations as a transaction (e.g. create, read, update, delete, patch, and/or [extended operations])
|
|
423
|
+
*
|
|
424
|
+
* A transaction interaction is performed by an HTTP POST command as shown:
|
|
425
|
+
*
|
|
426
|
+
* ```
|
|
427
|
+
* POST [base] {?_format=[mime-type]}
|
|
428
|
+
* ```
|
|
429
|
+
*
|
|
430
|
+
* FHIR Reference: https://hl7.org/fhir/http.html#transaction
|
|
431
|
+
*
|
|
432
|
+
* @group Whole System Interactions
|
|
433
|
+
*/
|
|
434
|
+
transaction(opts: TransactionOptions<TBundle>): Promise<Result<ResourceResponse<unknown>, ResourceResponse<TOperationOutcome>>>;
|
|
435
|
+
/**
|
|
436
|
+
* Perform an operation as defined by an `OperationDefinition`.
|
|
437
|
+
*
|
|
438
|
+
* The interaction is performed by an HTTP POST command as shown:
|
|
439
|
+
*
|
|
440
|
+
* ```
|
|
441
|
+
* POST [base]/[type]/[operation] {?_format=[mime-type]}
|
|
442
|
+
* POST [base]/[type]/[id]/[operation] {?_format=[mime-type]}
|
|
443
|
+
* ```
|
|
444
|
+
*
|
|
445
|
+
* FHIR Reference: https://hl7.org/fhir/operations.html
|
|
446
|
+
*
|
|
447
|
+
* @group Operations
|
|
448
|
+
*/
|
|
449
|
+
operation<TResource, TResult>(opts: OperationOptions<TResource>): Promise<Result<ResourceResponse<TResult>, ResourceResponse<TOperationOutcome>>>;
|
|
450
|
+
/**
|
|
451
|
+
* Perform the Validate Operation.
|
|
452
|
+
*
|
|
453
|
+
* The interaction is performed by an HTTP POST command as shown:
|
|
454
|
+
*
|
|
455
|
+
* ```
|
|
456
|
+
* [base]/[type]/$validate
|
|
457
|
+
* [base]/[type]/[id]/$validate
|
|
458
|
+
* ```
|
|
459
|
+
*
|
|
460
|
+
* FHIR Reference: https://hl7.org/fhir/operation-resource-validate.html
|
|
461
|
+
*
|
|
462
|
+
* @group Operations
|
|
463
|
+
*/
|
|
464
|
+
validate<T>(opts: ValidateOptions<T>): Promise<Result<ResourceResponse<TOperationOutcome>, ResourceResponse<TOperationOutcome>>>;
|
|
465
|
+
/**
|
|
466
|
+
* Performs a request to `/auth/userinfo`.
|
|
467
|
+
*
|
|
468
|
+
* @group Aidbox methods
|
|
469
|
+
*/
|
|
470
|
+
userinfo(): Promise<TUser>;
|
|
471
|
+
/**
|
|
472
|
+
* Performs a request to `/auth/logout`.
|
|
473
|
+
*
|
|
474
|
+
* @group Aidbox methods
|
|
475
|
+
*/
|
|
476
|
+
logout(): Promise<Response>;
|
|
477
|
+
/**
|
|
478
|
+
* Typed request
|
|
479
|
+
*
|
|
480
|
+
* Example usage:
|
|
481
|
+
*
|
|
482
|
+
* ```typescript
|
|
483
|
+
* const result = client.request<Patient>({
|
|
484
|
+
* method: "GET",
|
|
485
|
+
* url: "/fhir/Patient/pt-1",
|
|
486
|
+
* })
|
|
487
|
+
*
|
|
488
|
+
* if (isOk(result)) {
|
|
489
|
+
* const { value } = result;
|
|
490
|
+
* // work with value as a Patient type
|
|
491
|
+
* } else {
|
|
492
|
+
* const { error } = result;
|
|
493
|
+
* // work with error as an OperationOutcome type.
|
|
494
|
+
* }
|
|
495
|
+
* ```
|
|
496
|
+
*
|
|
497
|
+
* @group Client methods
|
|
498
|
+
*/
|
|
499
|
+
request<T>(params: RequestParams): Promise<Result<ResourceResponse<T>, ResourceResponse<TOperationOutcome>>>;
|
|
500
|
+
/**
|
|
501
|
+
* Untyped request.
|
|
502
|
+
*
|
|
503
|
+
* Example usage:
|
|
504
|
+
*
|
|
505
|
+
* ```typescript
|
|
506
|
+
* const result = client.rawRequest({
|
|
507
|
+
* method: "GET",
|
|
508
|
+
* url: "/fhir/Patient/pt-1",
|
|
509
|
+
* })
|
|
510
|
+
* ```
|
|
511
|
+
*
|
|
512
|
+
* @group Client methods
|
|
513
|
+
*/
|
|
514
|
+
rawRequest(requestParams: RequestParams): Promise<ResponseWithMeta>;
|
|
515
|
+
/**
|
|
516
|
+
* Obtain server's base URL.
|
|
517
|
+
*
|
|
518
|
+
* @group Client methods
|
|
519
|
+
*/
|
|
520
|
+
getBaseUrl(): string;
|
|
521
|
+
}
|
|
25
522
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/src/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,KAAK,EACX,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EACxB,aAAa,EACb,2BAA2B,EAC3B,aAAa,EACb,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,wBAAwB,EACxB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,IAAI,EACJ,eAAe,EACf,YAAY,EACZ,MAAM,SAAS,CAAC;AA2BjB;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,YAAY,CACxB,OAAO,GAAG,MAAM,EAChB,iBAAiB,GAAG,gBAAgB,EACpC,KAAK,GAAG,IAAI;;IAEL,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,YAAY,CAAC;gBAEtB,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY;I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