@medplum/core 1.0.0 → 1.0.2
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/client.d.ts +27 -15
- package/dist/cjs/eventtarget.d.ts +1 -1
- package/dist/cjs/format.d.ts +14 -1
- package/dist/cjs/hl7.d.ts +106 -13
- package/dist/cjs/index.js +263 -34
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.min.js +1 -1
- package/dist/cjs/index.min.js.map +1 -1
- package/dist/cjs/search.d.ts +1 -0
- package/dist/cjs/utils.d.ts +8 -1
- package/dist/esm/client.d.ts +27 -15
- package/dist/esm/client.js +20 -7
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/eventtarget.d.ts +1 -1
- package/dist/esm/format.d.ts +14 -1
- package/dist/esm/format.js +97 -1
- package/dist/esm/format.js.map +1 -1
- package/dist/esm/hl7.d.ts +106 -13
- package/dist/esm/hl7.js +135 -25
- package/dist/esm/hl7.js.map +1 -1
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.min.js +1 -1
- package/dist/esm/index.min.js.map +1 -1
- package/dist/esm/node_modules/tslib/tslib.es6.js.map +1 -1
- package/dist/esm/search.d.ts +1 -0
- package/dist/esm/search.js.map +1 -1
- package/dist/esm/utils.d.ts +8 -1
- package/dist/esm/utils.js +10 -1
- package/dist/esm/utils.js.map +1 -1
- package/package.json +3 -3
- package/rollup.config.mjs +1 -1
- package/stats.html +0 -4034
package/dist/cjs/client.d.ts
CHANGED
|
@@ -136,10 +136,7 @@ export interface CreatePdfFunction {
|
|
|
136
136
|
[name: string]: CustomTableLayout;
|
|
137
137
|
} | undefined, fonts?: TFontDictionary | undefined): Promise<any>;
|
|
138
138
|
}
|
|
139
|
-
export interface
|
|
140
|
-
readonly email: string;
|
|
141
|
-
readonly password: string;
|
|
142
|
-
readonly remember?: boolean;
|
|
139
|
+
export interface BaseLoginRequest {
|
|
143
140
|
readonly projectId?: string;
|
|
144
141
|
readonly clientId?: string;
|
|
145
142
|
readonly resourceType?: string;
|
|
@@ -147,6 +144,13 @@ export interface LoginRequest {
|
|
|
147
144
|
readonly nonce?: string;
|
|
148
145
|
readonly codeChallenge?: string;
|
|
149
146
|
readonly codeChallengeMethod?: string;
|
|
147
|
+
readonly googleClientId?: string;
|
|
148
|
+
readonly launch?: string;
|
|
149
|
+
}
|
|
150
|
+
export interface EmailPasswordLoginRequest extends BaseLoginRequest {
|
|
151
|
+
readonly email: string;
|
|
152
|
+
readonly password: string;
|
|
153
|
+
readonly remember?: boolean;
|
|
150
154
|
}
|
|
151
155
|
export interface NewUserRequest {
|
|
152
156
|
readonly firstName: string;
|
|
@@ -170,16 +174,9 @@ export interface GoogleCredentialResponse {
|
|
|
170
174
|
readonly clientId: string;
|
|
171
175
|
readonly credential: string;
|
|
172
176
|
}
|
|
173
|
-
export interface GoogleLoginRequest {
|
|
177
|
+
export interface GoogleLoginRequest extends BaseLoginRequest {
|
|
174
178
|
readonly googleClientId: string;
|
|
175
179
|
readonly googleCredential: string;
|
|
176
|
-
readonly projectId?: string;
|
|
177
|
-
readonly clientId?: string;
|
|
178
|
-
readonly resourceType?: string;
|
|
179
|
-
readonly scope?: string;
|
|
180
|
-
readonly nonce?: string;
|
|
181
|
-
readonly codeChallenge?: string;
|
|
182
|
-
readonly codeChallengeMethod?: string;
|
|
183
180
|
readonly createUser?: boolean;
|
|
184
181
|
}
|
|
185
182
|
export interface LoginAuthenticationResponse {
|
|
@@ -210,7 +207,7 @@ export interface TokenResponse {
|
|
|
210
207
|
readonly project: Reference<Project>;
|
|
211
208
|
readonly profile: Reference<ProfileResource>;
|
|
212
209
|
}
|
|
213
|
-
export interface BotEvent<T = Resource | Hl7Message | string
|
|
210
|
+
export interface BotEvent<T = Resource | Hl7Message | string | Record<string, any>> {
|
|
214
211
|
readonly contentType: string;
|
|
215
212
|
readonly input: T;
|
|
216
213
|
readonly secrets: Record<string, ProjectSecret>;
|
|
@@ -318,6 +315,11 @@ export interface MailOptions {
|
|
|
318
315
|
* const bundle = await medplum.search('Patient', 'name=Alice');
|
|
319
316
|
* console.log(bundle.total);
|
|
320
317
|
* ```
|
|
318
|
+
*
|
|
319
|
+
* <head>
|
|
320
|
+
* <meta name="algolia:pageRank" content="100" />
|
|
321
|
+
* </head>
|
|
322
|
+
|
|
321
323
|
*/
|
|
322
324
|
export declare class MedplumClient extends EventTarget {
|
|
323
325
|
#private;
|
|
@@ -454,7 +456,7 @@ export declare class MedplumClient extends EventTarget {
|
|
|
454
456
|
* @param loginRequest Login request including email and password.
|
|
455
457
|
* @returns Promise to the authentication response.
|
|
456
458
|
*/
|
|
457
|
-
startLogin(loginRequest:
|
|
459
|
+
startLogin(loginRequest: EmailPasswordLoginRequest): Promise<LoginAuthenticationResponse>;
|
|
458
460
|
/**
|
|
459
461
|
* Tries to sign in with Google authentication.
|
|
460
462
|
* The response parameter is the result of a Google authentication.
|
|
@@ -464,7 +466,7 @@ export declare class MedplumClient extends EventTarget {
|
|
|
464
466
|
* @returns Promise to the authentication response.
|
|
465
467
|
*/
|
|
466
468
|
startGoogleLogin(loginRequest: GoogleLoginRequest): Promise<LoginAuthenticationResponse>;
|
|
467
|
-
getCodeChallenge(loginRequest:
|
|
469
|
+
getCodeChallenge(loginRequest: BaseLoginRequest): {
|
|
468
470
|
codeChallenge?: string;
|
|
469
471
|
codeChallengeMethod?: string;
|
|
470
472
|
};
|
|
@@ -724,6 +726,16 @@ export declare class MedplumClient extends EventTarget {
|
|
|
724
726
|
*/
|
|
725
727
|
readVersion<K extends ResourceType>(resourceType: K, id: string, vid: string, options?: RequestInit): ReadablePromise<ExtractResource<K>>;
|
|
726
728
|
/**
|
|
729
|
+
* Executes the Patient "everything" operation for a patient.
|
|
730
|
+
*
|
|
731
|
+
* Example:
|
|
732
|
+
*
|
|
733
|
+
* ```typescript
|
|
734
|
+
* const bundle = await medplum.readPatientEverything('123');
|
|
735
|
+
* console.log(bundle);
|
|
736
|
+
* ```
|
|
737
|
+
*
|
|
738
|
+
* See the FHIR "patient-everything" operation for full details: https://hl7.org/fhir/operation-patient-everything.html
|
|
727
739
|
*
|
|
728
740
|
* @category Read
|
|
729
741
|
* @param id The Patient Id
|
package/dist/cjs/format.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Address, HumanName, Period, Timing } from '@medplum/fhirtypes';
|
|
1
|
+
import { Address, HumanName, Period, Timing, Range, Quantity } from '@medplum/fhirtypes';
|
|
2
2
|
export interface AddressFormatOptions {
|
|
3
3
|
all?: boolean;
|
|
4
4
|
use?: boolean;
|
|
@@ -19,3 +19,16 @@ export declare function formatTime(time: string | undefined, options?: Intl.Date
|
|
|
19
19
|
export declare function formatDateTime(dateTime: string | undefined, options?: Intl.DateTimeFormatOptions): string;
|
|
20
20
|
export declare function formatPeriod(period: Period | undefined): string;
|
|
21
21
|
export declare function formatTiming(timing: Timing | undefined): string;
|
|
22
|
+
/**
|
|
23
|
+
* Returns a human-readable string for a FHIR Range datatype, taking into account comparators and one-sided ranges
|
|
24
|
+
* @param range A FHIR Range element
|
|
25
|
+
* @param exclusive If true, one-sided ranges will be rendered with the '>' or '<' bounds rather than '>=' or '<='
|
|
26
|
+
* @returns A human-readable string representation of the Range
|
|
27
|
+
*/
|
|
28
|
+
export declare function formatRange(range: Range | undefined, precision?: number, exclusive?: boolean): string;
|
|
29
|
+
/**
|
|
30
|
+
* Returns a human-readable string for a FHIR Quantity datatype, taking into account units and comparators
|
|
31
|
+
* @param quantity A FHIR Quantity element
|
|
32
|
+
* @returns A human-readable string representation of the Quantity
|
|
33
|
+
*/
|
|
34
|
+
export declare function formatQuantity(quantity: Quantity | undefined, precision?: number): string;
|
package/dist/cjs/hl7.d.ts
CHANGED
|
@@ -1,43 +1,136 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The Hl7Context class represents the parsing context for an HL7 message.
|
|
3
|
+
*
|
|
4
|
+
* MSH-1:
|
|
5
|
+
* https://hl7-definition.caristix.com/v2/HL7v2.6/Fields/MSH.1
|
|
6
|
+
*
|
|
7
|
+
* MSH-2:
|
|
8
|
+
* https://hl7-definition.caristix.com/v2/HL7v2.6/Fields/MSH.2
|
|
9
|
+
*
|
|
10
|
+
* See this tutorial on MSH, and why it's a bad idea to use anything other than the default values:
|
|
11
|
+
* https://www.hl7soup.com/HL7TutorialMSH.html
|
|
12
|
+
*/
|
|
13
|
+
export declare class Hl7Context {
|
|
14
|
+
readonly segmentSeparator: string;
|
|
15
|
+
readonly fieldSeparator: string;
|
|
16
|
+
readonly componentSeparator: string;
|
|
17
|
+
readonly repetitionSeparator: string;
|
|
18
|
+
readonly escapeCharacter: string;
|
|
19
|
+
readonly subcomponentSeparator: string;
|
|
20
|
+
constructor(segmentSeparator?: string, fieldSeparator?: string, componentSeparator?: string, repetitionSeparator?: string, escapeCharacter?: string, subcomponentSeparator?: string);
|
|
21
|
+
/**
|
|
22
|
+
* Returns the MSH-2 field value based on the configured separators.
|
|
23
|
+
* @returns The HL7 MSH-2 field value.
|
|
24
|
+
*/
|
|
25
|
+
getMsh2(): string;
|
|
26
|
+
}
|
|
4
27
|
/**
|
|
5
28
|
* The Hl7Message class represents one HL7 message.
|
|
6
29
|
* A message is a collection of segments.
|
|
7
|
-
* Note that we do not strictly parse messages, and only use default delimeters.
|
|
8
30
|
*/
|
|
9
31
|
export declare class Hl7Message {
|
|
32
|
+
readonly context: Hl7Context;
|
|
10
33
|
readonly segments: Hl7Segment[];
|
|
11
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Creates a new HL7 message.
|
|
36
|
+
* @param segments The HL7 segments.
|
|
37
|
+
* @param context Optional HL7 parsing context.
|
|
38
|
+
*/
|
|
39
|
+
constructor(segments: Hl7Segment[], context?: Hl7Context);
|
|
40
|
+
/**
|
|
41
|
+
* Returns an HL7 segment by index or by name.
|
|
42
|
+
* @param index The HL7 segment index or name.
|
|
43
|
+
* @returns The HL7 segment if found; otherwise, undefined.
|
|
44
|
+
*/
|
|
12
45
|
get(index: number | string): Hl7Segment | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Returns all HL7 segments of a given name.
|
|
48
|
+
* @param name The HL7 segment name.
|
|
49
|
+
* @returns An array of HL7 segments with the specified name.
|
|
50
|
+
*/
|
|
13
51
|
getAll(name: string): Hl7Segment[];
|
|
52
|
+
/**
|
|
53
|
+
* Returns the HL7 message as a string.
|
|
54
|
+
* @returns The HL7 message as a string.
|
|
55
|
+
*/
|
|
14
56
|
toString(): string;
|
|
57
|
+
/**
|
|
58
|
+
* Returns an HL7 "ACK" (acknowledgement) message for this message.
|
|
59
|
+
* @returns The HL7 "ACK" message.
|
|
60
|
+
*/
|
|
15
61
|
buildAck(): Hl7Message;
|
|
62
|
+
/**
|
|
63
|
+
* Parses an HL7 message string into an Hl7Message object.
|
|
64
|
+
* @param text The HL7 message text.
|
|
65
|
+
* @returns The parsed HL7 message.
|
|
66
|
+
*/
|
|
16
67
|
static parse(text: string): Hl7Message;
|
|
17
68
|
}
|
|
18
69
|
/**
|
|
19
70
|
* The Hl7Segment class represents one HL7 segment.
|
|
20
71
|
* A segment is a collection of fields.
|
|
21
72
|
* The name field is the first field.
|
|
22
|
-
* Note that we do not strictly parse messages, and only use default delimeters.
|
|
23
73
|
*/
|
|
24
74
|
export declare class Hl7Segment {
|
|
75
|
+
readonly context: Hl7Context;
|
|
25
76
|
readonly name: string;
|
|
26
77
|
readonly fields: Hl7Field[];
|
|
27
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Creates a new HL7 segment.
|
|
80
|
+
* @param fields The HL7 fields.
|
|
81
|
+
* @param context Optional HL7 parsing context.
|
|
82
|
+
*/
|
|
83
|
+
constructor(fields: Hl7Field[] | string[], context?: Hl7Context);
|
|
84
|
+
/**
|
|
85
|
+
* Returns an HL7 field by index.
|
|
86
|
+
* @param index The HL7 field index.
|
|
87
|
+
* @returns The HL7 field.
|
|
88
|
+
*/
|
|
28
89
|
get(index: number): Hl7Field;
|
|
90
|
+
/**
|
|
91
|
+
* Returns the HL7 segment as a string.
|
|
92
|
+
* @returns The HL7 segment as a string.
|
|
93
|
+
*/
|
|
29
94
|
toString(): string;
|
|
30
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Parses an HL7 segment string into an Hl7Segment object.
|
|
97
|
+
* @param text The HL7 segment text.
|
|
98
|
+
* @param context Optional HL7 parsing context.
|
|
99
|
+
* @returns The parsed HL7 segment.
|
|
100
|
+
*/
|
|
101
|
+
static parse(text: string, context?: Hl7Context): Hl7Segment;
|
|
31
102
|
}
|
|
32
103
|
/**
|
|
33
104
|
* The Hl7Field class represents one HL7 field.
|
|
34
105
|
* A field is a collection of components.
|
|
35
|
-
* Note that we do not strictly parse messages, and only use default delimeters.
|
|
36
106
|
*/
|
|
37
107
|
export declare class Hl7Field {
|
|
38
|
-
readonly
|
|
39
|
-
|
|
40
|
-
|
|
108
|
+
readonly context: Hl7Context;
|
|
109
|
+
readonly components: string[][];
|
|
110
|
+
/**
|
|
111
|
+
* Creates a new HL7 field.
|
|
112
|
+
* @param components The HL7 components.
|
|
113
|
+
* @param context Optional HL7 parsing context.
|
|
114
|
+
*/
|
|
115
|
+
constructor(components: string[][], context?: Hl7Context);
|
|
116
|
+
/**
|
|
117
|
+
* Returns an HL7 component by index.
|
|
118
|
+
* @param component The component index.
|
|
119
|
+
* @param subcomponent Optional subcomponent index.
|
|
120
|
+
* @param repetition Optional repetition index.
|
|
121
|
+
* @returns The string value of the specified component.
|
|
122
|
+
*/
|
|
123
|
+
get(component: number, subcomponent?: number, repetition?: number): string;
|
|
124
|
+
/**
|
|
125
|
+
* Returns the HL7 field as a string.
|
|
126
|
+
* @returns The HL7 field as a string.
|
|
127
|
+
*/
|
|
41
128
|
toString(): string;
|
|
42
|
-
|
|
129
|
+
/**
|
|
130
|
+
* Parses an HL7 field string into an Hl7Field object.
|
|
131
|
+
* @param text The HL7 field text.
|
|
132
|
+
* @param context Optional HL7 parsing context.
|
|
133
|
+
* @returns The parsed HL7 field.
|
|
134
|
+
*/
|
|
135
|
+
static parse(text: string, context?: Hl7Context): Hl7Field;
|
|
43
136
|
}
|