@medplum/core 0.9.6 → 0.9.7
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/README.md +3 -23
- package/dist/cjs/index.js +2696 -93
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.min.js +1 -1
- package/dist/cjs/index.min.js.map +1 -1
- package/dist/cjs/package.json +1 -0
- package/dist/esm/index.js +2691 -92
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +1 -1
- package/dist/esm/index.min.js.map +1 -1
- package/dist/esm/package.json +1 -0
- package/dist/types/client.d.ts +134 -36
- package/dist/types/fhirpath/atoms.d.ts +150 -0
- package/dist/types/fhirpath/date.d.ts +1 -0
- package/dist/types/fhirpath/functions.d.ts +964 -0
- package/dist/types/fhirpath/index.d.ts +2 -0
- package/dist/types/fhirpath/parse.d.ts +17 -0
- package/dist/types/fhirpath/tokenize.d.ts +5 -0
- package/dist/types/fhirpath/utils.d.ts +65 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/utils.d.ts +12 -0
- package/package.json +2 -4
- package/dist/types/fix-ro-iddentifiers.d.ts +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FhirPathAtom } from './atoms';
|
|
2
|
+
/**
|
|
3
|
+
* Parses a FHIRPath expression into an AST.
|
|
4
|
+
* The result can be used to evaluate the expression against a resource or other object.
|
|
5
|
+
* This method is useful if you know that you will evaluate the same expression many times
|
|
6
|
+
* against different resources.
|
|
7
|
+
* @param input The FHIRPath expression to parse.
|
|
8
|
+
* @returns The AST representing the expression.
|
|
9
|
+
*/
|
|
10
|
+
export declare function parseFhirPath(input: string): FhirPathAtom;
|
|
11
|
+
/**
|
|
12
|
+
* Evaluates a FHIRPath expression against a resource or other object.
|
|
13
|
+
* @param input The FHIRPath expression to parse.
|
|
14
|
+
* @param context The resource or object to evaluate the expression against.
|
|
15
|
+
* @returns The result of the FHIRPath expression against the resource or object.
|
|
16
|
+
*/
|
|
17
|
+
export declare function evalFhirPath(input: string, context: unknown): unknown[];
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Period, Quantity } from '@medplum/fhirtypes';
|
|
2
|
+
/**
|
|
3
|
+
* Ensures that the value is wrapped in an array.
|
|
4
|
+
* @param input The input as a an array or a value.
|
|
5
|
+
* @returns The input as an array.
|
|
6
|
+
*/
|
|
7
|
+
export declare function ensureArray(input: unknown): unknown[];
|
|
8
|
+
/**
|
|
9
|
+
* Applies a function to single value or an array of values.
|
|
10
|
+
* @param context The context which will be passed to the function.
|
|
11
|
+
* @param fn The function to apply.
|
|
12
|
+
* @returns The result of the function.
|
|
13
|
+
*/
|
|
14
|
+
export declare function applyMaybeArray(context: unknown, fn: (context: unknown) => unknown): unknown;
|
|
15
|
+
/**
|
|
16
|
+
* Determines if the input is an empty array.
|
|
17
|
+
* @param obj Any value or array of values.
|
|
18
|
+
* @returns True if the input is an empty array.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isEmptyArray(obj: unknown): boolean;
|
|
21
|
+
export declare function isFalsy(obj: unknown): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Converts unknown object into a JavaScript boolean.
|
|
24
|
+
* Note that this is different than the FHIRPath "toBoolean",
|
|
25
|
+
* which has particular semantics around arrays, empty arrays, and type conversions.
|
|
26
|
+
* @param obj Any value or array of values.
|
|
27
|
+
* @returns The converted boolean value according to FHIRPath rules.
|
|
28
|
+
*/
|
|
29
|
+
export declare function toJsBoolean(obj: unknown): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Removes duplicates in array using FHIRPath equality rules.
|
|
32
|
+
* @param arr The input array.
|
|
33
|
+
* @returns The result array with duplicates removed.
|
|
34
|
+
*/
|
|
35
|
+
export declare function removeDuplicates(arr: unknown[]): unknown[];
|
|
36
|
+
/**
|
|
37
|
+
* Determines if two values are equal according to FHIRPath equality rules.
|
|
38
|
+
* @param x The first value.
|
|
39
|
+
* @param y The second value.
|
|
40
|
+
* @returns True if equal.
|
|
41
|
+
*/
|
|
42
|
+
export declare function fhirPathEquals(x: unknown, y: unknown): boolean | [];
|
|
43
|
+
/**
|
|
44
|
+
* Determines if two values are equal according to FHIRPath equality rules.
|
|
45
|
+
* @param x The first value.
|
|
46
|
+
* @param y The second value.
|
|
47
|
+
* @returns True if equal.
|
|
48
|
+
*/
|
|
49
|
+
export declare function fhirPathEquivalent(x: unknown, y: unknown): boolean | [];
|
|
50
|
+
export declare function fhirPathIs(value: unknown, desiredType: unknown): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Determines if the input is a Period object.
|
|
53
|
+
* This is heuristic based, as we do not have strong typing at runtime.
|
|
54
|
+
* @param input The input value.
|
|
55
|
+
* @returns True if the input is a period.
|
|
56
|
+
*/
|
|
57
|
+
export declare function isPeriod(input: unknown): input is Period;
|
|
58
|
+
/**
|
|
59
|
+
* Determines if the input is a Quantity object.
|
|
60
|
+
* This is heuristic based, as we do not have strong typing at runtime.
|
|
61
|
+
* @param input The input value.
|
|
62
|
+
* @returns True if the input is a quantity.
|
|
63
|
+
*/
|
|
64
|
+
export declare function isQuantity(input: unknown): input is Quantity;
|
|
65
|
+
export declare function isQuantityEquivalent(x: Quantity, y: Quantity): boolean;
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/utils.d.ts
CHANGED
|
@@ -71,6 +71,18 @@ export declare function calculateAgeString(birthDateStr: string, endDateStr?: st
|
|
|
71
71
|
* @returns Questionnaire answers mapped by link ID.
|
|
72
72
|
*/
|
|
73
73
|
export declare function getQuestionnaireAnswers(response: QuestionnaireResponse): Record<string, QuestionnaireResponseItemAnswer>;
|
|
74
|
+
/**
|
|
75
|
+
* Returns the resource identifier for the given system.
|
|
76
|
+
*
|
|
77
|
+
* If multiple identifiers exist with the same system, the first one is returned.
|
|
78
|
+
*
|
|
79
|
+
* If the system is not found, then returns undefined.
|
|
80
|
+
*
|
|
81
|
+
* @param resource The resource to check.
|
|
82
|
+
* @param system The identifier system.
|
|
83
|
+
* @returns The identifier value if found; otherwise undefined.
|
|
84
|
+
*/
|
|
85
|
+
export declare function getIdentifier(resource: Resource, system: string): string | undefined;
|
|
74
86
|
/**
|
|
75
87
|
* Returns an extension value by extension URLs.
|
|
76
88
|
* @param resource The base resource.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medplum/core",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.7",
|
|
4
4
|
"description": "Medplum TS/JS Library",
|
|
5
5
|
"author": "Medplum <hello@medplum.com>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -17,9 +17,7 @@
|
|
|
17
17
|
"test": "jest"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@medplum/fhirtypes": "0.9.
|
|
21
|
-
"@types/nodemailer": "6.4.4",
|
|
22
|
-
"fast-json-patch": "3.1.1"
|
|
20
|
+
"@medplum/fhirtypes": "0.9.7"
|
|
23
21
|
},
|
|
24
22
|
"main": "dist/cjs/index.js",
|
|
25
23
|
"module": "dist/esm/index.js",
|
|
File without changes
|