Skip to main content

Interface: MedplumClientOptions

The MedplumClientOptions interface defines configuration options for MedplumClient.

All configuration settings are optional.

Properties

baseUrl

Optional baseUrl: string

Base server URL.

Default value is https://api.medplum.com/

Use this to point to a custom Medplum deployment.

Defined in

packages/core/src/client.ts:75


authorizeUrl

Optional authorizeUrl: string

OAuth2 authorize URL.

Default value is baseUrl + "/oauth2/authorize".

Use this if you want to use a separate OAuth server.

Defined in

packages/core/src/client.ts:84


fhirUrlPath

Optional fhirUrlPath: string

FHIR URL path.

Default value is "fhir/R4/".

Use this if you want to use a different path when connecting to a FHIR server.

Defined in

packages/core/src/client.ts:93


tokenUrl

Optional tokenUrl: string

OAuth2 token URL.

Default value is baseUrl + "/oauth2/token".

Use this if you want to use a separate OAuth server.

Defined in

packages/core/src/client.ts:102


logoutUrl

Optional logoutUrl: string

OAuth2 logout URL.

Default value is baseUrl + "/oauth2/logout".

Use this if you want to use a separate OAuth server.

Defined in

packages/core/src/client.ts:111


clientId

Optional clientId: string

The client ID.

Client ID can be used for SMART-on-FHIR customization.

Defined in

packages/core/src/client.ts:118


clientSecret

Optional clientSecret: string

The client secret.

Client secret can be used for FHIR Oauth Client Credential flows

Defined in

packages/core/src/client.ts:125


accessToken

Optional accessToken: string

The OAuth Access Token.

Access Token used to connect to make request to FHIR servers

Defined in

packages/core/src/client.ts:132


resourceCacheSize

Optional resourceCacheSize: number

Number of resources to store in the cache.

Default value is 1000.

Consider using this for performance of displaying Patient or Practitioner resources.

Defined in

packages/core/src/client.ts:141


cacheTime

Optional cacheTime: number

The length of time in milliseconds to cache resources.

Default value is 10000 (10 seconds).

Cache time of zero disables all caching.

For any individual request, the cache behavior can be overridden by setting the cache property on request options.

See: https://developer.mozilla.org/en-US/docs/Web/API/Request/cache

Defined in

packages/core/src/client.ts:154


autoBatchTime

Optional autoBatchTime: number

The length of time in milliseconds to delay requests for auto batching.

Auto batching attempts to group multiple requests together into a single batch request.

Default value is 0, which disables auto batching.

Defined in

packages/core/src/client.ts:163


fetch

Optional fetch: FetchLike

Fetch implementation.

Default is window.fetch (if available).

For Node.js applications, consider the 'node-fetch' package.

Defined in

packages/core/src/client.ts:172


profile

Optional profile: string

The profile name.

This is for handling multiple profiles to access different FHIR Servers

If undefined, the default profile is "default".

Defined in

packages/core/src/client.ts:181


storage

Optional storage: ClientStorage

Storage implementation.

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.

Defined in

packages/core/src/client.ts:188


createPdf

Optional createPdf: CreatePdfFunction

Create PDF implementation.

Default is none, and PDF generation is disabled.

In browser environments, import the client-side pdfmake library.

<script src="pdfmake.min.js"></script>
<script>
async function createPdf(docDefinition, tableLayouts, fonts) {
return new Promise((resolve) => {
pdfMake.createPdf(docDefinition, tableLayouts, fonts).getBlob(resolve);
});
}
</script>

In Node.js applications:

import type { CustomTableLayout, TDocumentDefinitions, TFontDictionary } from 'pdfmake/interfaces';
function createPdf(
docDefinition: TDocumentDefinitions,
tableLayouts?: { [name: string]: CustomTableLayout },
fonts?: TFontDictionary
): Promise<Buffer> {
return new Promise((resolve, reject) => {
const printer = new PdfPrinter(fonts ?? {});
const pdfDoc = printer.createPdfKitDocument(docDefinition, { tableLayouts });
const chunks: Uint8Array[] = [];
pdfDoc.on('data', (chunk: Uint8Array) => chunks.push(chunk));
pdfDoc.on('end', () => resolve(Buffer.concat(chunks)));
pdfDoc.on('error', reject);
pdfDoc.end();
});
}

Defined in

packages/core/src/client.ts:229


onUnauthenticated

Optional onUnauthenticated: () => void

Type declaration

▸ (): void

Callback for when the client is unauthenticated.

Default is do nothing.

For client side applications, consider redirecting to a sign in page.

Returns

void

Defined in

packages/core/src/client.ts:238