@medplum/core 2.1.8 → 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 +3 -3
- package/dist/cjs/index.cjs.map +4 -4
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/index.mjs.map +4 -4
- 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 -57
- 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 -202
- 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.d.ts
ADDED
|
@@ -0,0 +1,4181 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
|
|
3
|
+
import { AccessPolicy } from '@medplum/fhirtypes';
|
|
4
|
+
import { AccessPolicyResource } from '@medplum/fhirtypes';
|
|
5
|
+
import { Address } from '@medplum/fhirtypes';
|
|
6
|
+
import { Agent } from '@medplum/fhirtypes';
|
|
7
|
+
import { Attachment } from '@medplum/fhirtypes';
|
|
8
|
+
import { Binary } from '@medplum/fhirtypes';
|
|
9
|
+
import { BulkDataExport } from '@medplum/fhirtypes';
|
|
10
|
+
import { Bundle } from '@medplum/fhirtypes';
|
|
11
|
+
import { CodeableConcept } from '@medplum/fhirtypes';
|
|
12
|
+
import { Coding } from '@medplum/fhirtypes';
|
|
13
|
+
import { Communication } from '@medplum/fhirtypes';
|
|
14
|
+
import type { CustomTableLayout } from 'pdfmake/interfaces';
|
|
15
|
+
import { Device } from '@medplum/fhirtypes';
|
|
16
|
+
import { ElementDefinition } from '@medplum/fhirtypes';
|
|
17
|
+
import { ElementDefinitionBinding } from '@medplum/fhirtypes';
|
|
18
|
+
import { Extension } from '@medplum/fhirtypes';
|
|
19
|
+
import { ExtractResource } from '@medplum/fhirtypes';
|
|
20
|
+
import { HumanName } from '@medplum/fhirtypes';
|
|
21
|
+
import { Identifier } from '@medplum/fhirtypes';
|
|
22
|
+
import { Media } from '@medplum/fhirtypes';
|
|
23
|
+
import { Money } from '@medplum/fhirtypes';
|
|
24
|
+
import { Observation } from '@medplum/fhirtypes';
|
|
25
|
+
import { ObservationComponent } from '@medplum/fhirtypes';
|
|
26
|
+
import { ObservationDefinition } from '@medplum/fhirtypes';
|
|
27
|
+
import { ObservationDefinitionQualifiedInterval } from '@medplum/fhirtypes';
|
|
28
|
+
import { OperationOutcome } from '@medplum/fhirtypes';
|
|
29
|
+
import { OperationOutcomeIssue } from '@medplum/fhirtypes';
|
|
30
|
+
import { Patient } from '@medplum/fhirtypes';
|
|
31
|
+
import { Period } from '@medplum/fhirtypes';
|
|
32
|
+
import { Practitioner } from '@medplum/fhirtypes';
|
|
33
|
+
import { Project } from '@medplum/fhirtypes';
|
|
34
|
+
import { ProjectMembership } from '@medplum/fhirtypes';
|
|
35
|
+
import { ProjectMembershipAccess } from '@medplum/fhirtypes';
|
|
36
|
+
import { ProjectSecret } from '@medplum/fhirtypes';
|
|
37
|
+
import { Quantity } from '@medplum/fhirtypes';
|
|
38
|
+
import { QuestionnaireResponse } from '@medplum/fhirtypes';
|
|
39
|
+
import { QuestionnaireResponseItemAnswer } from '@medplum/fhirtypes';
|
|
40
|
+
import { Range as Range_2 } from '@medplum/fhirtypes';
|
|
41
|
+
import { Readable } from 'stream';
|
|
42
|
+
import { Reference } from '@medplum/fhirtypes';
|
|
43
|
+
import { RelatedPerson } from '@medplum/fhirtypes';
|
|
44
|
+
import { Resource } from '@medplum/fhirtypes';
|
|
45
|
+
import { ResourceType } from '@medplum/fhirtypes';
|
|
46
|
+
import { SearchParameter } from '@medplum/fhirtypes';
|
|
47
|
+
import { StructureDefinition } from '@medplum/fhirtypes';
|
|
48
|
+
import { StructureMap } from '@medplum/fhirtypes';
|
|
49
|
+
import type { TDocumentDefinitions } from 'pdfmake/interfaces';
|
|
50
|
+
import type { TFontDictionary } from 'pdfmake/interfaces';
|
|
51
|
+
import { Timing } from '@medplum/fhirtypes';
|
|
52
|
+
import { UserConfiguration } from '@medplum/fhirtypes';
|
|
53
|
+
import { ValueSet } from '@medplum/fhirtypes';
|
|
54
|
+
|
|
55
|
+
export declare function accepted(location: string): OperationOutcome;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Interactions with a resource that can be controlled via an access policy.
|
|
59
|
+
*
|
|
60
|
+
* Codes taken from http://hl7.org/fhir/codesystem-restful-interaction.html
|
|
61
|
+
*/
|
|
62
|
+
export declare enum AccessPolicyInteraction {
|
|
63
|
+
READ = "read",
|
|
64
|
+
VREAD = "vread",
|
|
65
|
+
UPDATE = "update",
|
|
66
|
+
PATCH = "patch",
|
|
67
|
+
DELETE = "delete",
|
|
68
|
+
HISTORY = "history",
|
|
69
|
+
HISTORY_INSTANCE = "history-instance",
|
|
70
|
+
HISTORY_TYPE = "history-type",
|
|
71
|
+
HISTORY_SYSTEM = "history-system",
|
|
72
|
+
CREATE = "create",
|
|
73
|
+
SEARCH = "search",
|
|
74
|
+
SEARCH_TYPE = "search-type",
|
|
75
|
+
SEARCH_SYSTEM = "search-system",
|
|
76
|
+
SEARCH_COMPARTMENT = "search-compartment",
|
|
77
|
+
CAPABILITIES = "capabilities",
|
|
78
|
+
TRANSACTION = "transaction",
|
|
79
|
+
BATCH = "batch",
|
|
80
|
+
OPERATION = "operation"
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export declare interface AddressFormatOptions {
|
|
84
|
+
all?: boolean;
|
|
85
|
+
use?: boolean;
|
|
86
|
+
lineSeparator?: string;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export declare const allOk: OperationOutcome;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Converts an ArrayBuffer to a base-64 encoded string.
|
|
93
|
+
* @param arrayBuffer The input array buffer.
|
|
94
|
+
* @returns The base-64 encoded string.
|
|
95
|
+
*/
|
|
96
|
+
export declare function arrayBufferToBase64(arrayBuffer: ArrayBuffer): string;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Converts an ArrayBuffer to hex string.
|
|
100
|
+
* See: https://stackoverflow.com/a/55200387
|
|
101
|
+
* @param arrayBuffer The input array buffer.
|
|
102
|
+
* @returns The resulting hex string.
|
|
103
|
+
*/
|
|
104
|
+
export declare function arrayBufferToHex(arrayBuffer: ArrayBuffer): string;
|
|
105
|
+
|
|
106
|
+
export declare function arrayify<T>(value: T | T[] | undefined): T[] | undefined;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Asserts that the operation completed successfully and that the resource is defined.
|
|
110
|
+
* @param outcome The operation outcome.
|
|
111
|
+
* @param resource The resource that may or may not have been returned.
|
|
112
|
+
*/
|
|
113
|
+
export declare function assertOk<T>(outcome: OperationOutcome, resource: T | undefined): asserts resource is T;
|
|
114
|
+
|
|
115
|
+
export declare interface Atom {
|
|
116
|
+
eval(context: AtomContext, input: TypedValue[]): TypedValue[];
|
|
117
|
+
toString(): string;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export declare interface AtomContext {
|
|
121
|
+
parent?: AtomContext;
|
|
122
|
+
variables: Record<string, TypedValue>;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export declare function badRequest(details: string, expression?: string): OperationOutcome;
|
|
126
|
+
|
|
127
|
+
export declare interface BaseLoginRequest {
|
|
128
|
+
readonly projectId?: string;
|
|
129
|
+
readonly clientId?: string;
|
|
130
|
+
readonly resourceType?: string;
|
|
131
|
+
readonly scope?: string;
|
|
132
|
+
readonly nonce?: string;
|
|
133
|
+
readonly codeChallenge?: string;
|
|
134
|
+
readonly codeChallengeMethod?: CodeChallengeMethod;
|
|
135
|
+
readonly googleClientId?: string;
|
|
136
|
+
readonly launch?: string;
|
|
137
|
+
readonly redirectUri?: string;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export declare type BaseSchema = Record<string, {
|
|
141
|
+
elements: Record<string, Partial<InternalSchemaElement>>;
|
|
142
|
+
}>;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Source for a FHIR Binary.
|
|
146
|
+
*/
|
|
147
|
+
export declare type BinarySource = string | File | Blob | Uint8Array;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Returns a single element array with a typed boolean value.
|
|
151
|
+
* @param value The primitive boolean value.
|
|
152
|
+
* @returns Single element array with a typed boolean value.
|
|
153
|
+
*/
|
|
154
|
+
export declare function booleanToTypedValue(value: boolean): [TypedValue];
|
|
155
|
+
|
|
156
|
+
export declare interface BotEvent<T = Resource | Hl7Message | string | Record<string, any>> {
|
|
157
|
+
readonly contentType: string;
|
|
158
|
+
readonly input: T;
|
|
159
|
+
readonly secrets: Record<string, ProjectSecret>;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export declare function buildTypeName(components: string[]): string;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Calculates the age in years from the birth date.
|
|
166
|
+
* @param birthDateStr The birth date or start date in ISO-8601 format YYYY-MM-DD.
|
|
167
|
+
* @param endDateStr Optional end date in ISO-8601 format YYYY-MM-DD. Default value is today.
|
|
168
|
+
* @returns The age in years, months, and days.
|
|
169
|
+
*/
|
|
170
|
+
export declare function calculateAge(birthDateStr: string, endDateStr?: string): {
|
|
171
|
+
years: number;
|
|
172
|
+
months: number;
|
|
173
|
+
days: number;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Calculates the age string for display using the age appropriate units.
|
|
178
|
+
* If the age is greater than or equal to 2 years, then the age is displayed in years.
|
|
179
|
+
* If the age is greater than or equal to 1 month, then the age is displayed in months.
|
|
180
|
+
* Otherwise, the age is displayed in days.
|
|
181
|
+
* @param birthDateStr The birth date or start date in ISO-8601 format YYYY-MM-DD.
|
|
182
|
+
* @param endDateStr Optional end date in ISO-8601 format YYYY-MM-DD. Default value is today.
|
|
183
|
+
* @returns The age string.
|
|
184
|
+
*/
|
|
185
|
+
export declare function calculateAgeString(birthDateStr: string, endDateStr?: string): string | undefined;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Determines if the current user can read the specified resource type.
|
|
189
|
+
* @param accessPolicy The access policy.
|
|
190
|
+
* @param resourceType The resource type.
|
|
191
|
+
* @returns True if the current user can read the specified resource type.
|
|
192
|
+
*/
|
|
193
|
+
export declare function canReadResourceType(accessPolicy: AccessPolicy, resourceType: ResourceType): boolean;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Determines if the current user can write the specified resource.
|
|
197
|
+
* This is a more in-depth check after building the candidate result of a write operation.
|
|
198
|
+
* @param accessPolicy The access policy.
|
|
199
|
+
* @param resource The resource.
|
|
200
|
+
* @returns True if the current user can write the specified resource type.
|
|
201
|
+
*/
|
|
202
|
+
export declare function canWriteResource(accessPolicy: AccessPolicy, resource: Resource): boolean;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Determines if the current user can write the specified resource type.
|
|
206
|
+
* This is a preliminary check before evaluating a write operation in depth.
|
|
207
|
+
* If a user cannot write a resource type at all, then don't bother looking up previous versions.
|
|
208
|
+
* @param accessPolicy The access policy.
|
|
209
|
+
* @param resourceType The resource type.
|
|
210
|
+
* @returns True if the current user can write the specified resource type.
|
|
211
|
+
*/
|
|
212
|
+
export declare function canWriteResourceType(accessPolicy: AccessPolicy, resourceType: ResourceType): boolean;
|
|
213
|
+
|
|
214
|
+
export declare function capitalize(word: string): string;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Recursively checks for null values in an object.
|
|
218
|
+
*
|
|
219
|
+
* Note that "null" is a special value in JSON that is not allowed in FHIR.
|
|
220
|
+
* @param value Input value of any type.
|
|
221
|
+
* @param path Path string to the value for OperationOutcome.
|
|
222
|
+
* @param issues Output list of issues.
|
|
223
|
+
*/
|
|
224
|
+
export declare function checkForNull(value: unknown, path: string, issues: OperationOutcomeIssue[]): void;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* The ClientStorage class is a utility class for storing strings and objects.
|
|
228
|
+
*
|
|
229
|
+
* When using MedplumClient in the browser, it will be backed by browser localStorage.
|
|
230
|
+
*
|
|
231
|
+
* When Using MedplumClient in the server, it will be backed by the MemoryStorage class. For example, the Medplum CLI uses `FileSystemStorage`.
|
|
232
|
+
*/
|
|
233
|
+
export declare class ClientStorage {
|
|
234
|
+
private readonly storage;
|
|
235
|
+
constructor();
|
|
236
|
+
clear(): void;
|
|
237
|
+
getString(key: string): string | undefined;
|
|
238
|
+
setString(key: string, value: string | undefined): void;
|
|
239
|
+
getObject<T>(key: string): T | undefined;
|
|
240
|
+
setObject<T>(key: string, value: T): void;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
declare interface Code {
|
|
244
|
+
code?: CodeableConcept;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Allowed values for `code_challenge_method` in a PKCE exchange.
|
|
249
|
+
* @internal
|
|
250
|
+
*/
|
|
251
|
+
export declare type CodeChallengeMethod = 'plain' | 'S256';
|
|
252
|
+
|
|
253
|
+
export declare function compressElement(element: InternalSchemaElement): Partial<InternalSchemaElement>;
|
|
254
|
+
|
|
255
|
+
export declare interface Constraint {
|
|
256
|
+
key: string;
|
|
257
|
+
severity: 'error' | 'warning';
|
|
258
|
+
expression: string;
|
|
259
|
+
description: string;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Content type constants.
|
|
264
|
+
*/
|
|
265
|
+
export declare const ContentType: {
|
|
266
|
+
CSS: string;
|
|
267
|
+
FAVICON: string;
|
|
268
|
+
FHIR_JSON: string;
|
|
269
|
+
FORM_URL_ENCODED: string;
|
|
270
|
+
HL7_V2: string;
|
|
271
|
+
HTML: string;
|
|
272
|
+
JAVASCRIPT: string;
|
|
273
|
+
JSON: string;
|
|
274
|
+
JSON_PATCH: string;
|
|
275
|
+
PNG: string;
|
|
276
|
+
SVG: string;
|
|
277
|
+
TEXT: string;
|
|
278
|
+
TYPESCRIPT: string;
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Converts a resource with contained resources to a transaction bundle.
|
|
283
|
+
* This function is useful when creating a resource that contains other resources.
|
|
284
|
+
* Handles local references and topological sorting.
|
|
285
|
+
* @param resource The input resource which may or may not include contained resources.
|
|
286
|
+
* @returns A bundle with the input resource and all contained resources.
|
|
287
|
+
*/
|
|
288
|
+
export declare function convertContainedResourcesToBundle(resource: Resource & {
|
|
289
|
+
contained?: Resource[];
|
|
290
|
+
}): Bundle;
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* More on Bundles can be found here
|
|
294
|
+
* http://hl7.org/fhir/R4/bundle.html
|
|
295
|
+
*/
|
|
296
|
+
/**
|
|
297
|
+
* Takes a bundle and creates a Transaction Type bundle
|
|
298
|
+
* @param bundle The Bundle object that we'll receive from the search query
|
|
299
|
+
* @returns transaction type bundle
|
|
300
|
+
*/
|
|
301
|
+
export declare function convertToTransactionBundle(bundle: Bundle): Bundle;
|
|
302
|
+
|
|
303
|
+
export declare const CPT = "http://www.ama-assn.org/go/cpt";
|
|
304
|
+
|
|
305
|
+
export declare function crawlResource(resource: Resource, visitor: ResourceVisitor, schema?: InternalTypeSchema, initialPath?: string): void;
|
|
306
|
+
|
|
307
|
+
export declare function createConstraintIssue(expression: string, constraint: Constraint): OperationOutcomeIssue;
|
|
308
|
+
|
|
309
|
+
export declare const created: OperationOutcome;
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Creates a serializable JSON payload for the `FHIRcast` protocol
|
|
313
|
+
*
|
|
314
|
+
* @param topic The topic that this message will be published on. Usually a UUID.
|
|
315
|
+
* @param event The event name, ie. "patient-open" or "patient-close".
|
|
316
|
+
* @param context The updated context, containing new versions of resources related to this event.
|
|
317
|
+
* @returns A serializable `FhircastMessagePayload`.
|
|
318
|
+
*/
|
|
319
|
+
export declare function createFhircastMessagePayload(topic: string, event: FhircastEventName, context: FhircastEventContext | FhircastEventContext[]): FhircastMessagePayload;
|
|
320
|
+
|
|
321
|
+
export declare interface CreatePdfFunction {
|
|
322
|
+
(docDefinition: TDocumentDefinitions, tableLayouts?: Record<string, CustomTableLayout> | undefined, fonts?: TFontDictionary | undefined): Promise<any>;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export declare function createProcessingIssue(expression: string, message: string, err: Error, data?: Record<string, any>): OperationOutcomeIssue;
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Creates a reference resource.
|
|
329
|
+
* @param resource The FHIR reesource.
|
|
330
|
+
* @returns A reference resource.
|
|
331
|
+
*/
|
|
332
|
+
export declare function createReference<T extends Resource>(resource: T): Reference<T>;
|
|
333
|
+
|
|
334
|
+
export declare function createStructureIssue(expression: string, details: string): OperationOutcomeIssue;
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Decodes a base64 string.
|
|
338
|
+
* Handles both browser and Node environments.
|
|
339
|
+
* @param data The base-64 encoded input string.
|
|
340
|
+
* @returns The decoded string.
|
|
341
|
+
*/
|
|
342
|
+
export declare function decodeBase64(data: string): string;
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Creates a deep clone of the input value.
|
|
346
|
+
*
|
|
347
|
+
* Limitations:
|
|
348
|
+
* - Only supports JSON primitives and arrays.
|
|
349
|
+
* - Does not support Functions, lambdas, etc.
|
|
350
|
+
* - Does not support circular references.
|
|
351
|
+
*
|
|
352
|
+
* See: https://web.dev/structured-clone/
|
|
353
|
+
* See: https://stackoverflow.com/questions/40488190/how-is-structured-clone-algorithm-different-from-deep-copy
|
|
354
|
+
* @param input The input to clone.
|
|
355
|
+
* @returns A deep clone of the input.
|
|
356
|
+
*/
|
|
357
|
+
export declare function deepClone<T>(input: T): T;
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Resource equality.
|
|
361
|
+
* Ignores meta.versionId and meta.lastUpdated.
|
|
362
|
+
* @param object1 The first object.
|
|
363
|
+
* @param object2 The second object.
|
|
364
|
+
* @param path Optional path string.
|
|
365
|
+
* @returns True if the objects are equal.
|
|
366
|
+
*/
|
|
367
|
+
export declare function deepEquals(object1: unknown, object2: unknown, path?: string): boolean;
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Checks if object2 includes all fields and values of object1.
|
|
371
|
+
* It doesn't matter if object2 has extra fields.
|
|
372
|
+
* @param value The object to test if contained in pattern.
|
|
373
|
+
* @param pattern The object to test against.
|
|
374
|
+
* @returns True if pattern includes all fields and values of value.
|
|
375
|
+
*/
|
|
376
|
+
export declare function deepIncludes(value: any, pattern: any): boolean;
|
|
377
|
+
|
|
378
|
+
export declare const DEFAULT_ACCEPT: string;
|
|
379
|
+
|
|
380
|
+
export declare const DEFAULT_SEARCH_COUNT = 20;
|
|
381
|
+
|
|
382
|
+
export declare interface ElementType {
|
|
383
|
+
code: string;
|
|
384
|
+
targetProfile?: string[];
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
export declare interface EmailPasswordLoginRequest extends BaseLoginRequest {
|
|
388
|
+
readonly email: string;
|
|
389
|
+
readonly password: string;
|
|
390
|
+
/** @deprecated Use scope of "offline" or "offline_access" instead. */
|
|
391
|
+
readonly remember?: boolean;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Encodes a base64 string.
|
|
396
|
+
* Handles both browser and Node environments.
|
|
397
|
+
* @param data The unencoded input string.
|
|
398
|
+
* @returns The base-64 encoded string.
|
|
399
|
+
*/
|
|
400
|
+
export declare function encodeBase64(data: string): string;
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Encrypts a string with SHA256 encryption.
|
|
404
|
+
* @param str The unencrypted input string.
|
|
405
|
+
* @returns The encrypted value in an ArrayBuffer.
|
|
406
|
+
*/
|
|
407
|
+
export declare function encryptSHA256(str: string): Promise<ArrayBuffer>;
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Evaluates a FHIRPath expression against a resource or other object.
|
|
411
|
+
* @param expression The FHIRPath expression to parse.
|
|
412
|
+
* @param input The resource or object to evaluate the expression against.
|
|
413
|
+
* @returns The result of the FHIRPath expression against the resource or object.
|
|
414
|
+
*/
|
|
415
|
+
export declare function evalFhirPath(expression: string, input: unknown): unknown[];
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* Evaluates a FHIRPath expression against a resource or other object.
|
|
419
|
+
* @param expression The FHIRPath expression to parse.
|
|
420
|
+
* @param input The resource or object to evaluate the expression against.
|
|
421
|
+
* @param variables A map of variables for eval input.
|
|
422
|
+
* @returns The result of the FHIRPath expression against the resource or object.
|
|
423
|
+
*/
|
|
424
|
+
export declare function evalFhirPathTyped(expression: string, input: TypedValue[], variables?: Record<string, TypedValue>): TypedValue[];
|
|
425
|
+
|
|
426
|
+
declare interface Event_2 {
|
|
427
|
+
readonly type: string;
|
|
428
|
+
readonly defaultPrevented?: boolean;
|
|
429
|
+
}
|
|
430
|
+
export { Event_2 as Event }
|
|
431
|
+
|
|
432
|
+
declare type EventListener_2 = (e: Event_2) => void;
|
|
433
|
+
export { EventListener_2 as EventListener }
|
|
434
|
+
|
|
435
|
+
declare class EventTarget_2 {
|
|
436
|
+
private readonly listeners;
|
|
437
|
+
constructor();
|
|
438
|
+
addEventListener(type: string, callback: EventListener_2): void;
|
|
439
|
+
removeEventListener(type: string, callback: EventListener_2): void;
|
|
440
|
+
dispatchEvent(event: Event_2): boolean;
|
|
441
|
+
}
|
|
442
|
+
export { EventTarget_2 as EventTarget }
|
|
443
|
+
|
|
444
|
+
export declare type ExternalSecret<T extends ExternalSecretPrimitive = ExternalSecretPrimitive> = {
|
|
445
|
+
system: ExternalSecretSystem;
|
|
446
|
+
key: string;
|
|
447
|
+
type: TypeName<T>;
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
export declare type ExternalSecretPrimitive = string | boolean | number;
|
|
451
|
+
|
|
452
|
+
export declare type ExternalSecretPrimitiveType = 'string' | 'boolean' | 'number';
|
|
453
|
+
|
|
454
|
+
export declare type ExternalSecretSystem = keyof typeof ExternalSecretSystems;
|
|
455
|
+
|
|
456
|
+
export declare const ExternalSecretSystems: {
|
|
457
|
+
readonly aws_ssm_parameter_store: "aws_ssm_parameter_store";
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
export declare interface FetchLike {
|
|
461
|
+
(url: string, options?: any): Promise<any>;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
declare const FHIRCAST_CONTEXT_KEY_LOOKUP: {
|
|
465
|
+
readonly study: "ImagingStudy";
|
|
466
|
+
readonly patient: "Patient";
|
|
467
|
+
readonly encounter: "Encounter";
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
declare const FHIRCAST_EVENT_NAMES: {
|
|
471
|
+
readonly 'patient-open': "patient-open";
|
|
472
|
+
readonly 'patient-close': "patient-close";
|
|
473
|
+
readonly 'imagingstudy-open': "imagingstudy-open";
|
|
474
|
+
readonly 'imagingstudy-close': "imagingstudy-close";
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
declare const FHIRCAST_RESOURCE_TYPES: readonly ["Patient", "Encounter", "ImagingStudy"];
|
|
478
|
+
|
|
479
|
+
export declare type FhircastConnectEvent = {
|
|
480
|
+
type: 'connect';
|
|
481
|
+
};
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* A class representing a `FHIRcast` connection.
|
|
485
|
+
*
|
|
486
|
+
* `FhircastConnection` extends `EventTarget` and emits 3 lifecycle events:
|
|
487
|
+
* 1. `connect` - An event to signal when a WebSocket connection has been opened. Fired as soon as a WebSocket emits `open`.
|
|
488
|
+
* 2. `message` - Contains a `payload` field containing a `FHIRcast` message payload exactly as it comes in over WebSockets.
|
|
489
|
+
* 3. `disconnect` - An event to signal when a WebSocket connection has been closed. Fired as soon as a WebSocket emits `close`.
|
|
490
|
+
*
|
|
491
|
+
* To close the connection, call `connection.disconnect()` and listen to the `disconnect` event to know when the connection has been disconnected.
|
|
492
|
+
*/
|
|
493
|
+
export declare class FhircastConnection extends TypedEventTarget<FhircastSubscriptionEventMap> {
|
|
494
|
+
subRequest: SubscriptionRequest;
|
|
495
|
+
private websocket;
|
|
496
|
+
/**
|
|
497
|
+
* Creates a new `FhircastConnection`.
|
|
498
|
+
* @param subRequest The subscription request to initialize the connection from.
|
|
499
|
+
*/
|
|
500
|
+
constructor(subRequest: SubscriptionRequest);
|
|
501
|
+
disconnect(): void;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
export declare type FhircastDisconnectEvent = {
|
|
505
|
+
type: 'disconnect';
|
|
506
|
+
};
|
|
507
|
+
|
|
508
|
+
export declare type FhircastEventContext<K extends FhircastEventContextKey = FhircastEventContextKey> = {
|
|
509
|
+
key: K;
|
|
510
|
+
resource: Resource & {
|
|
511
|
+
resourceType: FhircastEventContextMap[K];
|
|
512
|
+
id: string;
|
|
513
|
+
};
|
|
514
|
+
};
|
|
515
|
+
|
|
516
|
+
declare type FhircastEventContextKey = keyof FhircastEventContextMap;
|
|
517
|
+
|
|
518
|
+
declare type FhircastEventContextMap = typeof FHIRCAST_CONTEXT_KEY_LOOKUP;
|
|
519
|
+
|
|
520
|
+
export declare type FhircastEventName = keyof typeof FHIRCAST_EVENT_NAMES;
|
|
521
|
+
|
|
522
|
+
export declare type FhircastEventPayload = {
|
|
523
|
+
'hub.topic': string;
|
|
524
|
+
'hub.event': string;
|
|
525
|
+
context: FhircastEventContext[];
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
export declare type FhircastMessageEvent = {
|
|
529
|
+
type: 'message';
|
|
530
|
+
payload: FhircastMessagePayload;
|
|
531
|
+
};
|
|
532
|
+
|
|
533
|
+
export declare type FhircastMessagePayload = {
|
|
534
|
+
timestamp: string;
|
|
535
|
+
id: string;
|
|
536
|
+
event: FhircastEventPayload;
|
|
537
|
+
};
|
|
538
|
+
|
|
539
|
+
export declare type FhircastResourceType = (typeof FHIRCAST_RESOURCE_TYPES)[number];
|
|
540
|
+
|
|
541
|
+
export declare type FhircastSubscriptionEventMap = {
|
|
542
|
+
connect: FhircastConnectEvent;
|
|
543
|
+
message: FhircastMessageEvent;
|
|
544
|
+
disconnect: FhircastDisconnectEvent;
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* The FhirFilterComparison class represents a comparison expression.
|
|
549
|
+
*/
|
|
550
|
+
export declare class FhirFilterComparison {
|
|
551
|
+
readonly path: string;
|
|
552
|
+
readonly operator: Operator;
|
|
553
|
+
readonly value: string;
|
|
554
|
+
constructor(path: string, operator: Operator, value: string);
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
* The FhirFilterConnective class represents a connective expression.
|
|
559
|
+
* It contains a list of child expressions.
|
|
560
|
+
*/
|
|
561
|
+
export declare class FhirFilterConnective {
|
|
562
|
+
readonly keyword: 'and' | 'or';
|
|
563
|
+
readonly left: FhirFilterExpression;
|
|
564
|
+
readonly right: FhirFilterExpression;
|
|
565
|
+
constructor(keyword: 'and' | 'or', left: FhirFilterExpression, right: FhirFilterExpression);
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* The FhirFilterExpression type is the base type of all filter expressions.
|
|
570
|
+
*/
|
|
571
|
+
export declare type FhirFilterExpression = FhirFilterComparison | FhirFilterNegation | FhirFilterConnective;
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* The FhirFilterNegation class represents a negation expression.
|
|
575
|
+
* It contains a single child expression.
|
|
576
|
+
*/
|
|
577
|
+
export declare class FhirFilterNegation {
|
|
578
|
+
readonly child: FhirFilterExpression;
|
|
579
|
+
constructor(child: FhirFilterExpression);
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* Determines if two arrays are equal according to FHIRPath equality rules.
|
|
584
|
+
* @param x The first array.
|
|
585
|
+
* @param y The second array.
|
|
586
|
+
* @returns FHIRPath true if the arrays are equal.
|
|
587
|
+
*/
|
|
588
|
+
export declare function fhirPathArrayEquals(x: TypedValue[], y: TypedValue[]): TypedValue[];
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* Determines if two arrays are equivalent according to FHIRPath equality rules.
|
|
592
|
+
* @param x The first array.
|
|
593
|
+
* @param y The second array.
|
|
594
|
+
* @returns FHIRPath true if the arrays are equivalent.
|
|
595
|
+
*/
|
|
596
|
+
export declare function fhirPathArrayEquivalent(x: TypedValue[], y: TypedValue[]): TypedValue[];
|
|
597
|
+
|
|
598
|
+
declare class FhirPathAtom implements Atom {
|
|
599
|
+
readonly original: string;
|
|
600
|
+
readonly child: Atom;
|
|
601
|
+
constructor(original: string, child: Atom);
|
|
602
|
+
eval(context: AtomContext, input: TypedValue[]): TypedValue[];
|
|
603
|
+
toString(): string;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* Determines if two values are equal according to FHIRPath equality rules.
|
|
608
|
+
* @param x The first value.
|
|
609
|
+
* @param y The second value.
|
|
610
|
+
* @returns True if equal.
|
|
611
|
+
*/
|
|
612
|
+
export declare function fhirPathEquals(x: TypedValue, y: TypedValue): TypedValue[];
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* Determines if two values are equivalent according to FHIRPath equality rules.
|
|
616
|
+
* @param x The first value.
|
|
617
|
+
* @param y The second value.
|
|
618
|
+
* @returns True if equivalent.
|
|
619
|
+
*/
|
|
620
|
+
export declare function fhirPathEquivalent(x: TypedValue, y: TypedValue): TypedValue[];
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* Determines if the typed value is the desired type.
|
|
624
|
+
* @param typedValue The typed value to check.
|
|
625
|
+
* @param desiredType The desired type name.
|
|
626
|
+
* @returns True if the typed value is of the desired type.
|
|
627
|
+
*/
|
|
628
|
+
export declare function fhirPathIs(typedValue: TypedValue, desiredType: string): boolean;
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* Returns a negated FHIRPath boolean expression.
|
|
632
|
+
* @param input The input array.
|
|
633
|
+
* @returns The negated type value array.
|
|
634
|
+
*/
|
|
635
|
+
export declare function fhirPathNot(input: TypedValue[]): TypedValue[];
|
|
636
|
+
|
|
637
|
+
export declare const fhirTypeToJsType: {
|
|
638
|
+
readonly base64Binary: "string";
|
|
639
|
+
readonly boolean: "boolean";
|
|
640
|
+
readonly canonical: "string";
|
|
641
|
+
readonly code: "string";
|
|
642
|
+
readonly date: "string";
|
|
643
|
+
readonly dateTime: "string";
|
|
644
|
+
readonly decimal: "number";
|
|
645
|
+
readonly id: "string";
|
|
646
|
+
readonly instant: "string";
|
|
647
|
+
readonly integer: "number";
|
|
648
|
+
readonly markdown: "string";
|
|
649
|
+
readonly oid: "string";
|
|
650
|
+
readonly positiveInt: "number";
|
|
651
|
+
readonly string: "string";
|
|
652
|
+
readonly time: "string";
|
|
653
|
+
readonly unsignedInt: "number";
|
|
654
|
+
readonly uri: "string";
|
|
655
|
+
readonly url: "string";
|
|
656
|
+
readonly uuid: "string";
|
|
657
|
+
readonly xhtml: "string";
|
|
658
|
+
readonly 'http://hl7.org/fhirpath/System.String': "string";
|
|
659
|
+
};
|
|
660
|
+
|
|
661
|
+
export declare interface Filter {
|
|
662
|
+
code: string;
|
|
663
|
+
operator: Operator;
|
|
664
|
+
value: string;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* Tries to find an observation interval for the given patient and value.
|
|
669
|
+
* @param definition The observation definition.
|
|
670
|
+
* @param patient The patient.
|
|
671
|
+
* @param value The observation value.
|
|
672
|
+
* @param category Optional interval category restriction.
|
|
673
|
+
* @returns The observation interval if found; otherwise undefined.
|
|
674
|
+
*/
|
|
675
|
+
export declare function findObservationInterval(definition: ObservationDefinition, patient: Patient, value: number, category?: 'reference' | 'critical' | 'absolute'): ObservationDefinitionQualifiedInterval | undefined;
|
|
676
|
+
|
|
677
|
+
/**
|
|
678
|
+
* Tries to find an observation reference range for the given patient and condition names.
|
|
679
|
+
* @param definition The observation definition.
|
|
680
|
+
* @param patient The patient.
|
|
681
|
+
* @param names The condition names.
|
|
682
|
+
* @returns The observation interval if found; otherwise undefined.
|
|
683
|
+
*/
|
|
684
|
+
export declare function findObservationReferenceRange(definition: ObservationDefinition, patient: Patient, names: string[]): ObservationDefinitionQualifiedInterval | undefined;
|
|
685
|
+
|
|
686
|
+
/**
|
|
687
|
+
* Finds the first resource in the input array that matches the specified code and system.
|
|
688
|
+
* @param resources - The array of resources to search.
|
|
689
|
+
* @param code - The code to search for.
|
|
690
|
+
* @param system - The system to search for.
|
|
691
|
+
* @returns The first resource in the input array that matches the specified code and system, or undefined if no such resource is found.
|
|
692
|
+
*/
|
|
693
|
+
export declare function findResourceByCode(resources: ResourceWithCode[], code: CodeableConcept | string, system: string): ResourceWithCode | undefined;
|
|
694
|
+
|
|
695
|
+
export declare const forbidden: OperationOutcome;
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* Formats a FHIR Address as a string.
|
|
699
|
+
* @param address The address to format.
|
|
700
|
+
* @param options Optional address format options.
|
|
701
|
+
* @returns The formatted address string.
|
|
702
|
+
*/
|
|
703
|
+
export declare function formatAddress(address: Address, options?: AddressFormatOptions): string;
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* Formats a CodeableConcept element as a string.
|
|
707
|
+
* @param codeableConcept A FHIR CodeableConcept element
|
|
708
|
+
* @returns The codeable concept as a string.
|
|
709
|
+
*/
|
|
710
|
+
export declare function formatCodeableConcept(codeableConcept: CodeableConcept | undefined): string;
|
|
711
|
+
|
|
712
|
+
/**
|
|
713
|
+
* Formats a Coding element as a string.
|
|
714
|
+
* @param coding A FHIR Coding element
|
|
715
|
+
* @returns The coding as a string.
|
|
716
|
+
*/
|
|
717
|
+
export declare function formatCoding(coding: Coding | undefined): string;
|
|
718
|
+
|
|
719
|
+
/**
|
|
720
|
+
* Formats a FHIR date string as a human readable string.
|
|
721
|
+
* Handles missing values and invalid dates.
|
|
722
|
+
* @param date The date to format.
|
|
723
|
+
* @param locales Optional locales.
|
|
724
|
+
* @param options Optional date format options.
|
|
725
|
+
* @returns The formatted date string.
|
|
726
|
+
*/
|
|
727
|
+
export declare function formatDate(date: string | undefined, locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions | undefined): string;
|
|
728
|
+
|
|
729
|
+
/**
|
|
730
|
+
* Formats a FHIR dateTime string as a human readable string.
|
|
731
|
+
* Handles missing values and invalid dates.
|
|
732
|
+
* @param dateTime The dateTime to format.
|
|
733
|
+
* @param locales Optional locales.
|
|
734
|
+
* @param options Optional dateTime format options.
|
|
735
|
+
* @returns The formatted dateTime string.
|
|
736
|
+
*/
|
|
737
|
+
export declare function formatDateTime(dateTime: string | undefined, locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions | undefined): string;
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* Formats the family name portion of a FHIR HumanName element.
|
|
741
|
+
* @param name The name to format.
|
|
742
|
+
* @returns The formatted family name string.
|
|
743
|
+
*/
|
|
744
|
+
export declare function formatFamilyName(name: HumanName): string;
|
|
745
|
+
|
|
746
|
+
/**
|
|
747
|
+
* Formats the given name portion of a FHIR HumanName element.
|
|
748
|
+
* @param name The name to format.
|
|
749
|
+
* @returns The formatted given name string.
|
|
750
|
+
*/
|
|
751
|
+
export declare function formatGivenName(name: HumanName): string;
|
|
752
|
+
|
|
753
|
+
/**
|
|
754
|
+
* Formats an ISO date/time string into an HL7 date/time string.
|
|
755
|
+
* @param isoDate The ISO date/time string.
|
|
756
|
+
* @returns The HL7 date/time string.
|
|
757
|
+
*/
|
|
758
|
+
export declare function formatHl7DateTime(isoDate: Date | string): string;
|
|
759
|
+
|
|
760
|
+
/**
|
|
761
|
+
* Formats a FHIR HumanName as a string.
|
|
762
|
+
* @param name The name to format.
|
|
763
|
+
* @param options Optional name format options.
|
|
764
|
+
* @returns The formatted name string.
|
|
765
|
+
*/
|
|
766
|
+
export declare function formatHumanName(name: HumanName, options?: HumanNameFormatOptions): string;
|
|
767
|
+
|
|
768
|
+
export declare function formatMoney(money: Money | undefined): string;
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* Formats a FHIR Observation resource value as a string.
|
|
772
|
+
* @param obs A FHIR Observation resource.
|
|
773
|
+
* @returns A human-readable string representation of the Observation.
|
|
774
|
+
*/
|
|
775
|
+
export declare function formatObservationValue(obs: Observation | ObservationComponent | undefined): string;
|
|
776
|
+
|
|
777
|
+
/**
|
|
778
|
+
* Formats a FHIR Period as a human readable string.
|
|
779
|
+
* @param period The period to format.
|
|
780
|
+
* @param locales Optional locales.
|
|
781
|
+
* @param options Optional period format options.
|
|
782
|
+
* @returns The formatted period string.
|
|
783
|
+
*/
|
|
784
|
+
export declare function formatPeriod(period: Period | undefined, locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions | undefined): string;
|
|
785
|
+
|
|
786
|
+
/**
|
|
787
|
+
* Returns a human-readable string for a FHIR Quantity datatype, taking into account units and comparators
|
|
788
|
+
* @param quantity A FHIR Quantity element
|
|
789
|
+
* @param precision Number of decimal places to display in the rendered quantity values
|
|
790
|
+
* @returns A human-readable string representation of the Quantity
|
|
791
|
+
*/
|
|
792
|
+
export declare function formatQuantity(quantity: Quantity | undefined, precision?: number): string;
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* Returns a human-readable string for a FHIR Range datatype, taking into account one-sided ranges
|
|
796
|
+
* @param range A FHIR Range element
|
|
797
|
+
* @param precision Number of decimal places to display in the rendered quantity values
|
|
798
|
+
* @param exclusive If true, one-sided ranges will be rendered with the '>' or '<' bounds rather than '>=' or '<='
|
|
799
|
+
* @returns A human-readable string representation of the Range
|
|
800
|
+
*/
|
|
801
|
+
export declare function formatRange(range: Range_2 | undefined, precision?: number, exclusive?: boolean): string;
|
|
802
|
+
|
|
803
|
+
/**
|
|
804
|
+
* Formats a search definition object into a query string.
|
|
805
|
+
* Note: The return value does not include the resource type.
|
|
806
|
+
* @param definition The search definition.
|
|
807
|
+
* @returns Formatted URL.
|
|
808
|
+
*/
|
|
809
|
+
export declare function formatSearchQuery(definition: SearchRequest): string;
|
|
810
|
+
|
|
811
|
+
/**
|
|
812
|
+
* Formats a FHIR time string as a human readable string.
|
|
813
|
+
* Handles missing values and invalid dates.
|
|
814
|
+
* @param time The date to format.
|
|
815
|
+
* @param locales Optional locales.
|
|
816
|
+
* @param options Optional time format options.
|
|
817
|
+
* @returns The formatted time string.
|
|
818
|
+
*/
|
|
819
|
+
export declare function formatTime(time: string | undefined, locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions | undefined): string;
|
|
820
|
+
|
|
821
|
+
/**
|
|
822
|
+
* Formats a FHIR Timing as a human readable string.
|
|
823
|
+
* @param timing The timing to format.
|
|
824
|
+
* @returns The formatted timing string.
|
|
825
|
+
*/
|
|
826
|
+
export declare function formatTiming(timing: Timing | undefined): string;
|
|
827
|
+
|
|
828
|
+
/**
|
|
829
|
+
* Cross platform random UUID generator
|
|
830
|
+
* Note that this is not intended for production use, but rather for testing
|
|
831
|
+
* This should be replaced when crypto.randomUUID is fully supported
|
|
832
|
+
* See: https://stackoverflow.com/revisions/2117523/28
|
|
833
|
+
* @returns A random UUID.
|
|
834
|
+
*/
|
|
835
|
+
export declare function generateId(): string;
|
|
836
|
+
|
|
837
|
+
export declare function getAllDataTypes(): Record<string, InternalTypeSchema>;
|
|
838
|
+
|
|
839
|
+
/**
|
|
840
|
+
* Returns an array of questionnaire answers as a map by link ID.
|
|
841
|
+
* @param response The questionnaire response resource.
|
|
842
|
+
* @returns Questionnaire answer arrays mapped by link ID.
|
|
843
|
+
*/
|
|
844
|
+
export declare function getAllQuestionnaireAnswers(response: QuestionnaireResponse): Record<string, QuestionnaireResponseItemAnswer[]>;
|
|
845
|
+
|
|
846
|
+
/**
|
|
847
|
+
* Tries to find a code string for a given system within a given codeable concept.
|
|
848
|
+
* @param concept The codeable concept.
|
|
849
|
+
* @param system The system string.
|
|
850
|
+
* @returns The code if found; otherwise undefined.
|
|
851
|
+
*/
|
|
852
|
+
export declare function getCodeBySystem(concept: CodeableConcept, system: string): string | undefined;
|
|
853
|
+
|
|
854
|
+
export declare function getDataType(type: string): InternalTypeSchema;
|
|
855
|
+
|
|
856
|
+
/**
|
|
857
|
+
* Returns a Date property as a Date.
|
|
858
|
+
* When working with JSON objects, Dates are often serialized as ISO-8601 strings.
|
|
859
|
+
* When that happens, we need to safely convert to a proper Date object.
|
|
860
|
+
* @param date The date property value, which could be a string or a Date object.
|
|
861
|
+
* @returns A Date object.
|
|
862
|
+
*/
|
|
863
|
+
export declare function getDateProperty(date: string | undefined): Date | undefined;
|
|
864
|
+
|
|
865
|
+
/**
|
|
866
|
+
* Returns a display string for the resource.
|
|
867
|
+
* @param resource The input resource.
|
|
868
|
+
* @returns Human friendly display string.
|
|
869
|
+
*/
|
|
870
|
+
export declare function getDisplayString(resource: Resource): string;
|
|
871
|
+
|
|
872
|
+
/**
|
|
873
|
+
* Returns an element definition by type and property name.
|
|
874
|
+
* Handles content references.
|
|
875
|
+
* @param typeName The type name.
|
|
876
|
+
* @param propertyName The property name.
|
|
877
|
+
* @returns The element definition if found.
|
|
878
|
+
*/
|
|
879
|
+
export declare function getElementDefinition(typeName: string, propertyName: string): InternalSchemaElement | undefined;
|
|
880
|
+
|
|
881
|
+
/**
|
|
882
|
+
* Returns the type name for an ElementDefinition.
|
|
883
|
+
* @param elementDefinition The element definition.
|
|
884
|
+
* @returns The Medplum type name.
|
|
885
|
+
*/
|
|
886
|
+
export declare function getElementDefinitionTypeName(elementDefinition: ElementDefinition): string;
|
|
887
|
+
|
|
888
|
+
export declare function getExpressionForResourceType(resourceType: string, expression: string): string | undefined;
|
|
889
|
+
|
|
890
|
+
export declare function getExpressionsForResourceType(resourceType: string, expression: string): Atom[];
|
|
891
|
+
|
|
892
|
+
/**
|
|
893
|
+
* Returns an extension by extension URLs.
|
|
894
|
+
* @param resource The base resource.
|
|
895
|
+
* @param urls Array of extension URLs. Each entry represents a nested extension.
|
|
896
|
+
* @returns The extension object if found; undefined otherwise.
|
|
897
|
+
*/
|
|
898
|
+
export declare function getExtension(resource: any, ...urls: string[]): Extension | undefined;
|
|
899
|
+
|
|
900
|
+
/**
|
|
901
|
+
* Returns an extension value by extension URLs.
|
|
902
|
+
* @param resource The base resource.
|
|
903
|
+
* @param urls Array of extension URLs. Each entry represents a nested extension.
|
|
904
|
+
* @returns The extension value if found; undefined otherwise.
|
|
905
|
+
*/
|
|
906
|
+
export declare function getExtensionValue(resource: any, ...urls: string[]): string | undefined;
|
|
907
|
+
|
|
908
|
+
/**
|
|
909
|
+
* Returns the resource identifier for the given system.
|
|
910
|
+
*
|
|
911
|
+
* If multiple identifiers exist with the same system, the first one is returned.
|
|
912
|
+
*
|
|
913
|
+
* If the system is not found, then returns undefined.
|
|
914
|
+
* @param resource The resource to check.
|
|
915
|
+
* @param system The identifier system.
|
|
916
|
+
* @returns The identifier value if found; otherwise undefined.
|
|
917
|
+
*/
|
|
918
|
+
export declare function getIdentifier(resource: Resource, system: string): string | undefined;
|
|
919
|
+
|
|
920
|
+
/**
|
|
921
|
+
* Returns an image URL for the resource, if one is available.
|
|
922
|
+
* @param resource The input resource.
|
|
923
|
+
* @returns The image URL for the resource or undefined.
|
|
924
|
+
*/
|
|
925
|
+
export declare function getImageSrc(resource: Resource): string | undefined;
|
|
926
|
+
|
|
927
|
+
export declare function getNestedProperty(value: TypedValue, key: string): (TypedValue | TypedValue[] | undefined)[];
|
|
928
|
+
|
|
929
|
+
/**
|
|
930
|
+
* Returns a human friendly display name for a FHIR element definition path.
|
|
931
|
+
* @param path The FHIR element definition path.
|
|
932
|
+
* @returns The best guess of the display name.
|
|
933
|
+
*/
|
|
934
|
+
export declare function getPropertyDisplayName(path: string): string;
|
|
935
|
+
|
|
936
|
+
/**
|
|
937
|
+
* Returns all questionnaire answers as a map by link ID.
|
|
938
|
+
* @param response The questionnaire response resource.
|
|
939
|
+
* @returns Questionnaire answers mapped by link ID.
|
|
940
|
+
*/
|
|
941
|
+
export declare function getQuestionnaireAnswers(response: QuestionnaireResponse): Record<string, QuestionnaireResponseItemAnswer>;
|
|
942
|
+
|
|
943
|
+
/**
|
|
944
|
+
* Returns a cryptographically secure random string.
|
|
945
|
+
* @returns A cryptographically secure random string.
|
|
946
|
+
*/
|
|
947
|
+
export declare function getRandomString(): string;
|
|
948
|
+
|
|
949
|
+
/**
|
|
950
|
+
* Returns a reference string for a resource.
|
|
951
|
+
* @param input The FHIR resource or reference.
|
|
952
|
+
* @returns A reference string of the form resourceType/id.
|
|
953
|
+
*/
|
|
954
|
+
export declare function getReferenceString(input: Reference | Resource): string;
|
|
955
|
+
|
|
956
|
+
/**
|
|
957
|
+
* Returns an array of all resource types.
|
|
958
|
+
* Note that this is based on globalSchema, and will only return resource types that are currently in memory.
|
|
959
|
+
* @returns An array of all resource types.
|
|
960
|
+
*/
|
|
961
|
+
export declare function getResourceTypes(): ResourceType[];
|
|
962
|
+
|
|
963
|
+
/**
|
|
964
|
+
* Returns a search parameter for a resource type by search code.
|
|
965
|
+
* @param resourceType The FHIR resource type.
|
|
966
|
+
* @param code The search parameter code.
|
|
967
|
+
* @returns The search parameter if found, otherwise undefined.
|
|
968
|
+
*/
|
|
969
|
+
export declare function getSearchParameter(resourceType: string, code: string): SearchParameter | undefined;
|
|
970
|
+
|
|
971
|
+
/**
|
|
972
|
+
* Returns the type details of a SearchParameter.
|
|
973
|
+
*
|
|
974
|
+
* The SearchParameter resource has a "type" parameter, but that is missing some critical information.
|
|
975
|
+
*
|
|
976
|
+
* For example:
|
|
977
|
+
* 1) The "date" type includes "date", "datetime", and "period".
|
|
978
|
+
* 2) The "token" type includes enums and booleans.
|
|
979
|
+
* 3) Arrays/multiple values are not reflected at all.
|
|
980
|
+
* @param resourceType The root resource type.
|
|
981
|
+
* @param searchParam The search parameter.
|
|
982
|
+
* @returns The search parameter type details.
|
|
983
|
+
*/
|
|
984
|
+
export declare function getSearchParameterDetails(resourceType: string, searchParam: SearchParameter): SearchParameterDetails;
|
|
985
|
+
|
|
986
|
+
/**
|
|
987
|
+
* Returns the search parameters for the resource type indexed by search code.
|
|
988
|
+
* @param resourceType The resource type.
|
|
989
|
+
* @returns The search parameters for the resource type indexed by search code.
|
|
990
|
+
*/
|
|
991
|
+
export declare function getSearchParameters(resourceType: string): Record<string, SearchParameter> | undefined;
|
|
992
|
+
|
|
993
|
+
export declare function getStatus(outcome: OperationOutcome): number;
|
|
994
|
+
|
|
995
|
+
/**
|
|
996
|
+
* Returns the value of the property and the property type.
|
|
997
|
+
* Some property definitions support multiple types.
|
|
998
|
+
* For example, "Observation.value[x]" can be "valueString", "valueInteger", "valueQuantity", etc.
|
|
999
|
+
* According to the spec, there can only be one property for a given element definition.
|
|
1000
|
+
* This function returns the value and the type.
|
|
1001
|
+
* @param input The base context (FHIR resource or backbone element).
|
|
1002
|
+
* @param path The property path.
|
|
1003
|
+
* @returns The value of the property and the property type.
|
|
1004
|
+
*/
|
|
1005
|
+
export declare function getTypedPropertyValue(input: TypedValue, path: string): TypedValue[] | TypedValue | undefined;
|
|
1006
|
+
|
|
1007
|
+
/**
|
|
1008
|
+
* Global schema singleton.
|
|
1009
|
+
*/
|
|
1010
|
+
export declare const globalSchema: IndexedStructureDefinition;
|
|
1011
|
+
|
|
1012
|
+
export declare const gone: OperationOutcome;
|
|
1013
|
+
|
|
1014
|
+
export declare interface GoogleCredentialResponse {
|
|
1015
|
+
readonly clientId: string;
|
|
1016
|
+
readonly credential: string;
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
export declare interface GoogleLoginRequest extends BaseLoginRequest {
|
|
1020
|
+
readonly googleClientId: string;
|
|
1021
|
+
readonly googleCredential: string;
|
|
1022
|
+
readonly createUser?: boolean;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
/**
|
|
1026
|
+
* The Hl7Context class represents the parsing context for an HL7 message.
|
|
1027
|
+
*
|
|
1028
|
+
* MSH-1:
|
|
1029
|
+
* https://hl7-definition.caristix.com/v2/HL7v2.6/Fields/MSH.1
|
|
1030
|
+
*
|
|
1031
|
+
* MSH-2:
|
|
1032
|
+
* https://hl7-definition.caristix.com/v2/HL7v2.6/Fields/MSH.2
|
|
1033
|
+
*
|
|
1034
|
+
* See this tutorial on MSH, and why it's a bad idea to use anything other than the default values:
|
|
1035
|
+
* https://www.hl7soup.com/HL7TutorialMSH.html
|
|
1036
|
+
*/
|
|
1037
|
+
export declare class Hl7Context {
|
|
1038
|
+
readonly segmentSeparator: string;
|
|
1039
|
+
readonly fieldSeparator: string;
|
|
1040
|
+
readonly componentSeparator: string;
|
|
1041
|
+
readonly repetitionSeparator: string;
|
|
1042
|
+
readonly escapeCharacter: string;
|
|
1043
|
+
readonly subcomponentSeparator: string;
|
|
1044
|
+
constructor(segmentSeparator?: string, fieldSeparator?: string, componentSeparator?: string, repetitionSeparator?: string, escapeCharacter?: string, subcomponentSeparator?: string);
|
|
1045
|
+
/**
|
|
1046
|
+
* Returns the MSH-1 field value based on the configured separators.
|
|
1047
|
+
* @returns The HL7 MSH-1 field value.
|
|
1048
|
+
*/
|
|
1049
|
+
getMsh1(): string;
|
|
1050
|
+
/**
|
|
1051
|
+
* Returns the MSH-2 field value based on the configured separators.
|
|
1052
|
+
* @returns The HL7 MSH-2 field value.
|
|
1053
|
+
*/
|
|
1054
|
+
getMsh2(): string;
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
export declare interface Hl7DateParseOptions {
|
|
1058
|
+
/**
|
|
1059
|
+
* Default timezone offset.
|
|
1060
|
+
* Example: "-0500"
|
|
1061
|
+
*/
|
|
1062
|
+
tzOffset?: string;
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
/**
|
|
1066
|
+
* The Hl7Field class represents one HL7 field.
|
|
1067
|
+
* A field is a collection of components.
|
|
1068
|
+
*/
|
|
1069
|
+
export declare class Hl7Field {
|
|
1070
|
+
readonly context: Hl7Context;
|
|
1071
|
+
readonly components: string[][];
|
|
1072
|
+
/**
|
|
1073
|
+
* Creates a new HL7 field.
|
|
1074
|
+
* @param components The HL7 components.
|
|
1075
|
+
* @param context Optional HL7 parsing context.
|
|
1076
|
+
*/
|
|
1077
|
+
constructor(components: string[][], context?: Hl7Context);
|
|
1078
|
+
/**
|
|
1079
|
+
* Returns an HL7 component by index.
|
|
1080
|
+
* @param component The component index.
|
|
1081
|
+
* @param subcomponent Optional subcomponent index.
|
|
1082
|
+
* @param repetition Optional repetition index.
|
|
1083
|
+
* @returns The string value of the specified component.
|
|
1084
|
+
* @deprecated Use getComponent() instead. This method will be removed in a future release.
|
|
1085
|
+
*/
|
|
1086
|
+
get(component: number, subcomponent?: number, repetition?: number): string;
|
|
1087
|
+
/**
|
|
1088
|
+
* Returns an HL7 component by index.
|
|
1089
|
+
*
|
|
1090
|
+
* Note that the index is 1-based, not 0-based.
|
|
1091
|
+
*
|
|
1092
|
+
* For example, to get the first component, use `getComponent(1)`.
|
|
1093
|
+
*
|
|
1094
|
+
* This aligns with HL7 component names such as MSH.9.2.
|
|
1095
|
+
*
|
|
1096
|
+
* @param component The component index.
|
|
1097
|
+
* @param subcomponent Optional subcomponent index.
|
|
1098
|
+
* @param repetition Optional repetition index.
|
|
1099
|
+
* @returns The string value of the specified component.
|
|
1100
|
+
*/
|
|
1101
|
+
getComponent(component: number, subcomponent?: number, repetition?: number): string;
|
|
1102
|
+
/**
|
|
1103
|
+
* Returns the HL7 field as a string.
|
|
1104
|
+
* @returns The HL7 field as a string.
|
|
1105
|
+
*/
|
|
1106
|
+
toString(): string;
|
|
1107
|
+
/**
|
|
1108
|
+
* Parses an HL7 field string into an Hl7Field object.
|
|
1109
|
+
* @param text The HL7 field text.
|
|
1110
|
+
* @param context Optional HL7 parsing context.
|
|
1111
|
+
* @returns The parsed HL7 field.
|
|
1112
|
+
*/
|
|
1113
|
+
static parse(text: string, context?: Hl7Context): Hl7Field;
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
/**
|
|
1117
|
+
* The Hl7Message class represents one HL7 message.
|
|
1118
|
+
* A message is a collection of segments.
|
|
1119
|
+
*/
|
|
1120
|
+
export declare class Hl7Message {
|
|
1121
|
+
readonly context: Hl7Context;
|
|
1122
|
+
readonly segments: Hl7Segment[];
|
|
1123
|
+
/**
|
|
1124
|
+
* Creates a new HL7 message.
|
|
1125
|
+
* @param segments The HL7 segments.
|
|
1126
|
+
* @param context Optional HL7 parsing context.
|
|
1127
|
+
*/
|
|
1128
|
+
constructor(segments: Hl7Segment[], context?: Hl7Context);
|
|
1129
|
+
/**
|
|
1130
|
+
* Returns the HL7 message header.
|
|
1131
|
+
* @returns The HL7 message header.
|
|
1132
|
+
*/
|
|
1133
|
+
get header(): Hl7Segment;
|
|
1134
|
+
/**
|
|
1135
|
+
* Returns an HL7 segment by index or by name.
|
|
1136
|
+
* @param index The HL7 segment index or name.
|
|
1137
|
+
* @returns The HL7 segment if found; otherwise, undefined.
|
|
1138
|
+
* @deprecated Use getSegment() instead. This method will be removed in a future release.
|
|
1139
|
+
*/
|
|
1140
|
+
get(index: number | string): Hl7Segment | undefined;
|
|
1141
|
+
/**
|
|
1142
|
+
* Returns all HL7 segments of a given name.
|
|
1143
|
+
* @param name The HL7 segment name.
|
|
1144
|
+
* @returns An array of HL7 segments with the specified name.
|
|
1145
|
+
* @deprecated Use getAllSegments() instead. This method will be removed in a future release.
|
|
1146
|
+
*/
|
|
1147
|
+
getAll(name: string): Hl7Segment[];
|
|
1148
|
+
/**
|
|
1149
|
+
* Returns an HL7 segment by index or by name.
|
|
1150
|
+
*
|
|
1151
|
+
* When using a numeric index, the first segment (usually the MSH header segment) is at index 0.
|
|
1152
|
+
*
|
|
1153
|
+
* When using a string index, this method returns the first segment with the specified name.
|
|
1154
|
+
*
|
|
1155
|
+
* @param index The HL7 segment index or name.
|
|
1156
|
+
* @returns The HL7 segment if found; otherwise, undefined.
|
|
1157
|
+
*/
|
|
1158
|
+
getSegment(index: number | string): Hl7Segment | undefined;
|
|
1159
|
+
/**
|
|
1160
|
+
* Returns all HL7 segments of a given name.
|
|
1161
|
+
* @param name The HL7 segment name.
|
|
1162
|
+
* @returns An array of HL7 segments with the specified name.
|
|
1163
|
+
*/
|
|
1164
|
+
getAllSegments(name: string): Hl7Segment[];
|
|
1165
|
+
/**
|
|
1166
|
+
* Returns the HL7 message as a string.
|
|
1167
|
+
* @returns The HL7 message as a string.
|
|
1168
|
+
*/
|
|
1169
|
+
toString(): string;
|
|
1170
|
+
/**
|
|
1171
|
+
* Returns an HL7 "ACK" (acknowledgement) message for this message.
|
|
1172
|
+
* @returns The HL7 "ACK" message.
|
|
1173
|
+
*/
|
|
1174
|
+
buildAck(): Hl7Message;
|
|
1175
|
+
private buildAckMessageType;
|
|
1176
|
+
/**
|
|
1177
|
+
* Parses an HL7 message string into an Hl7Message object.
|
|
1178
|
+
* @param text The HL7 message text.
|
|
1179
|
+
* @returns The parsed HL7 message.
|
|
1180
|
+
*/
|
|
1181
|
+
static parse(text: string): Hl7Message;
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
/**
|
|
1185
|
+
* The Hl7Segment class represents one HL7 segment.
|
|
1186
|
+
* A segment is a collection of fields.
|
|
1187
|
+
* The name field is the first field.
|
|
1188
|
+
*/
|
|
1189
|
+
export declare class Hl7Segment {
|
|
1190
|
+
readonly context: Hl7Context;
|
|
1191
|
+
readonly name: string;
|
|
1192
|
+
readonly fields: Hl7Field[];
|
|
1193
|
+
/**
|
|
1194
|
+
* Creates a new HL7 segment.
|
|
1195
|
+
* @param fields The HL7 fields. The first field is the segment name.
|
|
1196
|
+
* @param context Optional HL7 parsing context.
|
|
1197
|
+
*/
|
|
1198
|
+
constructor(fields: Hl7Field[] | string[], context?: Hl7Context);
|
|
1199
|
+
/**
|
|
1200
|
+
* Returns an HL7 field by index.
|
|
1201
|
+
* @param index The HL7 field index.
|
|
1202
|
+
* @returns The HL7 field.
|
|
1203
|
+
* @deprecated Use getSegment() instead. This method includes the segment name in the index, which leads to confusing behavior. This method will be removed in a future release.
|
|
1204
|
+
*/
|
|
1205
|
+
get(index: number): Hl7Field;
|
|
1206
|
+
/**
|
|
1207
|
+
* Returns an HL7 field by index.
|
|
1208
|
+
*
|
|
1209
|
+
* Note that the index is 1-based, not 0-based.
|
|
1210
|
+
*
|
|
1211
|
+
* For example, to get the first field, use `getField(1)`.
|
|
1212
|
+
*
|
|
1213
|
+
* This aligns with HL7 field names such as PID.1, PID.2, etc.
|
|
1214
|
+
*
|
|
1215
|
+
* Field zero is the segment name.
|
|
1216
|
+
*
|
|
1217
|
+
* @param index The HL7 field index.
|
|
1218
|
+
* @returns The HL7 field.
|
|
1219
|
+
*/
|
|
1220
|
+
getField(index: number): Hl7Field;
|
|
1221
|
+
/**
|
|
1222
|
+
* Returns an HL7 component by field index and component index.
|
|
1223
|
+
*
|
|
1224
|
+
* This is a shortcut for `getField(field).getComponent(component)`.
|
|
1225
|
+
*
|
|
1226
|
+
* Note that both indexex are 1-based, not 0-based.
|
|
1227
|
+
*
|
|
1228
|
+
* For example, to get the first component, use `getComponent(1, 1)`.
|
|
1229
|
+
*
|
|
1230
|
+
* This aligns with HL7 component names such as MSH.9.2.
|
|
1231
|
+
*
|
|
1232
|
+
* @param fieldIndex The HL7 field index.
|
|
1233
|
+
* @param component The component index.
|
|
1234
|
+
* @param subcomponent Optional subcomponent index.
|
|
1235
|
+
* @param repetition Optional repetition index.
|
|
1236
|
+
* @returns The string value of the specified component.
|
|
1237
|
+
*/
|
|
1238
|
+
getComponent(fieldIndex: number, component: number, subcomponent?: number, repetition?: number): string;
|
|
1239
|
+
/**
|
|
1240
|
+
* Returns the HL7 segment as a string.
|
|
1241
|
+
* @returns The HL7 segment as a string.
|
|
1242
|
+
*/
|
|
1243
|
+
toString(): string;
|
|
1244
|
+
/**
|
|
1245
|
+
* Parses an HL7 segment string into an Hl7Segment object.
|
|
1246
|
+
* @param text The HL7 segment text.
|
|
1247
|
+
* @param context Optional HL7 parsing context.
|
|
1248
|
+
* @returns The parsed HL7 segment.
|
|
1249
|
+
*/
|
|
1250
|
+
static parse(text: string, context?: Hl7Context): Hl7Segment;
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
export declare interface HumanNameFormatOptions {
|
|
1254
|
+
all?: boolean;
|
|
1255
|
+
prefix?: boolean;
|
|
1256
|
+
suffix?: boolean;
|
|
1257
|
+
use?: boolean;
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
export declare const ICD10 = "http://hl7.org/fhir/sid/icd-10";
|
|
1261
|
+
|
|
1262
|
+
export declare interface IncludeTarget {
|
|
1263
|
+
resourceType: string;
|
|
1264
|
+
searchParam: string;
|
|
1265
|
+
targetType?: string;
|
|
1266
|
+
modifier?: string;
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
/**
|
|
1270
|
+
* An IndexedStructureDefinition is a lookup-optimized version of a StructureDefinition.
|
|
1271
|
+
*
|
|
1272
|
+
* StructureDefinition resources contain schema information for other resource types.
|
|
1273
|
+
* These schemas can be used to automatically generate user interface elements for
|
|
1274
|
+
* resources.
|
|
1275
|
+
*
|
|
1276
|
+
* However, a StructureDefinition resource is not optimized for realtime lookups. All
|
|
1277
|
+
* resource types, sub types, and property definitions are stored in a flat array of
|
|
1278
|
+
* ElementDefinition objects. Therefore, to lookup the schema for a property (i.e., "Patient.name")
|
|
1279
|
+
* requires a linear scan of all ElementDefinition objects
|
|
1280
|
+
*
|
|
1281
|
+
* A StructureDefinition resource contains information about one or more types.
|
|
1282
|
+
* For example, the "Patient" StructureDefinition includes "Patient", "Patient_Contact",
|
|
1283
|
+
* "Patient_Communication", and "Patient_Link". This is inefficient.
|
|
1284
|
+
*
|
|
1285
|
+
* Instead, we create an indexed version of the StructureDefinition, called IndexedStructureDefinition.
|
|
1286
|
+
* In an IndexedStructureDefinition, retrieving a property definition is a hashtable lookup.
|
|
1287
|
+
*
|
|
1288
|
+
* The hierarchy is:
|
|
1289
|
+
* IndexedStructureDefinition - top level for one resource type
|
|
1290
|
+
* TypeSchema - one per resource type and all contained BackboneElements
|
|
1291
|
+
* PropertySchema - one per property/field
|
|
1292
|
+
*/
|
|
1293
|
+
export declare interface IndexedStructureDefinition {
|
|
1294
|
+
types: {
|
|
1295
|
+
[resourceType: string]: TypeInfo;
|
|
1296
|
+
};
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
/**
|
|
1300
|
+
* Indexes a SearchParameter resource for fast lookup.
|
|
1301
|
+
* Indexes by SearchParameter.code, which is the query string parameter name.
|
|
1302
|
+
* @param searchParam The SearchParameter resource.
|
|
1303
|
+
* @see {@link IndexedStructureDefinition} for more details on indexed StructureDefinitions.
|
|
1304
|
+
*/
|
|
1305
|
+
export declare function indexSearchParameter(searchParam: SearchParameter): void;
|
|
1306
|
+
|
|
1307
|
+
/**
|
|
1308
|
+
* Indexes a bundle of SearchParameter resources for faster lookup.
|
|
1309
|
+
* @param bundle A FHIR bundle SearchParameter resources.
|
|
1310
|
+
* @see {@link IndexedStructureDefinition} for more details on indexed StructureDefinitions.
|
|
1311
|
+
*/
|
|
1312
|
+
export declare function indexSearchParameterBundle(bundle: Bundle<SearchParameter>): void;
|
|
1313
|
+
|
|
1314
|
+
export declare function indexStructureDefinitionBundle(bundle: StructureDefinition[] | Bundle): void;
|
|
1315
|
+
|
|
1316
|
+
export declare abstract class InfixOperatorAtom implements Atom {
|
|
1317
|
+
readonly operator: string;
|
|
1318
|
+
readonly left: Atom;
|
|
1319
|
+
readonly right: Atom;
|
|
1320
|
+
constructor(operator: string, left: Atom, right: Atom);
|
|
1321
|
+
abstract eval(context: AtomContext, input: TypedValue[]): TypedValue[];
|
|
1322
|
+
toString(): string;
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
export declare interface InfixParselet {
|
|
1326
|
+
precedence: number;
|
|
1327
|
+
parse?(parser: Parser, left: Atom, token: Token): Atom;
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
export declare function inflateBaseSchema(base: BaseSchema): Record<string, InternalTypeSchema>;
|
|
1331
|
+
|
|
1332
|
+
export declare function inflateElement(partial: Partial<InternalSchemaElement>): InternalSchemaElement;
|
|
1333
|
+
|
|
1334
|
+
export declare function initFhirPathParserBuilder(): ParserBuilder;
|
|
1335
|
+
|
|
1336
|
+
export declare interface InternalSchemaElement {
|
|
1337
|
+
description: string;
|
|
1338
|
+
path: string;
|
|
1339
|
+
min: number;
|
|
1340
|
+
max: number;
|
|
1341
|
+
isArray?: boolean;
|
|
1342
|
+
constraints?: Constraint[];
|
|
1343
|
+
type: ElementType[];
|
|
1344
|
+
slicing?: SlicingRules;
|
|
1345
|
+
fixed?: TypedValue;
|
|
1346
|
+
pattern?: TypedValue;
|
|
1347
|
+
binding?: ElementDefinitionBinding;
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
/**
|
|
1351
|
+
* Internal representation of a non-primitive FHIR type, suitable for use in resource validation
|
|
1352
|
+
*/
|
|
1353
|
+
export declare interface InternalTypeSchema {
|
|
1354
|
+
name: string;
|
|
1355
|
+
url?: string;
|
|
1356
|
+
kind?: string;
|
|
1357
|
+
description?: string;
|
|
1358
|
+
elements: Record<string, InternalSchemaElement>;
|
|
1359
|
+
constraints?: Constraint[];
|
|
1360
|
+
parentType?: InternalTypeSchema;
|
|
1361
|
+
innerTypes: InternalTypeSchema[];
|
|
1362
|
+
summaryProperties?: Set<string>;
|
|
1363
|
+
mandatoryProperties?: Set<string>;
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
export declare interface InviteRequest {
|
|
1367
|
+
resourceType: 'Patient' | 'Practitioner' | 'RelatedPerson';
|
|
1368
|
+
firstName: string;
|
|
1369
|
+
lastName: string;
|
|
1370
|
+
email?: string;
|
|
1371
|
+
externalId?: string;
|
|
1372
|
+
password?: string;
|
|
1373
|
+
sendEmail?: boolean;
|
|
1374
|
+
membership?: Partial<ProjectMembership>;
|
|
1375
|
+
/** @deprecated Use membership.accessPolicy instead. */
|
|
1376
|
+
accessPolicy?: Reference<AccessPolicy>;
|
|
1377
|
+
/** @deprecated Use membership.access instead. */
|
|
1378
|
+
access?: ProjectMembershipAccess[];
|
|
1379
|
+
/** @deprecated Use membership.admin instead. */
|
|
1380
|
+
admin?: boolean;
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
export declare function isAccepted(outcome: OperationOutcome): boolean;
|
|
1384
|
+
|
|
1385
|
+
export declare function isCompletedSubscriptionRequest(subscriptionRequest: SubscriptionRequest | PendingSubscriptionRequest): subscriptionRequest is SubscriptionRequest;
|
|
1386
|
+
|
|
1387
|
+
export declare function isCreated(outcome: OperationOutcome): boolean;
|
|
1388
|
+
|
|
1389
|
+
export declare function isDataTypeLoaded(type: string): boolean;
|
|
1390
|
+
|
|
1391
|
+
/**
|
|
1392
|
+
* Returns true if the value is empty (null, undefined, empty string, or empty object).
|
|
1393
|
+
* @param v Any value.
|
|
1394
|
+
* @returns True if the value is an empty string or an empty object.
|
|
1395
|
+
*/
|
|
1396
|
+
export declare function isEmpty(v: any): boolean;
|
|
1397
|
+
|
|
1398
|
+
/**
|
|
1399
|
+
* Checks if a `ResourceType` can be used in a `FHIRcast` context.
|
|
1400
|
+
*
|
|
1401
|
+
* @param resourceType A `ResourceType` to test.
|
|
1402
|
+
* @returns `true` if this is a resource type associated with `FHIRcast` contexts, otherwise returns `false`.
|
|
1403
|
+
*/
|
|
1404
|
+
export declare function isFhircastResourceType(resourceType: FhircastResourceType): boolean;
|
|
1405
|
+
|
|
1406
|
+
export declare function isGone(outcome: OperationOutcome): boolean;
|
|
1407
|
+
|
|
1408
|
+
/**
|
|
1409
|
+
* Returns true if the token is a JWT.
|
|
1410
|
+
* @param token The potential JWT token.
|
|
1411
|
+
* @returns True if the token is a JWT.
|
|
1412
|
+
*/
|
|
1413
|
+
export declare function isJwt(token: string): boolean;
|
|
1414
|
+
|
|
1415
|
+
export declare function isLowerCase(c: string): boolean;
|
|
1416
|
+
|
|
1417
|
+
/**
|
|
1418
|
+
* Returns true if the access token was issued by a Medplum server.
|
|
1419
|
+
* @param accessToken An access token of unknown origin.
|
|
1420
|
+
* @returns True if the access token was issued by a Medplum server.
|
|
1421
|
+
*/
|
|
1422
|
+
export declare function isMedplumAccessToken(accessToken: string): boolean;
|
|
1423
|
+
|
|
1424
|
+
export declare function isNotFound(outcome: OperationOutcome): boolean;
|
|
1425
|
+
|
|
1426
|
+
/**
|
|
1427
|
+
* Returns true if the input is an object.
|
|
1428
|
+
* @param obj The candidate object.
|
|
1429
|
+
* @returns True if the input is a non-null non-undefined object.
|
|
1430
|
+
*/
|
|
1431
|
+
export declare function isObject(obj: unknown): obj is Record<string, unknown>;
|
|
1432
|
+
|
|
1433
|
+
export declare function isOk(outcome: OperationOutcome): boolean;
|
|
1434
|
+
|
|
1435
|
+
export declare function isOperationOutcome(value: unknown): value is OperationOutcome;
|
|
1436
|
+
|
|
1437
|
+
/**
|
|
1438
|
+
* Determines if the input is a Period object.
|
|
1439
|
+
* This is heuristic based, as we do not have strong typing at runtime.
|
|
1440
|
+
* @param input The input value.
|
|
1441
|
+
* @returns True if the input is a period.
|
|
1442
|
+
*/
|
|
1443
|
+
export declare function isPeriod(input: unknown): input is Period;
|
|
1444
|
+
|
|
1445
|
+
/**
|
|
1446
|
+
* Returns true if the resource is a "ProfileResource".
|
|
1447
|
+
* @param resource The FHIR resource.
|
|
1448
|
+
* @returns True if the resource is a "ProfileResource".
|
|
1449
|
+
*/
|
|
1450
|
+
export declare function isProfileResource(resource: Resource): resource is ProfileResource;
|
|
1451
|
+
|
|
1452
|
+
/**
|
|
1453
|
+
* Determines if the input is a Quantity object.
|
|
1454
|
+
* This is heuristic based, as we do not have strong typing at runtime.
|
|
1455
|
+
* @param input The input value.
|
|
1456
|
+
* @returns True if the input is a quantity.
|
|
1457
|
+
*/
|
|
1458
|
+
export declare function isQuantity(input: unknown): input is Quantity;
|
|
1459
|
+
|
|
1460
|
+
export declare function isQuantityEquivalent(x: Quantity, y: Quantity): boolean;
|
|
1461
|
+
|
|
1462
|
+
/**
|
|
1463
|
+
* Typeguard to validate that an object is a FHIR resource
|
|
1464
|
+
* @param value The object to check
|
|
1465
|
+
* @returns True if the input is of type 'object' and contains property 'reference'
|
|
1466
|
+
*/
|
|
1467
|
+
export declare function isReference(value: unknown): value is Reference & {
|
|
1468
|
+
reference: string;
|
|
1469
|
+
};
|
|
1470
|
+
|
|
1471
|
+
/**
|
|
1472
|
+
* Typeguard to validate that an object is a FHIR resource
|
|
1473
|
+
* @param value The object to check
|
|
1474
|
+
* @returns True if the input is of type 'object' and contains property 'resourceType'
|
|
1475
|
+
*/
|
|
1476
|
+
export declare function isResource(value: unknown): value is Resource;
|
|
1477
|
+
|
|
1478
|
+
/**
|
|
1479
|
+
* Returns true if the given string is a valid FHIR resource type.
|
|
1480
|
+
*
|
|
1481
|
+
* ```ts
|
|
1482
|
+
* isResourceType('Patient'); // true
|
|
1483
|
+
* isResourceType('XYZ'); // false
|
|
1484
|
+
* ```
|
|
1485
|
+
*
|
|
1486
|
+
* @param resourceType The candidate resource type string.
|
|
1487
|
+
* @returns True if the resource type is a valid FHIR resource type.
|
|
1488
|
+
*/
|
|
1489
|
+
export declare function isResourceType(resourceType: string): boolean;
|
|
1490
|
+
|
|
1491
|
+
/**
|
|
1492
|
+
* Returns true if the type schema is a non-abstract FHIR resource.
|
|
1493
|
+
* @param typeSchema The type schema to check.
|
|
1494
|
+
* @returns True if the type schema is a non-abstract FHIR resource.
|
|
1495
|
+
*/
|
|
1496
|
+
export declare function isResourceTypeSchema(typeSchema: InternalTypeSchema): boolean;
|
|
1497
|
+
|
|
1498
|
+
/**
|
|
1499
|
+
* Returns true if the input array is an array of strings.
|
|
1500
|
+
* @param arr Input array.
|
|
1501
|
+
* @returns True if the input array is an array of strings.
|
|
1502
|
+
*/
|
|
1503
|
+
export declare function isStringArray(arr: any[]): arr is string[];
|
|
1504
|
+
|
|
1505
|
+
/**
|
|
1506
|
+
* Returns true if the input string is a UUID.
|
|
1507
|
+
* @param input The input string.
|
|
1508
|
+
* @returns True if the input string matches the UUID format.
|
|
1509
|
+
*/
|
|
1510
|
+
export declare function isUUID(input: string): input is `${string}-${string}-${string}-${string}-${string}`;
|
|
1511
|
+
|
|
1512
|
+
/**
|
|
1513
|
+
* Returns true if the given date object is a valid date.
|
|
1514
|
+
* Dates can be invalid if created by parsing an invalid string.
|
|
1515
|
+
* @param date A date object.
|
|
1516
|
+
* @returns Returns true if the date is a valid date.
|
|
1517
|
+
*/
|
|
1518
|
+
export declare function isValidDate(date: Date): boolean;
|
|
1519
|
+
|
|
1520
|
+
export declare function loadDataType(sd: StructureDefinition): void;
|
|
1521
|
+
|
|
1522
|
+
export declare interface LoginAuthenticationResponse {
|
|
1523
|
+
readonly login: string;
|
|
1524
|
+
readonly mfaRequired?: boolean;
|
|
1525
|
+
readonly code?: string;
|
|
1526
|
+
readonly memberships?: ProjectMembership[];
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
export declare interface LoginProfileResponse {
|
|
1530
|
+
readonly login: string;
|
|
1531
|
+
readonly scope: string;
|
|
1532
|
+
}
|
|
1533
|
+
|
|
1534
|
+
export declare interface LoginScopeResponse {
|
|
1535
|
+
readonly login: string;
|
|
1536
|
+
readonly code: string;
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
export declare interface LoginState {
|
|
1540
|
+
readonly project: Reference<Project>;
|
|
1541
|
+
readonly profile: Reference<ProfileResource>;
|
|
1542
|
+
readonly accessToken: string;
|
|
1543
|
+
readonly refreshToken: string;
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
export declare const LOINC = "http://loinc.org";
|
|
1547
|
+
|
|
1548
|
+
/**
|
|
1549
|
+
* LRU cache (least recently used)
|
|
1550
|
+
* Source: https://stackoverflow.com/a/46432113
|
|
1551
|
+
*/
|
|
1552
|
+
export declare class LRUCache<T> {
|
|
1553
|
+
private readonly max;
|
|
1554
|
+
private readonly cache;
|
|
1555
|
+
constructor(max?: number);
|
|
1556
|
+
/**
|
|
1557
|
+
* Deletes all values from the cache.
|
|
1558
|
+
*/
|
|
1559
|
+
clear(): void;
|
|
1560
|
+
/**
|
|
1561
|
+
* Returns the value for the given key.
|
|
1562
|
+
* @param key The key to retrieve.
|
|
1563
|
+
* @returns The value if found; undefined otherwise.
|
|
1564
|
+
*/
|
|
1565
|
+
get(key: string): T | undefined;
|
|
1566
|
+
/**
|
|
1567
|
+
* Sets the value for the given key.
|
|
1568
|
+
* @param key The key to set.
|
|
1569
|
+
* @param val The value to set.
|
|
1570
|
+
*/
|
|
1571
|
+
set(key: string, val: T): void;
|
|
1572
|
+
/**
|
|
1573
|
+
* Deletes the value for the given key.
|
|
1574
|
+
* @param key The key to delete.
|
|
1575
|
+
*/
|
|
1576
|
+
delete(key: string): void;
|
|
1577
|
+
/**
|
|
1578
|
+
* Returns the list of all keys in the cache.
|
|
1579
|
+
* @returns The array of keys in the cache.
|
|
1580
|
+
*/
|
|
1581
|
+
keys(): IterableIterator<string>;
|
|
1582
|
+
private first;
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1585
|
+
/**
|
|
1586
|
+
* Email address definition.
|
|
1587
|
+
* Compatible with nodemailer Mail.Address.
|
|
1588
|
+
*/
|
|
1589
|
+
export declare interface MailAddress {
|
|
1590
|
+
readonly name: string;
|
|
1591
|
+
readonly address: string;
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
/**
|
|
1595
|
+
* Email attachment definition.
|
|
1596
|
+
* Compatible with nodemailer Mail.Options.
|
|
1597
|
+
*/
|
|
1598
|
+
export declare interface MailAttachment {
|
|
1599
|
+
/** String, Buffer or a Stream contents for the attachmentent */
|
|
1600
|
+
readonly content?: string;
|
|
1601
|
+
/** 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) */
|
|
1602
|
+
readonly path?: string;
|
|
1603
|
+
/** 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 */
|
|
1604
|
+
readonly filename?: string | false;
|
|
1605
|
+
/** optional content type for the attachment, if not set will be derived from the filename property */
|
|
1606
|
+
readonly contentType?: string;
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
/**
|
|
1610
|
+
* Email destination definition.
|
|
1611
|
+
*/
|
|
1612
|
+
export declare type MailDestination = string | MailAddress | string[] | MailAddress[];
|
|
1613
|
+
|
|
1614
|
+
/**
|
|
1615
|
+
* Email message definition.
|
|
1616
|
+
* Compatible with nodemailer Mail.Options.
|
|
1617
|
+
*/
|
|
1618
|
+
export declare interface MailOptions {
|
|
1619
|
+
/** The e-mail address of the sender. All e-mail addresses can be plain 'sender@server.com' or formatted 'Sender Name <sender@server.com>' */
|
|
1620
|
+
readonly from?: string | MailAddress;
|
|
1621
|
+
/** An e-mail address that will appear on the Sender: field */
|
|
1622
|
+
readonly sender?: string | MailAddress;
|
|
1623
|
+
/** Comma separated list or an array of recipients e-mail addresses that will appear on the To: field */
|
|
1624
|
+
readonly to?: MailDestination;
|
|
1625
|
+
/** Comma separated list or an array of recipients e-mail addresses that will appear on the Cc: field */
|
|
1626
|
+
readonly cc?: MailDestination;
|
|
1627
|
+
/** Comma separated list or an array of recipients e-mail addresses that will appear on the Bcc: field */
|
|
1628
|
+
readonly bcc?: MailDestination;
|
|
1629
|
+
/** An e-mail address that will appear on the Reply-To: field */
|
|
1630
|
+
readonly replyTo?: string | MailAddress;
|
|
1631
|
+
/** The subject of the e-mail */
|
|
1632
|
+
readonly subject?: string;
|
|
1633
|
+
/** The plaintext version of the message */
|
|
1634
|
+
readonly text?: string;
|
|
1635
|
+
/** The HTML version of the message */
|
|
1636
|
+
readonly html?: string;
|
|
1637
|
+
/** An array of attachment objects */
|
|
1638
|
+
readonly attachments?: MailAttachment[];
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
declare interface Marker {
|
|
1642
|
+
index: number;
|
|
1643
|
+
line: number;
|
|
1644
|
+
column: number;
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1647
|
+
/**
|
|
1648
|
+
* Returns true if the resource satisfies the current access policy.
|
|
1649
|
+
* @param accessPolicy The access policy.
|
|
1650
|
+
* @param resource The resource.
|
|
1651
|
+
* @param readonlyMode True if the resource is being read.
|
|
1652
|
+
* @returns True if the resource matches the access policy.
|
|
1653
|
+
* @deprecated Use satisfiedAccessPolicy() instead.
|
|
1654
|
+
*/
|
|
1655
|
+
export declare function matchesAccessPolicy(accessPolicy: AccessPolicy, resource: Resource, readonlyMode: boolean): boolean;
|
|
1656
|
+
|
|
1657
|
+
/**
|
|
1658
|
+
* Returns true if the value is in the range accounting for precision.
|
|
1659
|
+
* @param value The numeric value.
|
|
1660
|
+
* @param range The numeric range.
|
|
1661
|
+
* @param precision Optional precision in number of digits.
|
|
1662
|
+
* @returns True if the value is within the range.
|
|
1663
|
+
*/
|
|
1664
|
+
export declare function matchesRange(value: number, range: Range_2, precision?: number): boolean;
|
|
1665
|
+
|
|
1666
|
+
/**
|
|
1667
|
+
* Determines if the resource matches the search request.
|
|
1668
|
+
* @param resource The resource that was created or updated.
|
|
1669
|
+
* @param searchRequest The subscription criteria as a search request.
|
|
1670
|
+
* @returns True if the resource satisfies the search request.
|
|
1671
|
+
*/
|
|
1672
|
+
export declare function matchesSearchRequest(resource: Resource, searchRequest: SearchRequest): boolean;
|
|
1673
|
+
|
|
1674
|
+
export declare const MEDPLUM_VERSION: string;
|
|
1675
|
+
|
|
1676
|
+
/**
|
|
1677
|
+
* The MedplumClient class provides a client for the Medplum FHIR server.
|
|
1678
|
+
*
|
|
1679
|
+
* The client can be used in the browser, in a Node.js application, or in a Medplum Bot.
|
|
1680
|
+
*
|
|
1681
|
+
* The client provides helpful methods for common operations such as:
|
|
1682
|
+
* 1) Authenticating
|
|
1683
|
+
* 2) Creating resources
|
|
1684
|
+
* 2) Reading resources
|
|
1685
|
+
* 3) Updating resources
|
|
1686
|
+
* 5) Deleting resources
|
|
1687
|
+
* 6) Searching
|
|
1688
|
+
* 7) Making GraphQL queries
|
|
1689
|
+
*
|
|
1690
|
+
* Here is a quick example of how to use the client:
|
|
1691
|
+
*
|
|
1692
|
+
* ```typescript
|
|
1693
|
+
* import { MedplumClient } from '@medplum/core';
|
|
1694
|
+
* const medplum = new MedplumClient();
|
|
1695
|
+
* ```
|
|
1696
|
+
*
|
|
1697
|
+
* Create a `Patient`:
|
|
1698
|
+
*
|
|
1699
|
+
* ```typescript
|
|
1700
|
+
* const patient = await medplum.createResource({
|
|
1701
|
+
* resourceType: 'Patient',
|
|
1702
|
+
* name: [{
|
|
1703
|
+
* given: ['Alice'],
|
|
1704
|
+
* family: 'Smith'
|
|
1705
|
+
* }]
|
|
1706
|
+
* });
|
|
1707
|
+
* ```
|
|
1708
|
+
*
|
|
1709
|
+
* Read a `Patient` by ID:
|
|
1710
|
+
*
|
|
1711
|
+
* ```typescript
|
|
1712
|
+
* const patient = await medplum.readResource('Patient', '123');
|
|
1713
|
+
* console.log(patient.name[0].given[0]);
|
|
1714
|
+
* ```
|
|
1715
|
+
*
|
|
1716
|
+
* Search for a `Patient` by name:
|
|
1717
|
+
*
|
|
1718
|
+
* ```typescript
|
|
1719
|
+
* const bundle = await medplum.search('Patient', 'name=Alice');
|
|
1720
|
+
* console.log(bundle.total);
|
|
1721
|
+
* ```
|
|
1722
|
+
*
|
|
1723
|
+
* <head>
|
|
1724
|
+
* <meta name="algolia:pageRank" content="100" />
|
|
1725
|
+
* </head>
|
|
1726
|
+
*/
|
|
1727
|
+
export declare class MedplumClient extends EventTarget_2 {
|
|
1728
|
+
private readonly options;
|
|
1729
|
+
private readonly fetch;
|
|
1730
|
+
private readonly createPdfImpl?;
|
|
1731
|
+
private readonly storage;
|
|
1732
|
+
private readonly requestCache;
|
|
1733
|
+
private readonly cacheTime;
|
|
1734
|
+
private readonly baseUrl;
|
|
1735
|
+
private readonly fhirBaseUrl;
|
|
1736
|
+
private readonly authorizeUrl;
|
|
1737
|
+
private readonly tokenUrl;
|
|
1738
|
+
private readonly logoutUrl;
|
|
1739
|
+
private readonly onUnauthenticated?;
|
|
1740
|
+
private readonly autoBatchTime;
|
|
1741
|
+
private readonly autoBatchQueue;
|
|
1742
|
+
private medplumServer?;
|
|
1743
|
+
private clientId?;
|
|
1744
|
+
private clientSecret?;
|
|
1745
|
+
private autoBatchTimerId?;
|
|
1746
|
+
private accessToken?;
|
|
1747
|
+
private refreshToken?;
|
|
1748
|
+
private refreshPromise?;
|
|
1749
|
+
private profilePromise?;
|
|
1750
|
+
private sessionDetails?;
|
|
1751
|
+
private basicAuth?;
|
|
1752
|
+
constructor(options?: MedplumClientOptions);
|
|
1753
|
+
/**
|
|
1754
|
+
* Returns the current base URL for all API requests.
|
|
1755
|
+
* By default, this is set to `https://api.medplum.com/`.
|
|
1756
|
+
* This can be overridden by setting the `baseUrl` option when creating the client.
|
|
1757
|
+
* @category HTTP
|
|
1758
|
+
* @returns The current base URL for all API requests.
|
|
1759
|
+
*/
|
|
1760
|
+
getBaseUrl(): string;
|
|
1761
|
+
/**
|
|
1762
|
+
* Returns the current authorize URL.
|
|
1763
|
+
* By default, this is set to `https://api.medplum.com/oauth2/authorize`.
|
|
1764
|
+
* This can be overridden by setting the `authorizeUrl` option when creating the client.
|
|
1765
|
+
* @category HTTP
|
|
1766
|
+
* @returns The current authorize URL.
|
|
1767
|
+
*/
|
|
1768
|
+
getAuthorizeUrl(): string;
|
|
1769
|
+
/**
|
|
1770
|
+
* Returns the current token URL.
|
|
1771
|
+
* By default, this is set to `https://api.medplum.com/oauth2/token`.
|
|
1772
|
+
* This can be overridden by setting the `tokenUrl` option when creating the client.
|
|
1773
|
+
* @category HTTP
|
|
1774
|
+
* @returns The current token URL.
|
|
1775
|
+
*/
|
|
1776
|
+
getTokenUrl(): string;
|
|
1777
|
+
/**
|
|
1778
|
+
* Returns the current logout URL.
|
|
1779
|
+
* By default, this is set to `https://api.medplum.com/oauth2/logout`.
|
|
1780
|
+
* This can be overridden by setting the `logoutUrl` option when creating the client.
|
|
1781
|
+
* @category HTTP
|
|
1782
|
+
* @returns The current logout URL.
|
|
1783
|
+
*/
|
|
1784
|
+
getLogoutUrl(): string;
|
|
1785
|
+
/**
|
|
1786
|
+
* Clears all auth state including local storage and session storage.
|
|
1787
|
+
* @category Authentication
|
|
1788
|
+
*/
|
|
1789
|
+
clear(): void;
|
|
1790
|
+
/**
|
|
1791
|
+
* Clears the active login from local storage.
|
|
1792
|
+
* Does not clear all local storage (such as other logins).
|
|
1793
|
+
* @category Authentication
|
|
1794
|
+
*/
|
|
1795
|
+
clearActiveLogin(): void;
|
|
1796
|
+
/**
|
|
1797
|
+
* Invalidates any cached values or cached requests for the given URL.
|
|
1798
|
+
* @category Caching
|
|
1799
|
+
* @param url The URL to invalidate.
|
|
1800
|
+
*/
|
|
1801
|
+
invalidateUrl(url: URL | string): void;
|
|
1802
|
+
/**
|
|
1803
|
+
* Invalidates all cached values and flushes the cache.
|
|
1804
|
+
* @category Caching
|
|
1805
|
+
*/
|
|
1806
|
+
invalidateAll(): void;
|
|
1807
|
+
/**
|
|
1808
|
+
* Invalidates all cached search results or cached requests for the given resourceType.
|
|
1809
|
+
* @category Caching
|
|
1810
|
+
* @param resourceType The resource type to invalidate.
|
|
1811
|
+
*/
|
|
1812
|
+
invalidateSearches<K extends ResourceType>(resourceType: K): void;
|
|
1813
|
+
/**
|
|
1814
|
+
* Makes an HTTP GET request to the specified URL.
|
|
1815
|
+
*
|
|
1816
|
+
* This is a lower level method for custom requests.
|
|
1817
|
+
* For common operations, we recommend using higher level methods
|
|
1818
|
+
* such as `readResource()`, `search()`, etc.
|
|
1819
|
+
* @category HTTP
|
|
1820
|
+
* @param url The target URL.
|
|
1821
|
+
* @param options Optional fetch options.
|
|
1822
|
+
* @returns Promise to the response content.
|
|
1823
|
+
*/
|
|
1824
|
+
get<T = any>(url: URL | string, options?: RequestInit): ReadablePromise<T>;
|
|
1825
|
+
/**
|
|
1826
|
+
* Makes an HTTP POST request to the specified URL.
|
|
1827
|
+
*
|
|
1828
|
+
* This is a lower level method for custom requests.
|
|
1829
|
+
* For common operations, we recommend using higher level methods
|
|
1830
|
+
* such as `createResource()`.
|
|
1831
|
+
* @category HTTP
|
|
1832
|
+
* @param url The target URL.
|
|
1833
|
+
* @param body The content body. Strings and `File` objects are passed directly. Other objects are converted to JSON.
|
|
1834
|
+
* @param contentType The content type to be included in the "Content-Type" header.
|
|
1835
|
+
* @param options Optional fetch options.
|
|
1836
|
+
* @returns Promise to the response content.
|
|
1837
|
+
*/
|
|
1838
|
+
post(url: URL | string, body: any, contentType?: string, options?: RequestInit): Promise<any>;
|
|
1839
|
+
/**
|
|
1840
|
+
* Makes an HTTP PUT request to the specified URL.
|
|
1841
|
+
*
|
|
1842
|
+
* This is a lower level method for custom requests.
|
|
1843
|
+
* For common operations, we recommend using higher level methods
|
|
1844
|
+
* such as `updateResource()`.
|
|
1845
|
+
* @category HTTP
|
|
1846
|
+
* @param url The target URL.
|
|
1847
|
+
* @param body The content body. Strings and `File` objects are passed directly. Other objects are converted to JSON.
|
|
1848
|
+
* @param contentType The content type to be included in the "Content-Type" header.
|
|
1849
|
+
* @param options Optional fetch options.
|
|
1850
|
+
* @returns Promise to the response content.
|
|
1851
|
+
*/
|
|
1852
|
+
put(url: URL | string, body: any, contentType?: string, options?: RequestInit): Promise<any>;
|
|
1853
|
+
/**
|
|
1854
|
+
* Makes an HTTP PATCH request to the specified URL.
|
|
1855
|
+
*
|
|
1856
|
+
* This is a lower level method for custom requests.
|
|
1857
|
+
* For common operations, we recommend using higher level methods
|
|
1858
|
+
* such as `patchResource()`.
|
|
1859
|
+
* @category HTTP
|
|
1860
|
+
* @param url The target URL.
|
|
1861
|
+
* @param operations Array of JSONPatch operations.
|
|
1862
|
+
* @param options Optional fetch options.
|
|
1863
|
+
* @returns Promise to the response content.
|
|
1864
|
+
*/
|
|
1865
|
+
patch(url: URL | string, operations: PatchOperation[], options?: RequestInit): Promise<any>;
|
|
1866
|
+
/**
|
|
1867
|
+
* Makes an HTTP DELETE request to the specified URL.
|
|
1868
|
+
*
|
|
1869
|
+
*
|
|
1870
|
+
* This is a lower level method for custom requests.
|
|
1871
|
+
* For common operations, we recommend using higher level methods
|
|
1872
|
+
* such as `deleteResource()`.
|
|
1873
|
+
* @category HTTP
|
|
1874
|
+
* @param url The target URL.
|
|
1875
|
+
* @param options Optional fetch options.
|
|
1876
|
+
* @returns Promise to the response content.
|
|
1877
|
+
*/
|
|
1878
|
+
delete(url: URL | string, options?: RequestInit): Promise<any>;
|
|
1879
|
+
/**
|
|
1880
|
+
* Initiates a new user flow.
|
|
1881
|
+
*
|
|
1882
|
+
* This method is part of the two different user registration flows:
|
|
1883
|
+
* 1) New Practitioner and new Project
|
|
1884
|
+
* 2) New Patient registration
|
|
1885
|
+
* @category Authentication
|
|
1886
|
+
* @param newUserRequest Register request including email and password.
|
|
1887
|
+
* @param options Optional fetch options.
|
|
1888
|
+
* @returns Promise to the authentication response.
|
|
1889
|
+
*/
|
|
1890
|
+
startNewUser(newUserRequest: NewUserRequest, options?: RequestInit): Promise<LoginAuthenticationResponse>;
|
|
1891
|
+
/**
|
|
1892
|
+
* Initiates a new project flow.
|
|
1893
|
+
*
|
|
1894
|
+
* This requires a partial login from `startNewUser` or `startNewGoogleUser`.
|
|
1895
|
+
* @param newProjectRequest Register request including email and password.
|
|
1896
|
+
* @param options Optional fetch options.
|
|
1897
|
+
* @returns Promise to the authentication response.
|
|
1898
|
+
*/
|
|
1899
|
+
startNewProject(newProjectRequest: NewProjectRequest, options?: RequestInit): Promise<LoginAuthenticationResponse>;
|
|
1900
|
+
/**
|
|
1901
|
+
* Initiates a new patient flow.
|
|
1902
|
+
*
|
|
1903
|
+
* This requires a partial login from `startNewUser` or `startNewGoogleUser`.
|
|
1904
|
+
* @param newPatientRequest Register request including email and password.
|
|
1905
|
+
* @param options Optional fetch options.
|
|
1906
|
+
* @returns Promise to the authentication response.
|
|
1907
|
+
*/
|
|
1908
|
+
startNewPatient(newPatientRequest: NewPatientRequest, options?: RequestInit): Promise<LoginAuthenticationResponse>;
|
|
1909
|
+
/**
|
|
1910
|
+
* Initiates a user login flow.
|
|
1911
|
+
* @category Authentication
|
|
1912
|
+
* @param loginRequest Login request including email and password.
|
|
1913
|
+
* @param options Optional fetch options.
|
|
1914
|
+
* @returns Promise to the authentication response.
|
|
1915
|
+
*/
|
|
1916
|
+
startLogin(loginRequest: EmailPasswordLoginRequest, options?: RequestInit): Promise<LoginAuthenticationResponse>;
|
|
1917
|
+
/**
|
|
1918
|
+
* Tries to sign in with Google authentication.
|
|
1919
|
+
* The response parameter is the result of a Google authentication.
|
|
1920
|
+
* See: https://developers.google.com/identity/gsi/web/guides/handle-credential-responses-js-functions
|
|
1921
|
+
* @category Authentication
|
|
1922
|
+
* @param loginRequest Login request including Google credential response.
|
|
1923
|
+
* @param options Optional fetch options.
|
|
1924
|
+
* @returns Promise to the authentication response.
|
|
1925
|
+
*/
|
|
1926
|
+
startGoogleLogin(loginRequest: GoogleLoginRequest, options?: RequestInit): Promise<LoginAuthenticationResponse>;
|
|
1927
|
+
/**
|
|
1928
|
+
* Returns the PKCE code challenge and method.
|
|
1929
|
+
* If the login request already includes a code challenge, it is returned.
|
|
1930
|
+
* Otherwise, a new PKCE code challenge is generated.
|
|
1931
|
+
* @category Authentication
|
|
1932
|
+
* @param loginRequest The original login request.
|
|
1933
|
+
* @returns The PKCE code challenge and method.
|
|
1934
|
+
*/
|
|
1935
|
+
ensureCodeChallenge<T extends BaseLoginRequest>(loginRequest: T): Promise<T>;
|
|
1936
|
+
/**
|
|
1937
|
+
* Signs out locally.
|
|
1938
|
+
* Does not invalidate tokens with the server.
|
|
1939
|
+
* @category Authentication
|
|
1940
|
+
*/
|
|
1941
|
+
signOut(): Promise<void>;
|
|
1942
|
+
/**
|
|
1943
|
+
* Tries to sign in the user.
|
|
1944
|
+
* Returns true if the user is signed in.
|
|
1945
|
+
* This may result in navigating away to the sign in page.
|
|
1946
|
+
* @category Authentication
|
|
1947
|
+
* @param loginParams Optional login parameters.
|
|
1948
|
+
* @returns The user profile resource if available.
|
|
1949
|
+
*/
|
|
1950
|
+
signInWithRedirect(loginParams?: Partial<BaseLoginRequest>): Promise<ProfileResource | undefined>;
|
|
1951
|
+
/**
|
|
1952
|
+
* Tries to sign out the user.
|
|
1953
|
+
* See: https://docs.aws.amazon.com/cognito/latest/developerguide/logout-endpoint.html
|
|
1954
|
+
* @category Authentication
|
|
1955
|
+
*/
|
|
1956
|
+
signOutWithRedirect(): void;
|
|
1957
|
+
/**
|
|
1958
|
+
* Initiates sign in with an external identity provider.
|
|
1959
|
+
* @param authorizeUrl The external authorization URL.
|
|
1960
|
+
* @param clientId The external client ID.
|
|
1961
|
+
* @param redirectUri The external identity provider redirect URI.
|
|
1962
|
+
* @param baseLogin The Medplum login request.
|
|
1963
|
+
* @category Authentication
|
|
1964
|
+
*/
|
|
1965
|
+
signInWithExternalAuth(authorizeUrl: string, clientId: string, redirectUri: string, baseLogin: BaseLoginRequest): Promise<void>;
|
|
1966
|
+
/**
|
|
1967
|
+
* Exchange an external access token for a Medplum access token.
|
|
1968
|
+
* @param token The access token that was generated by the external identity provider.
|
|
1969
|
+
* @param clientId The ID of the `ClientApplication` in your Medplum project that will be making the exchange request.
|
|
1970
|
+
* @returns The user profile resource.
|
|
1971
|
+
* @category Authentication
|
|
1972
|
+
*/
|
|
1973
|
+
exchangeExternalAccessToken(token: string, clientId?: string): Promise<ProfileResource>;
|
|
1974
|
+
/**
|
|
1975
|
+
* Builds the external identity provider redirect URI.
|
|
1976
|
+
* @param authorizeUrl The external authorization URL.
|
|
1977
|
+
* @param clientId The external client ID.
|
|
1978
|
+
* @param redirectUri The external identity provider redirect URI.
|
|
1979
|
+
* @param loginRequest The Medplum login request.
|
|
1980
|
+
* @returns The external identity provider redirect URI.
|
|
1981
|
+
* @category Authentication
|
|
1982
|
+
*/
|
|
1983
|
+
getExternalAuthRedirectUri(authorizeUrl: string, clientId: string, redirectUri: string, loginRequest: BaseLoginRequest): string;
|
|
1984
|
+
/**
|
|
1985
|
+
* Builds a FHIR URL from a collection of URL path components.
|
|
1986
|
+
* For example, `buildUrl('/Patient', '123')` returns `fhir/R4/Patient/123`.
|
|
1987
|
+
* @category HTTP
|
|
1988
|
+
* @param path The path component of the URL.
|
|
1989
|
+
* @returns The well-formed FHIR URL.
|
|
1990
|
+
*/
|
|
1991
|
+
fhirUrl(...path: string[]): URL;
|
|
1992
|
+
/**
|
|
1993
|
+
* Builds a FHIR search URL from a search query or structured query object.
|
|
1994
|
+
* @category HTTP
|
|
1995
|
+
* @category Search
|
|
1996
|
+
* @param resourceType The FHIR resource type.
|
|
1997
|
+
* @param query The FHIR search query or structured query object. Can be any valid input to the URLSearchParams() constructor.
|
|
1998
|
+
* @returns The well-formed FHIR URL.
|
|
1999
|
+
*/
|
|
2000
|
+
fhirSearchUrl(resourceType: ResourceType, query: QueryTypes): URL;
|
|
2001
|
+
/**
|
|
2002
|
+
* Sends a FHIR search request.
|
|
2003
|
+
*
|
|
2004
|
+
* Example using a FHIR search string:
|
|
2005
|
+
*
|
|
2006
|
+
* ```typescript
|
|
2007
|
+
* const bundle = await client.search('Patient', 'name=Alice');
|
|
2008
|
+
* console.log(bundle);
|
|
2009
|
+
* ```
|
|
2010
|
+
*
|
|
2011
|
+
* The return value is a FHIR bundle:
|
|
2012
|
+
*
|
|
2013
|
+
* ```json
|
|
2014
|
+
* {
|
|
2015
|
+
* "resourceType": "Bundle",
|
|
2016
|
+
* "type": "searchset",
|
|
2017
|
+
* "entry": [
|
|
2018
|
+
* {
|
|
2019
|
+
* "resource": {
|
|
2020
|
+
* "resourceType": "Patient",
|
|
2021
|
+
* "name": [
|
|
2022
|
+
* {
|
|
2023
|
+
* "given": [
|
|
2024
|
+
* "George"
|
|
2025
|
+
* ],
|
|
2026
|
+
* "family": "Washington"
|
|
2027
|
+
* }
|
|
2028
|
+
* ],
|
|
2029
|
+
* }
|
|
2030
|
+
* }
|
|
2031
|
+
* ]
|
|
2032
|
+
* }
|
|
2033
|
+
* ```
|
|
2034
|
+
*
|
|
2035
|
+
* To query the count of a search, use the summary feature like so:
|
|
2036
|
+
*
|
|
2037
|
+
* ```typescript
|
|
2038
|
+
* const patients = medplum.search('Patient', '_summary=count');
|
|
2039
|
+
* ```
|
|
2040
|
+
*
|
|
2041
|
+
* See FHIR search for full details: https://www.hl7.org/fhir/search.html
|
|
2042
|
+
* @category Search
|
|
2043
|
+
* @param resourceType The FHIR resource type.
|
|
2044
|
+
* @param query Optional FHIR search query or structured query object. Can be any valid input to the URLSearchParams() constructor.
|
|
2045
|
+
* @param options Optional fetch options.
|
|
2046
|
+
* @returns Promise to the search result bundle.
|
|
2047
|
+
*/
|
|
2048
|
+
search<K extends ResourceType>(resourceType: K, query?: QueryTypes, options?: RequestInit): ReadablePromise<Bundle<ExtractResource<K>>>;
|
|
2049
|
+
/**
|
|
2050
|
+
* Sends a FHIR search request for a single resource.
|
|
2051
|
+
*
|
|
2052
|
+
* This is a convenience method for `search()` that returns the first resource rather than a `Bundle`.
|
|
2053
|
+
*
|
|
2054
|
+
* Example using a FHIR search string:
|
|
2055
|
+
*
|
|
2056
|
+
* ```typescript
|
|
2057
|
+
* const patient = await client.searchOne('Patient', 'identifier=123');
|
|
2058
|
+
* console.log(patient);
|
|
2059
|
+
* ```
|
|
2060
|
+
*
|
|
2061
|
+
* The return value is the resource, if available; otherwise, undefined.
|
|
2062
|
+
*
|
|
2063
|
+
* See FHIR search for full details: https://www.hl7.org/fhir/search.html
|
|
2064
|
+
* @category Search
|
|
2065
|
+
* @param resourceType The FHIR resource type.
|
|
2066
|
+
* @param query Optional FHIR search query or structured query object. Can be any valid input to the URLSearchParams() constructor.
|
|
2067
|
+
* @param options Optional fetch options.
|
|
2068
|
+
* @returns Promise to the first search result.
|
|
2069
|
+
*/
|
|
2070
|
+
searchOne<K extends ResourceType>(resourceType: K, query?: QueryTypes, options?: RequestInit): ReadablePromise<ExtractResource<K> | undefined>;
|
|
2071
|
+
/**
|
|
2072
|
+
* Sends a FHIR search request for an array of resources.
|
|
2073
|
+
*
|
|
2074
|
+
* This is a convenience method for `search()` that returns the resources as an array rather than a `Bundle`.
|
|
2075
|
+
*
|
|
2076
|
+
* Example using a FHIR search string:
|
|
2077
|
+
*
|
|
2078
|
+
* ```typescript
|
|
2079
|
+
* const patients = await client.searchResources('Patient', 'name=Alice');
|
|
2080
|
+
* console.log(patients);
|
|
2081
|
+
* ```
|
|
2082
|
+
*
|
|
2083
|
+
* The return value is an array of resources.
|
|
2084
|
+
*
|
|
2085
|
+
* See FHIR search for full details: https://www.hl7.org/fhir/search.html
|
|
2086
|
+
* @category Search
|
|
2087
|
+
* @param resourceType The FHIR resource type.
|
|
2088
|
+
* @param query Optional FHIR search query or structured query object. Can be any valid input to the URLSearchParams() constructor.
|
|
2089
|
+
* @param options Optional fetch options.
|
|
2090
|
+
* @returns Promise to the array of search results.
|
|
2091
|
+
*/
|
|
2092
|
+
searchResources<K extends ResourceType>(resourceType: K, query?: QueryTypes, options?: RequestInit): ReadablePromise<ResourceArray<ExtractResource<K>>>;
|
|
2093
|
+
/**
|
|
2094
|
+
* Creates an
|
|
2095
|
+
* [async generator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncGenerator)
|
|
2096
|
+
* over a series of FHIR search requests for paginated search results. Each iteration of the generator yields
|
|
2097
|
+
* the array of resources on each page.
|
|
2098
|
+
*
|
|
2099
|
+
*
|
|
2100
|
+
* ```typescript
|
|
2101
|
+
* for await (const page of medplum.searchResourcePages('Patient', { _count: 10 })) {
|
|
2102
|
+
* for (const patient of page) {
|
|
2103
|
+
* console.log(`Processing Patient resource with ID: ${patient.id}`);
|
|
2104
|
+
* }
|
|
2105
|
+
* }
|
|
2106
|
+
* ```
|
|
2107
|
+
* @category Search
|
|
2108
|
+
* @param resourceType The FHIR resource type.
|
|
2109
|
+
* @param query Optional FHIR search query or structured query object. Can be any valid input to the URLSearchParams() constructor.
|
|
2110
|
+
* @param options Optional fetch options.
|
|
2111
|
+
* @yields An async generator, where each result is an array of resources for each page.
|
|
2112
|
+
*/
|
|
2113
|
+
searchResourcePages<K extends ResourceType>(resourceType: K, query?: QueryTypes, options?: RequestInit): AsyncGenerator<ResourceArray<ExtractResource<K>>>;
|
|
2114
|
+
/**
|
|
2115
|
+
* Searches a ValueSet resource using the "expand" operation.
|
|
2116
|
+
* See: https://www.hl7.org/fhir/operation-valueset-expand.html
|
|
2117
|
+
* @category Search
|
|
2118
|
+
* @param system The ValueSet system url.
|
|
2119
|
+
* @param filter The search string.
|
|
2120
|
+
* @param options Optional fetch options.
|
|
2121
|
+
* @returns Promise to expanded ValueSet.
|
|
2122
|
+
*/
|
|
2123
|
+
searchValueSet(system: string, filter: string, options?: RequestInit): ReadablePromise<ValueSet>;
|
|
2124
|
+
/**
|
|
2125
|
+
* Returns a cached resource if it is available.
|
|
2126
|
+
* @category Caching
|
|
2127
|
+
* @param resourceType The FHIR resource type.
|
|
2128
|
+
* @param id The FHIR resource ID.
|
|
2129
|
+
* @returns The resource if it is available in the cache; undefined otherwise.
|
|
2130
|
+
*/
|
|
2131
|
+
getCached<K extends ResourceType>(resourceType: K, id: string): ExtractResource<K> | undefined;
|
|
2132
|
+
/**
|
|
2133
|
+
* Returns a cached resource if it is available.
|
|
2134
|
+
* @category Caching
|
|
2135
|
+
* @param reference The FHIR reference.
|
|
2136
|
+
* @returns The resource if it is available in the cache; undefined otherwise.
|
|
2137
|
+
*/
|
|
2138
|
+
getCachedReference<T extends Resource>(reference: Reference<T>): T | undefined;
|
|
2139
|
+
/**
|
|
2140
|
+
* Reads a resource by resource type and ID.
|
|
2141
|
+
*
|
|
2142
|
+
* Example:
|
|
2143
|
+
*
|
|
2144
|
+
* ```typescript
|
|
2145
|
+
* const patient = await medplum.readResource('Patient', '123');
|
|
2146
|
+
* console.log(patient);
|
|
2147
|
+
* ```
|
|
2148
|
+
*
|
|
2149
|
+
* See the FHIR "read" operation for full details: https://www.hl7.org/fhir/http.html#read
|
|
2150
|
+
* @category Read
|
|
2151
|
+
* @param resourceType The FHIR resource type.
|
|
2152
|
+
* @param id The resource ID.
|
|
2153
|
+
* @param options Optional fetch options.
|
|
2154
|
+
* @returns The resource if available; undefined otherwise.
|
|
2155
|
+
*/
|
|
2156
|
+
readResource<K extends ResourceType>(resourceType: K, id: string, options?: RequestInit): ReadablePromise<ExtractResource<K>>;
|
|
2157
|
+
/**
|
|
2158
|
+
* Reads a resource by `Reference`.
|
|
2159
|
+
*
|
|
2160
|
+
* This is a convenience method for `readResource()` that accepts a `Reference` object.
|
|
2161
|
+
*
|
|
2162
|
+
* Example:
|
|
2163
|
+
*
|
|
2164
|
+
* ```typescript
|
|
2165
|
+
* const serviceRequest = await medplum.readResource('ServiceRequest', '123');
|
|
2166
|
+
* const patient = await medplum.readReference(serviceRequest.subject);
|
|
2167
|
+
* console.log(patient);
|
|
2168
|
+
* ```
|
|
2169
|
+
*
|
|
2170
|
+
* See the FHIR "read" operation for full details: https://www.hl7.org/fhir/http.html#read
|
|
2171
|
+
* @category Read
|
|
2172
|
+
* @param reference The FHIR reference object.
|
|
2173
|
+
* @param options Optional fetch options.
|
|
2174
|
+
* @returns The resource if available; undefined otherwise.
|
|
2175
|
+
*/
|
|
2176
|
+
readReference<T extends Resource>(reference: Reference<T>, options?: RequestInit): ReadablePromise<T>;
|
|
2177
|
+
/**
|
|
2178
|
+
* Requests the schema for a resource type.
|
|
2179
|
+
* If the schema is already cached, the promise is resolved immediately.
|
|
2180
|
+
* @category Schema
|
|
2181
|
+
* @param resourceType The FHIR resource type.
|
|
2182
|
+
* @returns Promise to a schema with the requested resource type.
|
|
2183
|
+
*/
|
|
2184
|
+
requestSchema(resourceType: string): Promise<void>;
|
|
2185
|
+
/**
|
|
2186
|
+
* Reads resource history by resource type and ID.
|
|
2187
|
+
*
|
|
2188
|
+
* The return value is a bundle of all versions of the resource.
|
|
2189
|
+
*
|
|
2190
|
+
* Example:
|
|
2191
|
+
*
|
|
2192
|
+
* ```typescript
|
|
2193
|
+
* const history = await medplum.readHistory('Patient', '123');
|
|
2194
|
+
* console.log(history);
|
|
2195
|
+
* ```
|
|
2196
|
+
*
|
|
2197
|
+
* See the FHIR "history" operation for full details: https://www.hl7.org/fhir/http.html#history
|
|
2198
|
+
* @category Read
|
|
2199
|
+
* @param resourceType The FHIR resource type.
|
|
2200
|
+
* @param id The resource ID.
|
|
2201
|
+
* @param options Optional fetch options.
|
|
2202
|
+
* @returns Promise to the resource history.
|
|
2203
|
+
*/
|
|
2204
|
+
readHistory<K extends ResourceType>(resourceType: K, id: string, options?: RequestInit): ReadablePromise<Bundle<ExtractResource<K>>>;
|
|
2205
|
+
/**
|
|
2206
|
+
* Reads a specific version of a resource by resource type, ID, and version ID.
|
|
2207
|
+
*
|
|
2208
|
+
* Example:
|
|
2209
|
+
*
|
|
2210
|
+
* ```typescript
|
|
2211
|
+
* const version = await medplum.readVersion('Patient', '123', '456');
|
|
2212
|
+
* console.log(version);
|
|
2213
|
+
* ```
|
|
2214
|
+
*
|
|
2215
|
+
* See the FHIR "vread" operation for full details: https://www.hl7.org/fhir/http.html#vread
|
|
2216
|
+
* @category Read
|
|
2217
|
+
* @param resourceType The FHIR resource type.
|
|
2218
|
+
* @param id The resource ID.
|
|
2219
|
+
* @param vid The version ID.
|
|
2220
|
+
* @param options Optional fetch options.
|
|
2221
|
+
* @returns The resource if available; undefined otherwise.
|
|
2222
|
+
*/
|
|
2223
|
+
readVersion<K extends ResourceType>(resourceType: K, id: string, vid: string, options?: RequestInit): ReadablePromise<ExtractResource<K>>;
|
|
2224
|
+
/**
|
|
2225
|
+
* Executes the Patient "everything" operation for a patient.
|
|
2226
|
+
*
|
|
2227
|
+
* Example:
|
|
2228
|
+
*
|
|
2229
|
+
* ```typescript
|
|
2230
|
+
* const bundle = await medplum.readPatientEverything('123');
|
|
2231
|
+
* console.log(bundle);
|
|
2232
|
+
* ```
|
|
2233
|
+
*
|
|
2234
|
+
* See the FHIR "patient-everything" operation for full details: https://hl7.org/fhir/operation-patient-everything.html
|
|
2235
|
+
* @category Read
|
|
2236
|
+
* @param id The Patient Id
|
|
2237
|
+
* @param options Optional fetch options.
|
|
2238
|
+
* @returns A Bundle of all Resources related to the Patient
|
|
2239
|
+
*/
|
|
2240
|
+
readPatientEverything(id: string, options?: RequestInit): ReadablePromise<Bundle>;
|
|
2241
|
+
/**
|
|
2242
|
+
* Creates a new FHIR resource.
|
|
2243
|
+
*
|
|
2244
|
+
* The return value is the newly created resource, including the ID and meta.
|
|
2245
|
+
*
|
|
2246
|
+
* Example:
|
|
2247
|
+
*
|
|
2248
|
+
* ```typescript
|
|
2249
|
+
* const result = await medplum.createResource({
|
|
2250
|
+
* resourceType: 'Patient',
|
|
2251
|
+
* name: [{
|
|
2252
|
+
* family: 'Smith',
|
|
2253
|
+
* given: ['John']
|
|
2254
|
+
* }]
|
|
2255
|
+
* });
|
|
2256
|
+
* console.log(result.id);
|
|
2257
|
+
* ```
|
|
2258
|
+
*
|
|
2259
|
+
* See the FHIR "create" operation for full details: https://www.hl7.org/fhir/http.html#create
|
|
2260
|
+
* @category Create
|
|
2261
|
+
* @param resource The FHIR resource to create.
|
|
2262
|
+
* @param options Optional fetch options.
|
|
2263
|
+
* @returns The result of the create operation.
|
|
2264
|
+
*/
|
|
2265
|
+
createResource<T extends Resource>(resource: T, options?: RequestInit): Promise<T>;
|
|
2266
|
+
/**
|
|
2267
|
+
* Conditionally create a new FHIR resource only if some equivalent resource does not already exist on the server.
|
|
2268
|
+
*
|
|
2269
|
+
* The return value is the existing resource or the newly created resource, including the ID and meta.
|
|
2270
|
+
*
|
|
2271
|
+
* Example:
|
|
2272
|
+
*
|
|
2273
|
+
* ```typescript
|
|
2274
|
+
* const result = await medplum.createResourceIfNoneExist(
|
|
2275
|
+
* {
|
|
2276
|
+
* resourceType: 'Patient',
|
|
2277
|
+
* identifier: [{
|
|
2278
|
+
* system: 'http://example.com/mrn',
|
|
2279
|
+
* value: '123'
|
|
2280
|
+
* }]
|
|
2281
|
+
* name: [{
|
|
2282
|
+
* family: 'Smith',
|
|
2283
|
+
* given: ['John']
|
|
2284
|
+
* }]
|
|
2285
|
+
* },
|
|
2286
|
+
* 'identifier=123'
|
|
2287
|
+
* );
|
|
2288
|
+
* console.log(result.id);
|
|
2289
|
+
* ```
|
|
2290
|
+
*
|
|
2291
|
+
* This method is syntactic sugar for:
|
|
2292
|
+
*
|
|
2293
|
+
* ```typescript
|
|
2294
|
+
* return searchOne(resourceType, query) ?? createResource(resource);
|
|
2295
|
+
* ```
|
|
2296
|
+
*
|
|
2297
|
+
* The query parameter only contains the search parameters (what would be in the URL following the "?").
|
|
2298
|
+
*
|
|
2299
|
+
* See the FHIR "conditional create" operation for full details: https://www.hl7.org/fhir/http.html#ccreate
|
|
2300
|
+
* @category Create
|
|
2301
|
+
* @param resource The FHIR resource to create.
|
|
2302
|
+
* @param query The search query for an equivalent resource (should not include resource type or "?").
|
|
2303
|
+
* @param options Optional fetch options.
|
|
2304
|
+
* @returns The result of the create operation.
|
|
2305
|
+
*/
|
|
2306
|
+
createResourceIfNoneExist<T extends Resource>(resource: T, query: string, options?: RequestInit): Promise<T>;
|
|
2307
|
+
/**
|
|
2308
|
+
* Creates a FHIR `Attachment` with the provided data content.
|
|
2309
|
+
*
|
|
2310
|
+
* This is a convenience method for creating a `Binary` resource and then creating an `Attachment` element.
|
|
2311
|
+
*
|
|
2312
|
+
* The `data` parameter can be a string or a `File` object.
|
|
2313
|
+
*
|
|
2314
|
+
* A `File` object often comes from a `<input type="file">` element.
|
|
2315
|
+
*
|
|
2316
|
+
* Example:
|
|
2317
|
+
*
|
|
2318
|
+
* ```typescript
|
|
2319
|
+
* const result = await medplum.createAttachment(myFile, 'test.jpg', 'image/jpeg');
|
|
2320
|
+
* console.log(result);
|
|
2321
|
+
* ```
|
|
2322
|
+
*
|
|
2323
|
+
* See the FHIR "create" operation for full details: https://www.hl7.org/fhir/http.html#create
|
|
2324
|
+
* @category Create
|
|
2325
|
+
* @param data The binary data to upload.
|
|
2326
|
+
* @param filename Optional filename for the binary.
|
|
2327
|
+
* @param contentType Content type for the binary.
|
|
2328
|
+
* @param onProgress Optional callback for progress events.
|
|
2329
|
+
* @returns The result of the create operation.
|
|
2330
|
+
*/
|
|
2331
|
+
createAttachment(data: BinarySource, filename: string | undefined, contentType: string, onProgress?: (e: ProgressEvent) => void): Promise<Attachment>;
|
|
2332
|
+
/**
|
|
2333
|
+
* Creates a FHIR `Binary` resource with the provided data content.
|
|
2334
|
+
*
|
|
2335
|
+
* The return value is the newly created resource, including the ID and meta.
|
|
2336
|
+
*
|
|
2337
|
+
* The `data` parameter can be a string or a `File` object.
|
|
2338
|
+
*
|
|
2339
|
+
* A `File` object often comes from a `<input type="file">` element.
|
|
2340
|
+
*
|
|
2341
|
+
* Example:
|
|
2342
|
+
*
|
|
2343
|
+
* ```typescript
|
|
2344
|
+
* const result = await medplum.createBinary(myFile, 'test.jpg', 'image/jpeg');
|
|
2345
|
+
* console.log(result.id);
|
|
2346
|
+
* ```
|
|
2347
|
+
*
|
|
2348
|
+
* See the FHIR "create" operation for full details: https://www.hl7.org/fhir/http.html#create
|
|
2349
|
+
* @category Create
|
|
2350
|
+
* @param data The binary data to upload.
|
|
2351
|
+
* @param filename Optional filename for the binary.
|
|
2352
|
+
* @param contentType Content type for the binary.
|
|
2353
|
+
* @param onProgress Optional callback for progress events.
|
|
2354
|
+
* @returns The result of the create operation.
|
|
2355
|
+
*/
|
|
2356
|
+
createBinary(data: BinarySource, filename: string | undefined, contentType: string, onProgress?: (e: ProgressEvent) => void): Promise<Binary>;
|
|
2357
|
+
uploadwithProgress(url: URL, data: BinarySource, contentType: string, onProgress: (e: ProgressEvent) => void): Promise<any>;
|
|
2358
|
+
/**
|
|
2359
|
+
* Creates a PDF as a FHIR `Binary` resource based on pdfmake document definition.
|
|
2360
|
+
*
|
|
2361
|
+
* The return value is the newly created resource, including the ID and meta.
|
|
2362
|
+
*
|
|
2363
|
+
* The `docDefinition` parameter is a pdfmake document definition.
|
|
2364
|
+
*
|
|
2365
|
+
* Example:
|
|
2366
|
+
*
|
|
2367
|
+
* ```typescript
|
|
2368
|
+
* const result = await medplum.createPdf({
|
|
2369
|
+
* content: ['Hello world']
|
|
2370
|
+
* });
|
|
2371
|
+
* console.log(result.id);
|
|
2372
|
+
* ```
|
|
2373
|
+
*
|
|
2374
|
+
* See the pdfmake document definition for full details: https://pdfmake.github.io/docs/0.1/document-definition-object/
|
|
2375
|
+
* @category Media
|
|
2376
|
+
* @param docDefinition The PDF document definition.
|
|
2377
|
+
* @param filename Optional filename for the PDF binary resource.
|
|
2378
|
+
* @param tableLayouts Optional pdfmake custom table layout.
|
|
2379
|
+
* @param fonts Optional pdfmake custom font dictionary.
|
|
2380
|
+
* @returns The result of the create operation.
|
|
2381
|
+
*/
|
|
2382
|
+
createPdf(docDefinition: TDocumentDefinitions, filename?: string, tableLayouts?: Record<string, CustomTableLayout>, fonts?: TFontDictionary): Promise<Binary>;
|
|
2383
|
+
/**
|
|
2384
|
+
* Creates a FHIR `Communication` resource with the provided data content.
|
|
2385
|
+
*
|
|
2386
|
+
* This is a convenience method to handle commmon cases where a `Communication` resource is created with a `payload`.
|
|
2387
|
+
* @category Create
|
|
2388
|
+
* @param resource The FHIR resource to comment on.
|
|
2389
|
+
* @param text The text of the comment.
|
|
2390
|
+
* @param options Optional fetch options.
|
|
2391
|
+
* @returns The result of the create operation.
|
|
2392
|
+
*/
|
|
2393
|
+
createComment(resource: Resource, text: string, options?: RequestInit): Promise<Communication>;
|
|
2394
|
+
/**
|
|
2395
|
+
* Updates a FHIR resource.
|
|
2396
|
+
*
|
|
2397
|
+
* The return value is the updated resource, including the ID and meta.
|
|
2398
|
+
*
|
|
2399
|
+
* Example:
|
|
2400
|
+
*
|
|
2401
|
+
* ```typescript
|
|
2402
|
+
* const result = await medplum.updateResource({
|
|
2403
|
+
* resourceType: 'Patient',
|
|
2404
|
+
* id: '123',
|
|
2405
|
+
* name: [{
|
|
2406
|
+
* family: 'Smith',
|
|
2407
|
+
* given: ['John']
|
|
2408
|
+
* }]
|
|
2409
|
+
* });
|
|
2410
|
+
* console.log(result.meta.versionId);
|
|
2411
|
+
* ```
|
|
2412
|
+
*
|
|
2413
|
+
* See the FHIR "update" operation for full details: https://www.hl7.org/fhir/http.html#update
|
|
2414
|
+
* @category Write
|
|
2415
|
+
* @param resource The FHIR resource to update.
|
|
2416
|
+
* @param options Optional fetch options.
|
|
2417
|
+
* @returns The result of the update operation.
|
|
2418
|
+
*/
|
|
2419
|
+
updateResource<T extends Resource>(resource: T, options?: RequestInit): Promise<T>;
|
|
2420
|
+
/**
|
|
2421
|
+
* Updates a FHIR resource using JSONPatch operations.
|
|
2422
|
+
*
|
|
2423
|
+
* The return value is the updated resource, including the ID and meta.
|
|
2424
|
+
*
|
|
2425
|
+
* Example:
|
|
2426
|
+
*
|
|
2427
|
+
* ```typescript
|
|
2428
|
+
* const result = await medplum.patchResource('Patient', '123', [
|
|
2429
|
+
* {op: 'replace', path: '/name/0/family', value: 'Smith'},
|
|
2430
|
+
* ]);
|
|
2431
|
+
* console.log(result.meta.versionId);
|
|
2432
|
+
* ```
|
|
2433
|
+
*
|
|
2434
|
+
* See the FHIR "update" operation for full details: https://www.hl7.org/fhir/http.html#patch
|
|
2435
|
+
*
|
|
2436
|
+
* See the JSONPatch specification for full details: https://tools.ietf.org/html/rfc6902
|
|
2437
|
+
* @category Write
|
|
2438
|
+
* @param resourceType The FHIR resource type.
|
|
2439
|
+
* @param id The resource ID.
|
|
2440
|
+
* @param operations The JSONPatch operations.
|
|
2441
|
+
* @param options Optional fetch options.
|
|
2442
|
+
* @returns The result of the patch operations.
|
|
2443
|
+
*/
|
|
2444
|
+
patchResource<K extends ResourceType>(resourceType: K, id: string, operations: PatchOperation[], options?: RequestInit): Promise<ExtractResource<K>>;
|
|
2445
|
+
/**
|
|
2446
|
+
* Deletes a FHIR resource by resource type and ID.
|
|
2447
|
+
*
|
|
2448
|
+
* Example:
|
|
2449
|
+
*
|
|
2450
|
+
* ```typescript
|
|
2451
|
+
* await medplum.deleteResource('Patient', '123');
|
|
2452
|
+
* ```
|
|
2453
|
+
*
|
|
2454
|
+
* See the FHIR "delete" operation for full details: https://www.hl7.org/fhir/http.html#delete
|
|
2455
|
+
* @category Delete
|
|
2456
|
+
* @param resourceType The FHIR resource type.
|
|
2457
|
+
* @param id The resource ID.
|
|
2458
|
+
* @param options Optional fetch options.
|
|
2459
|
+
* @returns The result of the delete operation.
|
|
2460
|
+
*/
|
|
2461
|
+
deleteResource(resourceType: ResourceType, id: string, options?: RequestInit): Promise<any>;
|
|
2462
|
+
/**
|
|
2463
|
+
* Executes the validate operation with the provided resource.
|
|
2464
|
+
*
|
|
2465
|
+
* Example:
|
|
2466
|
+
*
|
|
2467
|
+
* ```typescript
|
|
2468
|
+
* const result = await medplum.validateResource({
|
|
2469
|
+
* resourceType: 'Patient',
|
|
2470
|
+
* name: [{ given: ['Alice'], family: 'Smith' }],
|
|
2471
|
+
* });
|
|
2472
|
+
* ```
|
|
2473
|
+
*
|
|
2474
|
+
* See the FHIR "$validate" operation for full details: https://www.hl7.org/fhir/resource-operation-validate.html
|
|
2475
|
+
* @param resource The FHIR resource.
|
|
2476
|
+
* @param options Optional fetch options.
|
|
2477
|
+
* @returns The validate operation outcome.
|
|
2478
|
+
*/
|
|
2479
|
+
validateResource<T extends Resource>(resource: T, options?: RequestInit): Promise<OperationOutcome>;
|
|
2480
|
+
/**
|
|
2481
|
+
* Executes a bot by ID or Identifier.
|
|
2482
|
+
* @param idOrIdentifier The Bot ID or Identifier.
|
|
2483
|
+
* @param body The content body. Strings and `File` objects are passed directly. Other objects are converted to JSON.
|
|
2484
|
+
* @param contentType The content type to be included in the "Content-Type" header.
|
|
2485
|
+
* @param options Optional fetch options.
|
|
2486
|
+
* @returns The Bot return value.
|
|
2487
|
+
*/
|
|
2488
|
+
executeBot(idOrIdentifier: string | Identifier, body: any, contentType?: string, options?: RequestInit): Promise<any>;
|
|
2489
|
+
/**
|
|
2490
|
+
* Executes a batch or transaction of FHIR operations.
|
|
2491
|
+
*
|
|
2492
|
+
* Example:
|
|
2493
|
+
*
|
|
2494
|
+
* ```typescript
|
|
2495
|
+
* await medplum.executeBatch({
|
|
2496
|
+
* "resourceType": "Bundle",
|
|
2497
|
+
* "type": "transaction",
|
|
2498
|
+
* "entry": [
|
|
2499
|
+
* {
|
|
2500
|
+
* "fullUrl": "urn:uuid:61ebe359-bfdc-4613-8bf2-c5e300945f0a",
|
|
2501
|
+
* "resource": {
|
|
2502
|
+
* "resourceType": "Patient",
|
|
2503
|
+
* "name": [{ "use": "official", "given": ["Alice"], "family": "Smith" }],
|
|
2504
|
+
* "gender": "female",
|
|
2505
|
+
* "birthDate": "1974-12-25"
|
|
2506
|
+
* },
|
|
2507
|
+
* "request": {
|
|
2508
|
+
* "method": "POST",
|
|
2509
|
+
* "url": "Patient"
|
|
2510
|
+
* }
|
|
2511
|
+
* },
|
|
2512
|
+
* {
|
|
2513
|
+
* "fullUrl": "urn:uuid:88f151c0-a954-468a-88bd-5ae15c08e059",
|
|
2514
|
+
* "resource": {
|
|
2515
|
+
* "resourceType": "Patient",
|
|
2516
|
+
* "identifier": [{ "system": "http:/example.org/fhir/ids", "value": "234234" }],
|
|
2517
|
+
* "name": [{ "use": "official", "given": ["Bob"], "family": "Jones" }],
|
|
2518
|
+
* "gender": "male",
|
|
2519
|
+
* "birthDate": "1974-12-25"
|
|
2520
|
+
* },
|
|
2521
|
+
* "request": {
|
|
2522
|
+
* "method": "POST",
|
|
2523
|
+
* "url": "Patient",
|
|
2524
|
+
* "ifNoneExist": "identifier=http:/example.org/fhir/ids|234234"
|
|
2525
|
+
* }
|
|
2526
|
+
* }
|
|
2527
|
+
* ]
|
|
2528
|
+
* });
|
|
2529
|
+
* ```
|
|
2530
|
+
*
|
|
2531
|
+
* See The FHIR "batch/transaction" section for full details: https://hl7.org/fhir/http.html#transaction
|
|
2532
|
+
* @category Batch
|
|
2533
|
+
* @param bundle The FHIR batch/transaction bundle.
|
|
2534
|
+
* @param options Optional fetch options.
|
|
2535
|
+
* @returns The FHIR batch/transaction response bundle.
|
|
2536
|
+
*/
|
|
2537
|
+
executeBatch(bundle: Bundle, options?: RequestInit): Promise<Bundle>;
|
|
2538
|
+
/**
|
|
2539
|
+
* Sends an email using the Medplum Email API.
|
|
2540
|
+
*
|
|
2541
|
+
* Builds the email using nodemailer MailComposer.
|
|
2542
|
+
*
|
|
2543
|
+
* Examples:
|
|
2544
|
+
*
|
|
2545
|
+
* Send a simple text email:
|
|
2546
|
+
*
|
|
2547
|
+
* ```typescript
|
|
2548
|
+
* await medplum.sendEmail({
|
|
2549
|
+
* to: 'alice@example.com',
|
|
2550
|
+
* cc: 'bob@example.com',
|
|
2551
|
+
* subject: 'Hello',
|
|
2552
|
+
* text: 'Hello Alice',
|
|
2553
|
+
* });
|
|
2554
|
+
* ```
|
|
2555
|
+
*
|
|
2556
|
+
* Send an email with a `Binary` attachment:
|
|
2557
|
+
*
|
|
2558
|
+
* ```typescript
|
|
2559
|
+
* await medplum.sendEmail({
|
|
2560
|
+
* to: 'alice@example.com',
|
|
2561
|
+
* subject: 'Email with attachment',
|
|
2562
|
+
* text: 'See the attached report',
|
|
2563
|
+
* attachments: [{
|
|
2564
|
+
* filename: 'report.pdf',
|
|
2565
|
+
* path: "Binary/" + binary.id
|
|
2566
|
+
* }]
|
|
2567
|
+
* });
|
|
2568
|
+
* ```
|
|
2569
|
+
*
|
|
2570
|
+
* See options here: https://nodemailer.com/extras/mailcomposer/
|
|
2571
|
+
* @category Media
|
|
2572
|
+
* @param email The MailComposer options.
|
|
2573
|
+
* @param options Optional fetch options.
|
|
2574
|
+
* @returns Promise to the operation outcome.
|
|
2575
|
+
*/
|
|
2576
|
+
sendEmail(email: MailOptions, options?: RequestInit): Promise<OperationOutcome>;
|
|
2577
|
+
/**
|
|
2578
|
+
* Executes a GraphQL query.
|
|
2579
|
+
*
|
|
2580
|
+
* Example:
|
|
2581
|
+
*
|
|
2582
|
+
* ```typescript
|
|
2583
|
+
* const result = await medplum.graphql(`{
|
|
2584
|
+
* Patient(id: "123") {
|
|
2585
|
+
* resourceType
|
|
2586
|
+
* id
|
|
2587
|
+
* name {
|
|
2588
|
+
* given
|
|
2589
|
+
* family
|
|
2590
|
+
* }
|
|
2591
|
+
* }
|
|
2592
|
+
* }`);
|
|
2593
|
+
* ```
|
|
2594
|
+
*
|
|
2595
|
+
* Advanced queries such as named operations and variable substitution are supported:
|
|
2596
|
+
*
|
|
2597
|
+
* ```typescript
|
|
2598
|
+
* const result = await medplum.graphql(
|
|
2599
|
+
* `query GetPatientById($patientId: ID!) {
|
|
2600
|
+
* Patient(id: $patientId) {
|
|
2601
|
+
* resourceType
|
|
2602
|
+
* id
|
|
2603
|
+
* name {
|
|
2604
|
+
* given
|
|
2605
|
+
* family
|
|
2606
|
+
* }
|
|
2607
|
+
* }
|
|
2608
|
+
* }`,
|
|
2609
|
+
* 'GetPatientById',
|
|
2610
|
+
* { patientId: '123' }
|
|
2611
|
+
* );
|
|
2612
|
+
* ```
|
|
2613
|
+
*
|
|
2614
|
+
* See the GraphQL documentation for more details: https://graphql.org/learn/
|
|
2615
|
+
*
|
|
2616
|
+
* See the FHIR GraphQL documentation for FHIR specific details: https://www.hl7.org/fhir/graphql.html
|
|
2617
|
+
* @category Read
|
|
2618
|
+
* @param query The GraphQL query.
|
|
2619
|
+
* @param operationName Optional GraphQL operation name.
|
|
2620
|
+
* @param variables Optional GraphQL variables.
|
|
2621
|
+
* @param options Optional fetch options.
|
|
2622
|
+
* @returns The GraphQL result.
|
|
2623
|
+
*/
|
|
2624
|
+
graphql(query: string, operationName?: string | null, variables?: any, options?: RequestInit): Promise<any>;
|
|
2625
|
+
/**
|
|
2626
|
+
* Executes the $graph operation on this resource to fetch a Bundle of resources linked to the target resource
|
|
2627
|
+
* according to a graph definition
|
|
2628
|
+
* @category Read
|
|
2629
|
+
* @param resourceType The FHIR resource type.
|
|
2630
|
+
* @param id The resource ID.
|
|
2631
|
+
* @param graphName `name` parameter of the GraphDefinition
|
|
2632
|
+
* @param options Optional fetch options.
|
|
2633
|
+
* @returns A Bundle
|
|
2634
|
+
*/
|
|
2635
|
+
readResourceGraph<K extends ResourceType>(resourceType: K, id: string, graphName: string, options?: RequestInit): ReadablePromise<Bundle>;
|
|
2636
|
+
/**
|
|
2637
|
+
* Pushes a message to an agent.
|
|
2638
|
+
*
|
|
2639
|
+
* @param agent The agent to push to.
|
|
2640
|
+
* @param destination The destination device.
|
|
2641
|
+
* @param body The message body.
|
|
2642
|
+
* @param contentType Optional message content type.
|
|
2643
|
+
* @param options Optional fetch options.
|
|
2644
|
+
* @returns Promise to the operation outcome.
|
|
2645
|
+
*/
|
|
2646
|
+
pushToAgent(agent: Agent | Reference<Agent>, destination: Device | Reference<Device>, body: any, contentType?: string, options?: RequestInit): Promise<OperationOutcome>;
|
|
2647
|
+
/**
|
|
2648
|
+
* @category Authentication
|
|
2649
|
+
* @returns The Login State
|
|
2650
|
+
*/
|
|
2651
|
+
getActiveLogin(): LoginState | undefined;
|
|
2652
|
+
/**
|
|
2653
|
+
* Sets the active login.
|
|
2654
|
+
* @param login The new active login state.
|
|
2655
|
+
* @category Authentication
|
|
2656
|
+
*/
|
|
2657
|
+
setActiveLogin(login: LoginState): Promise<void>;
|
|
2658
|
+
/**
|
|
2659
|
+
* Returns the current access token.
|
|
2660
|
+
* @returns The current access token.
|
|
2661
|
+
* @category Authentication
|
|
2662
|
+
*/
|
|
2663
|
+
getAccessToken(): string | undefined;
|
|
2664
|
+
/**
|
|
2665
|
+
* Sets the current access token.
|
|
2666
|
+
* @param accessToken The new access token.
|
|
2667
|
+
* @param refreshToken Optional refresh token.
|
|
2668
|
+
* @category Authentication
|
|
2669
|
+
*/
|
|
2670
|
+
setAccessToken(accessToken: string, refreshToken?: string): void;
|
|
2671
|
+
/**
|
|
2672
|
+
* Returns the list of available logins.
|
|
2673
|
+
* @returns The list of available logins.
|
|
2674
|
+
* @category Authentication
|
|
2675
|
+
*/
|
|
2676
|
+
getLogins(): LoginState[];
|
|
2677
|
+
private addLogin;
|
|
2678
|
+
private refreshProfile;
|
|
2679
|
+
/**
|
|
2680
|
+
* Returns true if the client is waiting for authentication.
|
|
2681
|
+
* @returns True if the client is waiting for authentication.
|
|
2682
|
+
* @category Authentication
|
|
2683
|
+
*/
|
|
2684
|
+
isLoading(): boolean;
|
|
2685
|
+
/**
|
|
2686
|
+
* Returns true if the current user is authenticated as a super admin.
|
|
2687
|
+
* @returns True if the current user is authenticated as a super admin.
|
|
2688
|
+
* @category Authentication
|
|
2689
|
+
*/
|
|
2690
|
+
isSuperAdmin(): boolean;
|
|
2691
|
+
/**
|
|
2692
|
+
* Returns true if the current user is authenticated as a project admin.
|
|
2693
|
+
* @returns True if the current user is authenticated as a project admin.
|
|
2694
|
+
* @category Authentication
|
|
2695
|
+
*/
|
|
2696
|
+
isProjectAdmin(): boolean;
|
|
2697
|
+
/**
|
|
2698
|
+
* Returns the current project if available.
|
|
2699
|
+
* @returns The current project if available.
|
|
2700
|
+
* @category User Profile
|
|
2701
|
+
*/
|
|
2702
|
+
getProject(): Project | undefined;
|
|
2703
|
+
/**
|
|
2704
|
+
* Returns the current project membership if available.
|
|
2705
|
+
* @returns The current project membership if available.
|
|
2706
|
+
* @category User Profile
|
|
2707
|
+
*/
|
|
2708
|
+
getProjectMembership(): ProjectMembership | undefined;
|
|
2709
|
+
/**
|
|
2710
|
+
* Returns the current user profile resource if available.
|
|
2711
|
+
* This method does not wait for loading promises.
|
|
2712
|
+
* @returns The current user profile resource if available.
|
|
2713
|
+
* @category User Profile
|
|
2714
|
+
*/
|
|
2715
|
+
getProfile(): ProfileResource | undefined;
|
|
2716
|
+
/**
|
|
2717
|
+
* Returns the current user profile resource, retrieving form the server if necessary.
|
|
2718
|
+
* This method waits for loading promises.
|
|
2719
|
+
* @returns The current user profile resource.
|
|
2720
|
+
* @category User Profile
|
|
2721
|
+
*/
|
|
2722
|
+
getProfileAsync(): Promise<ProfileResource | undefined>;
|
|
2723
|
+
/**
|
|
2724
|
+
* Returns the current user configuration if available.
|
|
2725
|
+
* @returns The current user configuration if available.
|
|
2726
|
+
* @category User Profile
|
|
2727
|
+
*/
|
|
2728
|
+
getUserConfiguration(): UserConfiguration | undefined;
|
|
2729
|
+
/**
|
|
2730
|
+
* Returns the current user access policy if available.
|
|
2731
|
+
* @returns The current user access policy if available.
|
|
2732
|
+
* @category User Profile
|
|
2733
|
+
*/
|
|
2734
|
+
getAccessPolicy(): AccessPolicy | undefined;
|
|
2735
|
+
/**
|
|
2736
|
+
* Downloads the URL as a blob. Can accept binary URLs in the form of `Binary/{id}` as well.
|
|
2737
|
+
* @category Read
|
|
2738
|
+
* @param url The URL to request. Can be a standard URL or one in the form of `Binary/{id}`.
|
|
2739
|
+
* @param options Optional fetch request init options.
|
|
2740
|
+
* @returns Promise to the response body as a blob.
|
|
2741
|
+
*/
|
|
2742
|
+
download(url: URL | string, options?: RequestInit): Promise<Blob>;
|
|
2743
|
+
/**
|
|
2744
|
+
* Upload media to the server and create a Media instance for the uploaded content.
|
|
2745
|
+
* @param contents The contents of the media file, as a string, Uint8Array, File, or Blob.
|
|
2746
|
+
* @param contentType The media type of the content.
|
|
2747
|
+
* @param filename The name of the file to be uploaded, or undefined if not applicable.
|
|
2748
|
+
* @param additionalFields Additional fields for Media.
|
|
2749
|
+
* @param options Optional fetch options.
|
|
2750
|
+
* @returns Promise that resolves to the created Media
|
|
2751
|
+
*/
|
|
2752
|
+
uploadMedia(contents: string | Uint8Array | File | Blob, contentType: string, filename: string | undefined, additionalFields?: Partial<Media>, options?: RequestInit): Promise<Media>;
|
|
2753
|
+
/**
|
|
2754
|
+
* 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
|
|
2755
|
+
* @param exportLevel Optional export level. Defaults to system level export. 'Group/:id' - Group of Patients, 'Patient' - All Patients.
|
|
2756
|
+
* @param resourceTypes A string of comma-delimited FHIR resource types.
|
|
2757
|
+
* @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).
|
|
2758
|
+
* @param options Optional fetch options.
|
|
2759
|
+
* @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
|
|
2760
|
+
*/
|
|
2761
|
+
bulkExport(exportLevel?: string, resourceTypes?: string, since?: string, options?: RequestInit): Promise<Partial<BulkDataExport>>;
|
|
2762
|
+
/**
|
|
2763
|
+
* Starts an async request following the FHIR "Asynchronous Request Pattern".
|
|
2764
|
+
* See: https://hl7.org/fhir/r4/async.html
|
|
2765
|
+
* @param url The URL to request.
|
|
2766
|
+
* @param options Optional fetch options.
|
|
2767
|
+
* @returns The response body.
|
|
2768
|
+
*/
|
|
2769
|
+
startAsyncRequest<T>(url: string, options?: RequestInit): Promise<T>;
|
|
2770
|
+
/**
|
|
2771
|
+
* Returns the cache entry if available and not expired.
|
|
2772
|
+
* @param key The cache key to retrieve.
|
|
2773
|
+
* @param options Optional fetch options for cache settings.
|
|
2774
|
+
* @returns The cached entry if found.
|
|
2775
|
+
*/
|
|
2776
|
+
private getCacheEntry;
|
|
2777
|
+
/**
|
|
2778
|
+
* Adds a readable promise to the cache.
|
|
2779
|
+
* @param key The cache key to store.
|
|
2780
|
+
* @param value The readable promise to store.
|
|
2781
|
+
*/
|
|
2782
|
+
private setCacheEntry;
|
|
2783
|
+
/**
|
|
2784
|
+
* Adds a concrete value as the cache entry for the given resource.
|
|
2785
|
+
* This is used in cases where the resource is loaded indirectly.
|
|
2786
|
+
* For example, when a resource is loaded as part of a Bundle.
|
|
2787
|
+
* @param resource The resource to cache.
|
|
2788
|
+
*/
|
|
2789
|
+
private cacheResource;
|
|
2790
|
+
/**
|
|
2791
|
+
* Deletes a cache entry.
|
|
2792
|
+
* @param key The cache key to delete.
|
|
2793
|
+
*/
|
|
2794
|
+
private deleteCacheEntry;
|
|
2795
|
+
/**
|
|
2796
|
+
* Makes an HTTP request.
|
|
2797
|
+
* @param method The HTTP method (GET, POST, etc).
|
|
2798
|
+
* @param url The target URL.
|
|
2799
|
+
* @param options Optional fetch request init options.
|
|
2800
|
+
* @returns The JSON content body if available.
|
|
2801
|
+
*/
|
|
2802
|
+
private request;
|
|
2803
|
+
private parseResponse;
|
|
2804
|
+
private fetchWithRetry;
|
|
2805
|
+
private logRequest;
|
|
2806
|
+
private logResponse;
|
|
2807
|
+
private pollStatus;
|
|
2808
|
+
/**
|
|
2809
|
+
* Executes a batch of requests that were automatically batched together.
|
|
2810
|
+
*/
|
|
2811
|
+
private executeAutoBatch;
|
|
2812
|
+
/**
|
|
2813
|
+
* Adds default options to the fetch options.
|
|
2814
|
+
* @param options The options to add defaults to.
|
|
2815
|
+
*/
|
|
2816
|
+
private addFetchOptionsDefaults;
|
|
2817
|
+
/**
|
|
2818
|
+
* Sets the "Content-Type" header on fetch options.
|
|
2819
|
+
* @param options The fetch options.
|
|
2820
|
+
* @param contentType The new content type to set.
|
|
2821
|
+
*/
|
|
2822
|
+
private setRequestContentType;
|
|
2823
|
+
/**
|
|
2824
|
+
* Sets the body on fetch options.
|
|
2825
|
+
* @param options The fetch options.
|
|
2826
|
+
* @param data The new content body.
|
|
2827
|
+
*/
|
|
2828
|
+
private setRequestBody;
|
|
2829
|
+
/**
|
|
2830
|
+
* Handles an unauthenticated response from the server.
|
|
2831
|
+
* First, tries to refresh the access token and retry the request.
|
|
2832
|
+
* Otherwise, calls unauthenticated callbacks and rejects.
|
|
2833
|
+
* @param method The HTTP method of the original request.
|
|
2834
|
+
* @param url The URL of the original request.
|
|
2835
|
+
* @param options Optional fetch request init options.
|
|
2836
|
+
* @returns The result of the retry.
|
|
2837
|
+
*/
|
|
2838
|
+
private handleUnauthenticated;
|
|
2839
|
+
/**
|
|
2840
|
+
* Starts a new PKCE flow.
|
|
2841
|
+
* These PKCE values are stateful, and must survive redirects and page refreshes.
|
|
2842
|
+
* @category Authentication
|
|
2843
|
+
* @returns The PKCE code challenge details.
|
|
2844
|
+
*/
|
|
2845
|
+
startPkce(): Promise<{
|
|
2846
|
+
codeChallengeMethod: CodeChallengeMethod;
|
|
2847
|
+
codeChallenge: string;
|
|
2848
|
+
}>;
|
|
2849
|
+
/**
|
|
2850
|
+
* Redirects the user to the login screen for authorization.
|
|
2851
|
+
* Clears all auth state including local storage and session storage.
|
|
2852
|
+
* @param loginParams The authorization login parameters.
|
|
2853
|
+
* @see https://openid.net/specs/openid-connect-core-1_0.html#AuthorizationEndpoint
|
|
2854
|
+
*/
|
|
2855
|
+
private requestAuthorization;
|
|
2856
|
+
/**
|
|
2857
|
+
* Processes an OAuth authorization code.
|
|
2858
|
+
* See: https://openid.net/specs/openid-connect-core-1_0.html#TokenRequest
|
|
2859
|
+
* @param code The authorization code received by URL parameter.
|
|
2860
|
+
* @param loginParams Optional login parameters.
|
|
2861
|
+
* @returns The user profile resource.
|
|
2862
|
+
* @category Authentication
|
|
2863
|
+
*/
|
|
2864
|
+
processCode(code: string, loginParams?: Partial<BaseLoginRequest>): Promise<ProfileResource>;
|
|
2865
|
+
/**
|
|
2866
|
+
* Tries to refresh the auth tokens.
|
|
2867
|
+
* @returns The refresh promise if available; otherwise undefined.
|
|
2868
|
+
* @see https://openid.net/specs/openid-connect-core-1_0.html#RefreshTokens
|
|
2869
|
+
*/
|
|
2870
|
+
private refresh;
|
|
2871
|
+
/**
|
|
2872
|
+
* Starts a new OAuth2 client credentials flow.
|
|
2873
|
+
*
|
|
2874
|
+
* ```typescript
|
|
2875
|
+
* await medplum.startClientLogin(process.env.MEDPLUM_CLIENT_ID, process.env.MEDPLUM_CLIENT_SECRET)
|
|
2876
|
+
* // Example Search
|
|
2877
|
+
* await medplum.searchResources('Patient')
|
|
2878
|
+
* ```
|
|
2879
|
+
*
|
|
2880
|
+
* See: https://datatracker.ietf.org/doc/html/rfc6749#section-4.4
|
|
2881
|
+
*
|
|
2882
|
+
* @category Authentication
|
|
2883
|
+
* @param clientId The client ID.
|
|
2884
|
+
* @param clientSecret The client secret.
|
|
2885
|
+
* @returns Promise that resolves to the client profile.
|
|
2886
|
+
*/
|
|
2887
|
+
startClientLogin(clientId: string, clientSecret: string): Promise<ProfileResource>;
|
|
2888
|
+
/**
|
|
2889
|
+
* Starts a new OAuth2 JWT bearer flow.
|
|
2890
|
+
*
|
|
2891
|
+
* ```typescript
|
|
2892
|
+
* await medplum.startJwtBearerLogin(process.env.MEDPLUM_CLIENT_ID, process.env.MEDPLUM_JWT_BEARER_ASSERTION, 'openid profile');
|
|
2893
|
+
* // Example Search
|
|
2894
|
+
* await medplum.searchResources('Patient')
|
|
2895
|
+
* ```
|
|
2896
|
+
*
|
|
2897
|
+
* See: https://datatracker.ietf.org/doc/html/rfc7523#section-2.1
|
|
2898
|
+
*
|
|
2899
|
+
* @category Authentication
|
|
2900
|
+
* @param clientId The client ID.
|
|
2901
|
+
* @param assertion The JWT assertion.
|
|
2902
|
+
* @param scope The OAuth scope.
|
|
2903
|
+
* @returns Promise that resolves to the client profile.
|
|
2904
|
+
*/
|
|
2905
|
+
startJwtBearerLogin(clientId: string, assertion: string, scope: string): Promise<ProfileResource>;
|
|
2906
|
+
/**
|
|
2907
|
+
* Starts a new OAuth2 JWT assertion flow.
|
|
2908
|
+
*
|
|
2909
|
+
* See: https://datatracker.ietf.org/doc/html/rfc7523#section-2.2
|
|
2910
|
+
*
|
|
2911
|
+
* @category Authentication
|
|
2912
|
+
* @param jwt The JWT assertion.
|
|
2913
|
+
* @returns Promise that resolves to the client profile.
|
|
2914
|
+
*/
|
|
2915
|
+
startJwtAssertionLogin(jwt: string): Promise<ProfileResource>;
|
|
2916
|
+
/**
|
|
2917
|
+
* Sets the client ID and secret for basic auth.
|
|
2918
|
+
*
|
|
2919
|
+
* ```typescript
|
|
2920
|
+
* medplum.setBasicAuth(process.env.MEDPLUM_CLIENT_ID, process.env.MEDPLUM_CLIENT_SECRET)
|
|
2921
|
+
* // Example Search
|
|
2922
|
+
* await medplum.searchResources('Patient')
|
|
2923
|
+
* ```
|
|
2924
|
+
* @category Authentication
|
|
2925
|
+
* @param clientId The client ID.
|
|
2926
|
+
* @param clientSecret The client secret.
|
|
2927
|
+
*/
|
|
2928
|
+
setBasicAuth(clientId: string, clientSecret: string): void;
|
|
2929
|
+
/**
|
|
2930
|
+
* Subscribes to a specified topic, listening for a list of specified events.
|
|
2931
|
+
*
|
|
2932
|
+
* Once you have the `SubscriptionRequest` returned from this method, you can call `fhircastConnect(subscriptionRequest)` to connect to the subscription stream.
|
|
2933
|
+
*
|
|
2934
|
+
* @category FHIRcast
|
|
2935
|
+
* @param topic The topic to publish to. Usually a UUID.
|
|
2936
|
+
* @param events An array of event names to listen for.
|
|
2937
|
+
* @returns A `Promise` that resolves once the request completes, or rejects if it fails.
|
|
2938
|
+
*/
|
|
2939
|
+
fhircastSubscribe(topic: string, events: FhircastEventName[]): Promise<SubscriptionRequest>;
|
|
2940
|
+
/**
|
|
2941
|
+
* Unsubscribes from the specified topic.
|
|
2942
|
+
*
|
|
2943
|
+
* @category FHIRcast
|
|
2944
|
+
* @param subRequest A `SubscriptionRequest` representing a subscription to cancel. Mode will be set to `unsubscribe` automatically.
|
|
2945
|
+
* @returns A `Promise` that resolves when request to unsubscribe is completed.
|
|
2946
|
+
*/
|
|
2947
|
+
fhircastUnsubscribe(subRequest: SubscriptionRequest): Promise<void>;
|
|
2948
|
+
/**
|
|
2949
|
+
* Connects to a `FHIRcast` session.
|
|
2950
|
+
*
|
|
2951
|
+
* @category FHIRcast
|
|
2952
|
+
* @param subRequest The `SubscriptionRequest` to use for connecting.
|
|
2953
|
+
* @returns A `FhircastConnection` which emits lifecycle events for the `FHIRcast` WebSocket connection.
|
|
2954
|
+
*/
|
|
2955
|
+
fhircastConnect(subRequest: SubscriptionRequest): FhircastConnection;
|
|
2956
|
+
/**
|
|
2957
|
+
* Publishes a new context to a given topic for a specified event type.
|
|
2958
|
+
*
|
|
2959
|
+
* @category FHIRcast
|
|
2960
|
+
* @param topic The topic to publish to. Usually a UUID.
|
|
2961
|
+
* @param event The name of the event to publish an updated context for, ie. `patient-open`.
|
|
2962
|
+
* @param context The updated context containing resources relevant to this event.
|
|
2963
|
+
* @returns A `Promise` that resolves once the request completes, or rejects if it fails.
|
|
2964
|
+
*/
|
|
2965
|
+
fhircastPublish(topic: string, event: FhircastEventName, context: FhircastEventContext | FhircastEventContext[]): Promise<void>;
|
|
2966
|
+
/**
|
|
2967
|
+
* Invite a user to a project.
|
|
2968
|
+
* @param projectId The project ID.
|
|
2969
|
+
* @param body The InviteRequest.
|
|
2970
|
+
* @returns Promise that returns a project membership or an operation outcome.
|
|
2971
|
+
*/
|
|
2972
|
+
invite(projectId: string, body: InviteRequest): Promise<ProjectMembership | OperationOutcome>;
|
|
2973
|
+
/**
|
|
2974
|
+
* Makes a POST request to the tokens endpoint.
|
|
2975
|
+
* See: https://openid.net/specs/openid-connect-core-1_0.html#TokenEndpoint
|
|
2976
|
+
* @param formBody Token parameters in URL encoded format.
|
|
2977
|
+
* @returns The user profile resource.
|
|
2978
|
+
*/
|
|
2979
|
+
private fetchTokens;
|
|
2980
|
+
/**
|
|
2981
|
+
* Verifies the tokens received from the auth server.
|
|
2982
|
+
* Validates the JWT against the JWKS.
|
|
2983
|
+
* See: https://openid.net/specs/openid-connect-core-1_0.html#TokenEndpoint
|
|
2984
|
+
* @param tokens The token response.
|
|
2985
|
+
* @returns Promise to complete.
|
|
2986
|
+
*/
|
|
2987
|
+
private verifyTokens;
|
|
2988
|
+
/**
|
|
2989
|
+
* Sets up a listener for window storage events.
|
|
2990
|
+
* This synchronizes state across browser windows and browser tabs.
|
|
2991
|
+
*/
|
|
2992
|
+
private setupStorageListener;
|
|
2993
|
+
private retryCatch;
|
|
2994
|
+
}
|
|
2995
|
+
|
|
2996
|
+
/**
|
|
2997
|
+
* The MedplumClientOptions interface defines configuration options for MedplumClient.
|
|
2998
|
+
*
|
|
2999
|
+
* All configuration settings are optional.
|
|
3000
|
+
*/
|
|
3001
|
+
export declare interface MedplumClientOptions {
|
|
3002
|
+
/**
|
|
3003
|
+
* Base server URL.
|
|
3004
|
+
*
|
|
3005
|
+
* Default value is https://api.medplum.com/
|
|
3006
|
+
*
|
|
3007
|
+
* Use this to point to a custom Medplum deployment.
|
|
3008
|
+
*/
|
|
3009
|
+
baseUrl?: string;
|
|
3010
|
+
/**
|
|
3011
|
+
* OAuth2 authorize URL.
|
|
3012
|
+
*
|
|
3013
|
+
* Default value is baseUrl + "/oauth2/authorize".
|
|
3014
|
+
*
|
|
3015
|
+
* Can be specified as absolute URL or relative to baseUrl.
|
|
3016
|
+
*
|
|
3017
|
+
* Use this if you want to use a separate OAuth server.
|
|
3018
|
+
*/
|
|
3019
|
+
authorizeUrl?: string;
|
|
3020
|
+
/**
|
|
3021
|
+
* FHIR URL path.
|
|
3022
|
+
*
|
|
3023
|
+
* Default value is "fhir/R4/".
|
|
3024
|
+
*
|
|
3025
|
+
* Can be specified as absolute URL or relative to baseUrl.
|
|
3026
|
+
*
|
|
3027
|
+
* Use this if you want to use a different path when connecting to a FHIR server.
|
|
3028
|
+
*/
|
|
3029
|
+
fhirUrlPath?: string;
|
|
3030
|
+
/**
|
|
3031
|
+
* OAuth2 token URL.
|
|
3032
|
+
*
|
|
3033
|
+
* Default value is baseUrl + "/oauth2/token".
|
|
3034
|
+
*
|
|
3035
|
+
* Can be specified as absolute URL or relative to baseUrl.
|
|
3036
|
+
*
|
|
3037
|
+
* Use this if you want to use a separate OAuth server.
|
|
3038
|
+
*/
|
|
3039
|
+
tokenUrl?: string;
|
|
3040
|
+
/**
|
|
3041
|
+
* OAuth2 logout URL.
|
|
3042
|
+
*
|
|
3043
|
+
* Default value is baseUrl + "/oauth2/logout".
|
|
3044
|
+
*
|
|
3045
|
+
* Can be specified as absolute URL or relative to baseUrl.
|
|
3046
|
+
*
|
|
3047
|
+
* Use this if you want to use a separate OAuth server.
|
|
3048
|
+
*/
|
|
3049
|
+
logoutUrl?: string;
|
|
3050
|
+
/**
|
|
3051
|
+
* The client ID.
|
|
3052
|
+
*
|
|
3053
|
+
* Client ID can be used for SMART-on-FHIR customization.
|
|
3054
|
+
*/
|
|
3055
|
+
clientId?: string;
|
|
3056
|
+
/**
|
|
3057
|
+
* The client secret.
|
|
3058
|
+
*
|
|
3059
|
+
* Client secret can be used for FHIR Oauth Client Credential flows
|
|
3060
|
+
*/
|
|
3061
|
+
clientSecret?: string;
|
|
3062
|
+
/**
|
|
3063
|
+
* The OAuth Access Token.
|
|
3064
|
+
*
|
|
3065
|
+
* Access Token used to connect to make request to FHIR servers
|
|
3066
|
+
*/
|
|
3067
|
+
accessToken?: string;
|
|
3068
|
+
/**
|
|
3069
|
+
* Number of resources to store in the cache.
|
|
3070
|
+
*
|
|
3071
|
+
* Default value is 1000.
|
|
3072
|
+
*
|
|
3073
|
+
* Consider using this for performance of displaying Patient or Practitioner resources.
|
|
3074
|
+
*/
|
|
3075
|
+
resourceCacheSize?: number;
|
|
3076
|
+
/**
|
|
3077
|
+
* The length of time in milliseconds to cache resources.
|
|
3078
|
+
*
|
|
3079
|
+
* Default value is 10000 (10 seconds).
|
|
3080
|
+
*
|
|
3081
|
+
* Cache time of zero disables all caching.
|
|
3082
|
+
*
|
|
3083
|
+
* For any individual request, the cache behavior can be overridden by setting the cache property on request options.
|
|
3084
|
+
*
|
|
3085
|
+
* See: https://developer.mozilla.org/en-US/docs/Web/API/Request/cache
|
|
3086
|
+
*/
|
|
3087
|
+
cacheTime?: number;
|
|
3088
|
+
/**
|
|
3089
|
+
* The length of time in milliseconds to delay requests for auto batching.
|
|
3090
|
+
*
|
|
3091
|
+
* Auto batching attempts to group multiple requests together into a single batch request.
|
|
3092
|
+
*
|
|
3093
|
+
* Default value is 0, which disables auto batching.
|
|
3094
|
+
*/
|
|
3095
|
+
autoBatchTime?: number;
|
|
3096
|
+
/**
|
|
3097
|
+
* Fetch implementation.
|
|
3098
|
+
*
|
|
3099
|
+
* Default is window.fetch (if available).
|
|
3100
|
+
*
|
|
3101
|
+
* For Node.js applications, consider the 'node-fetch' package.
|
|
3102
|
+
*/
|
|
3103
|
+
fetch?: FetchLike;
|
|
3104
|
+
/**
|
|
3105
|
+
* Storage implementation.
|
|
3106
|
+
*
|
|
3107
|
+
* 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.
|
|
3108
|
+
*/
|
|
3109
|
+
storage?: ClientStorage;
|
|
3110
|
+
/**
|
|
3111
|
+
* Create PDF implementation.
|
|
3112
|
+
*
|
|
3113
|
+
* Default is none, and PDF generation is disabled.
|
|
3114
|
+
*
|
|
3115
|
+
* In browser environments, import the client-side pdfmake library.
|
|
3116
|
+
*
|
|
3117
|
+
* ```html
|
|
3118
|
+
* <script src="pdfmake.min.js"></script>
|
|
3119
|
+
* <script>
|
|
3120
|
+
* async function createPdf(docDefinition, tableLayouts, fonts) {
|
|
3121
|
+
* return new Promise((resolve) => {
|
|
3122
|
+
* pdfMake.createPdf(docDefinition, tableLayouts, fonts).getBlob(resolve);
|
|
3123
|
+
* });
|
|
3124
|
+
* }
|
|
3125
|
+
* </script>
|
|
3126
|
+
* ```
|
|
3127
|
+
*
|
|
3128
|
+
* In Node.js applications:
|
|
3129
|
+
*
|
|
3130
|
+
* ```ts
|
|
3131
|
+
* import type { CustomTableLayout, TDocumentDefinitions, TFontDictionary } from 'pdfmake/interfaces';
|
|
3132
|
+
* function createPdf(
|
|
3133
|
+
* docDefinition: TDocumentDefinitions,
|
|
3134
|
+
* tableLayouts?: { [name: string]: CustomTableLayout },
|
|
3135
|
+
* fonts?: TFontDictionary
|
|
3136
|
+
* ): Promise<Buffer> {
|
|
3137
|
+
* return new Promise((resolve, reject) => {
|
|
3138
|
+
* const printer = new PdfPrinter(fonts ?? {});
|
|
3139
|
+
* const pdfDoc = printer.createPdfKitDocument(docDefinition, { tableLayouts });
|
|
3140
|
+
* const chunks: Uint8Array[] = [];
|
|
3141
|
+
* pdfDoc.on('data', (chunk: Uint8Array) => chunks.push(chunk));
|
|
3142
|
+
* pdfDoc.on('end', () => resolve(Buffer.concat(chunks)));
|
|
3143
|
+
* pdfDoc.on('error', reject);
|
|
3144
|
+
* pdfDoc.end();
|
|
3145
|
+
* });
|
|
3146
|
+
* }
|
|
3147
|
+
* ```
|
|
3148
|
+
*/
|
|
3149
|
+
createPdf?: CreatePdfFunction;
|
|
3150
|
+
/**
|
|
3151
|
+
* Callback for when the client is unauthenticated.
|
|
3152
|
+
*
|
|
3153
|
+
* Default is do nothing.
|
|
3154
|
+
*
|
|
3155
|
+
* For client side applications, consider redirecting to a sign in page.
|
|
3156
|
+
*/
|
|
3157
|
+
onUnauthenticated?: () => void;
|
|
3158
|
+
/**
|
|
3159
|
+
* The default redirect behavior.
|
|
3160
|
+
*
|
|
3161
|
+
* The default behavior is to not follow redirects.
|
|
3162
|
+
*
|
|
3163
|
+
* Use "follow" to automatically follow redirects.
|
|
3164
|
+
*/
|
|
3165
|
+
redirect?: RequestRedirect;
|
|
3166
|
+
/**
|
|
3167
|
+
* When the verbose flag is set, the client will log all requests and responses to the console.
|
|
3168
|
+
*/
|
|
3169
|
+
verbose?: boolean;
|
|
3170
|
+
}
|
|
3171
|
+
|
|
3172
|
+
export declare interface MedplumInfraConfig {
|
|
3173
|
+
name: string;
|
|
3174
|
+
stackName: string;
|
|
3175
|
+
accountNumber: string;
|
|
3176
|
+
region: string;
|
|
3177
|
+
domainName: string;
|
|
3178
|
+
vpcId: string;
|
|
3179
|
+
apiPort: number;
|
|
3180
|
+
apiDomainName: string;
|
|
3181
|
+
apiSslCertArn: string;
|
|
3182
|
+
apiInternetFacing?: boolean;
|
|
3183
|
+
appDomainName: string;
|
|
3184
|
+
appSslCertArn: string;
|
|
3185
|
+
appApiProxy?: boolean;
|
|
3186
|
+
appLoggingBucket?: string;
|
|
3187
|
+
appLoggingPrefix?: string;
|
|
3188
|
+
storageBucketName: string;
|
|
3189
|
+
storageDomainName: string;
|
|
3190
|
+
storageSslCertArn: string;
|
|
3191
|
+
signingKeyId: string;
|
|
3192
|
+
storagePublicKey: string;
|
|
3193
|
+
storageLoggingBucket?: string;
|
|
3194
|
+
storageLoggingPrefix?: string;
|
|
3195
|
+
baseUrl: string;
|
|
3196
|
+
maxAzs: number;
|
|
3197
|
+
rdsInstances: number;
|
|
3198
|
+
rdsInstanceType: string;
|
|
3199
|
+
rdsSecretsArn?: string;
|
|
3200
|
+
cacheNodeType?: string;
|
|
3201
|
+
desiredServerCount: number;
|
|
3202
|
+
serverImage: string;
|
|
3203
|
+
serverMemory: number;
|
|
3204
|
+
serverCpu: number;
|
|
3205
|
+
loadBalancerLoggingBucket?: string;
|
|
3206
|
+
loadBalancerLoggingPrefix?: string;
|
|
3207
|
+
clamscanEnabled: boolean;
|
|
3208
|
+
clamscanLoggingBucket: string;
|
|
3209
|
+
clamscanLoggingPrefix: string;
|
|
3210
|
+
skipDns?: boolean;
|
|
3211
|
+
additionalContainers?: {
|
|
3212
|
+
name: string;
|
|
3213
|
+
image: string;
|
|
3214
|
+
cpu?: number;
|
|
3215
|
+
memory?: number;
|
|
3216
|
+
essential?: boolean;
|
|
3217
|
+
command?: string[];
|
|
3218
|
+
environment?: {
|
|
3219
|
+
[key: string]: string;
|
|
3220
|
+
};
|
|
3221
|
+
}[];
|
|
3222
|
+
cloudTrailAlarms?: {
|
|
3223
|
+
logGroupName: string;
|
|
3224
|
+
logGroupCreate?: boolean;
|
|
3225
|
+
snsTopicArn?: string;
|
|
3226
|
+
snsTopicName?: string;
|
|
3227
|
+
};
|
|
3228
|
+
}
|
|
3229
|
+
|
|
3230
|
+
export declare interface MedplumSourceInfraConfig {
|
|
3231
|
+
name: ValueOrExternalSecret<string>;
|
|
3232
|
+
stackName: ValueOrExternalSecret<string>;
|
|
3233
|
+
accountNumber: ValueOrExternalSecret<string>;
|
|
3234
|
+
region: string;
|
|
3235
|
+
domainName: ValueOrExternalSecret<string>;
|
|
3236
|
+
vpcId: ValueOrExternalSecret<string>;
|
|
3237
|
+
apiPort: ValueOrExternalSecret<number>;
|
|
3238
|
+
apiDomainName: ValueOrExternalSecret<string>;
|
|
3239
|
+
apiSslCertArn: ValueOrExternalSecret<string>;
|
|
3240
|
+
apiInternetFacing?: ValueOrExternalSecret<boolean>;
|
|
3241
|
+
appDomainName: ValueOrExternalSecret<string>;
|
|
3242
|
+
appSslCertArn: ValueOrExternalSecret<string>;
|
|
3243
|
+
appApiProxy?: ValueOrExternalSecret<boolean>;
|
|
3244
|
+
appLoggingBucket?: ValueOrExternalSecret<string>;
|
|
3245
|
+
appLoggingPrefix?: ValueOrExternalSecret<string>;
|
|
3246
|
+
storageBucketName: ValueOrExternalSecret<string>;
|
|
3247
|
+
storageDomainName: ValueOrExternalSecret<string>;
|
|
3248
|
+
storageSslCertArn: ValueOrExternalSecret<string>;
|
|
3249
|
+
signingKeyId: ValueOrExternalSecret<string>;
|
|
3250
|
+
storagePublicKey: ValueOrExternalSecret<string>;
|
|
3251
|
+
storageLoggingBucket?: ValueOrExternalSecret<string>;
|
|
3252
|
+
storageLoggingPrefix?: ValueOrExternalSecret<string>;
|
|
3253
|
+
baseUrl: ValueOrExternalSecret<string>;
|
|
3254
|
+
maxAzs: ValueOrExternalSecret<number>;
|
|
3255
|
+
rdsInstances: ValueOrExternalSecret<number>;
|
|
3256
|
+
rdsInstanceType: ValueOrExternalSecret<string>;
|
|
3257
|
+
rdsSecretsArn?: ValueOrExternalSecret<string>;
|
|
3258
|
+
cacheNodeType?: ValueOrExternalSecret<string>;
|
|
3259
|
+
desiredServerCount: ValueOrExternalSecret<number>;
|
|
3260
|
+
serverImage: ValueOrExternalSecret<string>;
|
|
3261
|
+
serverMemory: ValueOrExternalSecret<number>;
|
|
3262
|
+
serverCpu: ValueOrExternalSecret<number>;
|
|
3263
|
+
loadBalancerLoggingBucket?: ValueOrExternalSecret<string>;
|
|
3264
|
+
loadBalancerLoggingPrefix?: ValueOrExternalSecret<string>;
|
|
3265
|
+
clamscanEnabled: ValueOrExternalSecret<boolean>;
|
|
3266
|
+
clamscanLoggingBucket: ValueOrExternalSecret<string>;
|
|
3267
|
+
clamscanLoggingPrefix: ValueOrExternalSecret<string>;
|
|
3268
|
+
skipDns?: ValueOrExternalSecret<boolean>;
|
|
3269
|
+
additionalContainers?: {
|
|
3270
|
+
name: ValueOrExternalSecret<string>;
|
|
3271
|
+
image: ValueOrExternalSecret<string>;
|
|
3272
|
+
cpu?: ValueOrExternalSecret<number>;
|
|
3273
|
+
memory?: ValueOrExternalSecret<number>;
|
|
3274
|
+
essential?: ValueOrExternalSecret<boolean>;
|
|
3275
|
+
command?: ValueOrExternalSecret<string>[];
|
|
3276
|
+
environment?: {
|
|
3277
|
+
[key: string]: ValueOrExternalSecret<string>;
|
|
3278
|
+
};
|
|
3279
|
+
}[];
|
|
3280
|
+
cloudTrailAlarms?: {
|
|
3281
|
+
logGroupName: ValueOrExternalSecret<string>;
|
|
3282
|
+
logGroupCreate?: ValueOrExternalSecret<boolean>;
|
|
3283
|
+
snsTopicArn?: ValueOrExternalSecret<string>;
|
|
3284
|
+
snsTopicName?: ValueOrExternalSecret<string>;
|
|
3285
|
+
};
|
|
3286
|
+
}
|
|
3287
|
+
|
|
3288
|
+
/**
|
|
3289
|
+
* The MemoryStorage class is a minimal in-memory implementation of the Storage interface.
|
|
3290
|
+
*/
|
|
3291
|
+
export declare class MemoryStorage implements Storage {
|
|
3292
|
+
private data;
|
|
3293
|
+
constructor();
|
|
3294
|
+
/**
|
|
3295
|
+
* Returns the number of key/value pairs.
|
|
3296
|
+
* @returns The number of key/value pairs.
|
|
3297
|
+
*/
|
|
3298
|
+
get length(): number;
|
|
3299
|
+
/**
|
|
3300
|
+
* Removes all key/value pairs, if there are any.
|
|
3301
|
+
*/
|
|
3302
|
+
clear(): void;
|
|
3303
|
+
/**
|
|
3304
|
+
* Returns the current value associated with the given key, or null if the given key does not exist.
|
|
3305
|
+
* @param key The specified storage key.
|
|
3306
|
+
* @returns The current value associated with the given key, or null if the given key does not exist.
|
|
3307
|
+
*/
|
|
3308
|
+
getItem(key: string): string | null;
|
|
3309
|
+
/**
|
|
3310
|
+
* Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.
|
|
3311
|
+
* @param key The storage key.
|
|
3312
|
+
* @param value The new value.
|
|
3313
|
+
*/
|
|
3314
|
+
setItem(key: string, value: string | null): void;
|
|
3315
|
+
/**
|
|
3316
|
+
* Removes the key/value pair with the given key, if a key/value pair with the given key exists.
|
|
3317
|
+
* @param key The storage key.
|
|
3318
|
+
*/
|
|
3319
|
+
removeItem(key: string): void;
|
|
3320
|
+
/**
|
|
3321
|
+
* Returns the name of the nth key, or null if n is greater than or equal to the number of key/value pairs.
|
|
3322
|
+
* @param index The numeric index.
|
|
3323
|
+
* @returns The nth key.
|
|
3324
|
+
*/
|
|
3325
|
+
key(index: number): string | null;
|
|
3326
|
+
}
|
|
3327
|
+
|
|
3328
|
+
export declare interface NewPatientRequest {
|
|
3329
|
+
readonly login: string;
|
|
3330
|
+
readonly projectId: string;
|
|
3331
|
+
}
|
|
3332
|
+
|
|
3333
|
+
export declare interface NewProjectRequest {
|
|
3334
|
+
readonly login: string;
|
|
3335
|
+
readonly projectName: string;
|
|
3336
|
+
}
|
|
3337
|
+
|
|
3338
|
+
export declare interface NewUserRequest {
|
|
3339
|
+
readonly firstName: string;
|
|
3340
|
+
readonly lastName: string;
|
|
3341
|
+
readonly email: string;
|
|
3342
|
+
readonly password: string;
|
|
3343
|
+
readonly recaptchaToken: string;
|
|
3344
|
+
readonly recaptchaSiteKey?: string;
|
|
3345
|
+
readonly remember?: boolean;
|
|
3346
|
+
readonly projectId?: string;
|
|
3347
|
+
readonly clientId?: string;
|
|
3348
|
+
}
|
|
3349
|
+
|
|
3350
|
+
/**
|
|
3351
|
+
* Normalizes an error object into a displayable error string.
|
|
3352
|
+
* @param error The error value which could be a string, Error, OperationOutcome, or other unknown type.
|
|
3353
|
+
* @returns A display string for the error.
|
|
3354
|
+
*/
|
|
3355
|
+
export declare function normalizeErrorString(error: unknown): string;
|
|
3356
|
+
|
|
3357
|
+
/**
|
|
3358
|
+
* Normalizes an error object into an OperationOutcome.
|
|
3359
|
+
* @param error The error value which could be a string, Error, OperationOutcome, or other unknown type.
|
|
3360
|
+
* @returns The normalized OperationOutcome.
|
|
3361
|
+
*/
|
|
3362
|
+
export declare function normalizeOperationOutcome(error: unknown): OperationOutcome;
|
|
3363
|
+
|
|
3364
|
+
export declare const notFound: OperationOutcome;
|
|
3365
|
+
|
|
3366
|
+
export declare const notModified: OperationOutcome;
|
|
3367
|
+
|
|
3368
|
+
/**
|
|
3369
|
+
* OAuth 2.0 Client Authentication Methods
|
|
3370
|
+
* See: https://datatracker.ietf.org/doc/html/rfc7523#section-2.2
|
|
3371
|
+
*/
|
|
3372
|
+
export declare enum OAuthClientAssertionType {
|
|
3373
|
+
/** Using JWTs for Client Authentication */
|
|
3374
|
+
JwtBearer = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"
|
|
3375
|
+
}
|
|
3376
|
+
|
|
3377
|
+
/**
|
|
3378
|
+
* OAuth 2.0 Grant Type Identifiers
|
|
3379
|
+
* Standard identifiers: https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-07#name-grant-types
|
|
3380
|
+
* JWT bearer extension: https://datatracker.ietf.org/doc/html/rfc7523
|
|
3381
|
+
* Token exchange extension: https://datatracker.ietf.org/doc/html/rfc8693
|
|
3382
|
+
*/
|
|
3383
|
+
export declare enum OAuthGrantType {
|
|
3384
|
+
ClientCredentials = "client_credentials",
|
|
3385
|
+
AuthorizationCode = "authorization_code",
|
|
3386
|
+
RefreshToken = "refresh_token",
|
|
3387
|
+
JwtBearer = "urn:ietf:params:oauth:grant-type:jwt-bearer",
|
|
3388
|
+
TokenExchange = "urn:ietf:params:oauth:grant-type:token-exchange"
|
|
3389
|
+
}
|
|
3390
|
+
|
|
3391
|
+
/**
|
|
3392
|
+
* OAuth 2.0 Token Type Identifiers
|
|
3393
|
+
* See: https://datatracker.ietf.org/doc/html/rfc8693#name-token-type-identifiers
|
|
3394
|
+
*/
|
|
3395
|
+
export declare enum OAuthTokenType {
|
|
3396
|
+
/** Indicates that the token is an OAuth 2.0 access token issued by the given authorization server. */
|
|
3397
|
+
AccessToken = "urn:ietf:params:oauth:token-type:access_token",
|
|
3398
|
+
/** Indicates that the token is an OAuth 2.0 refresh token issued by the given authorization server. */
|
|
3399
|
+
RefreshToken = "urn:ietf:params:oauth:token-type:refresh_token",
|
|
3400
|
+
/** Indicates that the token is an ID Token as defined in Section 2 of [OpenID.Core]. */
|
|
3401
|
+
IdToken = "urn:ietf:params:oauth:token-type:id_token",
|
|
3402
|
+
/** Indicates that the token is a base64url-encoded SAML 1.1 [OASIS.saml-core-1.1] assertion. */
|
|
3403
|
+
Saml1Token = "urn:ietf:params:oauth:token-type:saml1",
|
|
3404
|
+
/** Indicates that the token is a base64url-encoded SAML 2.0 [OASIS.saml-core-2.0-os] assertion. */
|
|
3405
|
+
Saml2Token = "urn:ietf:params:oauth:token-type:saml2"
|
|
3406
|
+
}
|
|
3407
|
+
|
|
3408
|
+
export declare class OperationOutcomeError extends Error {
|
|
3409
|
+
readonly outcome: OperationOutcome;
|
|
3410
|
+
constructor(outcome: OperationOutcome, cause?: unknown);
|
|
3411
|
+
}
|
|
3412
|
+
|
|
3413
|
+
/**
|
|
3414
|
+
* Returns a string represenation of the operation outcome issue.
|
|
3415
|
+
* @param issue The operation outcome issue.
|
|
3416
|
+
* @returns The string representation of the operation outcome issue.
|
|
3417
|
+
*/
|
|
3418
|
+
export declare function operationOutcomeIssueToString(issue: OperationOutcomeIssue): string;
|
|
3419
|
+
|
|
3420
|
+
/**
|
|
3421
|
+
* Returns a string represenation of the operation outcome.
|
|
3422
|
+
* @param outcome The operation outcome.
|
|
3423
|
+
* @returns The string representation of the operation outcome.
|
|
3424
|
+
*/
|
|
3425
|
+
export declare function operationOutcomeToString(outcome: OperationOutcome): string;
|
|
3426
|
+
|
|
3427
|
+
/**
|
|
3428
|
+
* Search operators.
|
|
3429
|
+
* These operators represent "modifiers" and "prefixes" in FHIR search.
|
|
3430
|
+
* See: https://www.hl7.org/fhir/search.html
|
|
3431
|
+
*/
|
|
3432
|
+
export declare enum Operator {
|
|
3433
|
+
EQUALS = "eq",
|
|
3434
|
+
NOT_EQUALS = "ne",
|
|
3435
|
+
GREATER_THAN = "gt",
|
|
3436
|
+
LESS_THAN = "lt",
|
|
3437
|
+
GREATER_THAN_OR_EQUALS = "ge",
|
|
3438
|
+
LESS_THAN_OR_EQUALS = "le",
|
|
3439
|
+
STARTS_AFTER = "sa",
|
|
3440
|
+
ENDS_BEFORE = "eb",
|
|
3441
|
+
APPROXIMATELY = "ap",
|
|
3442
|
+
CONTAINS = "contains",
|
|
3443
|
+
EXACT = "exact",
|
|
3444
|
+
TEXT = "text",
|
|
3445
|
+
NOT = "not",
|
|
3446
|
+
ABOVE = "above",
|
|
3447
|
+
BELOW = "below",
|
|
3448
|
+
IN = "in",
|
|
3449
|
+
NOT_IN = "not-in",
|
|
3450
|
+
OF_TYPE = "of-type",
|
|
3451
|
+
MISSING = "missing",
|
|
3452
|
+
IDENTIFIER = "identifier",
|
|
3453
|
+
ITERATE = "iterate"
|
|
3454
|
+
}
|
|
3455
|
+
|
|
3456
|
+
/**
|
|
3457
|
+
* Operator precedence
|
|
3458
|
+
* See: https://hl7.org/fhirpath/#operator-precedence
|
|
3459
|
+
*/
|
|
3460
|
+
export declare const OperatorPrecedence: {
|
|
3461
|
+
FunctionCall: number;
|
|
3462
|
+
Dot: number;
|
|
3463
|
+
Indexer: number;
|
|
3464
|
+
UnaryAdd: number;
|
|
3465
|
+
UnarySubtract: number;
|
|
3466
|
+
Multiply: number;
|
|
3467
|
+
Divide: number;
|
|
3468
|
+
IntegerDivide: number;
|
|
3469
|
+
Modulo: number;
|
|
3470
|
+
Add: number;
|
|
3471
|
+
Subtract: number;
|
|
3472
|
+
Ampersand: number;
|
|
3473
|
+
Is: number;
|
|
3474
|
+
As: number;
|
|
3475
|
+
Union: number;
|
|
3476
|
+
GreaterThan: number;
|
|
3477
|
+
GreaterThanOrEquals: number;
|
|
3478
|
+
LessThan: number;
|
|
3479
|
+
LessThanOrEquals: number;
|
|
3480
|
+
Equals: number;
|
|
3481
|
+
Equivalent: number;
|
|
3482
|
+
NotEquals: number;
|
|
3483
|
+
NotEquivalent: number;
|
|
3484
|
+
In: number;
|
|
3485
|
+
Contains: number;
|
|
3486
|
+
And: number;
|
|
3487
|
+
Xor: number;
|
|
3488
|
+
Or: number;
|
|
3489
|
+
Implies: number;
|
|
3490
|
+
Arrow: number;
|
|
3491
|
+
Semicolon: number;
|
|
3492
|
+
};
|
|
3493
|
+
|
|
3494
|
+
/**
|
|
3495
|
+
* Parses a FHIR criteria string into a SearchRequest.
|
|
3496
|
+
* FHIR criteria strings are found on resources such as Subscription.
|
|
3497
|
+
* @param criteria The FHIR criteria string.
|
|
3498
|
+
* @returns Parsed search definition.
|
|
3499
|
+
*/
|
|
3500
|
+
export declare function parseCriteriaAsSearchRequest(criteria: string): SearchRequest;
|
|
3501
|
+
|
|
3502
|
+
/**
|
|
3503
|
+
* Parses a FHIRPath expression into an AST.
|
|
3504
|
+
* The result can be used to evaluate the expression against a resource or other object.
|
|
3505
|
+
* This method is useful if you know that you will evaluate the same expression many times
|
|
3506
|
+
* against different resources.
|
|
3507
|
+
* @param input The FHIRPath expression to parse.
|
|
3508
|
+
* @returns The AST representing the expression.
|
|
3509
|
+
*/
|
|
3510
|
+
export declare function parseFhirPath(input: string): FhirPathAtom;
|
|
3511
|
+
|
|
3512
|
+
/**
|
|
3513
|
+
* Parses a FHIR _filter parameter expression into an AST.
|
|
3514
|
+
* @param input The FHIR _filter parameter expression.
|
|
3515
|
+
* @returns The AST representing the filters.
|
|
3516
|
+
*/
|
|
3517
|
+
export declare function parseFilterParameter(input: string): FhirFilterExpression;
|
|
3518
|
+
|
|
3519
|
+
/**
|
|
3520
|
+
* Returns a formatted string representing the date in ISO-8601 format.
|
|
3521
|
+
*
|
|
3522
|
+
* HL7-Definition V2
|
|
3523
|
+
* Specifies a point in time using a 24-hour clock notation.
|
|
3524
|
+
*
|
|
3525
|
+
* Format: YYYY[MM[DD[HH[MM[SS[. S[S[S[S]]]]]]]]][+/-ZZZZ].
|
|
3526
|
+
*
|
|
3527
|
+
* @param hl7DateTime Date/time string.
|
|
3528
|
+
* @param options Optional parsing options.
|
|
3529
|
+
* @returns The date in ISO-8601 format.
|
|
3530
|
+
*/
|
|
3531
|
+
export declare function parseHl7DateTime(hl7DateTime: string | undefined, options?: Hl7DateParseOptions): string | undefined;
|
|
3532
|
+
|
|
3533
|
+
/**
|
|
3534
|
+
* Parses the JWT payload.
|
|
3535
|
+
* @param token JWT token.
|
|
3536
|
+
* @returns Collection of key value claims in the JWT payload.
|
|
3537
|
+
*/
|
|
3538
|
+
export declare function parseJWTPayload(token: string): Record<string, number | string>;
|
|
3539
|
+
|
|
3540
|
+
/**
|
|
3541
|
+
* Parses a FHIR Mapping Language document into an AST.
|
|
3542
|
+
* @param input The FHIR Mapping Language document to parse.
|
|
3543
|
+
* @returns The AST representing the document.
|
|
3544
|
+
*/
|
|
3545
|
+
export declare function parseMappingLanguage(input: string): StructureMap;
|
|
3546
|
+
|
|
3547
|
+
export declare class Parser {
|
|
3548
|
+
private tokens;
|
|
3549
|
+
private prefixParselets;
|
|
3550
|
+
private infixParselets;
|
|
3551
|
+
constructor(tokens: Token[], prefixParselets: Record<string, PrefixParselet>, infixParselets: Record<string, InfixParselet>);
|
|
3552
|
+
hasMore(): boolean;
|
|
3553
|
+
match(expected: string): boolean;
|
|
3554
|
+
consumeAndParse(precedence?: number): Atom;
|
|
3555
|
+
getPrecedence(): number;
|
|
3556
|
+
consume(expectedId?: string, expectedValue?: string): Token;
|
|
3557
|
+
peek(): Token | undefined;
|
|
3558
|
+
removeComments(): void;
|
|
3559
|
+
getInfixParselet(token: Token): InfixParselet | undefined;
|
|
3560
|
+
}
|
|
3561
|
+
|
|
3562
|
+
export declare class ParserBuilder {
|
|
3563
|
+
private readonly prefixParselets;
|
|
3564
|
+
private readonly infixParselets;
|
|
3565
|
+
registerInfix(tokenType: string, parselet: InfixParselet): this;
|
|
3566
|
+
registerPrefix(tokenType: string, parselet: PrefixParselet): this;
|
|
3567
|
+
prefix(tokenType: string, precedence: number, builder: (token: Token, right: Atom) => Atom): this;
|
|
3568
|
+
infixLeft(tokenType: string, precedence: number, builder: (left: Atom, token: Token, right: Atom) => Atom): this;
|
|
3569
|
+
construct(input: Token[]): Parser;
|
|
3570
|
+
}
|
|
3571
|
+
|
|
3572
|
+
/**
|
|
3573
|
+
* Parses a reference and returns a tuple of [ResourceType, ID].
|
|
3574
|
+
* @param reference A reference to a FHIR resource.
|
|
3575
|
+
* @returns A tuple containing the `ResourceType` and the ID of the resource or `undefined` when `undefined` or an invalid reference is passed.
|
|
3576
|
+
*/
|
|
3577
|
+
export declare function parseReference(reference: Reference): [ResourceType, string] | undefined;
|
|
3578
|
+
|
|
3579
|
+
export declare function parseReference(reference: undefined): undefined;
|
|
3580
|
+
|
|
3581
|
+
/**
|
|
3582
|
+
* Parses a URL string into a SearchRequest.
|
|
3583
|
+
* @param url The URL to parse.
|
|
3584
|
+
* @returns Parsed search definition.
|
|
3585
|
+
*/
|
|
3586
|
+
export declare function parseSearchDefinition<T extends Resource = Resource>(url: string): SearchRequest<T>;
|
|
3587
|
+
|
|
3588
|
+
/**
|
|
3589
|
+
* Parses a search URL into a search request.
|
|
3590
|
+
* @param resourceType The FHIR resource type.
|
|
3591
|
+
* @param query The collection of query string parameters.
|
|
3592
|
+
* @returns A parsed SearchRequest.
|
|
3593
|
+
*/
|
|
3594
|
+
export declare function parseSearchRequest<T extends Resource = Resource>(resourceType: T['resourceType'], query: Record<string, string[] | string | undefined>): SearchRequest<T>;
|
|
3595
|
+
|
|
3596
|
+
/**
|
|
3597
|
+
* Parses a search URL into a search request.
|
|
3598
|
+
* @param url The search URL.
|
|
3599
|
+
* @returns A parsed SearchRequest.
|
|
3600
|
+
*/
|
|
3601
|
+
export declare function parseSearchUrl<T extends Resource = Resource>(url: URL): SearchRequest<T>;
|
|
3602
|
+
|
|
3603
|
+
/**
|
|
3604
|
+
* Parses a StructureDefinition resource into an internal schema better suited for
|
|
3605
|
+
* programmatic validation and usage in internal systems
|
|
3606
|
+
* @param sd The StructureDefinition resource to parse
|
|
3607
|
+
* @returns The parsed schema for the given resource type
|
|
3608
|
+
* @experimental
|
|
3609
|
+
*/
|
|
3610
|
+
export declare function parseStructureDefinition(sd: StructureDefinition): InternalTypeSchema;
|
|
3611
|
+
|
|
3612
|
+
/**
|
|
3613
|
+
* Parses an extended FHIR search criteria string (i.e. application/x-fhir-query), evaluating
|
|
3614
|
+
* any embedded FHIRPath subexpressions (e.g. `{{ %patient.id }}`) with the provided variables.
|
|
3615
|
+
*
|
|
3616
|
+
* @see https://hl7.org/fhir/fhir-xquery.html
|
|
3617
|
+
* @param query The X-Fhir-Query string to parse
|
|
3618
|
+
* @param variables Values to pass into embedded FHIRPath expressions
|
|
3619
|
+
* @returns The parsed search request
|
|
3620
|
+
*/
|
|
3621
|
+
export declare function parseXFhirQuery(query: string, variables: Record<string, TypedValue>): SearchRequest;
|
|
3622
|
+
|
|
3623
|
+
/**
|
|
3624
|
+
* JSONPatch patch operation.
|
|
3625
|
+
* Compatible with fast-json-patch and rfc6902 Operation.
|
|
3626
|
+
*/
|
|
3627
|
+
export declare interface PatchOperation {
|
|
3628
|
+
readonly op: 'add' | 'remove' | 'replace' | 'copy' | 'move' | 'test';
|
|
3629
|
+
readonly path: string;
|
|
3630
|
+
readonly value?: any;
|
|
3631
|
+
}
|
|
3632
|
+
|
|
3633
|
+
export declare type PendingSubscriptionRequest = Omit<SubscriptionRequest, 'endpoint'>;
|
|
3634
|
+
|
|
3635
|
+
/**
|
|
3636
|
+
* Returns true if the two numbers are equal to the given precision.
|
|
3637
|
+
* @param a The first number.
|
|
3638
|
+
* @param b The second number.
|
|
3639
|
+
* @param precision Optional precision in number of digits.
|
|
3640
|
+
* @returns True if the two numbers are equal to the given precision.
|
|
3641
|
+
*/
|
|
3642
|
+
export declare function preciseEquals(a: number, b: number, precision?: number): boolean;
|
|
3643
|
+
|
|
3644
|
+
/**
|
|
3645
|
+
* Returns true if the first number is greater than the second number to the given precision.
|
|
3646
|
+
* @param a The first number.
|
|
3647
|
+
* @param b The second number.
|
|
3648
|
+
* @param precision Optional precision in number of digits.
|
|
3649
|
+
* @returns True if the first number is greater than the second number to the given precision.
|
|
3650
|
+
*/
|
|
3651
|
+
export declare function preciseGreaterThan(a: number, b: number, precision?: number): boolean;
|
|
3652
|
+
|
|
3653
|
+
/**
|
|
3654
|
+
* Returns true if the first number is greater than or equal to the second number to the given precision.
|
|
3655
|
+
* @param a The first number.
|
|
3656
|
+
* @param b The second number.
|
|
3657
|
+
* @param precision Optional precision in number of digits.
|
|
3658
|
+
* @returns True if the first number is greater than or equal to the second number to the given precision.
|
|
3659
|
+
*/
|
|
3660
|
+
export declare function preciseGreaterThanOrEquals(a: number, b: number, precision?: number): boolean;
|
|
3661
|
+
|
|
3662
|
+
/**
|
|
3663
|
+
* Returns true if the first number is less than the second number to the given precision.
|
|
3664
|
+
* @param a The first number.
|
|
3665
|
+
* @param b The second number.
|
|
3666
|
+
* @param precision Optional precision in number of digits.
|
|
3667
|
+
* @returns True if the first number is less than the second number to the given precision.
|
|
3668
|
+
*/
|
|
3669
|
+
export declare function preciseLessThan(a: number, b: number, precision?: number): boolean;
|
|
3670
|
+
|
|
3671
|
+
/**
|
|
3672
|
+
* Returns true if the first number is less than or equal to the second number to the given precision.
|
|
3673
|
+
* @param a The first number.
|
|
3674
|
+
* @param b The second number.
|
|
3675
|
+
* @param precision Optional precision in number of digits.
|
|
3676
|
+
* @returns True if the first number is less than or equal to the second number to the given precision.
|
|
3677
|
+
*/
|
|
3678
|
+
export declare function preciseLessThanOrEquals(a: number, b: number, precision?: number): boolean;
|
|
3679
|
+
|
|
3680
|
+
/**
|
|
3681
|
+
* Returns the input number rounded to the specified number of digits.
|
|
3682
|
+
* @param a The input number.
|
|
3683
|
+
* @param precision The precision in number of digits.
|
|
3684
|
+
* @returns The number rounded to the specified number of digits.
|
|
3685
|
+
*/
|
|
3686
|
+
export declare function preciseRound(a: number, precision: number): number;
|
|
3687
|
+
|
|
3688
|
+
export declare abstract class PrefixOperatorAtom implements Atom {
|
|
3689
|
+
readonly operator: string;
|
|
3690
|
+
readonly child: Atom;
|
|
3691
|
+
constructor(operator: string, child: Atom);
|
|
3692
|
+
abstract eval(context: AtomContext, input: TypedValue[]): TypedValue[];
|
|
3693
|
+
toString(): string;
|
|
3694
|
+
}
|
|
3695
|
+
|
|
3696
|
+
export declare interface PrefixParselet {
|
|
3697
|
+
parse(parser: Parser, token: Token): Atom;
|
|
3698
|
+
}
|
|
3699
|
+
|
|
3700
|
+
/**
|
|
3701
|
+
* @internal
|
|
3702
|
+
*/
|
|
3703
|
+
export declare type ProfileResource = Patient | Practitioner | RelatedPerson;
|
|
3704
|
+
|
|
3705
|
+
/**
|
|
3706
|
+
* Project admin resource types are special resources that are only
|
|
3707
|
+
* accessible to project administrators.
|
|
3708
|
+
*/
|
|
3709
|
+
export declare const projectAdminResourceTypes: string[];
|
|
3710
|
+
|
|
3711
|
+
/**
|
|
3712
|
+
* List of property types.
|
|
3713
|
+
* http://www.hl7.org/fhir/valueset-defined-types.html
|
|
3714
|
+
* The list here includes additions found from StructureDefinition resources.
|
|
3715
|
+
*/
|
|
3716
|
+
export declare const PropertyType: {
|
|
3717
|
+
Address: string;
|
|
3718
|
+
Age: string;
|
|
3719
|
+
Annotation: string;
|
|
3720
|
+
Attachment: string;
|
|
3721
|
+
BackboneElement: string;
|
|
3722
|
+
CodeableConcept: string;
|
|
3723
|
+
Coding: string;
|
|
3724
|
+
ContactDetail: string;
|
|
3725
|
+
ContactPoint: string;
|
|
3726
|
+
Contributor: string;
|
|
3727
|
+
Count: string;
|
|
3728
|
+
DataRequirement: string;
|
|
3729
|
+
Distance: string;
|
|
3730
|
+
Dosage: string;
|
|
3731
|
+
Duration: string;
|
|
3732
|
+
Expression: string;
|
|
3733
|
+
Extension: string;
|
|
3734
|
+
HumanName: string;
|
|
3735
|
+
Identifier: string;
|
|
3736
|
+
MarketingStatus: string;
|
|
3737
|
+
Meta: string;
|
|
3738
|
+
Money: string;
|
|
3739
|
+
Narrative: string;
|
|
3740
|
+
ParameterDefinition: string;
|
|
3741
|
+
Period: string;
|
|
3742
|
+
Population: string;
|
|
3743
|
+
ProdCharacteristic: string;
|
|
3744
|
+
ProductShelfLife: string;
|
|
3745
|
+
Quantity: string;
|
|
3746
|
+
Range: string;
|
|
3747
|
+
Ratio: string;
|
|
3748
|
+
Reference: string;
|
|
3749
|
+
RelatedArtifact: string;
|
|
3750
|
+
SampledData: string;
|
|
3751
|
+
Signature: string;
|
|
3752
|
+
SubstanceAmount: string;
|
|
3753
|
+
SystemString: string;
|
|
3754
|
+
Timing: string;
|
|
3755
|
+
TriggerDefinition: string;
|
|
3756
|
+
UsageContext: string;
|
|
3757
|
+
base64Binary: string;
|
|
3758
|
+
boolean: string;
|
|
3759
|
+
canonical: string;
|
|
3760
|
+
code: string;
|
|
3761
|
+
date: string;
|
|
3762
|
+
dateTime: string;
|
|
3763
|
+
decimal: string;
|
|
3764
|
+
id: string;
|
|
3765
|
+
instant: string;
|
|
3766
|
+
integer: string;
|
|
3767
|
+
markdown: string;
|
|
3768
|
+
oid: string;
|
|
3769
|
+
positiveInt: string;
|
|
3770
|
+
string: string;
|
|
3771
|
+
time: string;
|
|
3772
|
+
unsignedInt: string;
|
|
3773
|
+
uri: string;
|
|
3774
|
+
url: string;
|
|
3775
|
+
uuid: string;
|
|
3776
|
+
};
|
|
3777
|
+
|
|
3778
|
+
/**
|
|
3779
|
+
* Protected resource types are in the "medplum" project.
|
|
3780
|
+
* Reading and writing is limited to the system account.
|
|
3781
|
+
*/
|
|
3782
|
+
export declare const protectedResourceTypes: string[];
|
|
3783
|
+
|
|
3784
|
+
/**
|
|
3785
|
+
* QueryTypes defines the different ways to specify FHIR search parameters.
|
|
3786
|
+
*
|
|
3787
|
+
* Can be any valid input to the URLSearchParams() constructor.
|
|
3788
|
+
*
|
|
3789
|
+
* TypeScript definitions for URLSearchParams do not match runtime behavior.
|
|
3790
|
+
* The official spec only accepts string values.
|
|
3791
|
+
* Web browsers and Node.js automatically coerce values to strings.
|
|
3792
|
+
* See: https://github.com/microsoft/TypeScript/issues/32951
|
|
3793
|
+
*/
|
|
3794
|
+
export declare type QueryTypes = URLSearchParams | string[][] | Record<string, any> | string | undefined;
|
|
3795
|
+
|
|
3796
|
+
/**
|
|
3797
|
+
* The ReadablePromise class wraps a request promise suitable for React Suspense.
|
|
3798
|
+
* See: https://blog.logrocket.com/react-suspense-data-fetching/#wrappromise-js
|
|
3799
|
+
* See: https://github.com/ovieokeh/suspense-data-fetching/blob/master/lib/api/wrapPromise.js
|
|
3800
|
+
*/
|
|
3801
|
+
export declare class ReadablePromise<T> implements Promise<T> {
|
|
3802
|
+
readonly [Symbol.toStringTag]: string;
|
|
3803
|
+
private suspender;
|
|
3804
|
+
private status;
|
|
3805
|
+
private response;
|
|
3806
|
+
private error;
|
|
3807
|
+
constructor(requestPromise: Promise<T>);
|
|
3808
|
+
/**
|
|
3809
|
+
* Returns true if the promise is pending.
|
|
3810
|
+
* @returns True if the Promise is pending.
|
|
3811
|
+
*/
|
|
3812
|
+
isPending(): boolean;
|
|
3813
|
+
/**
|
|
3814
|
+
* Returns true if the promise resolved successfully.
|
|
3815
|
+
* @returns True if the Promise resolved successfully.
|
|
3816
|
+
*/
|
|
3817
|
+
isOk(): boolean;
|
|
3818
|
+
/**
|
|
3819
|
+
* Attempts to read the value of the promise.
|
|
3820
|
+
* If the promise is pending, this method will throw a promise.
|
|
3821
|
+
* If the promise rejected, this method will throw the rejection reason.
|
|
3822
|
+
* If the promise resolved, this method will return the resolved value.
|
|
3823
|
+
* @returns The resolved value of the Promise.
|
|
3824
|
+
*/
|
|
3825
|
+
read(): T;
|
|
3826
|
+
/**
|
|
3827
|
+
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
|
3828
|
+
* @param onfulfilled The callback to execute when the Promise is resolved.
|
|
3829
|
+
* @param onrejected The callback to execute when the Promise is rejected.
|
|
3830
|
+
* @returns A Promise for the completion of which ever callback is executed.
|
|
3831
|
+
*/
|
|
3832
|
+
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
|
|
3833
|
+
/**
|
|
3834
|
+
* Attaches a callback for only the rejection of the Promise.
|
|
3835
|
+
* @param onrejected The callback to execute when the Promise is rejected.
|
|
3836
|
+
* @returns A Promise for the completion of the callback.
|
|
3837
|
+
*/
|
|
3838
|
+
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
|
|
3839
|
+
/**
|
|
3840
|
+
* Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The
|
|
3841
|
+
* resolved value cannot be modified from the callback.
|
|
3842
|
+
* @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected).
|
|
3843
|
+
* @returns A Promise for the completion of the callback.
|
|
3844
|
+
*/
|
|
3845
|
+
finally(onfinally?: (() => void) | undefined | null): Promise<T>;
|
|
3846
|
+
}
|
|
3847
|
+
|
|
3848
|
+
/**
|
|
3849
|
+
* Removes duplicates in array using FHIRPath equality rules.
|
|
3850
|
+
* @param arr The input array.
|
|
3851
|
+
* @returns The result array with duplicates removed.
|
|
3852
|
+
*/
|
|
3853
|
+
export declare function removeDuplicates(arr: TypedValue[]): TypedValue[];
|
|
3854
|
+
|
|
3855
|
+
/**
|
|
3856
|
+
* Topologically sorts a `batch` or `transaction` bundle to improve reference resolution.
|
|
3857
|
+
* The bundle is sorted such that a resource is created _before_ references to that resource appear in the bundle.
|
|
3858
|
+
*
|
|
3859
|
+
* In the event of cycles, this function will first create a POST request for each resource in the cycle, and then will
|
|
3860
|
+
* append a PUT request to the bundle. This ensures that each resources in the cycle is visited twice, and all
|
|
3861
|
+
* references can be resolved
|
|
3862
|
+
* @param bundle Input bundle with type `batch` or `transaction`
|
|
3863
|
+
* @returns Bundle of the same type, with Bundle.entry reordered
|
|
3864
|
+
*/
|
|
3865
|
+
export declare function reorderBundle(bundle: Bundle): Bundle;
|
|
3866
|
+
|
|
3867
|
+
/**
|
|
3868
|
+
* Returns the ID portion of a reference.
|
|
3869
|
+
* @param input A FHIR reference or resource.
|
|
3870
|
+
* @returns The ID portion of a reference.
|
|
3871
|
+
*/
|
|
3872
|
+
export declare function resolveId(input: Reference | Resource | undefined): string | undefined;
|
|
3873
|
+
|
|
3874
|
+
/**
|
|
3875
|
+
* ResourceArray is an array of resources with a bundle property.
|
|
3876
|
+
* The bundle property is a FHIR Bundle containing the search results.
|
|
3877
|
+
* This is useful for retrieving bundle metadata such as total, offset, and next link.
|
|
3878
|
+
*/
|
|
3879
|
+
export declare type ResourceArray<T extends Resource = Resource> = T[] & {
|
|
3880
|
+
bundle: Bundle<T>;
|
|
3881
|
+
};
|
|
3882
|
+
|
|
3883
|
+
export declare interface ResourceVisitor {
|
|
3884
|
+
onEnterObject?: (path: string, value: TypedValue, schema: InternalTypeSchema) => void;
|
|
3885
|
+
onExitObject?: (path: string, value: TypedValue, schema: InternalTypeSchema) => void;
|
|
3886
|
+
onEnterResource?: (path: string, value: TypedValue, schema: InternalTypeSchema) => void;
|
|
3887
|
+
onExitResource?: (path: string, value: TypedValue, schema: InternalTypeSchema) => void;
|
|
3888
|
+
visitProperty?: (parent: TypedValue, key: string, path: string, propertyValues: (TypedValue | TypedValue[] | undefined)[], schema: InternalTypeSchema) => void;
|
|
3889
|
+
}
|
|
3890
|
+
|
|
3891
|
+
/**
|
|
3892
|
+
* @internal
|
|
3893
|
+
*/
|
|
3894
|
+
export declare type ResourceWithCode = Resource & Code;
|
|
3895
|
+
|
|
3896
|
+
export declare const RXNORM = "http://www.nlm.nih.gov/research/umls/rxnorm";
|
|
3897
|
+
|
|
3898
|
+
/**
|
|
3899
|
+
* Checks that there is an access policy permitting the given resource interaction, returning the matching policy object.
|
|
3900
|
+
* @param resource The resource being acted upon.
|
|
3901
|
+
* @param interaction The interaction being performed on the resource.
|
|
3902
|
+
* @param accessPolicy The relevant access policy for the current user.
|
|
3903
|
+
* @returns The satisfied access policy, or undefined if the access policy does not permit the given interaction.
|
|
3904
|
+
*/
|
|
3905
|
+
export declare function satisfiedAccessPolicy(resource: Resource, interaction: AccessPolicyInteraction, accessPolicy: AccessPolicy | undefined): AccessPolicyResource | undefined;
|
|
3906
|
+
|
|
3907
|
+
export declare interface SearchParameterDetails {
|
|
3908
|
+
readonly columnName: string;
|
|
3909
|
+
readonly type: SearchParameterType;
|
|
3910
|
+
readonly elementDefinitions?: InternalSchemaElement[];
|
|
3911
|
+
readonly array?: boolean;
|
|
3912
|
+
}
|
|
3913
|
+
|
|
3914
|
+
export declare enum SearchParameterType {
|
|
3915
|
+
BOOLEAN = "BOOLEAN",
|
|
3916
|
+
NUMBER = "NUMBER",
|
|
3917
|
+
QUANTITY = "QUANTITY",
|
|
3918
|
+
TEXT = "TEXT",
|
|
3919
|
+
REFERENCE = "REFERENCE",
|
|
3920
|
+
CANONICAL = "CANONICAL",
|
|
3921
|
+
DATE = "DATE",
|
|
3922
|
+
DATETIME = "DATETIME",
|
|
3923
|
+
PERIOD = "PERIOD",
|
|
3924
|
+
UUID = "UUID"
|
|
3925
|
+
}
|
|
3926
|
+
|
|
3927
|
+
export declare interface SearchRequest<T extends Resource = Resource> {
|
|
3928
|
+
readonly resourceType: T['resourceType'];
|
|
3929
|
+
filters?: Filter[];
|
|
3930
|
+
sortRules?: SortRule[];
|
|
3931
|
+
offset?: number;
|
|
3932
|
+
count?: number;
|
|
3933
|
+
fields?: string[];
|
|
3934
|
+
name?: string;
|
|
3935
|
+
total?: 'none' | 'estimate' | 'accurate';
|
|
3936
|
+
include?: IncludeTarget[];
|
|
3937
|
+
revInclude?: IncludeTarget[];
|
|
3938
|
+
summary?: 'true' | 'text' | 'data';
|
|
3939
|
+
}
|
|
3940
|
+
|
|
3941
|
+
/**
|
|
3942
|
+
* Creates a serialized url-encoded payload for a `FHIRcast` subscription from a `SubscriptionRequest` object that can be directly used in an HTTP request to the Hub.
|
|
3943
|
+
*
|
|
3944
|
+
* @param subscriptionRequest An object representing a subscription request.
|
|
3945
|
+
* @returns A serialized subscription in url-encoded form.
|
|
3946
|
+
*/
|
|
3947
|
+
export declare function serializeFhircastSubscriptionRequest(subscriptionRequest: SubscriptionRequest | PendingSubscriptionRequest): string;
|
|
3948
|
+
|
|
3949
|
+
export declare function serverError(err: Error): OperationOutcome;
|
|
3950
|
+
|
|
3951
|
+
/**
|
|
3952
|
+
* Sets a code for a given system within a given codeable concept.
|
|
3953
|
+
* @param concept The codeable concept.
|
|
3954
|
+
* @param system The system string.
|
|
3955
|
+
* @param code The code value.
|
|
3956
|
+
*/
|
|
3957
|
+
export declare function setCodeBySystem(concept: CodeableConcept, system: string, code: string): void;
|
|
3958
|
+
|
|
3959
|
+
/**
|
|
3960
|
+
* Sets a resource identifier for the given system.
|
|
3961
|
+
*
|
|
3962
|
+
* Note that this method is only available on resources that have an "identifier" property,
|
|
3963
|
+
* and that property must be an array of Identifier objects,
|
|
3964
|
+
* which is not true for all FHIR resources.
|
|
3965
|
+
*
|
|
3966
|
+
* If the identifier already exists, then the value is updated.
|
|
3967
|
+
*
|
|
3968
|
+
* Otherwise a new identifier is added.
|
|
3969
|
+
*
|
|
3970
|
+
* @param resource The resource to add the identifier to.
|
|
3971
|
+
* @param system The identifier system.
|
|
3972
|
+
* @param value The identifier value.
|
|
3973
|
+
*/
|
|
3974
|
+
export declare function setIdentifier(resource: Resource & {
|
|
3975
|
+
identifier?: Identifier[];
|
|
3976
|
+
}, system: string, value: string): void;
|
|
3977
|
+
|
|
3978
|
+
export declare function singleton(collection: TypedValue[], type?: string): TypedValue | undefined;
|
|
3979
|
+
|
|
3980
|
+
/**
|
|
3981
|
+
* Sleeps for the specified number of milliseconds.
|
|
3982
|
+
* @param ms Time delay in milliseconds
|
|
3983
|
+
* @returns A promise that resolves after the specified number of milliseconds.
|
|
3984
|
+
*/
|
|
3985
|
+
export declare const sleep: (ms: number) => Promise<void>;
|
|
3986
|
+
|
|
3987
|
+
export declare interface SliceDefinition {
|
|
3988
|
+
name: string;
|
|
3989
|
+
type?: ElementType[];
|
|
3990
|
+
elements: Record<string, InternalSchemaElement>;
|
|
3991
|
+
min: number;
|
|
3992
|
+
max: number;
|
|
3993
|
+
}
|
|
3994
|
+
|
|
3995
|
+
export declare interface SliceDiscriminator {
|
|
3996
|
+
path: string;
|
|
3997
|
+
type: string;
|
|
3998
|
+
}
|
|
3999
|
+
|
|
4000
|
+
export declare interface SlicingRules {
|
|
4001
|
+
discriminator: SliceDiscriminator[];
|
|
4002
|
+
ordered: boolean;
|
|
4003
|
+
rule?: 'open' | 'closed' | 'openAtEnd';
|
|
4004
|
+
slices: SliceDefinition[];
|
|
4005
|
+
}
|
|
4006
|
+
|
|
4007
|
+
export declare const SNOMED = "http://snomed.info/sct";
|
|
4008
|
+
|
|
4009
|
+
export declare interface SortRule {
|
|
4010
|
+
code: string;
|
|
4011
|
+
descending?: boolean;
|
|
4012
|
+
}
|
|
4013
|
+
|
|
4014
|
+
/**
|
|
4015
|
+
* Reads data from a Readable stream and returns a Promise that resolves with a Buffer containing all the data.
|
|
4016
|
+
* @param stream - The Readable stream to read from.
|
|
4017
|
+
* @returns A Promise that resolves with a Buffer containing all the data from the Readable stream.
|
|
4018
|
+
*/
|
|
4019
|
+
export declare function streamToBuffer(stream: Readable): Promise<Buffer>;
|
|
4020
|
+
|
|
4021
|
+
/**
|
|
4022
|
+
* FHIR JSON stringify.
|
|
4023
|
+
* Removes properties with empty string values.
|
|
4024
|
+
* Removes objects with zero properties.
|
|
4025
|
+
* See: https://www.hl7.org/fhir/json.html
|
|
4026
|
+
* @param value The input value.
|
|
4027
|
+
* @param pretty Optional flag to pretty-print the JSON.
|
|
4028
|
+
* @returns The resulting JSON string.
|
|
4029
|
+
*/
|
|
4030
|
+
export declare function stringify(value: any, pretty?: boolean): string;
|
|
4031
|
+
|
|
4032
|
+
/**
|
|
4033
|
+
* Output the string representation of a value, suitable for use as part of a search query.
|
|
4034
|
+
* @param v The value to format as a string
|
|
4035
|
+
* @returns The stringified value
|
|
4036
|
+
*/
|
|
4037
|
+
export declare function stringifyTypedValue(v: TypedValue): string;
|
|
4038
|
+
|
|
4039
|
+
/**
|
|
4040
|
+
* A `FHIRcast` subscription request.
|
|
4041
|
+
*
|
|
4042
|
+
* Can be passed to `MedplumClient.fhircastConnect` or `MedplumClient.fhircastUnsubscribe` to either open a `FHIRcast` connection, or unsubscribe from the subscription.
|
|
4043
|
+
*/
|
|
4044
|
+
export declare type SubscriptionRequest = {
|
|
4045
|
+
channelType: 'websocket';
|
|
4046
|
+
mode: 'subscribe' | 'unsubscribe';
|
|
4047
|
+
events: FhircastEventName[];
|
|
4048
|
+
topic: string;
|
|
4049
|
+
endpoint: string;
|
|
4050
|
+
};
|
|
4051
|
+
|
|
4052
|
+
/**
|
|
4053
|
+
* Construct the subset of a resource containing a minimum set of fields. The returned resource is not guaranteed
|
|
4054
|
+
* to contain only the provided properties, and may contain others (e.g. `resourceType` and `id`)
|
|
4055
|
+
*
|
|
4056
|
+
* @param resource The resource to subset
|
|
4057
|
+
* @param properties The minimum properties to include in the subset
|
|
4058
|
+
* @returns The modified resource, containing the listed properties and possibly other mandatory ones
|
|
4059
|
+
*/
|
|
4060
|
+
export declare function subsetResource<T extends Resource>(resource: T | undefined, properties: string[]): T | undefined;
|
|
4061
|
+
|
|
4062
|
+
/**
|
|
4063
|
+
* Converts unknown object into a JavaScript boolean.
|
|
4064
|
+
* Note that this is different than the FHIRPath "toBoolean",
|
|
4065
|
+
* which has particular semantics around arrays, empty arrays, and type conversions.
|
|
4066
|
+
* @param obj Any value or array of values.
|
|
4067
|
+
* @returns The converted boolean value according to FHIRPath rules.
|
|
4068
|
+
*/
|
|
4069
|
+
export declare function toJsBoolean(obj: TypedValue[]): boolean;
|
|
4070
|
+
|
|
4071
|
+
declare interface Token extends Marker {
|
|
4072
|
+
id: string;
|
|
4073
|
+
value: string;
|
|
4074
|
+
}
|
|
4075
|
+
|
|
4076
|
+
export declare interface TokenResponse {
|
|
4077
|
+
readonly token_type: string;
|
|
4078
|
+
readonly id_token: string;
|
|
4079
|
+
readonly access_token: string;
|
|
4080
|
+
readonly refresh_token: string;
|
|
4081
|
+
readonly expires_in: number;
|
|
4082
|
+
readonly project: Reference<Project>;
|
|
4083
|
+
readonly profile: Reference<ProfileResource>;
|
|
4084
|
+
}
|
|
4085
|
+
|
|
4086
|
+
export declare const tooManyRequests: OperationOutcome;
|
|
4087
|
+
|
|
4088
|
+
/**
|
|
4089
|
+
* Returns a "best guess" TypedValue for a given value.
|
|
4090
|
+
* @param value The unknown value to check.
|
|
4091
|
+
* @returns A "best guess" TypedValue for the given value.
|
|
4092
|
+
*/
|
|
4093
|
+
export declare function toTypedValue(value: unknown): TypedValue;
|
|
4094
|
+
|
|
4095
|
+
export declare function tryGetDataType(type: string): InternalTypeSchema | undefined;
|
|
4096
|
+
|
|
4097
|
+
export declare class TypedEventTarget<TEvents extends Record<string, Event_2>> {
|
|
4098
|
+
private emitter;
|
|
4099
|
+
dispatchEvent<TEventType extends keyof TEvents & string>(event: TEvents[TEventType]): void;
|
|
4100
|
+
addEventListener<TEventType extends keyof TEvents & string>(type: TEventType, handler: (event: TEvents[TEventType]) => void): void;
|
|
4101
|
+
removeEventListener<TEventType extends keyof TEvents & string>(type: TEventType, handler: (event: TEvents[TEventType]) => void): void;
|
|
4102
|
+
}
|
|
4103
|
+
|
|
4104
|
+
export declare interface TypedValue {
|
|
4105
|
+
readonly type: string;
|
|
4106
|
+
readonly value: any;
|
|
4107
|
+
}
|
|
4108
|
+
|
|
4109
|
+
/**
|
|
4110
|
+
* An indexed TypeSchema.
|
|
4111
|
+
*
|
|
4112
|
+
* Example: The IndexedStructureDefinition for "Patient" would include the following TypeSchemas:
|
|
4113
|
+
* 1) Patient
|
|
4114
|
+
* 2) Patient_Contact
|
|
4115
|
+
* 3) Patient_Communication
|
|
4116
|
+
* 4) Patient_Link
|
|
4117
|
+
*/
|
|
4118
|
+
export declare interface TypeInfo {
|
|
4119
|
+
searchParams?: {
|
|
4120
|
+
[code: string]: SearchParameter;
|
|
4121
|
+
};
|
|
4122
|
+
searchParamsDetails?: {
|
|
4123
|
+
[code: string]: SearchParameterDetails;
|
|
4124
|
+
};
|
|
4125
|
+
}
|
|
4126
|
+
|
|
4127
|
+
export declare type TypeName<T> = T extends string ? 'string' : T extends number ? 'number' : T extends boolean ? 'boolean' : T extends undefined ? 'undefined' : 'object';
|
|
4128
|
+
|
|
4129
|
+
export declare const UCUM = "http://unitsofmeasure.org";
|
|
4130
|
+
|
|
4131
|
+
export declare const unauthorized: OperationOutcome;
|
|
4132
|
+
|
|
4133
|
+
/**
|
|
4134
|
+
* Validates that a `SubscriptionRequest`.
|
|
4135
|
+
*
|
|
4136
|
+
* @param subscriptionRequest The `SubscriptionRequest` to validate.
|
|
4137
|
+
* @returns A `boolean` indicating whether or not the `SubscriptionRequest` is valid.
|
|
4138
|
+
*/
|
|
4139
|
+
export declare function validateFhircastSubscriptionRequest(subscriptionRequest: SubscriptionRequest | PendingSubscriptionRequest): boolean;
|
|
4140
|
+
|
|
4141
|
+
export declare function validateResource(resource: Resource, profile?: StructureDefinition): void;
|
|
4142
|
+
|
|
4143
|
+
/**
|
|
4144
|
+
* Validates that the given string is a valid FHIR resource type.
|
|
4145
|
+
* On success, silently returns void.
|
|
4146
|
+
* On failure, throws an OperationOutcomeError.
|
|
4147
|
+
*
|
|
4148
|
+
* ```ts
|
|
4149
|
+
* validateResourceType('Patient'); // nothing
|
|
4150
|
+
* validateResourceType('XYZ'); // throws OperationOutcomeError
|
|
4151
|
+
* ```
|
|
4152
|
+
*
|
|
4153
|
+
* Note that this depends on globalSchema, which is populated by the StructureDefinition loader.
|
|
4154
|
+
*
|
|
4155
|
+
* In a server context, you can load all schema definitions:
|
|
4156
|
+
*
|
|
4157
|
+
* ```ts
|
|
4158
|
+
* import { indexStructureDefinitionBundle } from '@medplum/core';
|
|
4159
|
+
* import { readJson } from '@medplum/definitions';
|
|
4160
|
+
* import { Bundle } from '@medplum/fhirtypes';
|
|
4161
|
+
*
|
|
4162
|
+
* indexStructureDefinitionBundle(readJson('fhir/r4/profiles-resources.json') as Bundle);
|
|
4163
|
+
* ```
|
|
4164
|
+
*
|
|
4165
|
+
* In a client context, you can load the schema definitions using MedplumClient:
|
|
4166
|
+
*
|
|
4167
|
+
* ```ts
|
|
4168
|
+
* import { MedplumClient } from '@medplum/core';
|
|
4169
|
+
*
|
|
4170
|
+
* const medplum = new MedplumClient();
|
|
4171
|
+
* await medplum.requestSchema('Patient');
|
|
4172
|
+
* ```
|
|
4173
|
+
* @param resourceType The candidate resource type string.
|
|
4174
|
+
*/
|
|
4175
|
+
export declare function validateResourceType(resourceType: string): void;
|
|
4176
|
+
|
|
4177
|
+
export declare function validationError(details: string): OperationOutcome;
|
|
4178
|
+
|
|
4179
|
+
export declare type ValueOrExternalSecret<T extends ExternalSecretPrimitive> = T | ExternalSecret<T>;
|
|
4180
|
+
|
|
4181
|
+
export { }
|