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:58
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:67
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:76
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:85
clientId
• Optional
clientId: string
The client ID.
Client ID can be used for SMART-on-FHIR customization.
Defined in
packages/core/src/client.ts:92
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:101
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:114
fetch
• Optional
fetch: FetchLike
Fetch implementation.
Default is window.fetch (if available).
For nodejs applications, consider the 'node-fetch' package.
Defined in
packages/core/src/client.ts:123
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 nodejs 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:164
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:173