@medplum/core 2.1.9 → 2.1.10
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/api-extractor.json +3 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types.d.ts +4181 -0
- package/package.json +4 -4
- package/dist/types/access.d.ts +0 -77
- package/dist/types/base-schema.d.ts +0 -7
- package/dist/types/base64.d.ts +0 -14
- package/dist/types/bundle.d.ts +0 -32
- package/dist/types/cache.d.ts +0 -36
- package/dist/types/client.d.ts +0 -1728
- package/dist/types/config.d.ts +0 -127
- package/dist/types/constants.d.ts +0 -6
- package/dist/types/contenttype.d.ts +0 -18
- package/dist/types/crypto.d.ts +0 -19
- package/dist/types/eventtarget.d.ts +0 -18
- package/dist/types/fhircast/index.d.ts +0 -115
- package/dist/types/fhircast/test-utils.d.ts +0 -2
- package/dist/types/fhirlexer/parse.d.ts +0 -55
- package/dist/types/fhirlexer/tokenize.d.ts +0 -45
- package/dist/types/fhirmapper/parse.d.ts +0 -7
- package/dist/types/fhirmapper/tokenize.d.ts +0 -2
- package/dist/types/fhirpath/atoms.d.ts +0 -139
- package/dist/types/fhirpath/date.d.ts +0 -1
- package/dist/types/fhirpath/functions.d.ts +0 -4
- package/dist/types/fhirpath/parse.d.ts +0 -65
- package/dist/types/fhirpath/tokenize.d.ts +0 -4
- package/dist/types/fhirpath/utils.d.ts +0 -96
- package/dist/types/filter/parse.d.ts +0 -7
- package/dist/types/filter/tokenize.d.ts +0 -2
- package/dist/types/filter/types.d.ts +0 -32
- package/dist/types/format.d.ts +0 -120
- package/dist/types/hl7.d.ts +0 -242
- package/dist/types/index.d.ts +0 -34
- package/dist/types/jwt.d.ts +0 -18
- package/dist/types/outcomes.d.ts +0 -58
- package/dist/types/readablepromise.d.ts +0 -51
- package/dist/types/schema.d.ts +0 -43
- package/dist/types/search/details.d.ts +0 -37
- package/dist/types/search/match.d.ts +0 -9
- package/dist/types/search/search.d.ts +0 -102
- package/dist/types/sftp.d.ts +0 -9
- package/dist/types/storage.d.ts +0 -55
- package/dist/types/types.d.ts +0 -203
- package/dist/types/typeschema/crawler.d.ts +0 -12
- package/dist/types/typeschema/types.d.ts +0 -92
- package/dist/types/typeschema/validation.d.ts +0 -25
- package/dist/types/utils.d.ts +0 -326
package/dist/types/client.d.ts
DELETED
|
@@ -1,1728 +0,0 @@
|
|
|
1
|
-
import { AccessPolicy, Agent, Attachment, Binary, BulkDataExport, Bundle, Communication, Device, ExtractResource, Identifier, Media, OperationOutcome, Project, ProjectMembership, ProjectMembershipAccess, ProjectSecret, Reference, Resource, ResourceType, UserConfiguration, ValueSet } from '@medplum/fhirtypes';
|
|
2
|
-
/** @ts-ignore */
|
|
3
|
-
import type { CustomTableLayout, TDocumentDefinitions, TFontDictionary } from 'pdfmake/interfaces';
|
|
4
|
-
import { EventTarget } from './eventtarget';
|
|
5
|
-
import { FhircastConnection, FhircastEventContext, FhircastEventName, SubscriptionRequest } from './fhircast';
|
|
6
|
-
import { Hl7Message } from './hl7';
|
|
7
|
-
import { ReadablePromise } from './readablepromise';
|
|
8
|
-
import { ClientStorage } from './storage';
|
|
9
|
-
import { CodeChallengeMethod, ProfileResource } from './utils';
|
|
10
|
-
export declare const MEDPLUM_VERSION: string;
|
|
11
|
-
export declare const DEFAULT_ACCEPT: string;
|
|
12
|
-
/**
|
|
13
|
-
* The MedplumClientOptions interface defines configuration options for MedplumClient.
|
|
14
|
-
*
|
|
15
|
-
* All configuration settings are optional.
|
|
16
|
-
*/
|
|
17
|
-
export interface MedplumClientOptions {
|
|
18
|
-
/**
|
|
19
|
-
* Base server URL.
|
|
20
|
-
*
|
|
21
|
-
* Default value is https://api.medplum.com/
|
|
22
|
-
*
|
|
23
|
-
* Use this to point to a custom Medplum deployment.
|
|
24
|
-
*/
|
|
25
|
-
baseUrl?: string;
|
|
26
|
-
/**
|
|
27
|
-
* OAuth2 authorize URL.
|
|
28
|
-
*
|
|
29
|
-
* Default value is baseUrl + "/oauth2/authorize".
|
|
30
|
-
*
|
|
31
|
-
* Can be specified as absolute URL or relative to baseUrl.
|
|
32
|
-
*
|
|
33
|
-
* Use this if you want to use a separate OAuth server.
|
|
34
|
-
*/
|
|
35
|
-
authorizeUrl?: string;
|
|
36
|
-
/**
|
|
37
|
-
* FHIR URL path.
|
|
38
|
-
*
|
|
39
|
-
* Default value is "fhir/R4/".
|
|
40
|
-
*
|
|
41
|
-
* Can be specified as absolute URL or relative to baseUrl.
|
|
42
|
-
*
|
|
43
|
-
* Use this if you want to use a different path when connecting to a FHIR server.
|
|
44
|
-
*/
|
|
45
|
-
fhirUrlPath?: string;
|
|
46
|
-
/**
|
|
47
|
-
* OAuth2 token URL.
|
|
48
|
-
*
|
|
49
|
-
* Default value is baseUrl + "/oauth2/token".
|
|
50
|
-
*
|
|
51
|
-
* Can be specified as absolute URL or relative to baseUrl.
|
|
52
|
-
*
|
|
53
|
-
* Use this if you want to use a separate OAuth server.
|
|
54
|
-
*/
|
|
55
|
-
tokenUrl?: string;
|
|
56
|
-
/**
|
|
57
|
-
* OAuth2 logout URL.
|
|
58
|
-
*
|
|
59
|
-
* Default value is baseUrl + "/oauth2/logout".
|
|
60
|
-
*
|
|
61
|
-
* Can be specified as absolute URL or relative to baseUrl.
|
|
62
|
-
*
|
|
63
|
-
* Use this if you want to use a separate OAuth server.
|
|
64
|
-
*/
|
|
65
|
-
logoutUrl?: string;
|
|
66
|
-
/**
|
|
67
|
-
* The client ID.
|
|
68
|
-
*
|
|
69
|
-
* Client ID can be used for SMART-on-FHIR customization.
|
|
70
|
-
*/
|
|
71
|
-
clientId?: string;
|
|
72
|
-
/**
|
|
73
|
-
* The client secret.
|
|
74
|
-
*
|
|
75
|
-
* Client secret can be used for FHIR Oauth Client Credential flows
|
|
76
|
-
*/
|
|
77
|
-
clientSecret?: string;
|
|
78
|
-
/**
|
|
79
|
-
* The OAuth Access Token.
|
|
80
|
-
*
|
|
81
|
-
* Access Token used to connect to make request to FHIR servers
|
|
82
|
-
*/
|
|
83
|
-
accessToken?: string;
|
|
84
|
-
/**
|
|
85
|
-
* Number of resources to store in the cache.
|
|
86
|
-
*
|
|
87
|
-
* Default value is 1000.
|
|
88
|
-
*
|
|
89
|
-
* Consider using this for performance of displaying Patient or Practitioner resources.
|
|
90
|
-
*/
|
|
91
|
-
resourceCacheSize?: number;
|
|
92
|
-
/**
|
|
93
|
-
* The length of time in milliseconds to cache resources.
|
|
94
|
-
*
|
|
95
|
-
* Default value is 10000 (10 seconds).
|
|
96
|
-
*
|
|
97
|
-
* Cache time of zero disables all caching.
|
|
98
|
-
*
|
|
99
|
-
* For any individual request, the cache behavior can be overridden by setting the cache property on request options.
|
|
100
|
-
*
|
|
101
|
-
* See: https://developer.mozilla.org/en-US/docs/Web/API/Request/cache
|
|
102
|
-
*/
|
|
103
|
-
cacheTime?: number;
|
|
104
|
-
/**
|
|
105
|
-
* The length of time in milliseconds to delay requests for auto batching.
|
|
106
|
-
*
|
|
107
|
-
* Auto batching attempts to group multiple requests together into a single batch request.
|
|
108
|
-
*
|
|
109
|
-
* Default value is 0, which disables auto batching.
|
|
110
|
-
*/
|
|
111
|
-
autoBatchTime?: number;
|
|
112
|
-
/**
|
|
113
|
-
* Fetch implementation.
|
|
114
|
-
*
|
|
115
|
-
* Default is window.fetch (if available).
|
|
116
|
-
*
|
|
117
|
-
* For Node.js applications, consider the 'node-fetch' package.
|
|
118
|
-
*/
|
|
119
|
-
fetch?: FetchLike;
|
|
120
|
-
/**
|
|
121
|
-
* Storage implementation.
|
|
122
|
-
*
|
|
123
|
-
* Default is window.localStorage (if available), this is the common implementation for use in the browser, or an in-memory storage implementation. If using Medplum on a server it may be useful to provide a custom storage implementation, for example using redis, a database or a file based storage. Medplum CLI is an an example of `FileSystemStorage`, for reference.
|
|
124
|
-
*/
|
|
125
|
-
storage?: ClientStorage;
|
|
126
|
-
/**
|
|
127
|
-
* Create PDF implementation.
|
|
128
|
-
*
|
|
129
|
-
* Default is none, and PDF generation is disabled.
|
|
130
|
-
*
|
|
131
|
-
* In browser environments, import the client-side pdfmake library.
|
|
132
|
-
*
|
|
133
|
-
* ```html
|
|
134
|
-
* <script src="pdfmake.min.js"></script>
|
|
135
|
-
* <script>
|
|
136
|
-
* async function createPdf(docDefinition, tableLayouts, fonts) {
|
|
137
|
-
* return new Promise((resolve) => {
|
|
138
|
-
* pdfMake.createPdf(docDefinition, tableLayouts, fonts).getBlob(resolve);
|
|
139
|
-
* });
|
|
140
|
-
* }
|
|
141
|
-
* </script>
|
|
142
|
-
* ```
|
|
143
|
-
*
|
|
144
|
-
* In Node.js applications:
|
|
145
|
-
*
|
|
146
|
-
* ```ts
|
|
147
|
-
* import type { CustomTableLayout, TDocumentDefinitions, TFontDictionary } from 'pdfmake/interfaces';
|
|
148
|
-
* function createPdf(
|
|
149
|
-
* docDefinition: TDocumentDefinitions,
|
|
150
|
-
* tableLayouts?: { [name: string]: CustomTableLayout },
|
|
151
|
-
* fonts?: TFontDictionary
|
|
152
|
-
* ): Promise<Buffer> {
|
|
153
|
-
* return new Promise((resolve, reject) => {
|
|
154
|
-
* const printer = new PdfPrinter(fonts ?? {});
|
|
155
|
-
* const pdfDoc = printer.createPdfKitDocument(docDefinition, { tableLayouts });
|
|
156
|
-
* const chunks: Uint8Array[] = [];
|
|
157
|
-
* pdfDoc.on('data', (chunk: Uint8Array) => chunks.push(chunk));
|
|
158
|
-
* pdfDoc.on('end', () => resolve(Buffer.concat(chunks)));
|
|
159
|
-
* pdfDoc.on('error', reject);
|
|
160
|
-
* pdfDoc.end();
|
|
161
|
-
* });
|
|
162
|
-
* }
|
|
163
|
-
* ```
|
|
164
|
-
*/
|
|
165
|
-
createPdf?: CreatePdfFunction;
|
|
166
|
-
/**
|
|
167
|
-
* Callback for when the client is unauthenticated.
|
|
168
|
-
*
|
|
169
|
-
* Default is do nothing.
|
|
170
|
-
*
|
|
171
|
-
* For client side applications, consider redirecting to a sign in page.
|
|
172
|
-
*/
|
|
173
|
-
onUnauthenticated?: () => void;
|
|
174
|
-
/**
|
|
175
|
-
* The default redirect behavior.
|
|
176
|
-
*
|
|
177
|
-
* The default behavior is to not follow redirects.
|
|
178
|
-
*
|
|
179
|
-
* Use "follow" to automatically follow redirects.
|
|
180
|
-
*/
|
|
181
|
-
redirect?: RequestRedirect;
|
|
182
|
-
/**
|
|
183
|
-
* When the verbose flag is set, the client will log all requests and responses to the console.
|
|
184
|
-
*/
|
|
185
|
-
verbose?: boolean;
|
|
186
|
-
}
|
|
187
|
-
export interface FetchLike {
|
|
188
|
-
(url: string, options?: any): Promise<any>;
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* QueryTypes defines the different ways to specify FHIR search parameters.
|
|
192
|
-
*
|
|
193
|
-
* Can be any valid input to the URLSearchParams() constructor.
|
|
194
|
-
*
|
|
195
|
-
* TypeScript definitions for URLSearchParams do not match runtime behavior.
|
|
196
|
-
* The official spec only accepts string values.
|
|
197
|
-
* Web browsers and Node.js automatically coerce values to strings.
|
|
198
|
-
* See: https://github.com/microsoft/TypeScript/issues/32951
|
|
199
|
-
*/
|
|
200
|
-
export type QueryTypes = URLSearchParams | string[][] | Record<string, any> | string | undefined;
|
|
201
|
-
/**
|
|
202
|
-
* ResourceArray is an array of resources with a bundle property.
|
|
203
|
-
* The bundle property is a FHIR Bundle containing the search results.
|
|
204
|
-
* This is useful for retrieving bundle metadata such as total, offset, and next link.
|
|
205
|
-
*/
|
|
206
|
-
export type ResourceArray<T extends Resource = Resource> = T[] & {
|
|
207
|
-
bundle: Bundle<T>;
|
|
208
|
-
};
|
|
209
|
-
export interface CreatePdfFunction {
|
|
210
|
-
(docDefinition: TDocumentDefinitions, tableLayouts?: Record<string, CustomTableLayout> | undefined, fonts?: TFontDictionary | undefined): Promise<any>;
|
|
211
|
-
}
|
|
212
|
-
export interface BaseLoginRequest {
|
|
213
|
-
readonly projectId?: string;
|
|
214
|
-
readonly clientId?: string;
|
|
215
|
-
readonly resourceType?: string;
|
|
216
|
-
readonly scope?: string;
|
|
217
|
-
readonly nonce?: string;
|
|
218
|
-
readonly codeChallenge?: string;
|
|
219
|
-
readonly codeChallengeMethod?: CodeChallengeMethod;
|
|
220
|
-
readonly googleClientId?: string;
|
|
221
|
-
readonly launch?: string;
|
|
222
|
-
readonly redirectUri?: string;
|
|
223
|
-
}
|
|
224
|
-
export interface EmailPasswordLoginRequest extends BaseLoginRequest {
|
|
225
|
-
readonly email: string;
|
|
226
|
-
readonly password: string;
|
|
227
|
-
/** @deprecated Use scope of "offline" or "offline_access" instead. */
|
|
228
|
-
readonly remember?: boolean;
|
|
229
|
-
}
|
|
230
|
-
export interface NewUserRequest {
|
|
231
|
-
readonly firstName: string;
|
|
232
|
-
readonly lastName: string;
|
|
233
|
-
readonly email: string;
|
|
234
|
-
readonly password: string;
|
|
235
|
-
readonly recaptchaToken: string;
|
|
236
|
-
readonly recaptchaSiteKey?: string;
|
|
237
|
-
readonly remember?: boolean;
|
|
238
|
-
readonly projectId?: string;
|
|
239
|
-
readonly clientId?: string;
|
|
240
|
-
}
|
|
241
|
-
export interface NewProjectRequest {
|
|
242
|
-
readonly login: string;
|
|
243
|
-
readonly projectName: string;
|
|
244
|
-
}
|
|
245
|
-
export interface NewPatientRequest {
|
|
246
|
-
readonly login: string;
|
|
247
|
-
readonly projectId: string;
|
|
248
|
-
}
|
|
249
|
-
export interface GoogleCredentialResponse {
|
|
250
|
-
readonly clientId: string;
|
|
251
|
-
readonly credential: string;
|
|
252
|
-
}
|
|
253
|
-
export interface GoogleLoginRequest extends BaseLoginRequest {
|
|
254
|
-
readonly googleClientId: string;
|
|
255
|
-
readonly googleCredential: string;
|
|
256
|
-
readonly createUser?: boolean;
|
|
257
|
-
}
|
|
258
|
-
export interface LoginAuthenticationResponse {
|
|
259
|
-
readonly login: string;
|
|
260
|
-
readonly mfaRequired?: boolean;
|
|
261
|
-
readonly code?: string;
|
|
262
|
-
readonly memberships?: ProjectMembership[];
|
|
263
|
-
}
|
|
264
|
-
export interface LoginProfileResponse {
|
|
265
|
-
readonly login: string;
|
|
266
|
-
readonly scope: string;
|
|
267
|
-
}
|
|
268
|
-
export interface LoginScopeResponse {
|
|
269
|
-
readonly login: string;
|
|
270
|
-
readonly code: string;
|
|
271
|
-
}
|
|
272
|
-
export interface LoginState {
|
|
273
|
-
readonly project: Reference<Project>;
|
|
274
|
-
readonly profile: Reference<ProfileResource>;
|
|
275
|
-
readonly accessToken: string;
|
|
276
|
-
readonly refreshToken: string;
|
|
277
|
-
}
|
|
278
|
-
export interface TokenResponse {
|
|
279
|
-
readonly token_type: string;
|
|
280
|
-
readonly id_token: string;
|
|
281
|
-
readonly access_token: string;
|
|
282
|
-
readonly refresh_token: string;
|
|
283
|
-
readonly expires_in: number;
|
|
284
|
-
readonly project: Reference<Project>;
|
|
285
|
-
readonly profile: Reference<ProfileResource>;
|
|
286
|
-
}
|
|
287
|
-
export interface BotEvent<T = Resource | Hl7Message | string | Record<string, any>> {
|
|
288
|
-
readonly contentType: string;
|
|
289
|
-
readonly input: T;
|
|
290
|
-
readonly secrets: Record<string, ProjectSecret>;
|
|
291
|
-
}
|
|
292
|
-
export interface InviteRequest {
|
|
293
|
-
resourceType: 'Patient' | 'Practitioner' | 'RelatedPerson';
|
|
294
|
-
firstName: string;
|
|
295
|
-
lastName: string;
|
|
296
|
-
email?: string;
|
|
297
|
-
externalId?: string;
|
|
298
|
-
password?: string;
|
|
299
|
-
sendEmail?: boolean;
|
|
300
|
-
membership?: Partial<ProjectMembership>;
|
|
301
|
-
/** @deprecated Use membership.accessPolicy instead. */
|
|
302
|
-
accessPolicy?: Reference<AccessPolicy>;
|
|
303
|
-
/** @deprecated Use membership.access instead. */
|
|
304
|
-
access?: ProjectMembershipAccess[];
|
|
305
|
-
/** @deprecated Use membership.admin instead. */
|
|
306
|
-
admin?: boolean;
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* JSONPatch patch operation.
|
|
310
|
-
* Compatible with fast-json-patch and rfc6902 Operation.
|
|
311
|
-
*/
|
|
312
|
-
export interface PatchOperation {
|
|
313
|
-
readonly op: 'add' | 'remove' | 'replace' | 'copy' | 'move' | 'test';
|
|
314
|
-
readonly path: string;
|
|
315
|
-
readonly value?: any;
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* Source for a FHIR Binary.
|
|
319
|
-
*/
|
|
320
|
-
export type BinarySource = string | File | Blob | Uint8Array;
|
|
321
|
-
/**
|
|
322
|
-
* Email address definition.
|
|
323
|
-
* Compatible with nodemailer Mail.Address.
|
|
324
|
-
*/
|
|
325
|
-
export interface MailAddress {
|
|
326
|
-
readonly name: string;
|
|
327
|
-
readonly address: string;
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* Email destination definition.
|
|
331
|
-
*/
|
|
332
|
-
export type MailDestination = string | MailAddress | string[] | MailAddress[];
|
|
333
|
-
/**
|
|
334
|
-
* Email attachment definition.
|
|
335
|
-
* Compatible with nodemailer Mail.Options.
|
|
336
|
-
*/
|
|
337
|
-
export interface MailAttachment {
|
|
338
|
-
/** String, Buffer or a Stream contents for the attachmentent */
|
|
339
|
-
readonly content?: string;
|
|
340
|
-
/** path to a file or an URL (data uris are allowed as well) if you want to stream the file instead of including it (better for larger attachments) */
|
|
341
|
-
readonly path?: string;
|
|
342
|
-
/** filename to be reported as the name of the attached file, use of unicode is allowed. If you do not want to use a filename, set this value as false, otherwise a filename is generated automatically */
|
|
343
|
-
readonly filename?: string | false;
|
|
344
|
-
/** optional content type for the attachment, if not set will be derived from the filename property */
|
|
345
|
-
readonly contentType?: string;
|
|
346
|
-
}
|
|
347
|
-
/**
|
|
348
|
-
* Email message definition.
|
|
349
|
-
* Compatible with nodemailer Mail.Options.
|
|
350
|
-
*/
|
|
351
|
-
export interface MailOptions {
|
|
352
|
-
/** The e-mail address of the sender. All e-mail addresses can be plain 'sender@server.com' or formatted 'Sender Name <sender@server.com>' */
|
|
353
|
-
readonly from?: string | MailAddress;
|
|
354
|
-
/** An e-mail address that will appear on the Sender: field */
|
|
355
|
-
readonly sender?: string | MailAddress;
|
|
356
|
-
/** Comma separated list or an array of recipients e-mail addresses that will appear on the To: field */
|
|
357
|
-
readonly to?: MailDestination;
|
|
358
|
-
/** Comma separated list or an array of recipients e-mail addresses that will appear on the Cc: field */
|
|
359
|
-
readonly cc?: MailDestination;
|
|
360
|
-
/** Comma separated list or an array of recipients e-mail addresses that will appear on the Bcc: field */
|
|
361
|
-
readonly bcc?: MailDestination;
|
|
362
|
-
/** An e-mail address that will appear on the Reply-To: field */
|
|
363
|
-
readonly replyTo?: string | MailAddress;
|
|
364
|
-
/** The subject of the e-mail */
|
|
365
|
-
readonly subject?: string;
|
|
366
|
-
/** The plaintext version of the message */
|
|
367
|
-
readonly text?: string;
|
|
368
|
-
/** The HTML version of the message */
|
|
369
|
-
readonly html?: string;
|
|
370
|
-
/** An array of attachment objects */
|
|
371
|
-
readonly attachments?: MailAttachment[];
|
|
372
|
-
}
|
|
373
|
-
/**
|
|
374
|
-
* OAuth 2.0 Grant Type Identifiers
|
|
375
|
-
* Standard identifiers: https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-07#name-grant-types
|
|
376
|
-
* JWT bearer extension: https://datatracker.ietf.org/doc/html/rfc7523
|
|
377
|
-
* Token exchange extension: https://datatracker.ietf.org/doc/html/rfc8693
|
|
378
|
-
*/
|
|
379
|
-
export declare enum OAuthGrantType {
|
|
380
|
-
ClientCredentials = "client_credentials",
|
|
381
|
-
AuthorizationCode = "authorization_code",
|
|
382
|
-
RefreshToken = "refresh_token",
|
|
383
|
-
JwtBearer = "urn:ietf:params:oauth:grant-type:jwt-bearer",
|
|
384
|
-
TokenExchange = "urn:ietf:params:oauth:grant-type:token-exchange"
|
|
385
|
-
}
|
|
386
|
-
/**
|
|
387
|
-
* OAuth 2.0 Token Type Identifiers
|
|
388
|
-
* See: https://datatracker.ietf.org/doc/html/rfc8693#name-token-type-identifiers
|
|
389
|
-
*/
|
|
390
|
-
export declare enum OAuthTokenType {
|
|
391
|
-
/** Indicates that the token is an OAuth 2.0 access token issued by the given authorization server. */
|
|
392
|
-
AccessToken = "urn:ietf:params:oauth:token-type:access_token",
|
|
393
|
-
/** Indicates that the token is an OAuth 2.0 refresh token issued by the given authorization server. */
|
|
394
|
-
RefreshToken = "urn:ietf:params:oauth:token-type:refresh_token",
|
|
395
|
-
/** Indicates that the token is an ID Token as defined in Section 2 of [OpenID.Core]. */
|
|
396
|
-
IdToken = "urn:ietf:params:oauth:token-type:id_token",
|
|
397
|
-
/** Indicates that the token is a base64url-encoded SAML 1.1 [OASIS.saml-core-1.1] assertion. */
|
|
398
|
-
Saml1Token = "urn:ietf:params:oauth:token-type:saml1",
|
|
399
|
-
/** Indicates that the token is a base64url-encoded SAML 2.0 [OASIS.saml-core-2.0-os] assertion. */
|
|
400
|
-
Saml2Token = "urn:ietf:params:oauth:token-type:saml2"
|
|
401
|
-
}
|
|
402
|
-
/**
|
|
403
|
-
* OAuth 2.0 Client Authentication Methods
|
|
404
|
-
* See: https://datatracker.ietf.org/doc/html/rfc7523#section-2.2
|
|
405
|
-
*/
|
|
406
|
-
export declare enum OAuthClientAssertionType {
|
|
407
|
-
/** Using JWTs for Client Authentication */
|
|
408
|
-
JwtBearer = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"
|
|
409
|
-
}
|
|
410
|
-
/**
|
|
411
|
-
* The MedplumClient class provides a client for the Medplum FHIR server.
|
|
412
|
-
*
|
|
413
|
-
* The client can be used in the browser, in a Node.js application, or in a Medplum Bot.
|
|
414
|
-
*
|
|
415
|
-
* The client provides helpful methods for common operations such as:
|
|
416
|
-
* 1) Authenticating
|
|
417
|
-
* 2) Creating resources
|
|
418
|
-
* 2) Reading resources
|
|
419
|
-
* 3) Updating resources
|
|
420
|
-
* 5) Deleting resources
|
|
421
|
-
* 6) Searching
|
|
422
|
-
* 7) Making GraphQL queries
|
|
423
|
-
*
|
|
424
|
-
* Here is a quick example of how to use the client:
|
|
425
|
-
*
|
|
426
|
-
* ```typescript
|
|
427
|
-
* import { MedplumClient } from '@medplum/core';
|
|
428
|
-
* const medplum = new MedplumClient();
|
|
429
|
-
* ```
|
|
430
|
-
*
|
|
431
|
-
* Create a `Patient`:
|
|
432
|
-
*
|
|
433
|
-
* ```typescript
|
|
434
|
-
* const patient = await medplum.createResource({
|
|
435
|
-
* resourceType: 'Patient',
|
|
436
|
-
* name: [{
|
|
437
|
-
* given: ['Alice'],
|
|
438
|
-
* family: 'Smith'
|
|
439
|
-
* }]
|
|
440
|
-
* });
|
|
441
|
-
* ```
|
|
442
|
-
*
|
|
443
|
-
* Read a `Patient` by ID:
|
|
444
|
-
*
|
|
445
|
-
* ```typescript
|
|
446
|
-
* const patient = await medplum.readResource('Patient', '123');
|
|
447
|
-
* console.log(patient.name[0].given[0]);
|
|
448
|
-
* ```
|
|
449
|
-
*
|
|
450
|
-
* Search for a `Patient` by name:
|
|
451
|
-
*
|
|
452
|
-
* ```typescript
|
|
453
|
-
* const bundle = await medplum.search('Patient', 'name=Alice');
|
|
454
|
-
* console.log(bundle.total);
|
|
455
|
-
* ```
|
|
456
|
-
*
|
|
457
|
-
* <head>
|
|
458
|
-
* <meta name="algolia:pageRank" content="100" />
|
|
459
|
-
* </head>
|
|
460
|
-
*/
|
|
461
|
-
export declare class MedplumClient extends EventTarget {
|
|
462
|
-
private readonly options;
|
|
463
|
-
private readonly fetch;
|
|
464
|
-
private readonly createPdfImpl?;
|
|
465
|
-
private readonly storage;
|
|
466
|
-
private readonly requestCache;
|
|
467
|
-
private readonly cacheTime;
|
|
468
|
-
private readonly baseUrl;
|
|
469
|
-
private readonly fhirBaseUrl;
|
|
470
|
-
private readonly authorizeUrl;
|
|
471
|
-
private readonly tokenUrl;
|
|
472
|
-
private readonly logoutUrl;
|
|
473
|
-
private readonly onUnauthenticated?;
|
|
474
|
-
private readonly autoBatchTime;
|
|
475
|
-
private readonly autoBatchQueue;
|
|
476
|
-
private medplumServer?;
|
|
477
|
-
private clientId?;
|
|
478
|
-
private clientSecret?;
|
|
479
|
-
private autoBatchTimerId?;
|
|
480
|
-
private accessToken?;
|
|
481
|
-
private refreshToken?;
|
|
482
|
-
private refreshPromise?;
|
|
483
|
-
private profilePromise?;
|
|
484
|
-
private sessionDetails?;
|
|
485
|
-
private basicAuth?;
|
|
486
|
-
constructor(options?: MedplumClientOptions);
|
|
487
|
-
/**
|
|
488
|
-
* Returns the current base URL for all API requests.
|
|
489
|
-
* By default, this is set to `https://api.medplum.com/`.
|
|
490
|
-
* This can be overridden by setting the `baseUrl` option when creating the client.
|
|
491
|
-
* @category HTTP
|
|
492
|
-
* @returns The current base URL for all API requests.
|
|
493
|
-
*/
|
|
494
|
-
getBaseUrl(): string;
|
|
495
|
-
/**
|
|
496
|
-
* Returns the current authorize URL.
|
|
497
|
-
* By default, this is set to `https://api.medplum.com/oauth2/authorize`.
|
|
498
|
-
* This can be overridden by setting the `authorizeUrl` option when creating the client.
|
|
499
|
-
* @category HTTP
|
|
500
|
-
* @returns The current authorize URL.
|
|
501
|
-
*/
|
|
502
|
-
getAuthorizeUrl(): string;
|
|
503
|
-
/**
|
|
504
|
-
* Returns the current token URL.
|
|
505
|
-
* By default, this is set to `https://api.medplum.com/oauth2/token`.
|
|
506
|
-
* This can be overridden by setting the `tokenUrl` option when creating the client.
|
|
507
|
-
* @category HTTP
|
|
508
|
-
* @returns The current token URL.
|
|
509
|
-
*/
|
|
510
|
-
getTokenUrl(): string;
|
|
511
|
-
/**
|
|
512
|
-
* Returns the current logout URL.
|
|
513
|
-
* By default, this is set to `https://api.medplum.com/oauth2/logout`.
|
|
514
|
-
* This can be overridden by setting the `logoutUrl` option when creating the client.
|
|
515
|
-
* @category HTTP
|
|
516
|
-
* @returns The current logout URL.
|
|
517
|
-
*/
|
|
518
|
-
getLogoutUrl(): string;
|
|
519
|
-
/**
|
|
520
|
-
* Clears all auth state including local storage and session storage.
|
|
521
|
-
* @category Authentication
|
|
522
|
-
*/
|
|
523
|
-
clear(): void;
|
|
524
|
-
/**
|
|
525
|
-
* Clears the active login from local storage.
|
|
526
|
-
* Does not clear all local storage (such as other logins).
|
|
527
|
-
* @category Authentication
|
|
528
|
-
*/
|
|
529
|
-
clearActiveLogin(): void;
|
|
530
|
-
/**
|
|
531
|
-
* Invalidates any cached values or cached requests for the given URL.
|
|
532
|
-
* @category Caching
|
|
533
|
-
* @param url The URL to invalidate.
|
|
534
|
-
*/
|
|
535
|
-
invalidateUrl(url: URL | string): void;
|
|
536
|
-
/**
|
|
537
|
-
* Invalidates all cached values and flushes the cache.
|
|
538
|
-
* @category Caching
|
|
539
|
-
*/
|
|
540
|
-
invalidateAll(): void;
|
|
541
|
-
/**
|
|
542
|
-
* Invalidates all cached search results or cached requests for the given resourceType.
|
|
543
|
-
* @category Caching
|
|
544
|
-
* @param resourceType The resource type to invalidate.
|
|
545
|
-
*/
|
|
546
|
-
invalidateSearches<K extends ResourceType>(resourceType: K): void;
|
|
547
|
-
/**
|
|
548
|
-
* Makes an HTTP GET request to the specified URL.
|
|
549
|
-
*
|
|
550
|
-
* This is a lower level method for custom requests.
|
|
551
|
-
* For common operations, we recommend using higher level methods
|
|
552
|
-
* such as `readResource()`, `search()`, etc.
|
|
553
|
-
* @category HTTP
|
|
554
|
-
* @param url The target URL.
|
|
555
|
-
* @param options Optional fetch options.
|
|
556
|
-
* @returns Promise to the response content.
|
|
557
|
-
*/
|
|
558
|
-
get<T = any>(url: URL | string, options?: RequestInit): ReadablePromise<T>;
|
|
559
|
-
/**
|
|
560
|
-
* Makes an HTTP POST request to the specified URL.
|
|
561
|
-
*
|
|
562
|
-
* This is a lower level method for custom requests.
|
|
563
|
-
* For common operations, we recommend using higher level methods
|
|
564
|
-
* such as `createResource()`.
|
|
565
|
-
* @category HTTP
|
|
566
|
-
* @param url The target URL.
|
|
567
|
-
* @param body The content body. Strings and `File` objects are passed directly. Other objects are converted to JSON.
|
|
568
|
-
* @param contentType The content type to be included in the "Content-Type" header.
|
|
569
|
-
* @param options Optional fetch options.
|
|
570
|
-
* @returns Promise to the response content.
|
|
571
|
-
*/
|
|
572
|
-
post(url: URL | string, body: any, contentType?: string, options?: RequestInit): Promise<any>;
|
|
573
|
-
/**
|
|
574
|
-
* Makes an HTTP PUT request to the specified URL.
|
|
575
|
-
*
|
|
576
|
-
* This is a lower level method for custom requests.
|
|
577
|
-
* For common operations, we recommend using higher level methods
|
|
578
|
-
* such as `updateResource()`.
|
|
579
|
-
* @category HTTP
|
|
580
|
-
* @param url The target URL.
|
|
581
|
-
* @param body The content body. Strings and `File` objects are passed directly. Other objects are converted to JSON.
|
|
582
|
-
* @param contentType The content type to be included in the "Content-Type" header.
|
|
583
|
-
* @param options Optional fetch options.
|
|
584
|
-
* @returns Promise to the response content.
|
|
585
|
-
*/
|
|
586
|
-
put(url: URL | string, body: any, contentType?: string, options?: RequestInit): Promise<any>;
|
|
587
|
-
/**
|
|
588
|
-
* Makes an HTTP PATCH request to the specified URL.
|
|
589
|
-
*
|
|
590
|
-
* This is a lower level method for custom requests.
|
|
591
|
-
* For common operations, we recommend using higher level methods
|
|
592
|
-
* such as `patchResource()`.
|
|
593
|
-
* @category HTTP
|
|
594
|
-
* @param url The target URL.
|
|
595
|
-
* @param operations Array of JSONPatch operations.
|
|
596
|
-
* @param options Optional fetch options.
|
|
597
|
-
* @returns Promise to the response content.
|
|
598
|
-
*/
|
|
599
|
-
patch(url: URL | string, operations: PatchOperation[], options?: RequestInit): Promise<any>;
|
|
600
|
-
/**
|
|
601
|
-
* Makes an HTTP DELETE request to the specified URL.
|
|
602
|
-
*
|
|
603
|
-
*
|
|
604
|
-
* This is a lower level method for custom requests.
|
|
605
|
-
* For common operations, we recommend using higher level methods
|
|
606
|
-
* such as `deleteResource()`.
|
|
607
|
-
* @category HTTP
|
|
608
|
-
* @param url The target URL.
|
|
609
|
-
* @param options Optional fetch options.
|
|
610
|
-
* @returns Promise to the response content.
|
|
611
|
-
*/
|
|
612
|
-
delete(url: URL | string, options?: RequestInit): Promise<any>;
|
|
613
|
-
/**
|
|
614
|
-
* Initiates a new user flow.
|
|
615
|
-
*
|
|
616
|
-
* This method is part of the two different user registration flows:
|
|
617
|
-
* 1) New Practitioner and new Project
|
|
618
|
-
* 2) New Patient registration
|
|
619
|
-
* @category Authentication
|
|
620
|
-
* @param newUserRequest Register request including email and password.
|
|
621
|
-
* @param options Optional fetch options.
|
|
622
|
-
* @returns Promise to the authentication response.
|
|
623
|
-
*/
|
|
624
|
-
startNewUser(newUserRequest: NewUserRequest, options?: RequestInit): Promise<LoginAuthenticationResponse>;
|
|
625
|
-
/**
|
|
626
|
-
* Initiates a new project flow.
|
|
627
|
-
*
|
|
628
|
-
* This requires a partial login from `startNewUser` or `startNewGoogleUser`.
|
|
629
|
-
* @param newProjectRequest Register request including email and password.
|
|
630
|
-
* @param options Optional fetch options.
|
|
631
|
-
* @returns Promise to the authentication response.
|
|
632
|
-
*/
|
|
633
|
-
startNewProject(newProjectRequest: NewProjectRequest, options?: RequestInit): Promise<LoginAuthenticationResponse>;
|
|
634
|
-
/**
|
|
635
|
-
* Initiates a new patient flow.
|
|
636
|
-
*
|
|
637
|
-
* This requires a partial login from `startNewUser` or `startNewGoogleUser`.
|
|
638
|
-
* @param newPatientRequest Register request including email and password.
|
|
639
|
-
* @param options Optional fetch options.
|
|
640
|
-
* @returns Promise to the authentication response.
|
|
641
|
-
*/
|
|
642
|
-
startNewPatient(newPatientRequest: NewPatientRequest, options?: RequestInit): Promise<LoginAuthenticationResponse>;
|
|
643
|
-
/**
|
|
644
|
-
* Initiates a user login flow.
|
|
645
|
-
* @category Authentication
|
|
646
|
-
* @param loginRequest Login request including email and password.
|
|
647
|
-
* @param options Optional fetch options.
|
|
648
|
-
* @returns Promise to the authentication response.
|
|
649
|
-
*/
|
|
650
|
-
startLogin(loginRequest: EmailPasswordLoginRequest, options?: RequestInit): Promise<LoginAuthenticationResponse>;
|
|
651
|
-
/**
|
|
652
|
-
* Tries to sign in with Google authentication.
|
|
653
|
-
* The response parameter is the result of a Google authentication.
|
|
654
|
-
* See: https://developers.google.com/identity/gsi/web/guides/handle-credential-responses-js-functions
|
|
655
|
-
* @category Authentication
|
|
656
|
-
* @param loginRequest Login request including Google credential response.
|
|
657
|
-
* @param options Optional fetch options.
|
|
658
|
-
* @returns Promise to the authentication response.
|
|
659
|
-
*/
|
|
660
|
-
startGoogleLogin(loginRequest: GoogleLoginRequest, options?: RequestInit): Promise<LoginAuthenticationResponse>;
|
|
661
|
-
/**
|
|
662
|
-
* Returns the PKCE code challenge and method.
|
|
663
|
-
* If the login request already includes a code challenge, it is returned.
|
|
664
|
-
* Otherwise, a new PKCE code challenge is generated.
|
|
665
|
-
* @category Authentication
|
|
666
|
-
* @param loginRequest The original login request.
|
|
667
|
-
* @returns The PKCE code challenge and method.
|
|
668
|
-
*/
|
|
669
|
-
ensureCodeChallenge<T extends BaseLoginRequest>(loginRequest: T): Promise<T>;
|
|
670
|
-
/**
|
|
671
|
-
* Signs out locally.
|
|
672
|
-
* Does not invalidate tokens with the server.
|
|
673
|
-
* @category Authentication
|
|
674
|
-
*/
|
|
675
|
-
signOut(): Promise<void>;
|
|
676
|
-
/**
|
|
677
|
-
* Tries to sign in the user.
|
|
678
|
-
* Returns true if the user is signed in.
|
|
679
|
-
* This may result in navigating away to the sign in page.
|
|
680
|
-
* @category Authentication
|
|
681
|
-
* @param loginParams Optional login parameters.
|
|
682
|
-
* @returns The user profile resource if available.
|
|
683
|
-
*/
|
|
684
|
-
signInWithRedirect(loginParams?: Partial<BaseLoginRequest>): Promise<ProfileResource | undefined>;
|
|
685
|
-
/**
|
|
686
|
-
* Tries to sign out the user.
|
|
687
|
-
* See: https://docs.aws.amazon.com/cognito/latest/developerguide/logout-endpoint.html
|
|
688
|
-
* @category Authentication
|
|
689
|
-
*/
|
|
690
|
-
signOutWithRedirect(): void;
|
|
691
|
-
/**
|
|
692
|
-
* Initiates sign in with an external identity provider.
|
|
693
|
-
* @param authorizeUrl The external authorization URL.
|
|
694
|
-
* @param clientId The external client ID.
|
|
695
|
-
* @param redirectUri The external identity provider redirect URI.
|
|
696
|
-
* @param baseLogin The Medplum login request.
|
|
697
|
-
* @category Authentication
|
|
698
|
-
*/
|
|
699
|
-
signInWithExternalAuth(authorizeUrl: string, clientId: string, redirectUri: string, baseLogin: BaseLoginRequest): Promise<void>;
|
|
700
|
-
/**
|
|
701
|
-
* Exchange an external access token for a Medplum access token.
|
|
702
|
-
* @param token The access token that was generated by the external identity provider.
|
|
703
|
-
* @param clientId The ID of the `ClientApplication` in your Medplum project that will be making the exchange request.
|
|
704
|
-
* @returns The user profile resource.
|
|
705
|
-
* @category Authentication
|
|
706
|
-
*/
|
|
707
|
-
exchangeExternalAccessToken(token: string, clientId?: string): Promise<ProfileResource>;
|
|
708
|
-
/**
|
|
709
|
-
* Builds the external identity provider redirect URI.
|
|
710
|
-
* @param authorizeUrl The external authorization URL.
|
|
711
|
-
* @param clientId The external client ID.
|
|
712
|
-
* @param redirectUri The external identity provider redirect URI.
|
|
713
|
-
* @param loginRequest The Medplum login request.
|
|
714
|
-
* @returns The external identity provider redirect URI.
|
|
715
|
-
* @category Authentication
|
|
716
|
-
*/
|
|
717
|
-
getExternalAuthRedirectUri(authorizeUrl: string, clientId: string, redirectUri: string, loginRequest: BaseLoginRequest): string;
|
|
718
|
-
/**
|
|
719
|
-
* Builds a FHIR URL from a collection of URL path components.
|
|
720
|
-
* For example, `buildUrl('/Patient', '123')` returns `fhir/R4/Patient/123`.
|
|
721
|
-
* @category HTTP
|
|
722
|
-
* @param path The path component of the URL.
|
|
723
|
-
* @returns The well-formed FHIR URL.
|
|
724
|
-
*/
|
|
725
|
-
fhirUrl(...path: string[]): URL;
|
|
726
|
-
/**
|
|
727
|
-
* Builds a FHIR search URL from a search query or structured query object.
|
|
728
|
-
* @category HTTP
|
|
729
|
-
* @category Search
|
|
730
|
-
* @param resourceType The FHIR resource type.
|
|
731
|
-
* @param query The FHIR search query or structured query object. Can be any valid input to the URLSearchParams() constructor.
|
|
732
|
-
* @returns The well-formed FHIR URL.
|
|
733
|
-
*/
|
|
734
|
-
fhirSearchUrl(resourceType: ResourceType, query: QueryTypes): URL;
|
|
735
|
-
/**
|
|
736
|
-
* Sends a FHIR search request.
|
|
737
|
-
*
|
|
738
|
-
* Example using a FHIR search string:
|
|
739
|
-
*
|
|
740
|
-
* ```typescript
|
|
741
|
-
* const bundle = await client.search('Patient', 'name=Alice');
|
|
742
|
-
* console.log(bundle);
|
|
743
|
-
* ```
|
|
744
|
-
*
|
|
745
|
-
* The return value is a FHIR bundle:
|
|
746
|
-
*
|
|
747
|
-
* ```json
|
|
748
|
-
* {
|
|
749
|
-
* "resourceType": "Bundle",
|
|
750
|
-
* "type": "searchset",
|
|
751
|
-
* "entry": [
|
|
752
|
-
* {
|
|
753
|
-
* "resource": {
|
|
754
|
-
* "resourceType": "Patient",
|
|
755
|
-
* "name": [
|
|
756
|
-
* {
|
|
757
|
-
* "given": [
|
|
758
|
-
* "George"
|
|
759
|
-
* ],
|
|
760
|
-
* "family": "Washington"
|
|
761
|
-
* }
|
|
762
|
-
* ],
|
|
763
|
-
* }
|
|
764
|
-
* }
|
|
765
|
-
* ]
|
|
766
|
-
* }
|
|
767
|
-
* ```
|
|
768
|
-
*
|
|
769
|
-
* To query the count of a search, use the summary feature like so:
|
|
770
|
-
*
|
|
771
|
-
* ```typescript
|
|
772
|
-
* const patients = medplum.search('Patient', '_summary=count');
|
|
773
|
-
* ```
|
|
774
|
-
*
|
|
775
|
-
* See FHIR search for full details: https://www.hl7.org/fhir/search.html
|
|
776
|
-
* @category Search
|
|
777
|
-
* @param resourceType The FHIR resource type.
|
|
778
|
-
* @param query Optional FHIR search query or structured query object. Can be any valid input to the URLSearchParams() constructor.
|
|
779
|
-
* @param options Optional fetch options.
|
|
780
|
-
* @returns Promise to the search result bundle.
|
|
781
|
-
*/
|
|
782
|
-
search<K extends ResourceType>(resourceType: K, query?: QueryTypes, options?: RequestInit): ReadablePromise<Bundle<ExtractResource<K>>>;
|
|
783
|
-
/**
|
|
784
|
-
* Sends a FHIR search request for a single resource.
|
|
785
|
-
*
|
|
786
|
-
* This is a convenience method for `search()` that returns the first resource rather than a `Bundle`.
|
|
787
|
-
*
|
|
788
|
-
* Example using a FHIR search string:
|
|
789
|
-
*
|
|
790
|
-
* ```typescript
|
|
791
|
-
* const patient = await client.searchOne('Patient', 'identifier=123');
|
|
792
|
-
* console.log(patient);
|
|
793
|
-
* ```
|
|
794
|
-
*
|
|
795
|
-
* The return value is the resource, if available; otherwise, undefined.
|
|
796
|
-
*
|
|
797
|
-
* See FHIR search for full details: https://www.hl7.org/fhir/search.html
|
|
798
|
-
* @category Search
|
|
799
|
-
* @param resourceType The FHIR resource type.
|
|
800
|
-
* @param query Optional FHIR search query or structured query object. Can be any valid input to the URLSearchParams() constructor.
|
|
801
|
-
* @param options Optional fetch options.
|
|
802
|
-
* @returns Promise to the first search result.
|
|
803
|
-
*/
|
|
804
|
-
searchOne<K extends ResourceType>(resourceType: K, query?: QueryTypes, options?: RequestInit): ReadablePromise<ExtractResource<K> | undefined>;
|
|
805
|
-
/**
|
|
806
|
-
* Sends a FHIR search request for an array of resources.
|
|
807
|
-
*
|
|
808
|
-
* This is a convenience method for `search()` that returns the resources as an array rather than a `Bundle`.
|
|
809
|
-
*
|
|
810
|
-
* Example using a FHIR search string:
|
|
811
|
-
*
|
|
812
|
-
* ```typescript
|
|
813
|
-
* const patients = await client.searchResources('Patient', 'name=Alice');
|
|
814
|
-
* console.log(patients);
|
|
815
|
-
* ```
|
|
816
|
-
*
|
|
817
|
-
* The return value is an array of resources.
|
|
818
|
-
*
|
|
819
|
-
* See FHIR search for full details: https://www.hl7.org/fhir/search.html
|
|
820
|
-
* @category Search
|
|
821
|
-
* @param resourceType The FHIR resource type.
|
|
822
|
-
* @param query Optional FHIR search query or structured query object. Can be any valid input to the URLSearchParams() constructor.
|
|
823
|
-
* @param options Optional fetch options.
|
|
824
|
-
* @returns Promise to the array of search results.
|
|
825
|
-
*/
|
|
826
|
-
searchResources<K extends ResourceType>(resourceType: K, query?: QueryTypes, options?: RequestInit): ReadablePromise<ResourceArray<ExtractResource<K>>>;
|
|
827
|
-
/**
|
|
828
|
-
* Creates an
|
|
829
|
-
* [async generator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncGenerator)
|
|
830
|
-
* over a series of FHIR search requests for paginated search results. Each iteration of the generator yields
|
|
831
|
-
* the array of resources on each page.
|
|
832
|
-
*
|
|
833
|
-
*
|
|
834
|
-
* ```typescript
|
|
835
|
-
* for await (const page of medplum.searchResourcePages('Patient', { _count: 10 })) {
|
|
836
|
-
* for (const patient of page) {
|
|
837
|
-
* console.log(`Processing Patient resource with ID: ${patient.id}`);
|
|
838
|
-
* }
|
|
839
|
-
* }
|
|
840
|
-
* ```
|
|
841
|
-
* @category Search
|
|
842
|
-
* @param resourceType The FHIR resource type.
|
|
843
|
-
* @param query Optional FHIR search query or structured query object. Can be any valid input to the URLSearchParams() constructor.
|
|
844
|
-
* @param options Optional fetch options.
|
|
845
|
-
* @yields An async generator, where each result is an array of resources for each page.
|
|
846
|
-
*/
|
|
847
|
-
searchResourcePages<K extends ResourceType>(resourceType: K, query?: QueryTypes, options?: RequestInit): AsyncGenerator<ResourceArray<ExtractResource<K>>>;
|
|
848
|
-
/**
|
|
849
|
-
* Searches a ValueSet resource using the "expand" operation.
|
|
850
|
-
* See: https://www.hl7.org/fhir/operation-valueset-expand.html
|
|
851
|
-
* @category Search
|
|
852
|
-
* @param system The ValueSet system url.
|
|
853
|
-
* @param filter The search string.
|
|
854
|
-
* @param options Optional fetch options.
|
|
855
|
-
* @returns Promise to expanded ValueSet.
|
|
856
|
-
*/
|
|
857
|
-
searchValueSet(system: string, filter: string, options?: RequestInit): ReadablePromise<ValueSet>;
|
|
858
|
-
/**
|
|
859
|
-
* Returns a cached resource if it is available.
|
|
860
|
-
* @category Caching
|
|
861
|
-
* @param resourceType The FHIR resource type.
|
|
862
|
-
* @param id The FHIR resource ID.
|
|
863
|
-
* @returns The resource if it is available in the cache; undefined otherwise.
|
|
864
|
-
*/
|
|
865
|
-
getCached<K extends ResourceType>(resourceType: K, id: string): ExtractResource<K> | undefined;
|
|
866
|
-
/**
|
|
867
|
-
* Returns a cached resource if it is available.
|
|
868
|
-
* @category Caching
|
|
869
|
-
* @param reference The FHIR reference.
|
|
870
|
-
* @returns The resource if it is available in the cache; undefined otherwise.
|
|
871
|
-
*/
|
|
872
|
-
getCachedReference<T extends Resource>(reference: Reference<T>): T | undefined;
|
|
873
|
-
/**
|
|
874
|
-
* Reads a resource by resource type and ID.
|
|
875
|
-
*
|
|
876
|
-
* Example:
|
|
877
|
-
*
|
|
878
|
-
* ```typescript
|
|
879
|
-
* const patient = await medplum.readResource('Patient', '123');
|
|
880
|
-
* console.log(patient);
|
|
881
|
-
* ```
|
|
882
|
-
*
|
|
883
|
-
* See the FHIR "read" operation for full details: https://www.hl7.org/fhir/http.html#read
|
|
884
|
-
* @category Read
|
|
885
|
-
* @param resourceType The FHIR resource type.
|
|
886
|
-
* @param id The resource ID.
|
|
887
|
-
* @param options Optional fetch options.
|
|
888
|
-
* @returns The resource if available; undefined otherwise.
|
|
889
|
-
*/
|
|
890
|
-
readResource<K extends ResourceType>(resourceType: K, id: string, options?: RequestInit): ReadablePromise<ExtractResource<K>>;
|
|
891
|
-
/**
|
|
892
|
-
* Reads a resource by `Reference`.
|
|
893
|
-
*
|
|
894
|
-
* This is a convenience method for `readResource()` that accepts a `Reference` object.
|
|
895
|
-
*
|
|
896
|
-
* Example:
|
|
897
|
-
*
|
|
898
|
-
* ```typescript
|
|
899
|
-
* const serviceRequest = await medplum.readResource('ServiceRequest', '123');
|
|
900
|
-
* const patient = await medplum.readReference(serviceRequest.subject);
|
|
901
|
-
* console.log(patient);
|
|
902
|
-
* ```
|
|
903
|
-
*
|
|
904
|
-
* See the FHIR "read" operation for full details: https://www.hl7.org/fhir/http.html#read
|
|
905
|
-
* @category Read
|
|
906
|
-
* @param reference The FHIR reference object.
|
|
907
|
-
* @param options Optional fetch options.
|
|
908
|
-
* @returns The resource if available; undefined otherwise.
|
|
909
|
-
*/
|
|
910
|
-
readReference<T extends Resource>(reference: Reference<T>, options?: RequestInit): ReadablePromise<T>;
|
|
911
|
-
/**
|
|
912
|
-
* Requests the schema for a resource type.
|
|
913
|
-
* If the schema is already cached, the promise is resolved immediately.
|
|
914
|
-
* @category Schema
|
|
915
|
-
* @param resourceType The FHIR resource type.
|
|
916
|
-
* @returns Promise to a schema with the requested resource type.
|
|
917
|
-
*/
|
|
918
|
-
requestSchema(resourceType: string): Promise<void>;
|
|
919
|
-
/**
|
|
920
|
-
* Reads resource history by resource type and ID.
|
|
921
|
-
*
|
|
922
|
-
* The return value is a bundle of all versions of the resource.
|
|
923
|
-
*
|
|
924
|
-
* Example:
|
|
925
|
-
*
|
|
926
|
-
* ```typescript
|
|
927
|
-
* const history = await medplum.readHistory('Patient', '123');
|
|
928
|
-
* console.log(history);
|
|
929
|
-
* ```
|
|
930
|
-
*
|
|
931
|
-
* See the FHIR "history" operation for full details: https://www.hl7.org/fhir/http.html#history
|
|
932
|
-
* @category Read
|
|
933
|
-
* @param resourceType The FHIR resource type.
|
|
934
|
-
* @param id The resource ID.
|
|
935
|
-
* @param options Optional fetch options.
|
|
936
|
-
* @returns Promise to the resource history.
|
|
937
|
-
*/
|
|
938
|
-
readHistory<K extends ResourceType>(resourceType: K, id: string, options?: RequestInit): ReadablePromise<Bundle<ExtractResource<K>>>;
|
|
939
|
-
/**
|
|
940
|
-
* Reads a specific version of a resource by resource type, ID, and version ID.
|
|
941
|
-
*
|
|
942
|
-
* Example:
|
|
943
|
-
*
|
|
944
|
-
* ```typescript
|
|
945
|
-
* const version = await medplum.readVersion('Patient', '123', '456');
|
|
946
|
-
* console.log(version);
|
|
947
|
-
* ```
|
|
948
|
-
*
|
|
949
|
-
* See the FHIR "vread" operation for full details: https://www.hl7.org/fhir/http.html#vread
|
|
950
|
-
* @category Read
|
|
951
|
-
* @param resourceType The FHIR resource type.
|
|
952
|
-
* @param id The resource ID.
|
|
953
|
-
* @param vid The version ID.
|
|
954
|
-
* @param options Optional fetch options.
|
|
955
|
-
* @returns The resource if available; undefined otherwise.
|
|
956
|
-
*/
|
|
957
|
-
readVersion<K extends ResourceType>(resourceType: K, id: string, vid: string, options?: RequestInit): ReadablePromise<ExtractResource<K>>;
|
|
958
|
-
/**
|
|
959
|
-
* Executes the Patient "everything" operation for a patient.
|
|
960
|
-
*
|
|
961
|
-
* Example:
|
|
962
|
-
*
|
|
963
|
-
* ```typescript
|
|
964
|
-
* const bundle = await medplum.readPatientEverything('123');
|
|
965
|
-
* console.log(bundle);
|
|
966
|
-
* ```
|
|
967
|
-
*
|
|
968
|
-
* See the FHIR "patient-everything" operation for full details: https://hl7.org/fhir/operation-patient-everything.html
|
|
969
|
-
* @category Read
|
|
970
|
-
* @param id The Patient Id
|
|
971
|
-
* @param options Optional fetch options.
|
|
972
|
-
* @returns A Bundle of all Resources related to the Patient
|
|
973
|
-
*/
|
|
974
|
-
readPatientEverything(id: string, options?: RequestInit): ReadablePromise<Bundle>;
|
|
975
|
-
/**
|
|
976
|
-
* Creates a new FHIR resource.
|
|
977
|
-
*
|
|
978
|
-
* The return value is the newly created resource, including the ID and meta.
|
|
979
|
-
*
|
|
980
|
-
* Example:
|
|
981
|
-
*
|
|
982
|
-
* ```typescript
|
|
983
|
-
* const result = await medplum.createResource({
|
|
984
|
-
* resourceType: 'Patient',
|
|
985
|
-
* name: [{
|
|
986
|
-
* family: 'Smith',
|
|
987
|
-
* given: ['John']
|
|
988
|
-
* }]
|
|
989
|
-
* });
|
|
990
|
-
* console.log(result.id);
|
|
991
|
-
* ```
|
|
992
|
-
*
|
|
993
|
-
* See the FHIR "create" operation for full details: https://www.hl7.org/fhir/http.html#create
|
|
994
|
-
* @category Create
|
|
995
|
-
* @param resource The FHIR resource to create.
|
|
996
|
-
* @param options Optional fetch options.
|
|
997
|
-
* @returns The result of the create operation.
|
|
998
|
-
*/
|
|
999
|
-
createResource<T extends Resource>(resource: T, options?: RequestInit): Promise<T>;
|
|
1000
|
-
/**
|
|
1001
|
-
* Conditionally create a new FHIR resource only if some equivalent resource does not already exist on the server.
|
|
1002
|
-
*
|
|
1003
|
-
* The return value is the existing resource or the newly created resource, including the ID and meta.
|
|
1004
|
-
*
|
|
1005
|
-
* Example:
|
|
1006
|
-
*
|
|
1007
|
-
* ```typescript
|
|
1008
|
-
* const result = await medplum.createResourceIfNoneExist(
|
|
1009
|
-
* {
|
|
1010
|
-
* resourceType: 'Patient',
|
|
1011
|
-
* identifier: [{
|
|
1012
|
-
* system: 'http://example.com/mrn',
|
|
1013
|
-
* value: '123'
|
|
1014
|
-
* }]
|
|
1015
|
-
* name: [{
|
|
1016
|
-
* family: 'Smith',
|
|
1017
|
-
* given: ['John']
|
|
1018
|
-
* }]
|
|
1019
|
-
* },
|
|
1020
|
-
* 'identifier=123'
|
|
1021
|
-
* );
|
|
1022
|
-
* console.log(result.id);
|
|
1023
|
-
* ```
|
|
1024
|
-
*
|
|
1025
|
-
* This method is syntactic sugar for:
|
|
1026
|
-
*
|
|
1027
|
-
* ```typescript
|
|
1028
|
-
* return searchOne(resourceType, query) ?? createResource(resource);
|
|
1029
|
-
* ```
|
|
1030
|
-
*
|
|
1031
|
-
* The query parameter only contains the search parameters (what would be in the URL following the "?").
|
|
1032
|
-
*
|
|
1033
|
-
* See the FHIR "conditional create" operation for full details: https://www.hl7.org/fhir/http.html#ccreate
|
|
1034
|
-
* @category Create
|
|
1035
|
-
* @param resource The FHIR resource to create.
|
|
1036
|
-
* @param query The search query for an equivalent resource (should not include resource type or "?").
|
|
1037
|
-
* @param options Optional fetch options.
|
|
1038
|
-
* @returns The result of the create operation.
|
|
1039
|
-
*/
|
|
1040
|
-
createResourceIfNoneExist<T extends Resource>(resource: T, query: string, options?: RequestInit): Promise<T>;
|
|
1041
|
-
/**
|
|
1042
|
-
* Creates a FHIR `Attachment` with the provided data content.
|
|
1043
|
-
*
|
|
1044
|
-
* This is a convenience method for creating a `Binary` resource and then creating an `Attachment` element.
|
|
1045
|
-
*
|
|
1046
|
-
* The `data` parameter can be a string or a `File` object.
|
|
1047
|
-
*
|
|
1048
|
-
* A `File` object often comes from a `<input type="file">` element.
|
|
1049
|
-
*
|
|
1050
|
-
* Example:
|
|
1051
|
-
*
|
|
1052
|
-
* ```typescript
|
|
1053
|
-
* const result = await medplum.createAttachment(myFile, 'test.jpg', 'image/jpeg');
|
|
1054
|
-
* console.log(result);
|
|
1055
|
-
* ```
|
|
1056
|
-
*
|
|
1057
|
-
* See the FHIR "create" operation for full details: https://www.hl7.org/fhir/http.html#create
|
|
1058
|
-
* @category Create
|
|
1059
|
-
* @param data The binary data to upload.
|
|
1060
|
-
* @param filename Optional filename for the binary.
|
|
1061
|
-
* @param contentType Content type for the binary.
|
|
1062
|
-
* @param onProgress Optional callback for progress events.
|
|
1063
|
-
* @returns The result of the create operation.
|
|
1064
|
-
*/
|
|
1065
|
-
createAttachment(data: BinarySource, filename: string | undefined, contentType: string, onProgress?: (e: ProgressEvent) => void): Promise<Attachment>;
|
|
1066
|
-
/**
|
|
1067
|
-
* Creates a FHIR `Binary` resource with the provided data content.
|
|
1068
|
-
*
|
|
1069
|
-
* The return value is the newly created resource, including the ID and meta.
|
|
1070
|
-
*
|
|
1071
|
-
* The `data` parameter can be a string or a `File` object.
|
|
1072
|
-
*
|
|
1073
|
-
* A `File` object often comes from a `<input type="file">` element.
|
|
1074
|
-
*
|
|
1075
|
-
* Example:
|
|
1076
|
-
*
|
|
1077
|
-
* ```typescript
|
|
1078
|
-
* const result = await medplum.createBinary(myFile, 'test.jpg', 'image/jpeg');
|
|
1079
|
-
* console.log(result.id);
|
|
1080
|
-
* ```
|
|
1081
|
-
*
|
|
1082
|
-
* See the FHIR "create" operation for full details: https://www.hl7.org/fhir/http.html#create
|
|
1083
|
-
* @category Create
|
|
1084
|
-
* @param data The binary data to upload.
|
|
1085
|
-
* @param filename Optional filename for the binary.
|
|
1086
|
-
* @param contentType Content type for the binary.
|
|
1087
|
-
* @param onProgress Optional callback for progress events.
|
|
1088
|
-
* @returns The result of the create operation.
|
|
1089
|
-
*/
|
|
1090
|
-
createBinary(data: BinarySource, filename: string | undefined, contentType: string, onProgress?: (e: ProgressEvent) => void): Promise<Binary>;
|
|
1091
|
-
uploadwithProgress(url: URL, data: BinarySource, contentType: string, onProgress: (e: ProgressEvent) => void): Promise<any>;
|
|
1092
|
-
/**
|
|
1093
|
-
* Creates a PDF as a FHIR `Binary` resource based on pdfmake document definition.
|
|
1094
|
-
*
|
|
1095
|
-
* The return value is the newly created resource, including the ID and meta.
|
|
1096
|
-
*
|
|
1097
|
-
* The `docDefinition` parameter is a pdfmake document definition.
|
|
1098
|
-
*
|
|
1099
|
-
* Example:
|
|
1100
|
-
*
|
|
1101
|
-
* ```typescript
|
|
1102
|
-
* const result = await medplum.createPdf({
|
|
1103
|
-
* content: ['Hello world']
|
|
1104
|
-
* });
|
|
1105
|
-
* console.log(result.id);
|
|
1106
|
-
* ```
|
|
1107
|
-
*
|
|
1108
|
-
* See the pdfmake document definition for full details: https://pdfmake.github.io/docs/0.1/document-definition-object/
|
|
1109
|
-
* @category Media
|
|
1110
|
-
* @param docDefinition The PDF document definition.
|
|
1111
|
-
* @param filename Optional filename for the PDF binary resource.
|
|
1112
|
-
* @param tableLayouts Optional pdfmake custom table layout.
|
|
1113
|
-
* @param fonts Optional pdfmake custom font dictionary.
|
|
1114
|
-
* @returns The result of the create operation.
|
|
1115
|
-
*/
|
|
1116
|
-
createPdf(docDefinition: TDocumentDefinitions, filename?: string, tableLayouts?: Record<string, CustomTableLayout>, fonts?: TFontDictionary): Promise<Binary>;
|
|
1117
|
-
/**
|
|
1118
|
-
* Creates a FHIR `Communication` resource with the provided data content.
|
|
1119
|
-
*
|
|
1120
|
-
* This is a convenience method to handle commmon cases where a `Communication` resource is created with a `payload`.
|
|
1121
|
-
* @category Create
|
|
1122
|
-
* @param resource The FHIR resource to comment on.
|
|
1123
|
-
* @param text The text of the comment.
|
|
1124
|
-
* @param options Optional fetch options.
|
|
1125
|
-
* @returns The result of the create operation.
|
|
1126
|
-
*/
|
|
1127
|
-
createComment(resource: Resource, text: string, options?: RequestInit): Promise<Communication>;
|
|
1128
|
-
/**
|
|
1129
|
-
* Updates a FHIR resource.
|
|
1130
|
-
*
|
|
1131
|
-
* The return value is the updated resource, including the ID and meta.
|
|
1132
|
-
*
|
|
1133
|
-
* Example:
|
|
1134
|
-
*
|
|
1135
|
-
* ```typescript
|
|
1136
|
-
* const result = await medplum.updateResource({
|
|
1137
|
-
* resourceType: 'Patient',
|
|
1138
|
-
* id: '123',
|
|
1139
|
-
* name: [{
|
|
1140
|
-
* family: 'Smith',
|
|
1141
|
-
* given: ['John']
|
|
1142
|
-
* }]
|
|
1143
|
-
* });
|
|
1144
|
-
* console.log(result.meta.versionId);
|
|
1145
|
-
* ```
|
|
1146
|
-
*
|
|
1147
|
-
* See the FHIR "update" operation for full details: https://www.hl7.org/fhir/http.html#update
|
|
1148
|
-
* @category Write
|
|
1149
|
-
* @param resource The FHIR resource to update.
|
|
1150
|
-
* @param options Optional fetch options.
|
|
1151
|
-
* @returns The result of the update operation.
|
|
1152
|
-
*/
|
|
1153
|
-
updateResource<T extends Resource>(resource: T, options?: RequestInit): Promise<T>;
|
|
1154
|
-
/**
|
|
1155
|
-
* Updates a FHIR resource using JSONPatch operations.
|
|
1156
|
-
*
|
|
1157
|
-
* The return value is the updated resource, including the ID and meta.
|
|
1158
|
-
*
|
|
1159
|
-
* Example:
|
|
1160
|
-
*
|
|
1161
|
-
* ```typescript
|
|
1162
|
-
* const result = await medplum.patchResource('Patient', '123', [
|
|
1163
|
-
* {op: 'replace', path: '/name/0/family', value: 'Smith'},
|
|
1164
|
-
* ]);
|
|
1165
|
-
* console.log(result.meta.versionId);
|
|
1166
|
-
* ```
|
|
1167
|
-
*
|
|
1168
|
-
* See the FHIR "update" operation for full details: https://www.hl7.org/fhir/http.html#patch
|
|
1169
|
-
*
|
|
1170
|
-
* See the JSONPatch specification for full details: https://tools.ietf.org/html/rfc6902
|
|
1171
|
-
* @category Write
|
|
1172
|
-
* @param resourceType The FHIR resource type.
|
|
1173
|
-
* @param id The resource ID.
|
|
1174
|
-
* @param operations The JSONPatch operations.
|
|
1175
|
-
* @param options Optional fetch options.
|
|
1176
|
-
* @returns The result of the patch operations.
|
|
1177
|
-
*/
|
|
1178
|
-
patchResource<K extends ResourceType>(resourceType: K, id: string, operations: PatchOperation[], options?: RequestInit): Promise<ExtractResource<K>>;
|
|
1179
|
-
/**
|
|
1180
|
-
* Deletes a FHIR resource by resource type and ID.
|
|
1181
|
-
*
|
|
1182
|
-
* Example:
|
|
1183
|
-
*
|
|
1184
|
-
* ```typescript
|
|
1185
|
-
* await medplum.deleteResource('Patient', '123');
|
|
1186
|
-
* ```
|
|
1187
|
-
*
|
|
1188
|
-
* See the FHIR "delete" operation for full details: https://www.hl7.org/fhir/http.html#delete
|
|
1189
|
-
* @category Delete
|
|
1190
|
-
* @param resourceType The FHIR resource type.
|
|
1191
|
-
* @param id The resource ID.
|
|
1192
|
-
* @param options Optional fetch options.
|
|
1193
|
-
* @returns The result of the delete operation.
|
|
1194
|
-
*/
|
|
1195
|
-
deleteResource(resourceType: ResourceType, id: string, options?: RequestInit): Promise<any>;
|
|
1196
|
-
/**
|
|
1197
|
-
* Executes the validate operation with the provided resource.
|
|
1198
|
-
*
|
|
1199
|
-
* Example:
|
|
1200
|
-
*
|
|
1201
|
-
* ```typescript
|
|
1202
|
-
* const result = await medplum.validateResource({
|
|
1203
|
-
* resourceType: 'Patient',
|
|
1204
|
-
* name: [{ given: ['Alice'], family: 'Smith' }],
|
|
1205
|
-
* });
|
|
1206
|
-
* ```
|
|
1207
|
-
*
|
|
1208
|
-
* See the FHIR "$validate" operation for full details: https://www.hl7.org/fhir/resource-operation-validate.html
|
|
1209
|
-
* @param resource The FHIR resource.
|
|
1210
|
-
* @param options Optional fetch options.
|
|
1211
|
-
* @returns The validate operation outcome.
|
|
1212
|
-
*/
|
|
1213
|
-
validateResource<T extends Resource>(resource: T, options?: RequestInit): Promise<OperationOutcome>;
|
|
1214
|
-
/**
|
|
1215
|
-
* Executes a bot by ID or Identifier.
|
|
1216
|
-
* @param idOrIdentifier The Bot ID or Identifier.
|
|
1217
|
-
* @param body The content body. Strings and `File` objects are passed directly. Other objects are converted to JSON.
|
|
1218
|
-
* @param contentType The content type to be included in the "Content-Type" header.
|
|
1219
|
-
* @param options Optional fetch options.
|
|
1220
|
-
* @returns The Bot return value.
|
|
1221
|
-
*/
|
|
1222
|
-
executeBot(idOrIdentifier: string | Identifier, body: any, contentType?: string, options?: RequestInit): Promise<any>;
|
|
1223
|
-
/**
|
|
1224
|
-
* Executes a batch or transaction of FHIR operations.
|
|
1225
|
-
*
|
|
1226
|
-
* Example:
|
|
1227
|
-
*
|
|
1228
|
-
* ```typescript
|
|
1229
|
-
* await medplum.executeBatch({
|
|
1230
|
-
* "resourceType": "Bundle",
|
|
1231
|
-
* "type": "transaction",
|
|
1232
|
-
* "entry": [
|
|
1233
|
-
* {
|
|
1234
|
-
* "fullUrl": "urn:uuid:61ebe359-bfdc-4613-8bf2-c5e300945f0a",
|
|
1235
|
-
* "resource": {
|
|
1236
|
-
* "resourceType": "Patient",
|
|
1237
|
-
* "name": [{ "use": "official", "given": ["Alice"], "family": "Smith" }],
|
|
1238
|
-
* "gender": "female",
|
|
1239
|
-
* "birthDate": "1974-12-25"
|
|
1240
|
-
* },
|
|
1241
|
-
* "request": {
|
|
1242
|
-
* "method": "POST",
|
|
1243
|
-
* "url": "Patient"
|
|
1244
|
-
* }
|
|
1245
|
-
* },
|
|
1246
|
-
* {
|
|
1247
|
-
* "fullUrl": "urn:uuid:88f151c0-a954-468a-88bd-5ae15c08e059",
|
|
1248
|
-
* "resource": {
|
|
1249
|
-
* "resourceType": "Patient",
|
|
1250
|
-
* "identifier": [{ "system": "http:/example.org/fhir/ids", "value": "234234" }],
|
|
1251
|
-
* "name": [{ "use": "official", "given": ["Bob"], "family": "Jones" }],
|
|
1252
|
-
* "gender": "male",
|
|
1253
|
-
* "birthDate": "1974-12-25"
|
|
1254
|
-
* },
|
|
1255
|
-
* "request": {
|
|
1256
|
-
* "method": "POST",
|
|
1257
|
-
* "url": "Patient",
|
|
1258
|
-
* "ifNoneExist": "identifier=http:/example.org/fhir/ids|234234"
|
|
1259
|
-
* }
|
|
1260
|
-
* }
|
|
1261
|
-
* ]
|
|
1262
|
-
* });
|
|
1263
|
-
* ```
|
|
1264
|
-
*
|
|
1265
|
-
* See The FHIR "batch/transaction" section for full details: https://hl7.org/fhir/http.html#transaction
|
|
1266
|
-
* @category Batch
|
|
1267
|
-
* @param bundle The FHIR batch/transaction bundle.
|
|
1268
|
-
* @param options Optional fetch options.
|
|
1269
|
-
* @returns The FHIR batch/transaction response bundle.
|
|
1270
|
-
*/
|
|
1271
|
-
executeBatch(bundle: Bundle, options?: RequestInit): Promise<Bundle>;
|
|
1272
|
-
/**
|
|
1273
|
-
* Sends an email using the Medplum Email API.
|
|
1274
|
-
*
|
|
1275
|
-
* Builds the email using nodemailer MailComposer.
|
|
1276
|
-
*
|
|
1277
|
-
* Examples:
|
|
1278
|
-
*
|
|
1279
|
-
* Send a simple text email:
|
|
1280
|
-
*
|
|
1281
|
-
* ```typescript
|
|
1282
|
-
* await medplum.sendEmail({
|
|
1283
|
-
* to: 'alice@example.com',
|
|
1284
|
-
* cc: 'bob@example.com',
|
|
1285
|
-
* subject: 'Hello',
|
|
1286
|
-
* text: 'Hello Alice',
|
|
1287
|
-
* });
|
|
1288
|
-
* ```
|
|
1289
|
-
*
|
|
1290
|
-
* Send an email with a `Binary` attachment:
|
|
1291
|
-
*
|
|
1292
|
-
* ```typescript
|
|
1293
|
-
* await medplum.sendEmail({
|
|
1294
|
-
* to: 'alice@example.com',
|
|
1295
|
-
* subject: 'Email with attachment',
|
|
1296
|
-
* text: 'See the attached report',
|
|
1297
|
-
* attachments: [{
|
|
1298
|
-
* filename: 'report.pdf',
|
|
1299
|
-
* path: "Binary/" + binary.id
|
|
1300
|
-
* }]
|
|
1301
|
-
* });
|
|
1302
|
-
* ```
|
|
1303
|
-
*
|
|
1304
|
-
* See options here: https://nodemailer.com/extras/mailcomposer/
|
|
1305
|
-
* @category Media
|
|
1306
|
-
* @param email The MailComposer options.
|
|
1307
|
-
* @param options Optional fetch options.
|
|
1308
|
-
* @returns Promise to the operation outcome.
|
|
1309
|
-
*/
|
|
1310
|
-
sendEmail(email: MailOptions, options?: RequestInit): Promise<OperationOutcome>;
|
|
1311
|
-
/**
|
|
1312
|
-
* Executes a GraphQL query.
|
|
1313
|
-
*
|
|
1314
|
-
* Example:
|
|
1315
|
-
*
|
|
1316
|
-
* ```typescript
|
|
1317
|
-
* const result = await medplum.graphql(`{
|
|
1318
|
-
* Patient(id: "123") {
|
|
1319
|
-
* resourceType
|
|
1320
|
-
* id
|
|
1321
|
-
* name {
|
|
1322
|
-
* given
|
|
1323
|
-
* family
|
|
1324
|
-
* }
|
|
1325
|
-
* }
|
|
1326
|
-
* }`);
|
|
1327
|
-
* ```
|
|
1328
|
-
*
|
|
1329
|
-
* Advanced queries such as named operations and variable substitution are supported:
|
|
1330
|
-
*
|
|
1331
|
-
* ```typescript
|
|
1332
|
-
* const result = await medplum.graphql(
|
|
1333
|
-
* `query GetPatientById($patientId: ID!) {
|
|
1334
|
-
* Patient(id: $patientId) {
|
|
1335
|
-
* resourceType
|
|
1336
|
-
* id
|
|
1337
|
-
* name {
|
|
1338
|
-
* given
|
|
1339
|
-
* family
|
|
1340
|
-
* }
|
|
1341
|
-
* }
|
|
1342
|
-
* }`,
|
|
1343
|
-
* 'GetPatientById',
|
|
1344
|
-
* { patientId: '123' }
|
|
1345
|
-
* );
|
|
1346
|
-
* ```
|
|
1347
|
-
*
|
|
1348
|
-
* See the GraphQL documentation for more details: https://graphql.org/learn/
|
|
1349
|
-
*
|
|
1350
|
-
* See the FHIR GraphQL documentation for FHIR specific details: https://www.hl7.org/fhir/graphql.html
|
|
1351
|
-
* @category Read
|
|
1352
|
-
* @param query The GraphQL query.
|
|
1353
|
-
* @param operationName Optional GraphQL operation name.
|
|
1354
|
-
* @param variables Optional GraphQL variables.
|
|
1355
|
-
* @param options Optional fetch options.
|
|
1356
|
-
* @returns The GraphQL result.
|
|
1357
|
-
*/
|
|
1358
|
-
graphql(query: string, operationName?: string | null, variables?: any, options?: RequestInit): Promise<any>;
|
|
1359
|
-
/**
|
|
1360
|
-
* Executes the $graph operation on this resource to fetch a Bundle of resources linked to the target resource
|
|
1361
|
-
* according to a graph definition
|
|
1362
|
-
* @category Read
|
|
1363
|
-
* @param resourceType The FHIR resource type.
|
|
1364
|
-
* @param id The resource ID.
|
|
1365
|
-
* @param graphName `name` parameter of the GraphDefinition
|
|
1366
|
-
* @param options Optional fetch options.
|
|
1367
|
-
* @returns A Bundle
|
|
1368
|
-
*/
|
|
1369
|
-
readResourceGraph<K extends ResourceType>(resourceType: K, id: string, graphName: string, options?: RequestInit): ReadablePromise<Bundle>;
|
|
1370
|
-
/**
|
|
1371
|
-
* Pushes a message to an agent.
|
|
1372
|
-
*
|
|
1373
|
-
* @param agent The agent to push to.
|
|
1374
|
-
* @param destination The destination device.
|
|
1375
|
-
* @param body The message body.
|
|
1376
|
-
* @param contentType Optional message content type.
|
|
1377
|
-
* @param options Optional fetch options.
|
|
1378
|
-
* @returns Promise to the operation outcome.
|
|
1379
|
-
*/
|
|
1380
|
-
pushToAgent(agent: Agent | Reference<Agent>, destination: Device | Reference<Device>, body: any, contentType?: string, options?: RequestInit): Promise<OperationOutcome>;
|
|
1381
|
-
/**
|
|
1382
|
-
* @category Authentication
|
|
1383
|
-
* @returns The Login State
|
|
1384
|
-
*/
|
|
1385
|
-
getActiveLogin(): LoginState | undefined;
|
|
1386
|
-
/**
|
|
1387
|
-
* Sets the active login.
|
|
1388
|
-
* @param login The new active login state.
|
|
1389
|
-
* @category Authentication
|
|
1390
|
-
*/
|
|
1391
|
-
setActiveLogin(login: LoginState): Promise<void>;
|
|
1392
|
-
/**
|
|
1393
|
-
* Returns the current access token.
|
|
1394
|
-
* @returns The current access token.
|
|
1395
|
-
* @category Authentication
|
|
1396
|
-
*/
|
|
1397
|
-
getAccessToken(): string | undefined;
|
|
1398
|
-
/**
|
|
1399
|
-
* Sets the current access token.
|
|
1400
|
-
* @param accessToken The new access token.
|
|
1401
|
-
* @param refreshToken Optional refresh token.
|
|
1402
|
-
* @category Authentication
|
|
1403
|
-
*/
|
|
1404
|
-
setAccessToken(accessToken: string, refreshToken?: string): void;
|
|
1405
|
-
/**
|
|
1406
|
-
* Returns the list of available logins.
|
|
1407
|
-
* @returns The list of available logins.
|
|
1408
|
-
* @category Authentication
|
|
1409
|
-
*/
|
|
1410
|
-
getLogins(): LoginState[];
|
|
1411
|
-
private addLogin;
|
|
1412
|
-
private refreshProfile;
|
|
1413
|
-
/**
|
|
1414
|
-
* Returns true if the client is waiting for authentication.
|
|
1415
|
-
* @returns True if the client is waiting for authentication.
|
|
1416
|
-
* @category Authentication
|
|
1417
|
-
*/
|
|
1418
|
-
isLoading(): boolean;
|
|
1419
|
-
/**
|
|
1420
|
-
* Returns true if the current user is authenticated as a super admin.
|
|
1421
|
-
* @returns True if the current user is authenticated as a super admin.
|
|
1422
|
-
* @category Authentication
|
|
1423
|
-
*/
|
|
1424
|
-
isSuperAdmin(): boolean;
|
|
1425
|
-
/**
|
|
1426
|
-
* Returns true if the current user is authenticated as a project admin.
|
|
1427
|
-
* @returns True if the current user is authenticated as a project admin.
|
|
1428
|
-
* @category Authentication
|
|
1429
|
-
*/
|
|
1430
|
-
isProjectAdmin(): boolean;
|
|
1431
|
-
/**
|
|
1432
|
-
* Returns the current project if available.
|
|
1433
|
-
* @returns The current project if available.
|
|
1434
|
-
* @category User Profile
|
|
1435
|
-
*/
|
|
1436
|
-
getProject(): Project | undefined;
|
|
1437
|
-
/**
|
|
1438
|
-
* Returns the current project membership if available.
|
|
1439
|
-
* @returns The current project membership if available.
|
|
1440
|
-
* @category User Profile
|
|
1441
|
-
*/
|
|
1442
|
-
getProjectMembership(): ProjectMembership | undefined;
|
|
1443
|
-
/**
|
|
1444
|
-
* Returns the current user profile resource if available.
|
|
1445
|
-
* This method does not wait for loading promises.
|
|
1446
|
-
* @returns The current user profile resource if available.
|
|
1447
|
-
* @category User Profile
|
|
1448
|
-
*/
|
|
1449
|
-
getProfile(): ProfileResource | undefined;
|
|
1450
|
-
/**
|
|
1451
|
-
* Returns the current user profile resource, retrieving form the server if necessary.
|
|
1452
|
-
* This method waits for loading promises.
|
|
1453
|
-
* @returns The current user profile resource.
|
|
1454
|
-
* @category User Profile
|
|
1455
|
-
*/
|
|
1456
|
-
getProfileAsync(): Promise<ProfileResource | undefined>;
|
|
1457
|
-
/**
|
|
1458
|
-
* Returns the current user configuration if available.
|
|
1459
|
-
* @returns The current user configuration if available.
|
|
1460
|
-
* @category User Profile
|
|
1461
|
-
*/
|
|
1462
|
-
getUserConfiguration(): UserConfiguration | undefined;
|
|
1463
|
-
/**
|
|
1464
|
-
* Returns the current user access policy if available.
|
|
1465
|
-
* @returns The current user access policy if available.
|
|
1466
|
-
* @category User Profile
|
|
1467
|
-
*/
|
|
1468
|
-
getAccessPolicy(): AccessPolicy | undefined;
|
|
1469
|
-
/**
|
|
1470
|
-
* Downloads the URL as a blob. Can accept binary URLs in the form of `Binary/{id}` as well.
|
|
1471
|
-
* @category Read
|
|
1472
|
-
* @param url The URL to request. Can be a standard URL or one in the form of `Binary/{id}`.
|
|
1473
|
-
* @param options Optional fetch request init options.
|
|
1474
|
-
* @returns Promise to the response body as a blob.
|
|
1475
|
-
*/
|
|
1476
|
-
download(url: URL | string, options?: RequestInit): Promise<Blob>;
|
|
1477
|
-
/**
|
|
1478
|
-
* Upload media to the server and create a Media instance for the uploaded content.
|
|
1479
|
-
* @param contents The contents of the media file, as a string, Uint8Array, File, or Blob.
|
|
1480
|
-
* @param contentType The media type of the content.
|
|
1481
|
-
* @param filename The name of the file to be uploaded, or undefined if not applicable.
|
|
1482
|
-
* @param additionalFields Additional fields for Media.
|
|
1483
|
-
* @param options Optional fetch options.
|
|
1484
|
-
* @returns Promise that resolves to the created Media
|
|
1485
|
-
*/
|
|
1486
|
-
uploadMedia(contents: string | Uint8Array | File | Blob, contentType: string, filename: string | undefined, additionalFields?: Partial<Media>, options?: RequestInit): Promise<Media>;
|
|
1487
|
-
/**
|
|
1488
|
-
* Performs Bulk Data Export operation request flow. See The FHIR "Bulk Data Export" for full details: https://build.fhir.org/ig/HL7/bulk-data/export.html#bulk-data-export
|
|
1489
|
-
* @param exportLevel Optional export level. Defaults to system level export. 'Group/:id' - Group of Patients, 'Patient' - All Patients.
|
|
1490
|
-
* @param resourceTypes A string of comma-delimited FHIR resource types.
|
|
1491
|
-
* @param since Resources will be included in the response if their state has changed after the supplied time (e.g. if Resource.meta.lastUpdated is later than the supplied _since time).
|
|
1492
|
-
* @param options Optional fetch options.
|
|
1493
|
-
* @returns Bulk Data Response containing links to Bulk Data files. See "Response - Complete Status" for full details: https://build.fhir.org/ig/HL7/bulk-data/export.html#response---complete-status
|
|
1494
|
-
*/
|
|
1495
|
-
bulkExport(exportLevel?: string, resourceTypes?: string, since?: string, options?: RequestInit): Promise<Partial<BulkDataExport>>;
|
|
1496
|
-
/**
|
|
1497
|
-
* Starts an async request following the FHIR "Asynchronous Request Pattern".
|
|
1498
|
-
* See: https://hl7.org/fhir/r4/async.html
|
|
1499
|
-
* @param url The URL to request.
|
|
1500
|
-
* @param options Optional fetch options.
|
|
1501
|
-
* @returns The response body.
|
|
1502
|
-
*/
|
|
1503
|
-
startAsyncRequest<T>(url: string, options?: RequestInit): Promise<T>;
|
|
1504
|
-
/**
|
|
1505
|
-
* Returns the cache entry if available and not expired.
|
|
1506
|
-
* @param key The cache key to retrieve.
|
|
1507
|
-
* @param options Optional fetch options for cache settings.
|
|
1508
|
-
* @returns The cached entry if found.
|
|
1509
|
-
*/
|
|
1510
|
-
private getCacheEntry;
|
|
1511
|
-
/**
|
|
1512
|
-
* Adds a readable promise to the cache.
|
|
1513
|
-
* @param key The cache key to store.
|
|
1514
|
-
* @param value The readable promise to store.
|
|
1515
|
-
*/
|
|
1516
|
-
private setCacheEntry;
|
|
1517
|
-
/**
|
|
1518
|
-
* Adds a concrete value as the cache entry for the given resource.
|
|
1519
|
-
* This is used in cases where the resource is loaded indirectly.
|
|
1520
|
-
* For example, when a resource is loaded as part of a Bundle.
|
|
1521
|
-
* @param resource The resource to cache.
|
|
1522
|
-
*/
|
|
1523
|
-
private cacheResource;
|
|
1524
|
-
/**
|
|
1525
|
-
* Deletes a cache entry.
|
|
1526
|
-
* @param key The cache key to delete.
|
|
1527
|
-
*/
|
|
1528
|
-
private deleteCacheEntry;
|
|
1529
|
-
/**
|
|
1530
|
-
* Makes an HTTP request.
|
|
1531
|
-
* @param method The HTTP method (GET, POST, etc).
|
|
1532
|
-
* @param url The target URL.
|
|
1533
|
-
* @param options Optional fetch request init options.
|
|
1534
|
-
* @returns The JSON content body if available.
|
|
1535
|
-
*/
|
|
1536
|
-
private request;
|
|
1537
|
-
private parseResponse;
|
|
1538
|
-
private fetchWithRetry;
|
|
1539
|
-
private logRequest;
|
|
1540
|
-
private logResponse;
|
|
1541
|
-
private pollStatus;
|
|
1542
|
-
/**
|
|
1543
|
-
* Executes a batch of requests that were automatically batched together.
|
|
1544
|
-
*/
|
|
1545
|
-
private executeAutoBatch;
|
|
1546
|
-
/**
|
|
1547
|
-
* Adds default options to the fetch options.
|
|
1548
|
-
* @param options The options to add defaults to.
|
|
1549
|
-
*/
|
|
1550
|
-
private addFetchOptionsDefaults;
|
|
1551
|
-
/**
|
|
1552
|
-
* Sets the "Content-Type" header on fetch options.
|
|
1553
|
-
* @param options The fetch options.
|
|
1554
|
-
* @param contentType The new content type to set.
|
|
1555
|
-
*/
|
|
1556
|
-
private setRequestContentType;
|
|
1557
|
-
/**
|
|
1558
|
-
* Sets the body on fetch options.
|
|
1559
|
-
* @param options The fetch options.
|
|
1560
|
-
* @param data The new content body.
|
|
1561
|
-
*/
|
|
1562
|
-
private setRequestBody;
|
|
1563
|
-
/**
|
|
1564
|
-
* Handles an unauthenticated response from the server.
|
|
1565
|
-
* First, tries to refresh the access token and retry the request.
|
|
1566
|
-
* Otherwise, calls unauthenticated callbacks and rejects.
|
|
1567
|
-
* @param method The HTTP method of the original request.
|
|
1568
|
-
* @param url The URL of the original request.
|
|
1569
|
-
* @param options Optional fetch request init options.
|
|
1570
|
-
* @returns The result of the retry.
|
|
1571
|
-
*/
|
|
1572
|
-
private handleUnauthenticated;
|
|
1573
|
-
/**
|
|
1574
|
-
* Starts a new PKCE flow.
|
|
1575
|
-
* These PKCE values are stateful, and must survive redirects and page refreshes.
|
|
1576
|
-
* @category Authentication
|
|
1577
|
-
* @returns The PKCE code challenge details.
|
|
1578
|
-
*/
|
|
1579
|
-
startPkce(): Promise<{
|
|
1580
|
-
codeChallengeMethod: CodeChallengeMethod;
|
|
1581
|
-
codeChallenge: string;
|
|
1582
|
-
}>;
|
|
1583
|
-
/**
|
|
1584
|
-
* Redirects the user to the login screen for authorization.
|
|
1585
|
-
* Clears all auth state including local storage and session storage.
|
|
1586
|
-
* @param loginParams The authorization login parameters.
|
|
1587
|
-
* @see https://openid.net/specs/openid-connect-core-1_0.html#AuthorizationEndpoint
|
|
1588
|
-
*/
|
|
1589
|
-
private requestAuthorization;
|
|
1590
|
-
/**
|
|
1591
|
-
* Processes an OAuth authorization code.
|
|
1592
|
-
* See: https://openid.net/specs/openid-connect-core-1_0.html#TokenRequest
|
|
1593
|
-
* @param code The authorization code received by URL parameter.
|
|
1594
|
-
* @param loginParams Optional login parameters.
|
|
1595
|
-
* @returns The user profile resource.
|
|
1596
|
-
* @category Authentication
|
|
1597
|
-
*/
|
|
1598
|
-
processCode(code: string, loginParams?: Partial<BaseLoginRequest>): Promise<ProfileResource>;
|
|
1599
|
-
/**
|
|
1600
|
-
* Tries to refresh the auth tokens.
|
|
1601
|
-
* @returns The refresh promise if available; otherwise undefined.
|
|
1602
|
-
* @see https://openid.net/specs/openid-connect-core-1_0.html#RefreshTokens
|
|
1603
|
-
*/
|
|
1604
|
-
private refresh;
|
|
1605
|
-
/**
|
|
1606
|
-
* Starts a new OAuth2 client credentials flow.
|
|
1607
|
-
*
|
|
1608
|
-
* ```typescript
|
|
1609
|
-
* await medplum.startClientLogin(process.env.MEDPLUM_CLIENT_ID, process.env.MEDPLUM_CLIENT_SECRET)
|
|
1610
|
-
* // Example Search
|
|
1611
|
-
* await medplum.searchResources('Patient')
|
|
1612
|
-
* ```
|
|
1613
|
-
*
|
|
1614
|
-
* See: https://datatracker.ietf.org/doc/html/rfc6749#section-4.4
|
|
1615
|
-
*
|
|
1616
|
-
* @category Authentication
|
|
1617
|
-
* @param clientId The client ID.
|
|
1618
|
-
* @param clientSecret The client secret.
|
|
1619
|
-
* @returns Promise that resolves to the client profile.
|
|
1620
|
-
*/
|
|
1621
|
-
startClientLogin(clientId: string, clientSecret: string): Promise<ProfileResource>;
|
|
1622
|
-
/**
|
|
1623
|
-
* Starts a new OAuth2 JWT bearer flow.
|
|
1624
|
-
*
|
|
1625
|
-
* ```typescript
|
|
1626
|
-
* await medplum.startJwtBearerLogin(process.env.MEDPLUM_CLIENT_ID, process.env.MEDPLUM_JWT_BEARER_ASSERTION, 'openid profile');
|
|
1627
|
-
* // Example Search
|
|
1628
|
-
* await medplum.searchResources('Patient')
|
|
1629
|
-
* ```
|
|
1630
|
-
*
|
|
1631
|
-
* See: https://datatracker.ietf.org/doc/html/rfc7523#section-2.1
|
|
1632
|
-
*
|
|
1633
|
-
* @category Authentication
|
|
1634
|
-
* @param clientId The client ID.
|
|
1635
|
-
* @param assertion The JWT assertion.
|
|
1636
|
-
* @param scope The OAuth scope.
|
|
1637
|
-
* @returns Promise that resolves to the client profile.
|
|
1638
|
-
*/
|
|
1639
|
-
startJwtBearerLogin(clientId: string, assertion: string, scope: string): Promise<ProfileResource>;
|
|
1640
|
-
/**
|
|
1641
|
-
* Starts a new OAuth2 JWT assertion flow.
|
|
1642
|
-
*
|
|
1643
|
-
* See: https://datatracker.ietf.org/doc/html/rfc7523#section-2.2
|
|
1644
|
-
*
|
|
1645
|
-
* @category Authentication
|
|
1646
|
-
* @param jwt The JWT assertion.
|
|
1647
|
-
* @returns Promise that resolves to the client profile.
|
|
1648
|
-
*/
|
|
1649
|
-
startJwtAssertionLogin(jwt: string): Promise<ProfileResource>;
|
|
1650
|
-
/**
|
|
1651
|
-
* Sets the client ID and secret for basic auth.
|
|
1652
|
-
*
|
|
1653
|
-
* ```typescript
|
|
1654
|
-
* medplum.setBasicAuth(process.env.MEDPLUM_CLIENT_ID, process.env.MEDPLUM_CLIENT_SECRET)
|
|
1655
|
-
* // Example Search
|
|
1656
|
-
* await medplum.searchResources('Patient')
|
|
1657
|
-
* ```
|
|
1658
|
-
* @category Authentication
|
|
1659
|
-
* @param clientId The client ID.
|
|
1660
|
-
* @param clientSecret The client secret.
|
|
1661
|
-
*/
|
|
1662
|
-
setBasicAuth(clientId: string, clientSecret: string): void;
|
|
1663
|
-
/**
|
|
1664
|
-
* Subscribes to a specified topic, listening for a list of specified events.
|
|
1665
|
-
*
|
|
1666
|
-
* Once you have the `SubscriptionRequest` returned from this method, you can call `fhircastConnect(subscriptionRequest)` to connect to the subscription stream.
|
|
1667
|
-
*
|
|
1668
|
-
* @category FHIRcast
|
|
1669
|
-
* @param topic The topic to publish to. Usually a UUID.
|
|
1670
|
-
* @param events An array of event names to listen for.
|
|
1671
|
-
* @returns A `Promise` that resolves once the request completes, or rejects if it fails.
|
|
1672
|
-
*/
|
|
1673
|
-
fhircastSubscribe(topic: string, events: FhircastEventName[]): Promise<SubscriptionRequest>;
|
|
1674
|
-
/**
|
|
1675
|
-
* Unsubscribes from the specified topic.
|
|
1676
|
-
*
|
|
1677
|
-
* @category FHIRcast
|
|
1678
|
-
* @param subRequest A `SubscriptionRequest` representing a subscription to cancel. Mode will be set to `unsubscribe` automatically.
|
|
1679
|
-
* @returns A `Promise` that resolves when request to unsubscribe is completed.
|
|
1680
|
-
*/
|
|
1681
|
-
fhircastUnsubscribe(subRequest: SubscriptionRequest): Promise<void>;
|
|
1682
|
-
/**
|
|
1683
|
-
* Connects to a `FHIRcast` session.
|
|
1684
|
-
*
|
|
1685
|
-
* @category FHIRcast
|
|
1686
|
-
* @param subRequest The `SubscriptionRequest` to use for connecting.
|
|
1687
|
-
* @returns A `FhircastConnection` which emits lifecycle events for the `FHIRcast` WebSocket connection.
|
|
1688
|
-
*/
|
|
1689
|
-
fhircastConnect(subRequest: SubscriptionRequest): FhircastConnection;
|
|
1690
|
-
/**
|
|
1691
|
-
* Publishes a new context to a given topic for a specified event type.
|
|
1692
|
-
*
|
|
1693
|
-
* @category FHIRcast
|
|
1694
|
-
* @param topic The topic to publish to. Usually a UUID.
|
|
1695
|
-
* @param event The name of the event to publish an updated context for, ie. `patient-open`.
|
|
1696
|
-
* @param context The updated context containing resources relevant to this event.
|
|
1697
|
-
* @returns A `Promise` that resolves once the request completes, or rejects if it fails.
|
|
1698
|
-
*/
|
|
1699
|
-
fhircastPublish(topic: string, event: FhircastEventName, context: FhircastEventContext | FhircastEventContext[]): Promise<void>;
|
|
1700
|
-
/**
|
|
1701
|
-
* Invite a user to a project.
|
|
1702
|
-
* @param projectId The project ID.
|
|
1703
|
-
* @param body The InviteRequest.
|
|
1704
|
-
* @returns Promise that returns a project membership or an operation outcome.
|
|
1705
|
-
*/
|
|
1706
|
-
invite(projectId: string, body: InviteRequest): Promise<ProjectMembership | OperationOutcome>;
|
|
1707
|
-
/**
|
|
1708
|
-
* Makes a POST request to the tokens endpoint.
|
|
1709
|
-
* See: https://openid.net/specs/openid-connect-core-1_0.html#TokenEndpoint
|
|
1710
|
-
* @param formBody Token parameters in URL encoded format.
|
|
1711
|
-
* @returns The user profile resource.
|
|
1712
|
-
*/
|
|
1713
|
-
private fetchTokens;
|
|
1714
|
-
/**
|
|
1715
|
-
* Verifies the tokens received from the auth server.
|
|
1716
|
-
* Validates the JWT against the JWKS.
|
|
1717
|
-
* See: https://openid.net/specs/openid-connect-core-1_0.html#TokenEndpoint
|
|
1718
|
-
* @param tokens The token response.
|
|
1719
|
-
* @returns Promise to complete.
|
|
1720
|
-
*/
|
|
1721
|
-
private verifyTokens;
|
|
1722
|
-
/**
|
|
1723
|
-
* Sets up a listener for window storage events.
|
|
1724
|
-
* This synchronizes state across browser windows and browser tabs.
|
|
1725
|
-
*/
|
|
1726
|
-
private setupStorageListener;
|
|
1727
|
-
private retryCatch;
|
|
1728
|
-
}
|