@medplum/core 2.0.25 → 2.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +4 -4
- package/dist/cjs/index.cjs.map +4 -4
- package/dist/esm/index.mjs +4 -4
- package/dist/esm/index.mjs.map +4 -4
- package/dist/types/client.d.ts +53 -15
- package/dist/types/config.d.ts +1 -0
- package/dist/types/fhirpath/atoms.d.ts +30 -11
- package/dist/types/fhirpath/parse.d.ts +33 -33
- package/dist/types/fhirpath/utils.d.ts +1 -0
- package/dist/types/hl7.d.ts +76 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/jwt.d.ts +6 -0
- package/dist/types/schema.d.ts +1 -0
- package/dist/types/search/details.d.ts +3 -1
- package/dist/types/types.d.ts +2 -2
- package/dist/types/typeschema/validation.d.ts +1 -1
- package/dist/types/utils.d.ts +1 -0
- package/package.json +4 -1
- package/dist/types/eventtarget.d.ts +0 -13
package/dist/types/client.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { AccessPolicy, Binary, BulkDataExport, Bundle, Communication, ExtractResource, Identifier, Media, OperationOutcome, Project, ProjectMembership, ProjectSecret, Reference, Resource, ResourceType, UserConfiguration, ValueSet } from '@medplum/fhirtypes';
|
|
1
|
+
import { AccessPolicy, Binary, BulkDataExport, Bundle, Communication, ExtractResource, Identifier, Media, OperationOutcome, Project, ProjectMembership, ProjectMembershipAccess, ProjectSecret, Reference, Resource, ResourceType, UserConfiguration, ValueSet } from '@medplum/fhirtypes';
|
|
2
2
|
/** @ts-ignore */
|
|
3
3
|
import type { CustomTableLayout, TDocumentDefinitions, TFontDictionary } from 'pdfmake/interfaces';
|
|
4
|
-
import { EventTarget } from './eventtarget';
|
|
5
4
|
import { Hl7Message } from './hl7';
|
|
6
5
|
import { ReadablePromise } from './readablepromise';
|
|
7
6
|
import { ClientStorage } from './storage';
|
|
@@ -142,7 +141,7 @@ export interface MedplumClientOptions {
|
|
|
142
141
|
* fonts?: TFontDictionary
|
|
143
142
|
* ): Promise<Buffer> {
|
|
144
143
|
* return new Promise((resolve, reject) => {
|
|
145
|
-
* const printer = new PdfPrinter(fonts
|
|
144
|
+
* const printer = new PdfPrinter(fonts ?? {});
|
|
146
145
|
* const pdfDoc = printer.createPdfKitDocument(docDefinition, { tableLayouts });
|
|
147
146
|
* const chunks: Uint8Array[] = [];
|
|
148
147
|
* pdfDoc.on('data', (chunk: Uint8Array) => chunks.push(chunk));
|
|
@@ -177,6 +176,14 @@ export interface FetchLike {
|
|
|
177
176
|
* See: https://github.com/microsoft/TypeScript/issues/32951
|
|
178
177
|
*/
|
|
179
178
|
export type QueryTypes = URLSearchParams | string[][] | Record<string, any> | string | undefined;
|
|
179
|
+
/**
|
|
180
|
+
* ResourceArray is an array of resources with a bundle property.
|
|
181
|
+
* The bundle property is a FHIR Bundle containing the search results.
|
|
182
|
+
* This is useful for retrieving bundle metadata such as total, offset, and next link.
|
|
183
|
+
*/
|
|
184
|
+
export type ResourceArray<T extends Resource = Resource> = T[] & {
|
|
185
|
+
bundle: Bundle<T>;
|
|
186
|
+
};
|
|
180
187
|
export interface CreatePdfFunction {
|
|
181
188
|
(docDefinition: TDocumentDefinitions, tableLayouts?: Record<string, CustomTableLayout> | undefined, fonts?: TFontDictionary | undefined): Promise<any>;
|
|
182
189
|
}
|
|
@@ -207,6 +214,7 @@ export interface NewUserRequest {
|
|
|
207
214
|
readonly recaptchaSiteKey?: string;
|
|
208
215
|
readonly remember?: boolean;
|
|
209
216
|
readonly projectId?: string;
|
|
217
|
+
readonly clientId?: string;
|
|
210
218
|
}
|
|
211
219
|
export interface NewProjectRequest {
|
|
212
220
|
readonly login: string;
|
|
@@ -259,13 +267,20 @@ export interface BotEvent<T = Resource | Hl7Message | string | Record<string, an
|
|
|
259
267
|
readonly input: T;
|
|
260
268
|
readonly secrets: Record<string, ProjectSecret>;
|
|
261
269
|
}
|
|
262
|
-
export interface
|
|
270
|
+
export interface InviteRequest {
|
|
263
271
|
resourceType: 'Patient' | 'Practitioner' | 'RelatedPerson';
|
|
264
272
|
firstName: string;
|
|
265
273
|
lastName: string;
|
|
266
274
|
email?: string;
|
|
275
|
+
externalId?: string;
|
|
276
|
+
password?: string;
|
|
267
277
|
sendEmail?: boolean;
|
|
278
|
+
membership?: Partial<ProjectMembership>;
|
|
279
|
+
/** @deprecated Use membership.accessPolicy instead. */
|
|
268
280
|
accessPolicy?: Reference<AccessPolicy>;
|
|
281
|
+
/** @deprecated Use membership.access instead. */
|
|
282
|
+
access?: ProjectMembershipAccess[];
|
|
283
|
+
/** @deprecated Use membership.admin instead. */
|
|
269
284
|
admin?: boolean;
|
|
270
285
|
}
|
|
271
286
|
/**
|
|
@@ -285,6 +300,10 @@ export interface MailAddress {
|
|
|
285
300
|
readonly name: string;
|
|
286
301
|
readonly address: string;
|
|
287
302
|
}
|
|
303
|
+
/**
|
|
304
|
+
* Email destination definition.
|
|
305
|
+
*/
|
|
306
|
+
export type MailDestination = string | MailAddress | string[] | MailAddress[];
|
|
288
307
|
/**
|
|
289
308
|
* Email attachment definition.
|
|
290
309
|
* Compatible with nodemailer Mail.Options.
|
|
@@ -309,11 +328,11 @@ export interface MailOptions {
|
|
|
309
328
|
/** An e-mail address that will appear on the Sender: field */
|
|
310
329
|
readonly sender?: string | MailAddress;
|
|
311
330
|
/** Comma separated list or an array of recipients e-mail addresses that will appear on the To: field */
|
|
312
|
-
readonly to?:
|
|
331
|
+
readonly to?: MailDestination;
|
|
313
332
|
/** Comma separated list or an array of recipients e-mail addresses that will appear on the Cc: field */
|
|
314
|
-
readonly cc?:
|
|
333
|
+
readonly cc?: MailDestination;
|
|
315
334
|
/** Comma separated list or an array of recipients e-mail addresses that will appear on the Bcc: field */
|
|
316
|
-
readonly bcc?:
|
|
335
|
+
readonly bcc?: MailDestination;
|
|
317
336
|
/** An e-mail address that will appear on the Reply-To: field */
|
|
318
337
|
readonly replyTo?: string | MailAddress;
|
|
319
338
|
/** The subject of the e-mail */
|
|
@@ -327,13 +346,15 @@ export interface MailOptions {
|
|
|
327
346
|
}
|
|
328
347
|
/**
|
|
329
348
|
* OAuth 2.0 Grant Type Identifiers
|
|
330
|
-
* Standard identifiers
|
|
331
|
-
*
|
|
349
|
+
* Standard identifiers: https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-07#name-grant-types
|
|
350
|
+
* JWT bearer extension: https://datatracker.ietf.org/doc/html/rfc7523
|
|
351
|
+
* Token exchange extension: https://datatracker.ietf.org/doc/html/rfc8693
|
|
332
352
|
*/
|
|
333
353
|
export declare enum OAuthGrantType {
|
|
334
354
|
ClientCredentials = "client_credentials",
|
|
335
355
|
AuthorizationCode = "authorization_code",
|
|
336
356
|
RefreshToken = "refresh_token",
|
|
357
|
+
JwtBearer = "urn:ietf:params:oauth:grant-type:jwt-bearer",
|
|
337
358
|
TokenExchange = "urn:ietf:params:oauth:grant-type:token-exchange"
|
|
338
359
|
}
|
|
339
360
|
/**
|
|
@@ -417,6 +438,7 @@ export declare class MedplumClient extends EventTarget {
|
|
|
417
438
|
private readonly onUnauthenticated?;
|
|
418
439
|
private readonly autoBatchTime;
|
|
419
440
|
private readonly autoBatchQueue;
|
|
441
|
+
private medplumServer?;
|
|
420
442
|
private clientId?;
|
|
421
443
|
private clientSecret?;
|
|
422
444
|
private autoBatchTimerId?;
|
|
@@ -750,7 +772,7 @@ export declare class MedplumClient extends EventTarget {
|
|
|
750
772
|
* @param options Optional fetch options.
|
|
751
773
|
* @returns Promise to the array of search results.
|
|
752
774
|
*/
|
|
753
|
-
searchResources<K extends ResourceType>(resourceType: K, query?: QueryTypes, options?: RequestInit): ReadablePromise<ExtractResource<K
|
|
775
|
+
searchResources<K extends ResourceType>(resourceType: K, query?: QueryTypes, options?: RequestInit): ReadablePromise<ResourceArray<ExtractResource<K>>>;
|
|
754
776
|
/**
|
|
755
777
|
* Creates an
|
|
756
778
|
* [async generator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncGenerator)
|
|
@@ -771,7 +793,7 @@ export declare class MedplumClient extends EventTarget {
|
|
|
771
793
|
* @param options Optional fetch options.
|
|
772
794
|
* @yields An async generator, where each result is an array of resources for each page.
|
|
773
795
|
*/
|
|
774
|
-
searchResourcePages<K extends ResourceType>(resourceType: K, query?: QueryTypes, options?: RequestInit): AsyncGenerator<ExtractResource<K
|
|
796
|
+
searchResourcePages<K extends ResourceType>(resourceType: K, query?: QueryTypes, options?: RequestInit): AsyncGenerator<ResourceArray<ExtractResource<K>>>;
|
|
775
797
|
/**
|
|
776
798
|
* Searches a ValueSet resource using the "expand" operation.
|
|
777
799
|
* See: https://www.hl7.org/fhir/operation-valueset-expand.html
|
|
@@ -1299,9 +1321,10 @@ export declare class MedplumClient extends EventTarget {
|
|
|
1299
1321
|
/**
|
|
1300
1322
|
* Sets the current access token.
|
|
1301
1323
|
* @param accessToken The new access token.
|
|
1324
|
+
* @param refreshToken Optional refresh token.
|
|
1302
1325
|
* @category Authentication
|
|
1303
1326
|
*/
|
|
1304
|
-
setAccessToken(accessToken: string): void;
|
|
1327
|
+
setAccessToken(accessToken: string, refreshToken?: string): void;
|
|
1305
1328
|
/**
|
|
1306
1329
|
* Returns the list of available logins.
|
|
1307
1330
|
* @returns The list of available logins.
|
|
@@ -1509,7 +1532,6 @@ export declare class MedplumClient extends EventTarget {
|
|
|
1509
1532
|
* await medplum.searchResources('Patient')
|
|
1510
1533
|
* ```
|
|
1511
1534
|
*
|
|
1512
|
-
*
|
|
1513
1535
|
* See: https://datatracker.ietf.org/doc/html/rfc6749#section-4.4
|
|
1514
1536
|
* @category Authentication
|
|
1515
1537
|
* @param clientId The client ID.
|
|
@@ -1517,6 +1539,22 @@ export declare class MedplumClient extends EventTarget {
|
|
|
1517
1539
|
* @returns Promise that resolves to the client profile.
|
|
1518
1540
|
*/
|
|
1519
1541
|
startClientLogin(clientId: string, clientSecret: string): Promise<ProfileResource>;
|
|
1542
|
+
/**
|
|
1543
|
+
* Starts a new OAuth2 JWT bearer flow.
|
|
1544
|
+
*
|
|
1545
|
+
* ```typescript
|
|
1546
|
+
* await medplum.startJwtBearerLogin(process.env.MEDPLUM_CLIENT_ID, process.env.MEDPLUM_JWT_BEARER_ASSERTION, 'openid profile');
|
|
1547
|
+
* // Example Search
|
|
1548
|
+
* await medplum.searchResources('Patient')
|
|
1549
|
+
* ```
|
|
1550
|
+
*
|
|
1551
|
+
* See: https://datatracker.ietf.org/doc/html/rfc7523#section-2.1
|
|
1552
|
+
* @param clientId The client ID.
|
|
1553
|
+
* @param assertion The JWT assertion.
|
|
1554
|
+
* @param scope The OAuth scope.
|
|
1555
|
+
* @returns Promise that resolves to the client profile.
|
|
1556
|
+
*/
|
|
1557
|
+
startJwtBearerLogin(clientId: string, assertion: string, scope: string): Promise<ProfileResource>;
|
|
1520
1558
|
/**
|
|
1521
1559
|
* Sets the client ID and secret for basic auth.
|
|
1522
1560
|
*
|
|
@@ -1533,10 +1571,10 @@ export declare class MedplumClient extends EventTarget {
|
|
|
1533
1571
|
/**
|
|
1534
1572
|
* Invite a user to a project.
|
|
1535
1573
|
* @param projectId The project ID.
|
|
1536
|
-
* @param body The
|
|
1574
|
+
* @param body The InviteRequest.
|
|
1537
1575
|
* @returns Promise that returns a project membership or an operation outcome.
|
|
1538
1576
|
*/
|
|
1539
|
-
invite(projectId: string, body:
|
|
1577
|
+
invite(projectId: string, body: InviteRequest): Promise<ProjectMembership | OperationOutcome>;
|
|
1540
1578
|
/**
|
|
1541
1579
|
* Makes a POST request to the tokens endpoint.
|
|
1542
1580
|
* See: https://openid.net/specs/openid-connect-core-1_0.html#TokenEndpoint
|
package/dist/types/config.d.ts
CHANGED
|
@@ -34,7 +34,10 @@ export declare class AsAtom extends InfixOperatorAtom {
|
|
|
34
34
|
constructor(left: Atom, right: Atom);
|
|
35
35
|
eval(context: AtomContext, input: TypedValue[]): TypedValue[];
|
|
36
36
|
}
|
|
37
|
-
export declare class
|
|
37
|
+
export declare abstract class BooleanInfixOperatorAtom extends InfixOperatorAtom {
|
|
38
|
+
abstract eval(context: AtomContext, input: TypedValue[]): TypedValue[];
|
|
39
|
+
}
|
|
40
|
+
export declare class ArithemticOperatorAtom extends BooleanInfixOperatorAtom {
|
|
38
41
|
readonly impl: (x: number, y: number) => number | boolean;
|
|
39
42
|
constructor(operator: string, left: Atom, right: Atom, impl: (x: number, y: number) => number | boolean);
|
|
40
43
|
eval(context: AtomContext, input: TypedValue[]): TypedValue[];
|
|
@@ -43,11 +46,11 @@ export declare class ConcatAtom extends InfixOperatorAtom {
|
|
|
43
46
|
constructor(left: Atom, right: Atom);
|
|
44
47
|
eval(context: AtomContext, input: TypedValue[]): TypedValue[];
|
|
45
48
|
}
|
|
46
|
-
export declare class ContainsAtom extends
|
|
49
|
+
export declare class ContainsAtom extends BooleanInfixOperatorAtom {
|
|
47
50
|
constructor(left: Atom, right: Atom);
|
|
48
51
|
eval(context: AtomContext, input: TypedValue[]): TypedValue[];
|
|
49
52
|
}
|
|
50
|
-
export declare class InAtom extends
|
|
53
|
+
export declare class InAtom extends BooleanInfixOperatorAtom {
|
|
51
54
|
constructor(left: Atom, right: Atom);
|
|
52
55
|
eval(context: AtomContext, input: TypedValue[]): TypedValue[];
|
|
53
56
|
}
|
|
@@ -60,23 +63,23 @@ export declare class UnionAtom extends InfixOperatorAtom {
|
|
|
60
63
|
constructor(left: Atom, right: Atom);
|
|
61
64
|
eval(context: AtomContext, input: TypedValue[]): TypedValue[];
|
|
62
65
|
}
|
|
63
|
-
export declare class EqualsAtom extends
|
|
66
|
+
export declare class EqualsAtom extends BooleanInfixOperatorAtom {
|
|
64
67
|
constructor(left: Atom, right: Atom);
|
|
65
68
|
eval(context: AtomContext, input: TypedValue[]): TypedValue[];
|
|
66
69
|
}
|
|
67
|
-
export declare class NotEqualsAtom extends
|
|
70
|
+
export declare class NotEqualsAtom extends BooleanInfixOperatorAtom {
|
|
68
71
|
constructor(left: Atom, right: Atom);
|
|
69
72
|
eval(context: AtomContext, input: TypedValue[]): TypedValue[];
|
|
70
73
|
}
|
|
71
|
-
export declare class EquivalentAtom extends
|
|
74
|
+
export declare class EquivalentAtom extends BooleanInfixOperatorAtom {
|
|
72
75
|
constructor(left: Atom, right: Atom);
|
|
73
76
|
eval(context: AtomContext, input: TypedValue[]): TypedValue[];
|
|
74
77
|
}
|
|
75
|
-
export declare class NotEquivalentAtom extends
|
|
78
|
+
export declare class NotEquivalentAtom extends BooleanInfixOperatorAtom {
|
|
76
79
|
constructor(left: Atom, right: Atom);
|
|
77
80
|
eval(context: AtomContext, input: TypedValue[]): TypedValue[];
|
|
78
81
|
}
|
|
79
|
-
export declare class IsAtom extends
|
|
82
|
+
export declare class IsAtom extends BooleanInfixOperatorAtom {
|
|
80
83
|
constructor(left: Atom, right: Atom);
|
|
81
84
|
eval(context: AtomContext, input: TypedValue[]): TypedValue[];
|
|
82
85
|
}
|
|
@@ -86,11 +89,17 @@ export declare class IsAtom extends InfixOperatorAtom {
|
|
|
86
89
|
* false if either operand evaluates to false,
|
|
87
90
|
* and the empty collection otherwise.
|
|
88
91
|
*/
|
|
89
|
-
export declare class AndAtom extends
|
|
92
|
+
export declare class AndAtom extends BooleanInfixOperatorAtom {
|
|
90
93
|
constructor(left: Atom, right: Atom);
|
|
91
94
|
eval(context: AtomContext, input: TypedValue[]): TypedValue[];
|
|
92
95
|
}
|
|
93
|
-
|
|
96
|
+
/**
|
|
97
|
+
* 6.5.2. or
|
|
98
|
+
* Returns false if both operands evaluate to false,
|
|
99
|
+
* true if either operand evaluates to true,
|
|
100
|
+
* and empty ({ }) otherwise:
|
|
101
|
+
*/
|
|
102
|
+
export declare class OrAtom extends BooleanInfixOperatorAtom {
|
|
94
103
|
constructor(left: Atom, right: Atom);
|
|
95
104
|
eval(context: AtomContext, input: TypedValue[]): TypedValue[];
|
|
96
105
|
}
|
|
@@ -100,7 +109,17 @@ export declare class OrAtom extends InfixOperatorAtom {
|
|
|
100
109
|
* false if either both operands evaluate to true or both operands evaluate to false,
|
|
101
110
|
* and the empty collection otherwise.
|
|
102
111
|
*/
|
|
103
|
-
export declare class XorAtom extends
|
|
112
|
+
export declare class XorAtom extends BooleanInfixOperatorAtom {
|
|
113
|
+
constructor(left: Atom, right: Atom);
|
|
114
|
+
eval(context: AtomContext, input: TypedValue[]): TypedValue[];
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* 6.5.5. implies
|
|
118
|
+
* Returns true if left is true and right is true,
|
|
119
|
+
* true left is false and right true, false or empty
|
|
120
|
+
* true left is empty
|
|
121
|
+
*/
|
|
122
|
+
export declare class ImpliesAtom extends BooleanInfixOperatorAtom {
|
|
104
123
|
constructor(left: Atom, right: Atom);
|
|
105
124
|
eval(context: AtomContext, input: TypedValue[]): TypedValue[];
|
|
106
125
|
}
|
|
@@ -5,39 +5,39 @@ import { FhirPathAtom } from './atoms';
|
|
|
5
5
|
* Operator precedence
|
|
6
6
|
* See: https://hl7.org/fhirpath/#operator-precedence
|
|
7
7
|
*/
|
|
8
|
-
export declare const
|
|
9
|
-
FunctionCall
|
|
10
|
-
Dot
|
|
11
|
-
Indexer
|
|
12
|
-
UnaryAdd
|
|
13
|
-
UnarySubtract
|
|
14
|
-
Multiply
|
|
15
|
-
Divide
|
|
16
|
-
IntegerDivide
|
|
17
|
-
Modulo
|
|
18
|
-
Add
|
|
19
|
-
Subtract
|
|
20
|
-
Ampersand
|
|
21
|
-
Is
|
|
22
|
-
As
|
|
23
|
-
Union
|
|
24
|
-
GreaterThan
|
|
25
|
-
GreaterThanOrEquals
|
|
26
|
-
LessThan
|
|
27
|
-
LessThanOrEquals
|
|
28
|
-
Equals
|
|
29
|
-
Equivalent
|
|
30
|
-
NotEquals
|
|
31
|
-
NotEquivalent
|
|
32
|
-
In
|
|
33
|
-
Contains
|
|
34
|
-
And
|
|
35
|
-
Xor
|
|
36
|
-
Or
|
|
37
|
-
Implies
|
|
38
|
-
Arrow
|
|
39
|
-
Semicolon
|
|
40
|
-
}
|
|
8
|
+
export declare const OperatorPrecedence: {
|
|
9
|
+
FunctionCall: number;
|
|
10
|
+
Dot: number;
|
|
11
|
+
Indexer: number;
|
|
12
|
+
UnaryAdd: number;
|
|
13
|
+
UnarySubtract: number;
|
|
14
|
+
Multiply: number;
|
|
15
|
+
Divide: number;
|
|
16
|
+
IntegerDivide: number;
|
|
17
|
+
Modulo: number;
|
|
18
|
+
Add: number;
|
|
19
|
+
Subtract: number;
|
|
20
|
+
Ampersand: number;
|
|
21
|
+
Is: number;
|
|
22
|
+
As: number;
|
|
23
|
+
Union: number;
|
|
24
|
+
GreaterThan: number;
|
|
25
|
+
GreaterThanOrEquals: number;
|
|
26
|
+
LessThan: number;
|
|
27
|
+
LessThanOrEquals: number;
|
|
28
|
+
Equals: number;
|
|
29
|
+
Equivalent: number;
|
|
30
|
+
NotEquals: number;
|
|
31
|
+
NotEquivalent: number;
|
|
32
|
+
In: number;
|
|
33
|
+
Contains: number;
|
|
34
|
+
And: number;
|
|
35
|
+
Xor: number;
|
|
36
|
+
Or: number;
|
|
37
|
+
Implies: number;
|
|
38
|
+
Arrow: number;
|
|
39
|
+
Semicolon: number;
|
|
40
|
+
};
|
|
41
41
|
export declare function initFhirPathParserBuilder(): ParserBuilder;
|
|
42
42
|
/**
|
|
43
43
|
* Parses a FHIRPath expression into an AST.
|
|
@@ -20,6 +20,7 @@ export declare function toTypedValue(value: unknown): TypedValue;
|
|
|
20
20
|
* @returns The converted boolean value according to FHIRPath rules.
|
|
21
21
|
*/
|
|
22
22
|
export declare function toJsBoolean(obj: TypedValue[]): boolean;
|
|
23
|
+
export declare function singleton(collection: TypedValue[], type?: string): TypedValue | undefined;
|
|
23
24
|
/**
|
|
24
25
|
* Returns the value of the property and the property type.
|
|
25
26
|
* Some property definitions support multiple types.
|
package/dist/types/hl7.d.ts
CHANGED
|
@@ -37,18 +37,42 @@ export declare class Hl7Message {
|
|
|
37
37
|
* @param context Optional HL7 parsing context.
|
|
38
38
|
*/
|
|
39
39
|
constructor(segments: Hl7Segment[], context?: Hl7Context);
|
|
40
|
+
/**
|
|
41
|
+
* Returns the HL7 message header.
|
|
42
|
+
* @returns The HL7 message header.
|
|
43
|
+
*/
|
|
44
|
+
get header(): Hl7Segment;
|
|
40
45
|
/**
|
|
41
46
|
* Returns an HL7 segment by index or by name.
|
|
42
47
|
* @param index The HL7 segment index or name.
|
|
43
48
|
* @returns The HL7 segment if found; otherwise, undefined.
|
|
49
|
+
* @deprecated Use getSegment() instead. This method will be removed in a future release.
|
|
44
50
|
*/
|
|
45
51
|
get(index: number | string): Hl7Segment | undefined;
|
|
46
52
|
/**
|
|
47
53
|
* Returns all HL7 segments of a given name.
|
|
48
54
|
* @param name The HL7 segment name.
|
|
49
55
|
* @returns An array of HL7 segments with the specified name.
|
|
56
|
+
* @deprecated Use getAllSegments() instead. This method will be removed in a future release.
|
|
50
57
|
*/
|
|
51
58
|
getAll(name: string): Hl7Segment[];
|
|
59
|
+
/**
|
|
60
|
+
* Returns an HL7 segment by index or by name.
|
|
61
|
+
*
|
|
62
|
+
* When using a numeric index, the first segment (usually the MSH header segment) is at index 0.
|
|
63
|
+
*
|
|
64
|
+
* When using a string index, this method returns the first segment with the specified name.
|
|
65
|
+
*
|
|
66
|
+
* @param index The HL7 segment index or name.
|
|
67
|
+
* @returns The HL7 segment if found; otherwise, undefined.
|
|
68
|
+
*/
|
|
69
|
+
getSegment(index: number | string): Hl7Segment | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Returns all HL7 segments of a given name.
|
|
72
|
+
* @param name The HL7 segment name.
|
|
73
|
+
* @returns An array of HL7 segments with the specified name.
|
|
74
|
+
*/
|
|
75
|
+
getAllSegments(name: string): Hl7Segment[];
|
|
52
76
|
/**
|
|
53
77
|
* Returns the HL7 message as a string.
|
|
54
78
|
* @returns The HL7 message as a string.
|
|
@@ -59,6 +83,7 @@ export declare class Hl7Message {
|
|
|
59
83
|
* @returns The HL7 "ACK" message.
|
|
60
84
|
*/
|
|
61
85
|
buildAck(): Hl7Message;
|
|
86
|
+
private buildAckMessageType;
|
|
62
87
|
/**
|
|
63
88
|
* Parses an HL7 message string into an Hl7Message object.
|
|
64
89
|
* @param text The HL7 message text.
|
|
@@ -77,7 +102,7 @@ export declare class Hl7Segment {
|
|
|
77
102
|
readonly fields: Hl7Field[];
|
|
78
103
|
/**
|
|
79
104
|
* Creates a new HL7 segment.
|
|
80
|
-
* @param fields The HL7 fields.
|
|
105
|
+
* @param fields The HL7 fields. The first field is the segment name.
|
|
81
106
|
* @param context Optional HL7 parsing context.
|
|
82
107
|
*/
|
|
83
108
|
constructor(fields: Hl7Field[] | string[], context?: Hl7Context);
|
|
@@ -85,8 +110,42 @@ export declare class Hl7Segment {
|
|
|
85
110
|
* Returns an HL7 field by index.
|
|
86
111
|
* @param index The HL7 field index.
|
|
87
112
|
* @returns The HL7 field.
|
|
113
|
+
* @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.
|
|
88
114
|
*/
|
|
89
115
|
get(index: number): Hl7Field;
|
|
116
|
+
/**
|
|
117
|
+
* Returns an HL7 field by index.
|
|
118
|
+
*
|
|
119
|
+
* Note that the index is 1-based, not 0-based.
|
|
120
|
+
*
|
|
121
|
+
* For example, to get the first field, use `getField(1)`.
|
|
122
|
+
*
|
|
123
|
+
* This aligns with HL7 field names such as PID.1, PID.2, etc.
|
|
124
|
+
*
|
|
125
|
+
* Field zero is the segment name.
|
|
126
|
+
*
|
|
127
|
+
* @param index The HL7 field index.
|
|
128
|
+
* @returns The HL7 field.
|
|
129
|
+
*/
|
|
130
|
+
getField(index: number): Hl7Field;
|
|
131
|
+
/**
|
|
132
|
+
* Returns an HL7 component by field index and component index.
|
|
133
|
+
*
|
|
134
|
+
* This is a shortcut for `getField(field).getComponent(component)`.
|
|
135
|
+
*
|
|
136
|
+
* Note that both indexex are 1-based, not 0-based.
|
|
137
|
+
*
|
|
138
|
+
* For example, to get the first component, use `getComponent(1, 1)`.
|
|
139
|
+
*
|
|
140
|
+
* This aligns with HL7 component names such as MSH.9.2.
|
|
141
|
+
*
|
|
142
|
+
* @param fieldIndex The HL7 field index.
|
|
143
|
+
* @param component The component index.
|
|
144
|
+
* @param subcomponent Optional subcomponent index.
|
|
145
|
+
* @param repetition Optional repetition index.
|
|
146
|
+
* @returns The string value of the specified component.
|
|
147
|
+
*/
|
|
148
|
+
getComponent(fieldIndex: number, component: number, subcomponent?: number, repetition?: number): string;
|
|
90
149
|
/**
|
|
91
150
|
* Returns the HL7 segment as a string.
|
|
92
151
|
* @returns The HL7 segment as a string.
|
|
@@ -119,8 +178,24 @@ export declare class Hl7Field {
|
|
|
119
178
|
* @param subcomponent Optional subcomponent index.
|
|
120
179
|
* @param repetition Optional repetition index.
|
|
121
180
|
* @returns The string value of the specified component.
|
|
181
|
+
* @deprecated Use getComponent() instead. This method will be removed in a future release.
|
|
122
182
|
*/
|
|
123
183
|
get(component: number, subcomponent?: number, repetition?: number): string;
|
|
184
|
+
/**
|
|
185
|
+
* Returns an HL7 component by index.
|
|
186
|
+
*
|
|
187
|
+
* Note that the index is 1-based, not 0-based.
|
|
188
|
+
*
|
|
189
|
+
* For example, to get the first component, use `getComponent(1)`.
|
|
190
|
+
*
|
|
191
|
+
* This aligns with HL7 component names such as MSH.9.2.
|
|
192
|
+
*
|
|
193
|
+
* @param component The component index.
|
|
194
|
+
* @param subcomponent Optional subcomponent index.
|
|
195
|
+
* @param repetition Optional repetition index.
|
|
196
|
+
* @returns The string value of the specified component.
|
|
197
|
+
*/
|
|
198
|
+
getComponent(component: number, subcomponent?: number, repetition?: number): string;
|
|
124
199
|
/**
|
|
125
200
|
* Returns the HL7 field as a string.
|
|
126
201
|
* @returns The HL7 field as a string.
|
package/dist/types/index.d.ts
CHANGED
|
@@ -22,4 +22,4 @@ export * from './storage';
|
|
|
22
22
|
export * from './types';
|
|
23
23
|
export * from './utils';
|
|
24
24
|
export { loadDataTypes } from './typeschema/types';
|
|
25
|
-
export {
|
|
25
|
+
export { validate } from './typeschema/validation';
|
package/dist/types/jwt.d.ts
CHANGED
|
@@ -4,3 +4,9 @@
|
|
|
4
4
|
* @returns Collection of key value claims in the JWT payload.
|
|
5
5
|
*/
|
|
6
6
|
export declare function parseJWTPayload(token: string): Record<string, number | string>;
|
|
7
|
+
/**
|
|
8
|
+
* Returns true if the access token was issued by a Medplum server.
|
|
9
|
+
* @param accessToken An access token of unknown origin.
|
|
10
|
+
* @returns True if the access token was issued by a Medplum server.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isMedplumAccessToken(accessToken: string): boolean;
|
package/dist/types/schema.d.ts
CHANGED
|
@@ -95,6 +95,7 @@ export declare function validateResourceType(resourceType: string): void;
|
|
|
95
95
|
* await medplum.requestSchema('Patient');
|
|
96
96
|
* ```
|
|
97
97
|
* @param resource The candidate resource.
|
|
98
|
+
* @deprecated use validate() instead
|
|
98
99
|
*/
|
|
99
100
|
export declare function validateResource<T extends Resource>(resource: T): void;
|
|
100
101
|
export declare class FhirSchemaValidator<T extends Resource> {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ElementDefinition, SearchParameter } from '@medplum/fhirtypes';
|
|
2
|
+
import { Atom } from '../fhirlexer';
|
|
2
3
|
export declare enum SearchParameterType {
|
|
3
4
|
BOOLEAN = "BOOLEAN",
|
|
4
5
|
NUMBER = "NUMBER",
|
|
@@ -14,7 +15,7 @@ export declare enum SearchParameterType {
|
|
|
14
15
|
export interface SearchParameterDetails {
|
|
15
16
|
readonly columnName: string;
|
|
16
17
|
readonly type: SearchParameterType;
|
|
17
|
-
readonly
|
|
18
|
+
readonly elementDefinitions?: ElementDefinition[];
|
|
18
19
|
readonly array?: boolean;
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
@@ -31,4 +32,5 @@ export interface SearchParameterDetails {
|
|
|
31
32
|
* @returns The search parameter type details.
|
|
32
33
|
*/
|
|
33
34
|
export declare function getSearchParameterDetails(resourceType: string, searchParam: SearchParameter): SearchParameterDetails;
|
|
35
|
+
export declare function getExpressionsForResourceType(resourceType: string, expression: string): Atom[];
|
|
34
36
|
export declare function getExpressionForResourceType(resourceType: string, expression: string): string | undefined;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -199,13 +199,13 @@ export declare function getElementDefinition(typeName: string, propertyName: str
|
|
|
199
199
|
* @param value The object to check
|
|
200
200
|
* @returns True if the input is of type 'object' and contains property 'resourceType'
|
|
201
201
|
*/
|
|
202
|
-
export declare function isResource
|
|
202
|
+
export declare function isResource(value: unknown): value is Resource;
|
|
203
203
|
/**
|
|
204
204
|
* Typeguard to validate that an object is a FHIR resource
|
|
205
205
|
* @param value The object to check
|
|
206
206
|
* @returns True if the input is of type 'object' and contains property 'reference'
|
|
207
207
|
*/
|
|
208
|
-
export declare function isReference
|
|
208
|
+
export declare function isReference(value: unknown): value is Reference & {
|
|
209
209
|
reference: string;
|
|
210
210
|
};
|
|
211
211
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Resource, StructureDefinition } from '@medplum/fhirtypes';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function validate(resource: Resource, profile?: StructureDefinition): void;
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -280,6 +280,7 @@ export declare function preciseGreaterThanOrEquals(a: number, b: number, precisi
|
|
|
280
280
|
* @returns The first resource in the input array that matches the specified code and system, or undefined if no such resource is found.
|
|
281
281
|
*/
|
|
282
282
|
export declare function findResourceByCode(resources: ResourceWithCode[], code: CodeableConcept | string, system: string): ResourceWithCode | undefined;
|
|
283
|
+
export declare function arrayify<T>(value: T | T[] | undefined): T[] | undefined;
|
|
283
284
|
/**
|
|
284
285
|
* Sleeps for the specified number of milliseconds.
|
|
285
286
|
* @param ms Time delay in milliseconds
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medplum/core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.27",
|
|
4
4
|
"description": "Medplum TS/JS Library",
|
|
5
5
|
"author": "Medplum <hello@medplum.com>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
"url": "https://github.com/medplum/medplum.git",
|
|
11
11
|
"directory": "packages/core"
|
|
12
12
|
},
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=18.0.0"
|
|
15
|
+
},
|
|
13
16
|
"scripts": {
|
|
14
17
|
"clean": "rimraf dist",
|
|
15
18
|
"build": "npm run clean && tsc --project tsconfig.build.json && node esbuild.mjs",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
interface Event {
|
|
2
|
-
readonly type: string;
|
|
3
|
-
readonly defaultPrevented?: boolean;
|
|
4
|
-
}
|
|
5
|
-
type EventListener = (e: Event) => void;
|
|
6
|
-
export declare class EventTarget {
|
|
7
|
-
private readonly listeners;
|
|
8
|
-
constructor();
|
|
9
|
-
addEventListener(type: string, callback: EventListener): void;
|
|
10
|
-
removeEventListeneer(type: string, callback: EventListener): void;
|
|
11
|
-
dispatchEvent(event: Event): boolean;
|
|
12
|
-
}
|
|
13
|
-
export {};
|