@medplum/core 2.0.14 → 2.0.16
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 +1244 -1101
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.min.cjs +1 -1
- package/dist/esm/base64.mjs +33 -0
- package/dist/esm/base64.mjs.map +1 -0
- package/dist/esm/cache.mjs +17 -23
- package/dist/esm/cache.mjs.map +1 -1
- package/dist/esm/client.mjs +500 -413
- package/dist/esm/client.mjs.map +1 -1
- package/dist/esm/eventtarget.mjs +6 -11
- package/dist/esm/eventtarget.mjs.map +1 -1
- package/dist/esm/fhirlexer/parse.mjs +15 -23
- package/dist/esm/fhirlexer/parse.mjs.map +1 -1
- package/dist/esm/fhirlexer/tokenize.mjs +190 -180
- package/dist/esm/fhirlexer/tokenize.mjs.map +1 -1
- package/dist/esm/fhirmapper/parse.mjs +264 -252
- package/dist/esm/fhirmapper/parse.mjs.map +1 -1
- package/dist/esm/fhirmapper/tokenize.mjs +0 -1
- package/dist/esm/fhirmapper/tokenize.mjs.map +1 -1
- package/dist/esm/fhirpath/atoms.mjs +0 -1
- package/dist/esm/fhirpath/atoms.mjs.map +1 -1
- package/dist/esm/fhirpath/parse.mjs +0 -1
- package/dist/esm/fhirpath/parse.mjs.map +1 -1
- package/dist/esm/fhirpath/tokenize.mjs +0 -1
- package/dist/esm/fhirpath/tokenize.mjs.map +1 -1
- package/dist/esm/filter/parse.mjs +0 -2
- package/dist/esm/filter/parse.mjs.map +1 -1
- package/dist/esm/filter/tokenize.mjs +0 -1
- package/dist/esm/filter/tokenize.mjs.map +1 -1
- package/dist/esm/format.mjs +24 -15
- package/dist/esm/format.mjs.map +1 -1
- package/dist/esm/index.min.mjs +1 -1
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/jwt.mjs +2 -9
- package/dist/esm/jwt.mjs.map +1 -1
- package/dist/esm/outcomes.mjs +15 -1
- package/dist/esm/outcomes.mjs.map +1 -1
- package/dist/esm/readablepromise.mjs +18 -23
- package/dist/esm/readablepromise.mjs.map +1 -1
- package/dist/esm/schema.mjs +146 -123
- package/dist/esm/schema.mjs.map +1 -1
- package/dist/esm/search/match.mjs +0 -2
- package/dist/esm/search/match.mjs.map +1 -1
- package/dist/esm/search/search.mjs +15 -9
- package/dist/esm/search/search.mjs.map +1 -1
- package/dist/esm/storage.mjs +13 -19
- package/dist/esm/storage.mjs.map +1 -1
- package/dist/types/base64.d.ts +14 -0
- package/dist/types/cache.d.ts +3 -1
- package/dist/types/client.d.ts +153 -1
- package/dist/types/eventtarget.d.ts +1 -1
- package/dist/types/fhirlexer/parse.d.ts +5 -2
- package/dist/types/fhirlexer/tokenize.d.ts +28 -1
- package/dist/types/format.d.ts +3 -1
- package/dist/types/outcomes.d.ts +1 -0
- package/dist/types/readablepromise.d.ts +4 -1
- package/dist/types/schema.d.ts +33 -1
- package/dist/types/storage.d.ts +2 -2
- package/package.json +1 -1
- package/dist/esm/node_modules/tslib/tslib.es6.mjs +0 -30
- package/dist/esm/node_modules/tslib/tslib.es6.mjs.map +0 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decodes a base64 string.
|
|
3
|
+
* Handles both browser and Node environments.
|
|
4
|
+
* @param data The base-64 encoded input string.
|
|
5
|
+
* @returns The decoded string.
|
|
6
|
+
*/
|
|
7
|
+
function decodeBase64(data) {
|
|
8
|
+
if (typeof window !== 'undefined') {
|
|
9
|
+
return window.atob(data);
|
|
10
|
+
}
|
|
11
|
+
if (typeof Buffer !== 'undefined') {
|
|
12
|
+
return Buffer.from(data, 'base64').toString('binary');
|
|
13
|
+
}
|
|
14
|
+
throw new Error('Unable to decode base64');
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Encodes a base64 string.
|
|
18
|
+
* Handles both browser and Node environments.
|
|
19
|
+
* @param data The unencoded input string.
|
|
20
|
+
* @returns The base-64 encoded string.
|
|
21
|
+
*/
|
|
22
|
+
function encodeBase64(data) {
|
|
23
|
+
if (typeof window !== 'undefined') {
|
|
24
|
+
return window.btoa(data);
|
|
25
|
+
}
|
|
26
|
+
if (typeof Buffer !== 'undefined') {
|
|
27
|
+
return Buffer.from(data, 'binary').toString('base64');
|
|
28
|
+
}
|
|
29
|
+
throw new Error('Unable to encode base64');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { decodeBase64, encodeBase64 };
|
|
33
|
+
//# sourceMappingURL=base64.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base64.mjs","sources":["../../src/base64.ts"],"sourcesContent":["/**\n * Decodes a base64 string.\n * Handles both browser and Node environments.\n * @param data The base-64 encoded input string.\n * @returns The decoded string.\n */\nexport function decodeBase64(data: string): string {\n if (typeof window !== 'undefined') {\n return window.atob(data);\n }\n if (typeof Buffer !== 'undefined') {\n return Buffer.from(data, 'base64').toString('binary');\n }\n throw new Error('Unable to decode base64');\n}\n\n/**\n * Encodes a base64 string.\n * Handles both browser and Node environments.\n * @param data The unencoded input string.\n * @returns The base-64 encoded string.\n */\nexport function encodeBase64(data: string): string {\n if (typeof window !== 'undefined') {\n return window.btoa(data);\n }\n if (typeof Buffer !== 'undefined') {\n return Buffer.from(data, 'binary').toString('base64');\n }\n throw new Error('Unable to encode base64');\n}\n"],"names":[],"mappings":"AAAA;;;;;AAKG;AACG,SAAU,YAAY,CAAC,IAAY,EAAA;AACvC,IAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AACjC,QAAA,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,KAAA;AACD,IAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AACjC,QAAA,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACvD,KAAA;AACD,IAAA,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;AAKG;AACG,SAAU,YAAY,CAAC,IAAY,EAAA;AACvC,IAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AACjC,QAAA,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,KAAA;AACD,IAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AACjC,QAAA,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACvD,KAAA;AACD,IAAA,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;AAC7C;;;;"}
|
package/dist/esm/cache.mjs
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
1
|
-
import { __classPrivateFieldSet, __classPrivateFieldGet } from './node_modules/tslib/tslib.es6.mjs';
|
|
2
|
-
|
|
3
|
-
var _LRUCache_instances, _LRUCache_max, _LRUCache_cache, _LRUCache_first;
|
|
4
1
|
/**
|
|
5
2
|
* LRU cache (least recently used)
|
|
6
3
|
* Source: https://stackoverflow.com/a/46432113
|
|
7
4
|
*/
|
|
8
5
|
class LRUCache {
|
|
9
6
|
constructor(max = 10) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
_LRUCache_cache.set(this, void 0);
|
|
13
|
-
__classPrivateFieldSet(this, _LRUCache_max, max, "f");
|
|
14
|
-
__classPrivateFieldSet(this, _LRUCache_cache, new Map(), "f");
|
|
7
|
+
this.max = max;
|
|
8
|
+
this.cache = new Map();
|
|
15
9
|
}
|
|
16
10
|
/**
|
|
17
11
|
* Deletes all values from the cache.
|
|
18
12
|
*/
|
|
19
13
|
clear() {
|
|
20
|
-
|
|
14
|
+
this.cache.clear();
|
|
21
15
|
}
|
|
22
16
|
/**
|
|
23
17
|
* Returns the value for the given key.
|
|
@@ -25,10 +19,10 @@ class LRUCache {
|
|
|
25
19
|
* @returns The value if found; undefined otherwise.
|
|
26
20
|
*/
|
|
27
21
|
get(key) {
|
|
28
|
-
const item =
|
|
22
|
+
const item = this.cache.get(key);
|
|
29
23
|
if (item) {
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
this.cache.delete(key);
|
|
25
|
+
this.cache.set(key, item);
|
|
32
26
|
}
|
|
33
27
|
return item;
|
|
34
28
|
}
|
|
@@ -38,33 +32,33 @@ class LRUCache {
|
|
|
38
32
|
* @param val The value to set.
|
|
39
33
|
*/
|
|
40
34
|
set(key, val) {
|
|
41
|
-
if (
|
|
42
|
-
|
|
35
|
+
if (this.cache.has(key)) {
|
|
36
|
+
this.cache.delete(key);
|
|
43
37
|
}
|
|
44
|
-
else if (
|
|
45
|
-
|
|
38
|
+
else if (this.cache.size >= this.max) {
|
|
39
|
+
this.cache.delete(this.first());
|
|
46
40
|
}
|
|
47
|
-
|
|
41
|
+
this.cache.set(key, val);
|
|
48
42
|
}
|
|
49
43
|
/**
|
|
50
44
|
* Deletes the value for the given key.
|
|
51
45
|
* @param key The key to delete.
|
|
52
46
|
*/
|
|
53
47
|
delete(key) {
|
|
54
|
-
|
|
48
|
+
this.cache.delete(key);
|
|
55
49
|
}
|
|
56
50
|
/**
|
|
57
51
|
* Returns the list of all keys in the cache.
|
|
58
52
|
* @returns The array of keys in the cache.
|
|
59
53
|
*/
|
|
60
54
|
keys() {
|
|
61
|
-
return
|
|
55
|
+
return this.cache.keys();
|
|
56
|
+
}
|
|
57
|
+
first() {
|
|
58
|
+
// This works because the Map class maintains ordered keys.
|
|
59
|
+
return this.cache.keys().next().value;
|
|
62
60
|
}
|
|
63
61
|
}
|
|
64
|
-
_LRUCache_max = new WeakMap(), _LRUCache_cache = new WeakMap(), _LRUCache_instances = new WeakSet(), _LRUCache_first = function _LRUCache_first() {
|
|
65
|
-
// This works because the Map class maintains ordered keys.
|
|
66
|
-
return __classPrivateFieldGet(this, _LRUCache_cache, "f").keys().next().value;
|
|
67
|
-
};
|
|
68
62
|
|
|
69
63
|
export { LRUCache };
|
|
70
64
|
//# sourceMappingURL=cache.mjs.map
|
package/dist/esm/cache.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.mjs","sources":["../../src/cache.ts"],"sourcesContent":["/**\n * LRU cache (least recently used)\n * Source: https://stackoverflow.com/a/46432113\n */\nexport class LRUCache<T> {\n readonly
|
|
1
|
+
{"version":3,"file":"cache.mjs","sources":["../../src/cache.ts"],"sourcesContent":["/**\n * LRU cache (least recently used)\n * Source: https://stackoverflow.com/a/46432113\n */\nexport class LRUCache<T> {\n private readonly max: number;\n private readonly cache: Map<string, T>;\n\n constructor(max = 10) {\n this.max = max;\n this.cache = new Map();\n }\n\n /**\n * Deletes all values from the cache.\n */\n clear(): void {\n this.cache.clear();\n }\n\n /**\n * Returns the value for the given key.\n * @param key The key to retrieve.\n * @returns The value if found; undefined otherwise.\n */\n get(key: string): T | undefined {\n const item = this.cache.get(key);\n if (item) {\n this.cache.delete(key);\n this.cache.set(key, item);\n }\n return item;\n }\n\n /**\n * Sets the value for the given key.\n * @param key The key to set.\n * @param val The value to set.\n */\n set(key: string, val: T): void {\n if (this.cache.has(key)) {\n this.cache.delete(key);\n } else if (this.cache.size >= this.max) {\n this.cache.delete(this.first());\n }\n this.cache.set(key, val);\n }\n\n /**\n * Deletes the value for the given key.\n * @param key The key to delete.\n */\n delete(key: string): void {\n this.cache.delete(key);\n }\n\n /**\n * Returns the list of all keys in the cache.\n * @returns The array of keys in the cache.\n */\n keys(): IterableIterator<string> {\n return this.cache.keys();\n }\n\n private first(): string {\n // This works because the Map class maintains ordered keys.\n return this.cache.keys().next().value;\n }\n}\n"],"names":[],"mappings":"AAAA;;;AAGG;MACU,QAAQ,CAAA;IAInB,WAAY,CAAA,GAAG,GAAG,EAAE,EAAA;AAClB,QAAA,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;AACf,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC;KACxB;AAED;;AAEG;IACH,K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