@medplum/core 2.0.3 → 2.0.4
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 +5 -3
- package/dist/cjs/index.cjs +443 -189
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.ts +4 -3
- package/dist/cjs/index.min.cjs +1 -1
- package/dist/cjs/{searchparams.d.ts → search/details.d.ts} +0 -0
- package/dist/cjs/{match.d.ts → search/match.d.ts} +0 -0
- package/dist/cjs/search/parse.d.ts +17 -0
- package/dist/cjs/{search.d.ts → search/search.d.ts} +0 -0
- package/dist/cjs/types.d.ts +30 -7
- package/dist/esm/client.d.ts +5 -3
- package/dist/esm/client.mjs +9 -5
- package/dist/esm/client.mjs.map +1 -1
- package/dist/esm/index.d.ts +4 -3
- package/dist/esm/index.min.mjs +1 -1
- package/dist/esm/index.mjs +5 -4
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/{searchparams.d.ts → search/details.d.ts} +0 -0
- package/dist/esm/{searchparams.mjs → search/details.mjs} +9 -11
- package/dist/esm/search/details.mjs.map +1 -0
- package/dist/esm/{match.d.ts → search/match.d.ts} +0 -0
- package/dist/esm/{match.mjs → search/match.mjs} +7 -7
- package/dist/esm/search/match.mjs.map +1 -0
- package/dist/esm/search/parse.d.ts +17 -0
- package/dist/esm/search/parse.mjs +218 -0
- package/dist/esm/search/parse.mjs.map +1 -0
- package/dist/esm/{search.d.ts → search/search.d.ts} +0 -0
- package/dist/esm/{search.mjs → search/search.mjs} +0 -3
- package/dist/esm/search/search.mjs.map +1 -0
- package/dist/esm/types.d.ts +30 -7
- package/dist/esm/types.mjs +63 -25
- package/dist/esm/types.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/esm/match.mjs.map +0 -1
- package/dist/esm/search.mjs.map +0 -1
- package/dist/esm/searchparams.mjs.map +0 -1
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { ResourceType } from '@medplum/fhirtypes';
|
|
3
|
+
import { URL } from 'url';
|
|
4
|
+
import { SearchRequest } from './search';
|
|
5
|
+
/**
|
|
6
|
+
* Parses a search URL into a search request.
|
|
7
|
+
* @param resourceType The FHIR resource type.
|
|
8
|
+
* @param query The collection of query string parameters.
|
|
9
|
+
* @returns A parsed SearchRequest.
|
|
10
|
+
*/
|
|
11
|
+
export declare function parseSearchRequest(resourceType: ResourceType, query: Record<string, string[] | string | undefined>): SearchRequest;
|
|
12
|
+
/**
|
|
13
|
+
* Parses a search URL into a search request.
|
|
14
|
+
* @param url The search URL.
|
|
15
|
+
* @returns A parsed SearchRequest.
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseSearchUrl(url: URL): SearchRequest;
|
|
File without changes
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Bundle, ElementDefinition, SearchParameter, StructureDefinition } from '@medplum/fhirtypes';
|
|
2
|
-
import { SearchParameterDetails } from './
|
|
2
|
+
import { SearchParameterDetails } from './search/details';
|
|
3
3
|
export interface TypedValue {
|
|
4
4
|
readonly type: string;
|
|
5
5
|
readonly value: any;
|
|
@@ -124,12 +124,6 @@ export interface TypeSchema {
|
|
|
124
124
|
description?: string;
|
|
125
125
|
parentType?: string;
|
|
126
126
|
}
|
|
127
|
-
/**
|
|
128
|
-
* Creates a new empty IndexedStructureDefinition.
|
|
129
|
-
* @returns The empty IndexedStructureDefinition.
|
|
130
|
-
* @deprecated Use globalSchema
|
|
131
|
-
*/
|
|
132
|
-
export declare function createSchema(): IndexedStructureDefinition;
|
|
133
127
|
/**
|
|
134
128
|
* Indexes a bundle of StructureDefinitions for faster lookup.
|
|
135
129
|
* @param bundle A FHIR bundle StructureDefinition resources.
|
|
@@ -162,6 +156,35 @@ export declare function indexSearchParameter(searchParam: SearchParameter): void
|
|
|
162
156
|
*/
|
|
163
157
|
export declare function getElementDefinitionTypeName(elementDefinition: ElementDefinition): string;
|
|
164
158
|
export declare function buildTypeName(components: string[]): string;
|
|
159
|
+
/**
|
|
160
|
+
* Returns true if the type schema is a DomainResource.
|
|
161
|
+
* @param typeSchema The type schema to check.
|
|
162
|
+
* @returns True if the type schema is a DomainResource.
|
|
163
|
+
*/
|
|
164
|
+
export declare function isResourceType(typeSchema: TypeSchema): boolean;
|
|
165
|
+
/**
|
|
166
|
+
* Returns an array of all resource types.
|
|
167
|
+
* Note that this is based on globalSchema, and will only return resource types that are currently in memory.
|
|
168
|
+
* @returns An array of all resource types.
|
|
169
|
+
*/
|
|
170
|
+
export declare function getResourceTypes(): string[];
|
|
171
|
+
/**
|
|
172
|
+
* Returns the type schema for the resource type.
|
|
173
|
+
* @param resourceType The resource type.
|
|
174
|
+
* @returns The type schema for the resource type.
|
|
175
|
+
*/
|
|
176
|
+
export declare function getResourceTypeSchema(resourceType: string): TypeSchema;
|
|
177
|
+
/**
|
|
178
|
+
* Returns the search parameters for the resource type indexed by search code.
|
|
179
|
+
* @param resourceType The resource type.
|
|
180
|
+
* @returns The search parameters for the resource type indexed by search code.
|
|
181
|
+
*/
|
|
182
|
+
export declare function getSearchParameters(resourceType: string): Record<string, SearchParameter> | undefined;
|
|
183
|
+
/**
|
|
184
|
+
* Returns a human friendly display name for a FHIR element definition path.
|
|
185
|
+
* @param path The FHIR element definition path.
|
|
186
|
+
* @returns The best guess of the display name.
|
|
187
|
+
*/
|
|
165
188
|
export declare function getPropertyDisplayName(path: string): string;
|
|
166
189
|
/**
|
|
167
190
|
* Returns an element definition by type and property name.
|
package/dist/esm/client.d.ts
CHANGED
|
@@ -84,7 +84,7 @@ export interface MedplumClientOptions {
|
|
|
84
84
|
*
|
|
85
85
|
* Default is window.fetch (if available).
|
|
86
86
|
*
|
|
87
|
-
* For
|
|
87
|
+
* For Node.js applications, consider the 'node-fetch' package.
|
|
88
88
|
*/
|
|
89
89
|
fetch?: FetchLike;
|
|
90
90
|
/**
|
|
@@ -105,7 +105,7 @@ export interface MedplumClientOptions {
|
|
|
105
105
|
* </script>
|
|
106
106
|
* ```
|
|
107
107
|
*
|
|
108
|
-
* In
|
|
108
|
+
* In Node.js applications:
|
|
109
109
|
*
|
|
110
110
|
* ```ts
|
|
111
111
|
* import type { CustomTableLayout, TDocumentDefinitions, TFontDictionary } from 'pdfmake/interfaces';
|
|
@@ -282,7 +282,7 @@ export interface MailOptions {
|
|
|
282
282
|
/**
|
|
283
283
|
* The MedplumClient class provides a client for the Medplum FHIR server.
|
|
284
284
|
*
|
|
285
|
-
* The client can be used in the browser, in a
|
|
285
|
+
* The client can be used in the browser, in a Node.js application, or in a Medplum Bot.
|
|
286
286
|
*
|
|
287
287
|
* The client provides helpful methods for common operations such as:
|
|
288
288
|
* 1) Authenticating
|
|
@@ -1193,6 +1193,7 @@ export declare class MedplumClient extends EventTarget {
|
|
|
1193
1193
|
/**
|
|
1194
1194
|
* Starts a new PKCE flow.
|
|
1195
1195
|
* These PKCE values are stateful, and must survive redirects and page refreshes.
|
|
1196
|
+
* @category Authentication
|
|
1196
1197
|
*/
|
|
1197
1198
|
startPkce(): Promise<{
|
|
1198
1199
|
codeChallengeMethod: string;
|
|
@@ -1202,6 +1203,7 @@ export declare class MedplumClient extends EventTarget {
|
|
|
1202
1203
|
* Processes an OAuth authorization code.
|
|
1203
1204
|
* See: https://openid.net/specs/openid-connect-core-1_0.html#TokenRequest
|
|
1204
1205
|
* @param code The authorization code received by URL parameter.
|
|
1206
|
+
* @category Authentication
|
|
1205
1207
|
*/
|
|
1206
1208
|
processCode(code: string): Promise<ProfileResource>;
|
|
1207
1209
|
/**
|
package/dist/esm/client.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import { createReference, arrayBufferToBase64 } from './utils.mjs';
|
|
|
12
12
|
// PKCE auth based on:
|
|
13
13
|
// https://aws.amazon.com/blogs/security/how-to-add-authentication-single-page-web-application-with-amazon-cognito-oauth2-implementation/
|
|
14
14
|
var _MedplumClient_instances, _MedplumClient_fetch, _MedplumClient_createPdf, _MedplumClient_storage, _MedplumClient_requestCache, _MedplumClient_cacheTime, _MedplumClient_baseUrl, _MedplumClient_fhirBaseUrl, _MedplumClient_authorizeUrl, _MedplumClient_tokenUrl, _MedplumClient_logoutUrl, _MedplumClient_onUnauthenticated, _MedplumClient_autoBatchTime, _MedplumClient_autoBatchQueue, _MedplumClient_clientId, _MedplumClient_clientSecret, _MedplumClient_autoBatchTimerId, _MedplumClient_accessToken, _MedplumClient_refreshToken, _MedplumClient_refreshPromise, _MedplumClient_profilePromise, _MedplumClient_profile, _MedplumClient_config, _MedplumClient_addLogin, _MedplumClient_refreshProfile, _MedplumClient_getCacheEntry, _MedplumClient_setCacheEntry, _MedplumClient_cacheResource, _MedplumClient_deleteCacheEntry, _MedplumClient_request, _MedplumClient_fetchWithRetry, _MedplumClient_executeAutoBatch, _MedplumClient_addFetchOptionsDefaults, _MedplumClient_setRequestContentType, _MedplumClient_setRequestBody, _MedplumClient_handleUnauthenticated, _MedplumClient_requestAuthorization, _MedplumClient_refresh, _MedplumClient_fetchTokens, _MedplumClient_verifyTokens, _MedplumClient_setupStorageListener;
|
|
15
|
-
const MEDPLUM_VERSION = "2.0.
|
|
15
|
+
const MEDPLUM_VERSION = "2.0.4-c4747b4e";
|
|
16
16
|
const DEFAULT_BASE_URL = 'https://api.medplum.com/';
|
|
17
17
|
const DEFAULT_RESOURCE_CACHE_SIZE = 1000;
|
|
18
18
|
const DEFAULT_CACHE_TIME = 60000; // 60 seconds
|
|
@@ -23,7 +23,7 @@ const system = { resourceType: 'Device', id: 'system', deviceName: [{ name: 'Sys
|
|
|
23
23
|
/**
|
|
24
24
|
* The MedplumClient class provides a client for the Medplum FHIR server.
|
|
25
25
|
*
|
|
26
|
-
* The client can be used in the browser, in a
|
|
26
|
+
* The client can be used in the browser, in a Node.js application, or in a Medplum Bot.
|
|
27
27
|
*
|
|
28
28
|
* The client provides helpful methods for common operations such as:
|
|
29
29
|
* 1) Authenticating
|
|
@@ -1404,6 +1404,7 @@ class MedplumClient extends EventTarget {
|
|
|
1404
1404
|
/**
|
|
1405
1405
|
* Starts a new PKCE flow.
|
|
1406
1406
|
* These PKCE values are stateful, and must survive redirects and page refreshes.
|
|
1407
|
+
* @category Authentication
|
|
1407
1408
|
*/
|
|
1408
1409
|
async startPkce() {
|
|
1409
1410
|
const pkceState = getRandomString();
|
|
@@ -1419,6 +1420,7 @@ class MedplumClient extends EventTarget {
|
|
|
1419
1420
|
* Processes an OAuth authorization code.
|
|
1420
1421
|
* See: https://openid.net/specs/openid-connect-core-1_0.html#TokenRequest
|
|
1421
1422
|
* @param code The authorization code received by URL parameter.
|
|
1423
|
+
* @category Authentication
|
|
1422
1424
|
*/
|
|
1423
1425
|
processCode(code) {
|
|
1424
1426
|
const formBody = new URLSearchParams();
|
|
@@ -1426,9 +1428,11 @@ class MedplumClient extends EventTarget {
|
|
|
1426
1428
|
formBody.set('client_id', __classPrivateFieldGet(this, _MedplumClient_clientId, "f"));
|
|
1427
1429
|
formBody.set('code', code);
|
|
1428
1430
|
formBody.set('redirect_uri', getWindowOrigin());
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1431
|
+
if (typeof sessionStorage !== 'undefined') {
|
|
1432
|
+
const codeVerifier = sessionStorage.getItem('codeVerifier');
|
|
1433
|
+
if (codeVerifier) {
|
|
1434
|
+
formBody.set('code_verifier', codeVerifier);
|
|
1435
|
+
}
|
|
1432
1436
|
}
|
|
1433
1437
|
return __classPrivateFieldGet(this, _MedplumClient_instances, "m", _MedplumClient_fetchTokens).call(this, formBody);
|
|
1434
1438
|
}
|