@medplum/core 0.9.28 → 0.9.31

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 (42) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/cache.d.ts +34 -0
  3. package/dist/cjs/client.d.ts +1095 -0
  4. package/dist/cjs/crypto.d.ts +9 -0
  5. package/dist/cjs/eventtarget.d.ts +13 -0
  6. package/dist/cjs/fhirpath/atoms.d.ts +150 -0
  7. package/dist/cjs/fhirpath/date.d.ts +1 -0
  8. package/dist/cjs/fhirpath/functions.d.ts +5 -0
  9. package/dist/cjs/fhirpath/index.d.ts +4 -0
  10. package/dist/cjs/fhirpath/parse.d.ts +24 -0
  11. package/dist/cjs/fhirpath/tokenize.d.ts +5 -0
  12. package/dist/cjs/fhirpath/utils.d.ts +95 -0
  13. package/dist/cjs/format.d.ts +21 -0
  14. package/dist/cjs/hl7.d.ts +43 -0
  15. package/dist/cjs/index.d.ts +12 -0
  16. package/dist/cjs/index.js +89 -47
  17. package/dist/cjs/index.js.map +1 -1
  18. package/dist/cjs/index.min.js +1 -1
  19. package/dist/cjs/index.min.js.map +1 -1
  20. package/dist/cjs/jwt.d.ts +5 -0
  21. package/dist/cjs/outcomes.d.ts +30 -0
  22. package/dist/cjs/readablepromise.d.ts +48 -0
  23. package/dist/cjs/search.d.ts +64 -0
  24. package/dist/cjs/searchparams.d.ts +35 -0
  25. package/dist/cjs/storage.d.ts +47 -0
  26. package/dist/cjs/types.d.ts +148 -0
  27. package/dist/cjs/utils.d.ts +245 -0
  28. package/dist/esm/client.d.ts +17 -15
  29. package/dist/esm/client.js +40 -35
  30. package/dist/esm/client.js.map +1 -1
  31. package/dist/esm/fhirpath/utils.js +3 -3
  32. package/dist/esm/fhirpath/utils.js.map +1 -1
  33. package/dist/esm/index.js +2 -2
  34. package/dist/esm/index.min.js +1 -1
  35. package/dist/esm/index.min.js.map +1 -1
  36. package/dist/esm/outcomes.d.ts +2 -1
  37. package/dist/esm/outcomes.js +27 -10
  38. package/dist/esm/outcomes.js.map +1 -1
  39. package/dist/esm/utils.d.ts +21 -0
  40. package/dist/esm/utils.js +18 -1
  41. package/dist/esm/utils.js.map +1 -1
  42. package/package.json +3 -3
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Parses the JWT payload.
3
+ * @param token JWT token
4
+ */
5
+ export declare function parseJWTPayload(token: string): Record<string, number | string>;
@@ -0,0 +1,30 @@
1
+ import { OperationOutcome } from '@medplum/fhirtypes';
2
+ export declare const allOk: OperationOutcome;
3
+ export declare const created: OperationOutcome;
4
+ export declare const notModified: OperationOutcome;
5
+ export declare const notFound: OperationOutcome;
6
+ export declare const unauthorized: OperationOutcome;
7
+ export declare const forbidden: OperationOutcome;
8
+ export declare const gone: OperationOutcome;
9
+ export declare const tooManyRequests: OperationOutcome;
10
+ export declare function badRequest(details: string, expression?: string): OperationOutcome;
11
+ export declare function isOk(outcome: OperationOutcome): boolean;
12
+ export declare function isNotFound(outcome: OperationOutcome): boolean;
13
+ export declare function isGone(outcome: OperationOutcome): boolean;
14
+ export declare function getStatus(outcome: OperationOutcome): number;
15
+ /**
16
+ * Asserts that the operation completed successfully and that the resource is defined.
17
+ * @param outcome The operation outcome.
18
+ * @param resource The resource that may or may not have been returned.
19
+ */
20
+ export declare function assertOk<T>(outcome: OperationOutcome, resource: T | undefined): asserts resource is T;
21
+ export declare class OperationOutcomeError extends Error {
22
+ readonly outcome: OperationOutcome;
23
+ constructor(outcome: OperationOutcome);
24
+ }
25
+ /**
26
+ * Normalizes an error object into a displayable error string.
27
+ * @param error The error value which could be a string, Error, OperationOutcome, or other unknown type.
28
+ * @returns A display string for the error.
29
+ */
30
+ export declare function normalizeErrorString(error: unknown): string;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * The ReadablePromise class wraps a request promise suitable for React Suspense.
3
+ * See: https://blog.logrocket.com/react-suspense-data-fetching/#wrappromise-js
4
+ * See: https://github.com/ovieokeh/suspense-data-fetching/blob/master/lib/api/wrapPromise.js
5
+ */
6
+ export declare class ReadablePromise<T> implements Promise<T> {
7
+ #private;
8
+ readonly [Symbol.toStringTag]: string;
9
+ constructor(requestPromise: Promise<T>);
10
+ /**
11
+ * Returns true if the promise is pending.
12
+ * @returns True if the Promise is pending.
13
+ */
14
+ isPending(): boolean;
15
+ /**
16
+ * Returns true if the promise resolved successfully.
17
+ * @returns True if the Promise resolved successfully.
18
+ */
19
+ isOk(): boolean;
20
+ /**
21
+ * Attempts to read the value of the promise.
22
+ * If the promise is pending, this method will throw a promise.
23
+ * If the promise rejected, this method will throw the rejection reason.
24
+ * If the promise resolved, this method will return the resolved value.
25
+ * @returns The resolved value of the Promise.
26
+ */
27
+ read(): T;
28
+ /**
29
+ * Attaches callbacks for the resolution and/or rejection of the Promise.
30
+ * @param onfulfilled The callback to execute when the Promise is resolved.
31
+ * @param onrejected The callback to execute when the Promise is rejected.
32
+ * @returns A Promise for the completion of which ever callback is executed.
33
+ */
34
+ then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
35
+ /**
36
+ * Attaches a callback for only the rejection of the Promise.
37
+ * @param onrejected The callback to execute when the Promise is rejected.
38
+ * @returns A Promise for the completion of the callback.
39
+ */
40
+ catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
41
+ /**
42
+ * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The
43
+ * resolved value cannot be modified from the callback.
44
+ * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected).
45
+ * @returns A Promise for the completion of the callback.
46
+ */
47
+ finally(onfinally?: (() => void) | undefined | null): Promise<T>;
48
+ }
@@ -0,0 +1,64 @@
1
+ export declare const DEFAULT_SEARCH_COUNT = 20;
2
+ export interface SearchRequest {
3
+ readonly resourceType: string;
4
+ filters?: Filter[];
5
+ sortRules?: SortRule[];
6
+ offset?: number;
7
+ count?: number;
8
+ fields?: string[];
9
+ name?: string;
10
+ total?: 'none' | 'estimate' | 'accurate';
11
+ }
12
+ export interface Filter {
13
+ code: string;
14
+ operator: Operator;
15
+ value: string;
16
+ unitSystem?: string;
17
+ unitCode?: string;
18
+ }
19
+ export interface SortRule {
20
+ code: string;
21
+ descending?: boolean;
22
+ }
23
+ /**
24
+ * Search operators.
25
+ * These operators represent "modifiers" and "prefixes" in FHIR search.
26
+ * See: https://www.hl7.org/fhir/search.html
27
+ */
28
+ export declare enum Operator {
29
+ EQUALS = "eq",
30
+ NOT_EQUALS = "ne",
31
+ GREATER_THAN = "gt",
32
+ LESS_THAN = "lt",
33
+ GREATER_THAN_OR_EQUALS = "ge",
34
+ LESS_THAN_OR_EQUALS = "le",
35
+ STARTS_AFTER = "sa",
36
+ ENDS_BEFORE = "eb",
37
+ APPROXIMATELY = "ap",
38
+ CONTAINS = "contains",
39
+ EXACT = "exact",
40
+ TEXT = "text",
41
+ NOT = "not",
42
+ ABOVE = "above",
43
+ BELOW = "below",
44
+ IN = "in",
45
+ NOT_IN = "not-in",
46
+ OF_TYPE = "of-type",
47
+ MISSING = "missing"
48
+ }
49
+ /**
50
+ * Parses a URL into a SearchRequest.
51
+ *
52
+ * See the FHIR search spec: http://hl7.org/fhir/r4/search.html
53
+ *
54
+ * @param url The URL to parse.
55
+ * @returns Parsed search definition.
56
+ */
57
+ export declare function parseSearchDefinition(url: string): SearchRequest;
58
+ /**
59
+ * Formats a search definition object into a query string.
60
+ * Note: The return value does not include the resource type.
61
+ * @param {!SearchRequest} definition The search definition.
62
+ * @returns Formatted URL.
63
+ */
64
+ export declare function formatSearchQuery(definition: SearchRequest): string;
@@ -0,0 +1,35 @@
1
+ import { ElementDefinition, SearchParameter } from '@medplum/fhirtypes';
2
+ import { IndexedStructureDefinition } from './types';
3
+ export declare enum SearchParameterType {
4
+ BOOLEAN = "BOOLEAN",
5
+ NUMBER = "NUMBER",
6
+ QUANTITY = "QUANTITY",
7
+ TEXT = "TEXT",
8
+ REFERENCE = "REFERENCE",
9
+ DATE = "DATE",
10
+ DATETIME = "DATETIME",
11
+ PERIOD = "PERIOD"
12
+ }
13
+ export interface SearchParameterDetails {
14
+ readonly columnName: string;
15
+ readonly type: SearchParameterType;
16
+ readonly elementDefinition?: ElementDefinition;
17
+ readonly array?: boolean;
18
+ }
19
+ /**
20
+ * Returns the type details of a SearchParameter.
21
+ *
22
+ * The SearchParameter resource has a "type" parameter, but that is missing some critical information.
23
+ *
24
+ * For example:
25
+ * 1) The "date" type includes "date", "datetime", and "period".
26
+ * 2) The "token" type includes enums and booleans.
27
+ * 3) Arrays/multiple values are not reflected at all.
28
+ *
29
+ * @param structureDefinitions Collection of StructureDefinition resources indexed by name.
30
+ * @param resourceType The root resource type.
31
+ * @param searchParam The search parameter.
32
+ * @returns The search parameter type details.
33
+ */
34
+ export declare function getSearchParameterDetails(structureDefinitions: IndexedStructureDefinition, resourceType: string, searchParam: SearchParameter): SearchParameterDetails;
35
+ export declare function getExpressionForResourceType(resourceType: string, expression: string): string | undefined;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * The ClientStorage class is a utility class for storing strings and objects.
3
+ *
4
+ * When using MedplumClient in the browser, it will be backed by browser localStorage.
5
+ *
6
+ * When Using MedplumClient in the server, it will be backed by the MemoryStorage class.
7
+ */
8
+ export declare class ClientStorage {
9
+ #private;
10
+ constructor();
11
+ clear(): void;
12
+ getString(key: string): string | undefined;
13
+ setString(key: string, value: string | undefined): void;
14
+ getObject<T>(key: string): T | undefined;
15
+ setObject<T>(key: string, value: T): void;
16
+ }
17
+ /**
18
+ * The MemoryStorage class is a minimal in-memory implementation of the Storage interface.
19
+ */
20
+ export declare class MemoryStorage implements Storage {
21
+ #private;
22
+ constructor();
23
+ /**
24
+ * Returns the number of key/value pairs.
25
+ */
26
+ get length(): number;
27
+ /**
28
+ * Removes all key/value pairs, if there are any.
29
+ */
30
+ clear(): void;
31
+ /**
32
+ * Returns the current value associated with the given key, or null if the given key does not exist.
33
+ */
34
+ getItem(key: string): string | null;
35
+ /**
36
+ * Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.
37
+ */
38
+ setItem(key: string, value: string | null): void;
39
+ /**
40
+ * Removes the key/value pair with the given key, if a key/value pair with the given key exists.
41
+ */
42
+ removeItem(key: string): void;
43
+ /**
44
+ * Returns the name of the nth key, or null if n is greater than or equal to the number of key/value pairs.
45
+ */
46
+ key(index: number): string | null;
47
+ }
@@ -0,0 +1,148 @@
1
+ import { Bundle, ElementDefinition, SearchParameter, StructureDefinition } from '@medplum/fhirtypes';
2
+ /**
3
+ * List of property types.
4
+ * http://www.hl7.org/fhir/valueset-defined-types.html
5
+ * The list here includes additions found from StructureDefinition resources.
6
+ */
7
+ export declare enum PropertyType {
8
+ Address = "Address",
9
+ Age = "Age",
10
+ Annotation = "Annotation",
11
+ Attachment = "Attachment",
12
+ BackboneElement = "BackboneElement",
13
+ CodeableConcept = "CodeableConcept",
14
+ Coding = "Coding",
15
+ ContactDetail = "ContactDetail",
16
+ ContactPoint = "ContactPoint",
17
+ Contributor = "Contributor",
18
+ Count = "Count",
19
+ DataRequirement = "DataRequirement",
20
+ Distance = "Distance",
21
+ Dosage = "Dosage",
22
+ Duration = "Duration",
23
+ Expression = "Expression",
24
+ Extension = "Extension",
25
+ HumanName = "HumanName",
26
+ Identifier = "Identifier",
27
+ MarketingStatus = "MarketingStatus",
28
+ Meta = "Meta",
29
+ Money = "Money",
30
+ Narrative = "Narrative",
31
+ ParameterDefinition = "ParameterDefinition",
32
+ Period = "Period",
33
+ Population = "Population",
34
+ ProdCharacteristic = "ProdCharacteristic",
35
+ ProductShelfLife = "ProductShelfLife",
36
+ Quantity = "Quantity",
37
+ Range = "Range",
38
+ Ratio = "Ratio",
39
+ Reference = "Reference",
40
+ RelatedArtifact = "RelatedArtifact",
41
+ SampledData = "SampledData",
42
+ Signature = "Signature",
43
+ SubstanceAmount = "SubstanceAmount",
44
+ SystemString = "http://hl7.org/fhirpath/System.String",
45
+ Timing = "Timing",
46
+ TriggerDefinition = "TriggerDefinition",
47
+ UsageContext = "UsageContext",
48
+ base64Binary = "base64Binary",
49
+ boolean = "boolean",
50
+ canonical = "canonical",
51
+ code = "code",
52
+ date = "date",
53
+ dateTime = "dateTime",
54
+ decimal = "decimal",
55
+ id = "id",
56
+ instant = "instant",
57
+ integer = "integer",
58
+ markdown = "markdown",
59
+ oid = "oid",
60
+ positiveInt = "positiveInt",
61
+ string = "string",
62
+ time = "time",
63
+ unsignedInt = "unsignedInt",
64
+ uri = "uri",
65
+ url = "url",
66
+ uuid = "uuid"
67
+ }
68
+ /**
69
+ * An IndexedStructureDefinition is a lookup-optimized version of a StructureDefinition.
70
+ *
71
+ * StructureDefinition resources contain schema information for other resource types.
72
+ * These schemas can be used to automatically generate user interface elements for
73
+ * resources.
74
+ *
75
+ * However, a StructureDefinition resource is not optimized for realtime lookups. All
76
+ * resource types, sub types, and property definitions are stored in a flat array of
77
+ * ElementDefinition objects. Therefore, to lookup the schema for a property (i.e., "Patient.name")
78
+ * requires a linear scan of all ElementDefinition objects
79
+ *
80
+ * A StructureDefinition resource contains information about one or more types.
81
+ * For example, the "Patient" StructureDefinition includes "Patient", "Patient_Contact",
82
+ * "Patient_Communication", and "Patient_Link". This is inefficient.
83
+ *
84
+ * Instead, we create an indexed version of the StructureDefinition, called IndexedStructureDefinition.
85
+ * In an IndexedStructureDefinition, retrieving a property definition is a hashtable lookup.
86
+ *
87
+ * The hierarchy is:
88
+ * IndexedStructureDefinition - top level for one resource type
89
+ * TypeSchema - one per resource type and all contained BackboneElements
90
+ * PropertySchema - one per property/field
91
+ */
92
+ export interface IndexedStructureDefinition {
93
+ types: {
94
+ [resourceType: string]: TypeSchema;
95
+ };
96
+ }
97
+ /**
98
+ * An indexed TypeSchema.
99
+ *
100
+ * Example: The IndexedStructureDefinition for "Patient" would include the following TypeSchemas:
101
+ * 1) Patient
102
+ * 2) Patient_Contact
103
+ * 3) Patient_Communication
104
+ * 4) Patient_Link
105
+ */
106
+ export interface TypeSchema {
107
+ display: string;
108
+ properties: {
109
+ [name: string]: ElementDefinition;
110
+ };
111
+ searchParams?: {
112
+ [code: string]: SearchParameter;
113
+ };
114
+ description?: string;
115
+ parentType?: string;
116
+ }
117
+ /**
118
+ * Creates a new empty IndexedStructureDefinition.
119
+ * @returns The empty IndexedStructureDefinition.
120
+ * @deprecated Use globalSchema
121
+ */
122
+ export declare function createSchema(): IndexedStructureDefinition;
123
+ export declare function createTypeSchema(typeName: string, description: string | undefined): TypeSchema;
124
+ /**
125
+ * Indexes a bundle of StructureDefinitions for faster lookup.
126
+ * @param bundle A FHIR bundle StructureDefinition resources.
127
+ */
128
+ export declare function indexStructureDefinitionBundle(bundle: Bundle): void;
129
+ /**
130
+ * Indexes a StructureDefinition for fast lookup.
131
+ * See comments on IndexedStructureDefinition for more details.
132
+ * @param schema The output IndexedStructureDefinition.
133
+ * @param structureDefinition The original StructureDefinition.
134
+ */
135
+ export declare function indexStructureDefinition(schema: IndexedStructureDefinition, structureDefinition: StructureDefinition): void;
136
+ /**
137
+ * Indexes a SearchParameter resource for fast lookup.
138
+ * Indexes by SearchParameter.code, which is the query string parameter name.
139
+ * @param schema The output IndexedStructureDefinition.
140
+ * @param searchParam The SearchParameter resource.
141
+ */
142
+ export declare function indexSearchParameter(schema: IndexedStructureDefinition, searchParam: SearchParameter): void;
143
+ export declare function buildTypeName(components: string[]): string;
144
+ export declare function getPropertyDisplayName(path: string): string;
145
+ /**
146
+ * Global schema singleton.
147
+ */
148
+ export declare const globalSchema: IndexedStructureDefinition;
@@ -0,0 +1,245 @@
1
+ import { CodeableConcept, ObservationDefinition, ObservationDefinitionQualifiedInterval, Patient, Practitioner, QuestionnaireResponse, QuestionnaireResponseItemAnswer, Range, Reference, RelatedPerson, Resource } from '@medplum/fhirtypes';
2
+ /**
3
+ * @internal
4
+ */
5
+ export declare type ProfileResource = Patient | Practitioner | RelatedPerson;
6
+ /**
7
+ * Creates a reference resource.
8
+ * @param resource The FHIR reesource.
9
+ * @returns A reference resource.
10
+ */
11
+ export declare function createReference<T extends Resource>(resource: T): Reference<T>;
12
+ /**
13
+ * Returns a reference string for a resource.
14
+ * @param resource The FHIR resource.
15
+ * @returns A reference string of the form resourceType/id.
16
+ */
17
+ export declare function getReferenceString(resource: Resource): string;
18
+ /**
19
+ * Returns the ID portion of a reference.
20
+ * @param reference A FHIR reference.
21
+ * @returns The ID portion of a reference.
22
+ */
23
+ export declare function resolveId(reference: Reference | undefined): string | undefined;
24
+ /**
25
+ * Returns true if the resource is a "ProfileResource".
26
+ * @param resource The FHIR resource.
27
+ * @returns True if the resource is a "ProfileResource".
28
+ */
29
+ export declare function isProfileResource(resource: Resource): boolean;
30
+ /**
31
+ * Returns a display string for the resource.
32
+ * @param resource The input resource.
33
+ * @return Human friendly display string.
34
+ */
35
+ export declare function getDisplayString(resource: Resource): string;
36
+ /**
37
+ * Returns an image URL for the resource, if one is available.
38
+ * @param resource The input resource.
39
+ * @returns The image URL for the resource or undefined.
40
+ */
41
+ export declare function getImageSrc(resource: Resource): string | undefined;
42
+ /**
43
+ * Returns a Date property as a Date.
44
+ * When working with JSON objects, Dates are often serialized as ISO-8601 strings.
45
+ * When that happens, we need to safely convert to a proper Date object.
46
+ * @param date The date property value, which could be a string or a Date object.
47
+ * @returns A Date object.
48
+ */
49
+ export declare function getDateProperty(date: string | undefined): Date | undefined;
50
+ /**
51
+ * Calculates the age in years from the birth date.
52
+ * @param birthDateStr The birth date or start date in ISO-8601 format YYYY-MM-DD.
53
+ * @param endDateStr Optional end date in ISO-8601 format YYYY-MM-DD. Default value is today.
54
+ * @returns The age in years, months, and days.
55
+ */
56
+ export declare function calculateAge(birthDateStr: string, endDateStr?: string): {
57
+ years: number;
58
+ months: number;
59
+ days: number;
60
+ };
61
+ /**
62
+ * Calculates the age string for display using the age appropriate units.
63
+ * If the age is greater than or equal to 2 years, then the age is displayed in years.
64
+ * If the age is greater than or equal to 1 month, then the age is displayed in months.
65
+ * Otherwise, the age is displayed in days.
66
+ * @param birthDateStr The birth date or start date in ISO-8601 format YYYY-MM-DD.
67
+ * @param endDateStr Optional end date in ISO-8601 format YYYY-MM-DD. Default value is today.
68
+ * @returns The age string.
69
+ */
70
+ export declare function calculateAgeString(birthDateStr: string, endDateStr?: string): string | undefined;
71
+ /**
72
+ * Returns all questionnaire answers as a map by link ID.
73
+ * @param response The questionnaire response resource.
74
+ * @returns Questionnaire answers mapped by link ID.
75
+ */
76
+ export declare function getQuestionnaireAnswers(response: QuestionnaireResponse): Record<string, QuestionnaireResponseItemAnswer>;
77
+ /**
78
+ * Returns the resource identifier for the given system.
79
+ *
80
+ * If multiple identifiers exist with the same system, the first one is returned.
81
+ *
82
+ * If the system is not found, then returns undefined.
83
+ *
84
+ * @param resource The resource to check.
85
+ * @param system The identifier system.
86
+ * @returns The identifier value if found; otherwise undefined.
87
+ */
88
+ export declare function getIdentifier(resource: Resource, system: string): string | undefined;
89
+ /**
90
+ * Returns an extension value by extension URLs.
91
+ * @param resource The base resource.
92
+ * @param urls Array of extension URLs. Each entry represents a nested extension.
93
+ * @returns The extension value if found; undefined otherwise.
94
+ */
95
+ export declare function getExtensionValue(resource: Resource, ...urls: string[]): string | undefined;
96
+ /**
97
+ * FHIR JSON stringify.
98
+ * Removes properties with empty string values.
99
+ * Removes objects with zero properties.
100
+ * See: https://www.hl7.org/fhir/json.html
101
+ * @param value The input value.
102
+ * @param pretty Optional flag to pretty-print the JSON.
103
+ * @returns The resulting JSON string.
104
+ */
105
+ export declare function stringify(value: any, pretty?: boolean): string;
106
+ /**
107
+ * Returns true if the value is empty (null, undefined, empty string, or empty object).
108
+ * @param v Any value.
109
+ * @returns True if the value is an empty string or an empty object.
110
+ */
111
+ export declare function isEmpty(v: any): boolean;
112
+ /**
113
+ * Resource equality.
114
+ * Ignores meta.versionId and meta.lastUpdated.
115
+ * @param object1 The first object.
116
+ * @param object2 The second object.
117
+ * @returns True if the objects are equal.
118
+ */
119
+ export declare function deepEquals(object1: unknown, object2: unknown, path?: string): boolean;
120
+ /**
121
+ * Creates a deep clone of the input value.
122
+ *
123
+ * Limitations:
124
+ * - Only supports JSON primitives and arrays.
125
+ * - Does not support Functions, lambdas, etc.
126
+ * - Does not support circular references.
127
+ *
128
+ * See: https://web.dev/structured-clone/
129
+ * See: https://stackoverflow.com/questions/40488190/how-is-structured-clone-algorithm-different-from-deep-copy
130
+ *
131
+ * @param input The input to clone.
132
+ * @returns A deep clone of the input.
133
+ */
134
+ export declare function deepClone<T>(input: T): T;
135
+ /**
136
+ * Returns true if the input string is a UUID.
137
+ * @param input The input string.
138
+ * @returns True if the input string matches the UUID format.
139
+ */
140
+ export declare function isUUID(input: string): boolean;
141
+ /**
142
+ * Returns true if the input is an object.
143
+ * @param object The candidate object.
144
+ * @returns True if the input is a non-null non-undefined object.
145
+ */
146
+ export declare function isObject(obj: unknown): obj is Record<string, unknown>;
147
+ /**
148
+ * Returns true if the input array is an array of strings.
149
+ * @param arr Input array.
150
+ * @returns True if the input array is an array of strings.
151
+ */
152
+ export declare function isStringArray(arr: any[]): arr is string[];
153
+ /**
154
+ * Converts an ArrayBuffer to hex string.
155
+ * See: https://stackoverflow.com/a/55200387
156
+ * @param arrayBuffer The input array buffer.
157
+ * @returns The resulting hex string.
158
+ */
159
+ export declare function arrayBufferToHex(arrayBuffer: ArrayBuffer): string;
160
+ /**
161
+ * Converts an ArrayBuffer to a base-64 encoded string.
162
+ * @param arrayBuffer The input array buffer.
163
+ * @returns The base-64 encoded string.
164
+ */
165
+ export declare function arrayBufferToBase64(arrayBuffer: ArrayBuffer): string;
166
+ export declare function capitalize(word: string): string;
167
+ export declare function isLowerCase(c: string): boolean;
168
+ /**
169
+ * Tries to find a code string for a given system within a given codeable concept.
170
+ * @param concept The codeable concept.
171
+ * @param system The system string.
172
+ * @returns The code if found; otherwise undefined.
173
+ */
174
+ export declare function getCodeBySystem(concept: CodeableConcept, system: string): string | undefined;
175
+ /**
176
+ * Sets a code for a given system within a given codeable concept.
177
+ * @param concept The codeable concept.
178
+ * @param system The system string.
179
+ * @param code The code value.
180
+ */
181
+ export declare function setCodeBySystem(concept: CodeableConcept, system: string, code: string): void;
182
+ /**
183
+ * Tries to find an observation interval for the given patient and value.
184
+ * @param definition The observation definition.
185
+ * @param patient The patient.
186
+ * @param value The observation value.
187
+ * @returns The observation interval if found; otherwise undefined.
188
+ */
189
+ export declare function findObservationInterval(definition: ObservationDefinition, patient: Patient, value: number, category?: 'reference' | 'critical' | 'absolute'): ObservationDefinitionQualifiedInterval | undefined;
190
+ /**
191
+ * Tries to find an observation reference range for the given patient and condition names.
192
+ * @param definition The observation definition.
193
+ * @param patient The patient.
194
+ * @param names The condition names.
195
+ * @returns The observation interval if found; otherwise undefined.
196
+ */
197
+ export declare function findObservationReferenceRange(definition: ObservationDefinition, patient: Patient, names: string[]): ObservationDefinitionQualifiedInterval | undefined;
198
+ /**
199
+ * Returns true if the value is in the range accounting for precision.
200
+ * @param value The numeric value.
201
+ * @param range The numeric range.
202
+ * @param precision Optional precision in number of digits.
203
+ * @returns True if the value is within the range.
204
+ */
205
+ export declare function matchesRange(value: number, range: Range, precision?: number): boolean;
206
+ /**
207
+ * Returns true if the two numbers are equal to the given precision.
208
+ * @param a The first number.
209
+ * @param b The second number.
210
+ * @param precision Optional precision in number of digits.
211
+ * @returns True if the two numbers are equal to the given precision.
212
+ */
213
+ export declare function preciseEquals(a: number, b: number, precision?: number): boolean;
214
+ /**
215
+ * Returns true if the first number is less than the second number to the given precision.
216
+ * @param a The first number.
217
+ * @param b The second number.
218
+ * @param precision Optional precision in number of digits.
219
+ * @returns True if the first number is less than the second number to the given precision.
220
+ */
221
+ export declare function preciseLessThan(a: number, b: number, precision?: number): boolean;
222
+ /**
223
+ * Returns true if the first number is greater than the second number to the given precision.
224
+ * @param a The first number.
225
+ * @param b The second number.
226
+ * @param precision Optional precision in number of digits.
227
+ * @returns True if the first number is greater than the second number to the given precision.
228
+ */
229
+ export declare function preciseGreaterThan(a: number, b: number, precision?: number): boolean;
230
+ /**
231
+ * Returns true if the first number is less than or equal to the second number to the given precision.
232
+ * @param a The first number.
233
+ * @param b The second number.
234
+ * @param precision Optional precision in number of digits.
235
+ * @returns True if the first number is less than or equal to the second number to the given precision.
236
+ */
237
+ export declare function preciseLessThanOrEquals(a: number, b: number, precision?: number): boolean;
238
+ /**
239
+ * Returns true if the first number is greater than or equal to the second number to the given precision.
240
+ * @param a The first number.
241
+ * @param b The second number.
242
+ * @param precision Optional precision in number of digits.
243
+ * @returns True if the first number is greater than or equal to the second number to the given precision.
244
+ */
245
+ export declare function preciseGreaterThanOrEquals(a: number, b: number, precision?: number): boolean;