@medplum/core 0.9.32 → 0.9.35
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 +18 -2
- package/dist/cjs/index.js +759 -694
- 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/searchparams.d.ts +1 -3
- package/dist/cjs/types.d.ts +16 -4
- package/dist/cjs/utils.d.ts +1 -1
- package/dist/esm/client.d.ts +18 -2
- package/dist/esm/client.js +27 -8
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/fhirpath/atoms.js +2 -1
- package/dist/esm/fhirpath/atoms.js.map +1 -1
- package/dist/esm/fhirpath/functions.js +3 -1
- package/dist/esm/fhirpath/functions.js.map +1 -1
- package/dist/esm/fhirpath/utils.js +18 -20
- package/dist/esm/fhirpath/utils.js.map +1 -1
- package/dist/esm/format.js +2 -2
- package/dist/esm/format.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.min.js +1 -1
- package/dist/esm/index.min.js.map +1 -1
- package/dist/esm/outcomes.js +3 -3
- package/dist/esm/outcomes.js.map +1 -1
- package/dist/esm/searchparams.d.ts +1 -3
- package/dist/esm/searchparams.js +23 -6
- package/dist/esm/searchparams.js.map +1 -1
- package/dist/esm/types.d.ts +16 -4
- package/dist/esm/types.js +63 -34
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/utils.d.ts +1 -1
- package/dist/esm/utils.js +1 -1
- package/dist/esm/utils.js.map +1 -1
- package/package.json +3 -3
- package/stats.html +4034 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ElementDefinition, SearchParameter } from '@medplum/fhirtypes';
|
|
2
|
-
import { IndexedStructureDefinition } from './types';
|
|
3
2
|
export declare enum SearchParameterType {
|
|
4
3
|
BOOLEAN = "BOOLEAN",
|
|
5
4
|
NUMBER = "NUMBER",
|
|
@@ -26,10 +25,9 @@ export interface SearchParameterDetails {
|
|
|
26
25
|
* 2) The "token" type includes enums and booleans.
|
|
27
26
|
* 3) Arrays/multiple values are not reflected at all.
|
|
28
27
|
*
|
|
29
|
-
* @param structureDefinitions Collection of StructureDefinition resources indexed by name.
|
|
30
28
|
* @param resourceType The root resource type.
|
|
31
29
|
* @param searchParam The search parameter.
|
|
32
30
|
* @returns The search parameter type details.
|
|
33
31
|
*/
|
|
34
|
-
export declare function getSearchParameterDetails(
|
|
32
|
+
export declare function getSearchParameterDetails(resourceType: string, searchParam: SearchParameter): SearchParameterDetails;
|
|
35
33
|
export declare function getExpressionForResourceType(resourceType: string, expression: string): string | undefined;
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Bundle, ElementDefinition, SearchParameter, StructureDefinition } from '@medplum/fhirtypes';
|
|
2
|
+
import { SearchParameterDetails } from './searchparams';
|
|
2
3
|
/**
|
|
3
4
|
* List of property types.
|
|
4
5
|
* http://www.hl7.org/fhir/valueset-defined-types.html
|
|
@@ -104,6 +105,8 @@ export interface IndexedStructureDefinition {
|
|
|
104
105
|
* 4) Patient_Link
|
|
105
106
|
*/
|
|
106
107
|
export interface TypeSchema {
|
|
108
|
+
structureDefinition: StructureDefinition;
|
|
109
|
+
elementDefinition: ElementDefinition;
|
|
107
110
|
display: string;
|
|
108
111
|
properties: {
|
|
109
112
|
[name: string]: ElementDefinition;
|
|
@@ -111,6 +114,9 @@ export interface TypeSchema {
|
|
|
111
114
|
searchParams?: {
|
|
112
115
|
[code: string]: SearchParameter;
|
|
113
116
|
};
|
|
117
|
+
searchParamsDetails?: {
|
|
118
|
+
[code: string]: SearchParameterDetails;
|
|
119
|
+
};
|
|
114
120
|
description?: string;
|
|
115
121
|
parentType?: string;
|
|
116
122
|
}
|
|
@@ -120,7 +126,6 @@ export interface TypeSchema {
|
|
|
120
126
|
* @deprecated Use globalSchema
|
|
121
127
|
*/
|
|
122
128
|
export declare function createSchema(): IndexedStructureDefinition;
|
|
123
|
-
export declare function createTypeSchema(typeName: string, description: string | undefined): TypeSchema;
|
|
124
129
|
/**
|
|
125
130
|
* Indexes a bundle of StructureDefinitions for faster lookup.
|
|
126
131
|
* @param bundle A FHIR bundle StructureDefinition resources.
|
|
@@ -129,19 +134,26 @@ export declare function indexStructureDefinitionBundle(bundle: Bundle): void;
|
|
|
129
134
|
/**
|
|
130
135
|
* Indexes a StructureDefinition for fast lookup.
|
|
131
136
|
* See comments on IndexedStructureDefinition for more details.
|
|
132
|
-
* @param schema The output IndexedStructureDefinition.
|
|
133
137
|
* @param structureDefinition The original StructureDefinition.
|
|
134
138
|
*/
|
|
135
|
-
export declare function indexStructureDefinition(
|
|
139
|
+
export declare function indexStructureDefinition(structureDefinition: StructureDefinition): void;
|
|
136
140
|
/**
|
|
137
141
|
* Indexes a SearchParameter resource for fast lookup.
|
|
138
142
|
* Indexes by SearchParameter.code, which is the query string parameter name.
|
|
139
143
|
* @param schema The output IndexedStructureDefinition.
|
|
140
144
|
* @param searchParam The SearchParameter resource.
|
|
141
145
|
*/
|
|
142
|
-
export declare function indexSearchParameter(
|
|
146
|
+
export declare function indexSearchParameter(searchParam: SearchParameter): void;
|
|
143
147
|
export declare function buildTypeName(components: string[]): string;
|
|
144
148
|
export declare function getPropertyDisplayName(path: string): string;
|
|
149
|
+
/**
|
|
150
|
+
* Returns an element definition by type and property name.
|
|
151
|
+
* Handles content references.
|
|
152
|
+
* @param typeName The type name.
|
|
153
|
+
* @param propertyName The property name.
|
|
154
|
+
* @returns The element definition if found.
|
|
155
|
+
*/
|
|
156
|
+
export declare function getElementDefinition(typeName: string, propertyName: string): ElementDefinition | undefined;
|
|
145
157
|
/**
|
|
146
158
|
* Global schema singleton.
|
|
147
159
|
*/
|
package/dist/cjs/utils.d.ts
CHANGED
|
@@ -92,7 +92,7 @@ export declare function getIdentifier(resource: Resource, system: string): strin
|
|
|
92
92
|
* @param urls Array of extension URLs. Each entry represents a nested extension.
|
|
93
93
|
* @returns The extension value if found; undefined otherwise.
|
|
94
94
|
*/
|
|
95
|
-
export declare function getExtensionValue(resource:
|
|
95
|
+
export declare function getExtensionValue(resource: any, ...urls: string[]): string | undefined;
|
|
96
96
|
/**
|
|
97
97
|
* FHIR JSON stringify.
|
|
98
98
|
* Removes properties with empty string values.
|
package/dist/esm/client.d.ts
CHANGED
|
@@ -143,6 +143,8 @@ export interface LoginRequest {
|
|
|
143
143
|
readonly clientId?: string;
|
|
144
144
|
readonly scope?: string;
|
|
145
145
|
readonly nonce?: string;
|
|
146
|
+
readonly codeChallenge?: string;
|
|
147
|
+
readonly codeChallengeMethod?: string;
|
|
146
148
|
}
|
|
147
149
|
export interface NewUserRequest {
|
|
148
150
|
readonly firstName: string;
|
|
@@ -173,6 +175,8 @@ export interface GoogleLoginRequest {
|
|
|
173
175
|
readonly clientId?: string;
|
|
174
176
|
readonly scope?: string;
|
|
175
177
|
readonly nonce?: string;
|
|
178
|
+
readonly codeChallenge?: string;
|
|
179
|
+
readonly codeChallengeMethod?: string;
|
|
176
180
|
readonly createUser?: boolean;
|
|
177
181
|
}
|
|
178
182
|
export interface LoginAuthenticationResponse {
|
|
@@ -507,7 +511,7 @@ export declare class MedplumClient extends EventTarget {
|
|
|
507
511
|
* ```json
|
|
508
512
|
* {
|
|
509
513
|
* "resourceType": "Bundle",
|
|
510
|
-
* "type": "
|
|
514
|
+
* "type": "searchset",
|
|
511
515
|
* "total": 1,
|
|
512
516
|
* "entry": [
|
|
513
517
|
* {
|
|
@@ -614,7 +618,7 @@ export declare class MedplumClient extends EventTarget {
|
|
|
614
618
|
*
|
|
615
619
|
* See the FHIR "read" operation for full details: https://www.hl7.org/fhir/http.html#read
|
|
616
620
|
*
|
|
617
|
-
* @category
|
|
621
|
+
* @category Read
|
|
618
622
|
* @param resourceType The FHIR resource type.
|
|
619
623
|
* @param id The resource ID.
|
|
620
624
|
* @returns The resource if available; undefined otherwise.
|
|
@@ -1033,6 +1037,18 @@ export declare class MedplumClient extends EventTarget {
|
|
|
1033
1037
|
* @returns The GraphQL result.
|
|
1034
1038
|
*/
|
|
1035
1039
|
graphql(query: string, operationName?: string | null, variables?: any, options?: RequestInit): Promise<any>;
|
|
1040
|
+
/**
|
|
1041
|
+
*
|
|
1042
|
+
* Executes the $graph operation on this resource to fetch a Bundle of resources linked to the target resource
|
|
1043
|
+
* according to a graph definition
|
|
1044
|
+
|
|
1045
|
+
* @category Read
|
|
1046
|
+
* @param resourceType The FHIR resource type.
|
|
1047
|
+
* @param id The resource ID.
|
|
1048
|
+
* @param graphName `name` parameter of the GraphDefinition
|
|
1049
|
+
* @returns A Bundle
|
|
1050
|
+
*/
|
|
1051
|
+
readResourceGraph<K extends ResourceType>(resourceType: K, id: string, graphName: string): ReadablePromise<Bundle<Resource>>;
|
|
1036
1052
|
/**
|
|
1037
1053
|
* @category Authentication
|
|
1038
1054
|
* @returns The Login State
|
package/dist/esm/client.js
CHANGED
|
@@ -318,8 +318,10 @@ class MedplumClient extends EventTarget {
|
|
|
318
318
|
startLogin(loginRequest) {
|
|
319
319
|
var _a, _b;
|
|
320
320
|
return __awaiter(this, void 0, void 0, function* () {
|
|
321
|
-
|
|
322
|
-
|
|
321
|
+
if (!loginRequest.codeChallenge || !loginRequest.codeChallengeMethod) {
|
|
322
|
+
yield __classPrivateFieldGet(this, _MedplumClient_instances, "m", _MedplumClient_startPkce).call(this);
|
|
323
|
+
}
|
|
324
|
+
return this.post('auth/login', Object.assign(Object.assign({}, loginRequest), { clientId: (_a = loginRequest.clientId) !== null && _a !== void 0 ? _a : __classPrivateFieldGet(this, _MedplumClient_clientId, "f"), scope: (_b = loginRequest.scope) !== null && _b !== void 0 ? _b : DEFAULT_SCOPE, codeChallengeMethod: loginRequest.codeChallengeMethod || 'S256', codeChallenge: loginRequest.codeChallenge || __classPrivateFieldGet(this, _MedplumClient_storage, "f").getString('codeChallenge') }));
|
|
323
325
|
});
|
|
324
326
|
}
|
|
325
327
|
/**
|
|
@@ -333,8 +335,10 @@ class MedplumClient extends EventTarget {
|
|
|
333
335
|
startGoogleLogin(loginRequest) {
|
|
334
336
|
var _a, _b;
|
|
335
337
|
return __awaiter(this, void 0, void 0, function* () {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
+
if (!loginRequest.codeChallenge || !loginRequest.codeChallengeMethod) {
|
|
339
|
+
yield __classPrivateFieldGet(this, _MedplumClient_instances, "m", _MedplumClient_startPkce).call(this);
|
|
340
|
+
}
|
|
341
|
+
return this.post('auth/google', Object.assign(Object.assign({}, loginRequest), { clientId: (_a = loginRequest.clientId) !== null && _a !== void 0 ? _a : __classPrivateFieldGet(this, _MedplumClient_clientId, "f"), scope: (_b = loginRequest.scope) !== null && _b !== void 0 ? _b : DEFAULT_SCOPE, codeChallengeMethod: loginRequest.codeChallengeMethod || 'S256', codeChallenge: loginRequest.codeChallenge || __classPrivateFieldGet(this, _MedplumClient_storage, "f").getString('codeChallenge') }));
|
|
338
342
|
});
|
|
339
343
|
}
|
|
340
344
|
/**
|
|
@@ -411,7 +415,7 @@ class MedplumClient extends EventTarget {
|
|
|
411
415
|
* ```json
|
|
412
416
|
* {
|
|
413
417
|
* "resourceType": "Bundle",
|
|
414
|
-
* "type": "
|
|
418
|
+
* "type": "searchset",
|
|
415
419
|
* "total": 1,
|
|
416
420
|
* "entry": [
|
|
417
421
|
* {
|
|
@@ -561,7 +565,7 @@ class MedplumClient extends EventTarget {
|
|
|
561
565
|
*
|
|
562
566
|
* See the FHIR "read" operation for full details: https://www.hl7.org/fhir/http.html#read
|
|
563
567
|
*
|
|
564
|
-
* @category
|
|
568
|
+
* @category Read
|
|
565
569
|
* @param resourceType The FHIR resource type.
|
|
566
570
|
* @param id The resource ID.
|
|
567
571
|
* @returns The resource if available; undefined otherwise.
|
|
@@ -654,10 +658,10 @@ class MedplumClient extends EventTarget {
|
|
|
654
658
|
}`.replace(/\s+/g, ' ');
|
|
655
659
|
const response = (yield this.graphql(query));
|
|
656
660
|
for (const structureDefinition of response.data.StructureDefinitionList) {
|
|
657
|
-
indexStructureDefinition(
|
|
661
|
+
indexStructureDefinition(structureDefinition);
|
|
658
662
|
}
|
|
659
663
|
for (const searchParameter of response.data.SearchParameterList) {
|
|
660
|
-
indexSearchParameter(
|
|
664
|
+
indexSearchParameter(searchParameter);
|
|
661
665
|
}
|
|
662
666
|
return globalSchema;
|
|
663
667
|
});
|
|
@@ -1116,6 +1120,20 @@ class MedplumClient extends EventTarget {
|
|
|
1116
1120
|
graphql(query, operationName, variables, options) {
|
|
1117
1121
|
return this.post(this.fhirUrl('$graphql'), { query, operationName, variables }, JSON_CONTENT_TYPE, options);
|
|
1118
1122
|
}
|
|
1123
|
+
/**
|
|
1124
|
+
*
|
|
1125
|
+
* Executes the $graph operation on this resource to fetch a Bundle of resources linked to the target resource
|
|
1126
|
+
* according to a graph definition
|
|
1127
|
+
|
|
1128
|
+
* @category Read
|
|
1129
|
+
* @param resourceType The FHIR resource type.
|
|
1130
|
+
* @param id The resource ID.
|
|
1131
|
+
* @param graphName `name` parameter of the GraphDefinition
|
|
1132
|
+
* @returns A Bundle
|
|
1133
|
+
*/
|
|
1134
|
+
readResourceGraph(resourceType, id, graphName) {
|
|
1135
|
+
return this.get(`${this.fhirUrl(resourceType, id)}/$graph?graph=${graphName}`);
|
|
1136
|
+
}
|
|
1119
1137
|
/**
|
|
1120
1138
|
* @category Authentication
|
|
1121
1139
|
* @returns The Login State
|
|
@@ -1311,6 +1329,7 @@ _MedplumClient_fetch = new WeakMap(), _MedplumClient_createPdf = new WeakMap(),
|
|
|
1311
1329
|
options.headers = {};
|
|
1312
1330
|
}
|
|
1313
1331
|
const headers = options.headers;
|
|
1332
|
+
headers['X-Medplum'] = 'extended';
|
|
1314
1333
|
if (!headers['Content-Type']) {
|
|
1315
1334
|
headers['Content-Type'] = FHIR_CONTENT_TYPE;
|
|
1316
1335
|
}
|