@medplum/core 2.0.4 → 2.0.5
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 +35 -21
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.min.cjs +1 -1
- package/dist/esm/client.mjs +10 -17
- package/dist/esm/client.mjs.map +1 -1
- package/dist/esm/index.min.mjs +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/outcomes.mjs +17 -2
- package/dist/esm/outcomes.mjs.map +1 -1
- package/dist/esm/search/match.mjs +9 -4
- package/dist/esm/search/match.mjs.map +1 -1
- package/dist/{esm → types}/outcomes.d.ts +7 -1
- package/package.json +4 -4
- package/tsconfig.build.json +9 -0
- package/dist/cjs/outcomes.d.ts +0 -31
- package/dist/esm/cache.d.ts +0 -34
- package/dist/esm/client.d.ts +0 -1218
- package/dist/esm/crypto.d.ts +0 -9
- package/dist/esm/eventtarget.d.ts +0 -13
- package/dist/esm/fhirlexer/index.d.ts +0 -2
- package/dist/esm/fhirlexer/parse.d.ts +0 -47
- package/dist/esm/fhirlexer/tokenize.d.ts +0 -14
- package/dist/esm/fhirmapper/parse.d.ts +0 -7
- package/dist/esm/fhirmapper/tokenize.d.ts +0 -2
- package/dist/esm/fhirpath/atoms.d.ts +0 -120
- package/dist/esm/fhirpath/date.d.ts +0 -1
- package/dist/esm/fhirpath/functions.d.ts +0 -6
- package/dist/esm/fhirpath/index.d.ts +0 -4
- package/dist/esm/fhirpath/parse.d.ts +0 -64
- package/dist/esm/fhirpath/tokenize.d.ts +0 -4
- package/dist/esm/fhirpath/utils.d.ts +0 -95
- package/dist/esm/format.d.ts +0 -118
- package/dist/esm/hl7.d.ts +0 -136
- package/dist/esm/index.d.ts +0 -14
- package/dist/esm/jwt.d.ts +0 -5
- package/dist/esm/readablepromise.d.ts +0 -48
- package/dist/esm/search/details.d.ts +0 -33
- package/dist/esm/search/match.d.ts +0 -9
- package/dist/esm/search/parse.d.ts +0 -17
- package/dist/esm/search/search.d.ts +0 -66
- package/dist/esm/storage.d.ts +0 -47
- package/dist/esm/types.d.ts +0 -200
- package/dist/esm/utils.d.ts +0 -259
- /package/dist/{cjs → types}/cache.d.ts +0 -0
- /package/dist/{cjs → types}/client.d.ts +0 -0
- /package/dist/{cjs → types}/crypto.d.ts +0 -0
- /package/dist/{cjs → types}/eventtarget.d.ts +0 -0
- /package/dist/{cjs → types}/fhirlexer/index.d.ts +0 -0
- /package/dist/{cjs → types}/fhirlexer/parse.d.ts +0 -0
- /package/dist/{cjs → types}/fhirlexer/tokenize.d.ts +0 -0
- /package/dist/{cjs → types}/fhirmapper/parse.d.ts +0 -0
- /package/dist/{cjs → types}/fhirmapper/tokenize.d.ts +0 -0
- /package/dist/{cjs → types}/fhirpath/atoms.d.ts +0 -0
- /package/dist/{cjs → types}/fhirpath/date.d.ts +0 -0
- /package/dist/{cjs → types}/fhirpath/functions.d.ts +0 -0
- /package/dist/{cjs → types}/fhirpath/index.d.ts +0 -0
- /package/dist/{cjs → types}/fhirpath/parse.d.ts +0 -0
- /package/dist/{cjs → types}/fhirpath/tokenize.d.ts +0 -0
- /package/dist/{cjs → types}/fhirpath/utils.d.ts +0 -0
- /package/dist/{cjs → types}/format.d.ts +0 -0
- /package/dist/{cjs → types}/hl7.d.ts +0 -0
- /package/dist/{cjs → types}/index.d.ts +0 -0
- /package/dist/{cjs → types}/jwt.d.ts +0 -0
- /package/dist/{cjs → types}/readablepromise.d.ts +0 -0
- /package/dist/{cjs → types}/search/details.d.ts +0 -0
- /package/dist/{cjs → types}/search/match.d.ts +0 -0
- /package/dist/{cjs → types}/search/parse.d.ts +0 -0
- /package/dist/{cjs → types}/search/search.d.ts +0 -0
- /package/dist/{cjs → types}/storage.d.ts +0 -0
- /package/dist/{cjs → types}/types.d.ts +0 -0
- /package/dist/{cjs → types}/utils.d.ts +0 -0
package/dist/esm/client.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { LRUCache } from './cache.mjs';
|
|
|
3
3
|
import { getRandomString, encryptSHA256 } from './crypto.mjs';
|
|
4
4
|
import { EventTarget } from './eventtarget.mjs';
|
|
5
5
|
import { parseJWTPayload } from './jwt.mjs';
|
|
6
|
-
import { isOk } from './outcomes.mjs';
|
|
6
|
+
import { OperationOutcomeError, normalizeOperationOutcome, isOk } from './outcomes.mjs';
|
|
7
7
|
import { ReadablePromise } from './readablepromise.mjs';
|
|
8
8
|
import { ClientStorage } from './storage.mjs';
|
|
9
9
|
import { globalSchema, indexStructureDefinition, indexSearchParameter } from './types.mjs';
|
|
@@ -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.5-886af1d8";
|
|
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
|
|
@@ -1527,7 +1527,7 @@ async function _MedplumClient_request(method, url, options = {}) {
|
|
|
1527
1527
|
throw err;
|
|
1528
1528
|
}
|
|
1529
1529
|
if (response.status >= 400) {
|
|
1530
|
-
throw obj;
|
|
1530
|
+
throw new OperationOutcomeError(normalizeOperationOutcome(obj));
|
|
1531
1531
|
}
|
|
1532
1532
|
return obj;
|
|
1533
1533
|
}, _MedplumClient_fetchWithRetry = async function _MedplumClient_fetchWithRetry(url, options) {
|
|
@@ -1578,7 +1578,7 @@ async function _MedplumClient_executeAutoBatch() {
|
|
|
1578
1578
|
const entry = entries[i];
|
|
1579
1579
|
const responseEntry = response.entry?.[i];
|
|
1580
1580
|
if (responseEntry?.response?.outcome && !isOk(responseEntry.response.outcome)) {
|
|
1581
|
-
entry.reject(responseEntry.response.outcome);
|
|
1581
|
+
entry.reject(new OperationOutcomeError(responseEntry.response.outcome));
|
|
1582
1582
|
}
|
|
1583
1583
|
else {
|
|
1584
1584
|
entry.resolve(responseEntry?.resource);
|
|
@@ -1722,14 +1722,6 @@ async function _MedplumClient_verifyTokens(tokens) {
|
|
|
1722
1722
|
// Silently ignore if this environment does not support storage events
|
|
1723
1723
|
}
|
|
1724
1724
|
};
|
|
1725
|
-
/**
|
|
1726
|
-
* Returns the current window if available.
|
|
1727
|
-
* All access to the current window should use this to support SSR such as Next.js.
|
|
1728
|
-
* @returns The current window or undefined if not available.
|
|
1729
|
-
*/
|
|
1730
|
-
function getWindow() {
|
|
1731
|
-
return typeof window === 'undefined' ? undefined : window;
|
|
1732
|
-
}
|
|
1733
1725
|
/**
|
|
1734
1726
|
* Returns the default fetch method.
|
|
1735
1727
|
* The default fetch is currently only available in browser environments.
|
|
@@ -1737,19 +1729,20 @@ function getWindow() {
|
|
|
1737
1729
|
* @returns The default fetch function for the current environment.
|
|
1738
1730
|
*/
|
|
1739
1731
|
function getDefaultFetch() {
|
|
1740
|
-
|
|
1741
|
-
if (!window) {
|
|
1732
|
+
if (!globalThis.fetch) {
|
|
1742
1733
|
throw new Error('Fetch not available in this environment');
|
|
1743
1734
|
}
|
|
1744
|
-
return
|
|
1735
|
+
return globalThis.fetch.bind(globalThis);
|
|
1745
1736
|
}
|
|
1746
1737
|
/**
|
|
1747
1738
|
* Returns the base URL for the current page.
|
|
1748
1739
|
* @category HTTP
|
|
1749
1740
|
*/
|
|
1750
1741
|
function getWindowOrigin() {
|
|
1751
|
-
|
|
1752
|
-
|
|
1742
|
+
if (typeof window === 'undefined') {
|
|
1743
|
+
return '';
|
|
1744
|
+
}
|
|
1745
|
+
return window.location.protocol + '//' + window.location.host + '/';
|
|
1753
1746
|
}
|
|
1754
1747
|
function ensureTrailingSlash(url) {
|
|
1755
1748
|
if (!url) {
|