@medplum/core 2.0.24 → 2.0.26

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.
Files changed (90) hide show
  1. package/dist/cjs/index.cjs +28 -14114
  2. package/dist/cjs/index.cjs.map +7 -1
  3. package/dist/esm/index.mjs +31 -29
  4. package/dist/esm/index.mjs.map +7 -1
  5. package/dist/types/client.d.ts +42 -10
  6. package/dist/types/fhirpath/atoms.d.ts +25 -11
  7. package/dist/types/fhirpath/parse.d.ts +33 -33
  8. package/dist/types/index.d.ts +1 -1
  9. package/dist/types/jwt.d.ts +6 -0
  10. package/dist/types/schema.d.ts +1 -0
  11. package/dist/types/search/details.d.ts +3 -1
  12. package/dist/types/types.d.ts +2 -2
  13. package/dist/types/typeschema/validation.d.ts +1 -1
  14. package/dist/types/utils.d.ts +15 -0
  15. package/package.json +5 -2
  16. package/dist/cjs/index.min.cjs +0 -1
  17. package/dist/esm/access.mjs +0 -142
  18. package/dist/esm/access.mjs.map +0 -1
  19. package/dist/esm/base-schema.json.mjs +0 -4408
  20. package/dist/esm/base-schema.json.mjs.map +0 -1
  21. package/dist/esm/base64.mjs +0 -33
  22. package/dist/esm/base64.mjs.map +0 -1
  23. package/dist/esm/bundle.mjs +0 -36
  24. package/dist/esm/bundle.mjs.map +0 -1
  25. package/dist/esm/cache.mjs +0 -64
  26. package/dist/esm/cache.mjs.map +0 -1
  27. package/dist/esm/client.mjs +0 -2168
  28. package/dist/esm/client.mjs.map +0 -1
  29. package/dist/esm/crypto.mjs +0 -22
  30. package/dist/esm/crypto.mjs.map +0 -1
  31. package/dist/esm/eventtarget.mjs +0 -36
  32. package/dist/esm/eventtarget.mjs.map +0 -1
  33. package/dist/esm/fhirlexer/parse.mjs +0 -122
  34. package/dist/esm/fhirlexer/parse.mjs.map +0 -1
  35. package/dist/esm/fhirlexer/tokenize.mjs +0 -231
  36. package/dist/esm/fhirlexer/tokenize.mjs.map +0 -1
  37. package/dist/esm/fhirmapper/parse.mjs +0 -329
  38. package/dist/esm/fhirmapper/parse.mjs.map +0 -1
  39. package/dist/esm/fhirmapper/tokenize.mjs +0 -13
  40. package/dist/esm/fhirmapper/tokenize.mjs.map +0 -1
  41. package/dist/esm/fhirpath/atoms.mjs +0 -347
  42. package/dist/esm/fhirpath/atoms.mjs.map +0 -1
  43. package/dist/esm/fhirpath/date.mjs +0 -24
  44. package/dist/esm/fhirpath/date.mjs.map +0 -1
  45. package/dist/esm/fhirpath/functions.mjs +0 -1626
  46. package/dist/esm/fhirpath/functions.mjs.map +0 -1
  47. package/dist/esm/fhirpath/parse.mjs +0 -145
  48. package/dist/esm/fhirpath/parse.mjs.map +0 -1
  49. package/dist/esm/fhirpath/tokenize.mjs +0 -10
  50. package/dist/esm/fhirpath/tokenize.mjs.map +0 -1
  51. package/dist/esm/fhirpath/utils.mjs +0 -377
  52. package/dist/esm/fhirpath/utils.mjs.map +0 -1
  53. package/dist/esm/filter/parse.mjs +0 -101
  54. package/dist/esm/filter/parse.mjs.map +0 -1
  55. package/dist/esm/filter/tokenize.mjs +0 -16
  56. package/dist/esm/filter/tokenize.mjs.map +0 -1
  57. package/dist/esm/filter/types.mjs +0 -34
  58. package/dist/esm/filter/types.mjs.map +0 -1
  59. package/dist/esm/format.mjs +0 -390
  60. package/dist/esm/format.mjs.map +0 -1
  61. package/dist/esm/hl7.mjs +0 -242
  62. package/dist/esm/hl7.mjs.map +0 -1
  63. package/dist/esm/index.min.mjs +0 -1
  64. package/dist/esm/jwt.mjs +0 -30
  65. package/dist/esm/jwt.mjs.map +0 -1
  66. package/dist/esm/node_modules/tslib/package.json +0 -1
  67. package/dist/esm/outcomes.mjs +0 -295
  68. package/dist/esm/outcomes.mjs.map +0 -1
  69. package/dist/esm/readablepromise.mjs +0 -82
  70. package/dist/esm/readablepromise.mjs.map +0 -1
  71. package/dist/esm/schema.mjs +0 -417
  72. package/dist/esm/schema.mjs.map +0 -1
  73. package/dist/esm/search/details.mjs +0 -162
  74. package/dist/esm/search/details.mjs.map +0 -1
  75. package/dist/esm/search/match.mjs +0 -166
  76. package/dist/esm/search/match.mjs.map +0 -1
  77. package/dist/esm/search/search.mjs +0 -378
  78. package/dist/esm/search/search.mjs.map +0 -1
  79. package/dist/esm/sftp.mjs +0 -24
  80. package/dist/esm/sftp.mjs.map +0 -1
  81. package/dist/esm/storage.mjs +0 -95
  82. package/dist/esm/storage.mjs.map +0 -1
  83. package/dist/esm/types.mjs +0 -370
  84. package/dist/esm/types.mjs.map +0 -1
  85. package/dist/esm/typeschema/types.mjs +0 -278
  86. package/dist/esm/typeschema/types.mjs.map +0 -1
  87. package/dist/esm/typeschema/validation.mjs +0 -262
  88. package/dist/esm/typeschema/validation.mjs.map +0 -1
  89. package/dist/esm/utils.mjs +0 -632
  90. package/dist/esm/utils.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"base-schema.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,33 +0,0 @@
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
@@ -1 +0,0 @@
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;;;;"}
@@ -1,36 +0,0 @@
1
- /**
2
- * More on Bundles can be found here
3
- * http://hl7.org/fhir/R4/bundle.html
4
- */
5
- /**
6
- * Takes a bundle and creates a Transaction Type bundle
7
- * @param bundle The Bundle object that we'll receive from the search query
8
- * @returns transaction type bundle
9
- */
10
- function convertToTransactionBundle(bundle) {
11
- for (const entry of bundle.entry || []) {
12
- delete entry.resource?.meta;
13
- entry.fullUrl = 'urn:uuid:' + entry.resource?.id;
14
- delete entry.resource?.id;
15
- }
16
- const input = bundle.entry;
17
- const jsonString = JSON.stringify({
18
- resourceType: 'Bundle',
19
- type: 'transaction',
20
- entry: input?.map((entry) => ({
21
- fullUrl: entry.fullUrl,
22
- request: { method: 'POST', url: entry.resource.resourceType },
23
- resource: entry.resource,
24
- })),
25
- }, replacer, 2);
26
- return JSON.parse(jsonString);
27
- }
28
- function replacer(key, value) {
29
- if (key === 'reference' && typeof value === 'string' && value.includes('/')) {
30
- return 'urn:uuid:' + value.split('/')[1];
31
- }
32
- return value;
33
- }
34
-
35
- export { convertToTransactionBundle };
36
- //# sourceMappingURL=bundle.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bundle.mjs","sources":["../../src/bundle.ts"],"sourcesContent":["import { Bundle } from '@medplum/fhirtypes';\n\n/**\n * More on Bundles can be found here\n * http://hl7.org/fhir/R4/bundle.html\n */\n\n/**\n * Takes a bundle and creates a Transaction Type bundle\n * @param bundle The Bundle object that we'll receive from the search query\n * @returns transaction type bundle\n */\nexport function convertToTransactionBundle(bundle: Bundle): Bundle {\n for (const entry of bundle.entry || []) {\n delete entry.resource?.meta;\n entry.fullUrl = 'urn:uuid:' + entry.resource?.id;\n delete entry.resource?.id;\n }\n const input = bundle.entry;\n const jsonString = JSON.stringify(\n {\n resourceType: 'Bundle',\n type: 'transaction',\n entry: input?.map((entry: any) => ({\n fullUrl: entry.fullUrl,\n request: { method: 'POST', url: entry.resource.resourceType },\n resource: entry.resource,\n })),\n },\n replacer,\n 2\n );\n return JSON.parse(jsonString);\n}\n\nfunction replacer(key: string, value: string): string {\n if (key === 'reference' && typeof value === 'string' && value.includes('/')) {\n return 'urn:uuid:' + value.split('/')[1];\n }\n return value;\n}\n"],"names":[],"mappings":"AAEA;;;AAGG;AAEH;;;;AAIG;AACG,SAAU,0BAA0B,CAAC,MAAc,EAAA;IACvD,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,KAAK,IAAI,EAAE,EAAE;AACtC,QAAA,OAAO,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC;QAC5B,KAAK,CAAC,OAAO,GAAG,WAAW,GAAG,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;AACjD,QAAA,OAAO,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;AAC3B,KAAA;AACD,IAAA,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;AAC3B,IAAA,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAC/B;AACE,QAAA,YAAY,EAAE,QAAQ;AACtB,QAAA,IAAI,EAAE,aAAa;QACnB,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,KAAU,MAAM;YACjC,OAAO,EAAE,KAAK,CAAC,OAAO;AACtB,YAAA,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,QAAQ,CAAC,YAAY,EAAE;YAC7D,QAAQ,EAAE,KAAK,CAAC,QAAQ;AACzB,SAAA,CAAC,CAAC;AACJ,KAAA,EACD,QAAQ,EACR,CAAC,CACF,CAAC;AACF,IAAA,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;AAChC,CAAC;AAED,SAAS,QAAQ,CAAC,GAAW,EAAE,KAAa,EAAA;AAC1C,IAAA,IAAI,GAAG,KAAK,WAAW,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QAC3E,OAAO,WAAW,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1C,KAAA;AACD,IAAA,OAAO,KAAK,CAAC;AACf;;;;"}
@@ -1,64 +0,0 @@
1
- /**
2
- * LRU cache (least recently used)
3
- * Source: https://stackoverflow.com/a/46432113
4
- */
5
- class LRUCache {
6
- constructor(max = 10) {
7
- this.max = max;
8
- this.cache = new Map();
9
- }
10
- /**
11
- * Deletes all values from the cache.
12
- */
13
- clear() {
14
- this.cache.clear();
15
- }
16
- /**
17
- * Returns the value for the given key.
18
- * @param key The key to retrieve.
19
- * @returns The value if found; undefined otherwise.
20
- */
21
- get(key) {
22
- const item = this.cache.get(key);
23
- if (item) {
24
- this.cache.delete(key);
25
- this.cache.set(key, item);
26
- }
27
- return item;
28
- }
29
- /**
30
- * Sets the value for the given key.
31
- * @param key The key to set.
32
- * @param val The value to set.
33
- */
34
- set(key, val) {
35
- if (this.cache.has(key)) {
36
- this.cache.delete(key);
37
- }
38
- else if (this.cache.size >= this.max) {
39
- this.cache.delete(this.first());
40
- }
41
- this.cache.set(key, val);
42
- }
43
- /**
44
- * Deletes the value for the given key.
45
- * @param key The key to delete.
46
- */
47
- delete(key) {
48
- this.cache.delete(key);
49
- }
50
- /**
51
- * Returns the list of all keys in the cache.
52
- * @returns The array of keys in the cache.
53
- */
54
- keys() {
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;
60
- }
61
- }
62
-
63
- export { LRUCache };
64
- //# sourceMappingURL=cache.mjs.map
@@ -1 +0,0 @@
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,KAAK,GAAA;AACH,QAAA,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;KACpB;AAED;;;;AA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