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:67
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:76
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:85
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:94
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:103
clientId
• Optional
clientId: string
The client ID.
Client ID can be used for SMART-on-FHIR customization.
Defined in
packages/core/src/client.ts:110
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:119
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:132
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:141
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:150
storage
• Optional
storage: ClientStorage
Storage implementation.
Default is window.localStorage (if available), or an in-memory storage implementation.
Defined in
packages/core/src/client.ts:157
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:198
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:207