@medplum/core 2.0.16 → 2.0.18
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/index.cjs +75 -6
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.min.cjs +1 -1
- package/dist/esm/client.mjs +20 -2
- package/dist/esm/client.mjs.map +1 -1
- package/dist/esm/index.min.mjs +1 -1
- package/dist/esm/search/search.mjs +56 -4
- package/dist/esm/search/search.mjs.map +1 -1
- package/dist/esm/storage.mjs +1 -1
- package/dist/esm/storage.mjs.map +1 -1
- package/dist/types/client.d.ts +17 -2
- package/dist/types/search/search.d.ts +10 -3
- package/dist/types/storage.d.ts +1 -1
- package/package.json +1 -1
package/dist/esm/client.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { LRUCache } from './cache.mjs';
|
|
|
2
2
|
import { getRandomString, encryptSHA256 } from './crypto.mjs';
|
|
3
3
|
import { EventTarget } from './eventtarget.mjs';
|
|
4
4
|
import { parseJWTPayload } from './jwt.mjs';
|
|
5
|
-
import { OperationOutcomeError, normalizeOperationOutcome, isOk } from './outcomes.mjs';
|
|
5
|
+
import { OperationOutcomeError, normalizeOperationOutcome, notFound, isOk } from './outcomes.mjs';
|
|
6
6
|
import { ReadablePromise } from './readablepromise.mjs';
|
|
7
7
|
import { ClientStorage } from './storage.mjs';
|
|
8
8
|
import { globalSchema, indexStructureDefinition, indexSearchParameter } from './types.mjs';
|
|
@@ -10,7 +10,7 @@ import { createReference, arrayBufferToBase64 } from './utils.mjs';
|
|
|
10
10
|
import { encodeBase64 } from './base64.mjs';
|
|
11
11
|
|
|
12
12
|
// PKCE auth based on:
|
|
13
|
-
const MEDPLUM_VERSION = "2.0.
|
|
13
|
+
const MEDPLUM_VERSION = "2.0.18-e7b9bd9c" ;
|
|
14
14
|
const DEFAULT_BASE_URL = 'https://api.medplum.com/';
|
|
15
15
|
const DEFAULT_RESOURCE_CACHE_SIZE = 1000;
|
|
16
16
|
const DEFAULT_CACHE_TIME = 60000; // 60 seconds
|
|
@@ -1586,6 +1586,9 @@ class MedplumClient extends EventTarget {
|
|
|
1586
1586
|
// No content or change
|
|
1587
1587
|
return undefined;
|
|
1588
1588
|
}
|
|
1589
|
+
if (response.status === 404) {
|
|
1590
|
+
throw new OperationOutcomeError(normalizeOperationOutcome(notFound));
|
|
1591
|
+
}
|
|
1589
1592
|
let obj = undefined;
|
|
1590
1593
|
try {
|
|
1591
1594
|
obj = await response.json();
|
|
@@ -1810,6 +1813,14 @@ class MedplumClient extends EventTarget {
|
|
|
1810
1813
|
}
|
|
1811
1814
|
/**
|
|
1812
1815
|
* Starts a new OAuth2 client credentials flow.
|
|
1816
|
+
*
|
|
1817
|
+
* ```typescript
|
|
1818
|
+
* await medplum.startClientLogin(process.env.MEDPLUM_CLIENT_ID, process.env.MEDPLUM_CLIENT_SECRET)
|
|
1819
|
+
* // Example Search
|
|
1820
|
+
* await medplum.searchResources('Patient')
|
|
1821
|
+
* ```
|
|
1822
|
+
*
|
|
1823
|
+
*
|
|
1813
1824
|
* See: https://datatracker.ietf.org/doc/html/rfc6749#section-4.4
|
|
1814
1825
|
* @category Authentication
|
|
1815
1826
|
* @param clientId The client ID.
|
|
@@ -1827,6 +1838,13 @@ class MedplumClient extends EventTarget {
|
|
|
1827
1838
|
}
|
|
1828
1839
|
/**
|
|
1829
1840
|
* Sets the client ID and secret for basic auth.
|
|
1841
|
+
*
|
|
1842
|
+
* ```typescript
|
|
1843
|
+
* medplum.setBasicAuth(process.env.MEDPLUM_CLIENT_ID, process.env.MEDPLUM_CLIENT_SECRET)
|
|
1844
|
+
* // Example Search
|
|
1845
|
+
* await medplum.searchResources('Patient')
|
|
1846
|
+
* ```
|
|
1847
|
+
*
|
|
1830
1848
|
* @category Authentication
|
|
1831
1849
|
* @param clientId The client ID.
|
|
1832
1850
|
* @param clientSecret The client secret.
|