@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.
Files changed (71) hide show
  1. package/dist/cjs/index.cjs +35 -21
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs/index.min.cjs +1 -1
  4. package/dist/esm/client.mjs +10 -17
  5. package/dist/esm/client.mjs.map +1 -1
  6. package/dist/esm/index.min.mjs +1 -1
  7. package/dist/esm/index.mjs +1 -1
  8. package/dist/esm/outcomes.mjs +17 -2
  9. package/dist/esm/outcomes.mjs.map +1 -1
  10. package/dist/esm/search/match.mjs +9 -4
  11. package/dist/esm/search/match.mjs.map +1 -1
  12. package/dist/{esm → types}/outcomes.d.ts +7 -1
  13. package/package.json +4 -4
  14. package/tsconfig.build.json +9 -0
  15. package/dist/cjs/outcomes.d.ts +0 -31
  16. package/dist/esm/cache.d.ts +0 -34
  17. package/dist/esm/client.d.ts +0 -1218
  18. package/dist/esm/crypto.d.ts +0 -9
  19. package/dist/esm/eventtarget.d.ts +0 -13
  20. package/dist/esm/fhirlexer/index.d.ts +0 -2
  21. package/dist/esm/fhirlexer/parse.d.ts +0 -47
  22. package/dist/esm/fhirlexer/tokenize.d.ts +0 -14
  23. package/dist/esm/fhirmapper/parse.d.ts +0 -7
  24. package/dist/esm/fhirmapper/tokenize.d.ts +0 -2
  25. package/dist/esm/fhirpath/atoms.d.ts +0 -120
  26. package/dist/esm/fhirpath/date.d.ts +0 -1
  27. package/dist/esm/fhirpath/functions.d.ts +0 -6
  28. package/dist/esm/fhirpath/index.d.ts +0 -4
  29. package/dist/esm/fhirpath/parse.d.ts +0 -64
  30. package/dist/esm/fhirpath/tokenize.d.ts +0 -4
  31. package/dist/esm/fhirpath/utils.d.ts +0 -95
  32. package/dist/esm/format.d.ts +0 -118
  33. package/dist/esm/hl7.d.ts +0 -136
  34. package/dist/esm/index.d.ts +0 -14
  35. package/dist/esm/jwt.d.ts +0 -5
  36. package/dist/esm/readablepromise.d.ts +0 -48
  37. package/dist/esm/search/details.d.ts +0 -33
  38. package/dist/esm/search/match.d.ts +0 -9
  39. package/dist/esm/search/parse.d.ts +0 -17
  40. package/dist/esm/search/search.d.ts +0 -66
  41. package/dist/esm/storage.d.ts +0 -47
  42. package/dist/esm/types.d.ts +0 -200
  43. package/dist/esm/utils.d.ts +0 -259
  44. /package/dist/{cjs → types}/cache.d.ts +0 -0
  45. /package/dist/{cjs → types}/client.d.ts +0 -0
  46. /package/dist/{cjs → types}/crypto.d.ts +0 -0
  47. /package/dist/{cjs → types}/eventtarget.d.ts +0 -0
  48. /package/dist/{cjs → types}/fhirlexer/index.d.ts +0 -0
  49. /package/dist/{cjs → types}/fhirlexer/parse.d.ts +0 -0
  50. /package/dist/{cjs → types}/fhirlexer/tokenize.d.ts +0 -0
  51. /package/dist/{cjs → types}/fhirmapper/parse.d.ts +0 -0
  52. /package/dist/{cjs → types}/fhirmapper/tokenize.d.ts +0 -0
  53. /package/dist/{cjs → types}/fhirpath/atoms.d.ts +0 -0
  54. /package/dist/{cjs → types}/fhirpath/date.d.ts +0 -0
  55. /package/dist/{cjs → types}/fhirpath/functions.d.ts +0 -0
  56. /package/dist/{cjs → types}/fhirpath/index.d.ts +0 -0
  57. /package/dist/{cjs → types}/fhirpath/parse.d.ts +0 -0
  58. /package/dist/{cjs → types}/fhirpath/tokenize.d.ts +0 -0
  59. /package/dist/{cjs → types}/fhirpath/utils.d.ts +0 -0
  60. /package/dist/{cjs → types}/format.d.ts +0 -0
  61. /package/dist/{cjs → types}/hl7.d.ts +0 -0
  62. /package/dist/{cjs → types}/index.d.ts +0 -0
  63. /package/dist/{cjs → types}/jwt.d.ts +0 -0
  64. /package/dist/{cjs → types}/readablepromise.d.ts +0 -0
  65. /package/dist/{cjs → types}/search/details.d.ts +0 -0
  66. /package/dist/{cjs → types}/search/match.d.ts +0 -0
  67. /package/dist/{cjs → types}/search/parse.d.ts +0 -0
  68. /package/dist/{cjs → types}/search/search.d.ts +0 -0
  69. /package/dist/{cjs → types}/storage.d.ts +0 -0
  70. /package/dist/{cjs → types}/types.d.ts +0 -0
  71. /package/dist/{cjs → types}/utils.d.ts +0 -0
@@ -1,259 +0,0 @@
1
- import { CodeableConcept, Extension, ObservationDefinition, ObservationDefinitionQualifiedInterval, Patient, Practitioner, QuestionnaireResponse, QuestionnaireResponseItemAnswer, Range, Reference, RelatedPerson, Resource } from '@medplum/fhirtypes';
2
- /**
3
- * @internal
4
- */
5
- export 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): resource is ProfileResource;
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: any, ...urls: string[]): string | undefined;
96
- /**
97
- * Returns an extension by extension URLs.
98
- * @param resource The base resource.
99
- * @param urls Array of extension URLs. Each entry represents a nested extension.
100
- * @returns The extension object if found; undefined otherwise.
101
- */
102
- export declare function getExtension(resource: any, ...urls: string[]): Extension | undefined;
103
- /**
104
- * FHIR JSON stringify.
105
- * Removes properties with empty string values.
106
- * Removes objects with zero properties.
107
- * See: https://www.hl7.org/fhir/json.html
108
- * @param value The input value.
109
- * @param pretty Optional flag to pretty-print the JSON.
110
- * @returns The resulting JSON string.
111
- */
112
- export declare function stringify(value: any, pretty?: boolean): string;
113
- /**
114
- * Returns true if the value is empty (null, undefined, empty string, or empty object).
115
- * @param v Any value.
116
- * @returns True if the value is an empty string or an empty object.
117
- */
118
- export declare function isEmpty(v: any): boolean;
119
- /**
120
- * Resource equality.
121
- * Ignores meta.versionId and meta.lastUpdated.
122
- * @param object1 The first object.
123
- * @param object2 The second object.
124
- * @returns True if the objects are equal.
125
- */
126
- export declare function deepEquals(object1: unknown, object2: unknown, path?: string): boolean;
127
- /**
128
- * Creates a deep clone of the input value.
129
- *
130
- * Limitations:
131
- * - Only supports JSON primitives and arrays.
132
- * - Does not support Functions, lambdas, etc.
133
- * - Does not support circular references.
134
- *
135
- * See: https://web.dev/structured-clone/
136
- * See: https://stackoverflow.com/questions/40488190/how-is-structured-clone-algorithm-different-from-deep-copy
137
- *
138
- * @param input The input to clone.
139
- * @returns A deep clone of the input.
140
- */
141
- export declare function deepClone<T>(input: T): T;
142
- /**
143
- * Returns true if the input string is a UUID.
144
- * @param input The input string.
145
- * @returns True if the input string matches the UUID format.
146
- */
147
- export declare function isUUID(input: string): boolean;
148
- /**
149
- * Returns true if the input is an object.
150
- * @param object The candidate object.
151
- * @returns True if the input is a non-null non-undefined object.
152
- */
153
- export declare function isObject(obj: unknown): obj is Record<string, unknown>;
154
- /**
155
- * Returns true if the input array is an array of strings.
156
- * @param arr Input array.
157
- * @returns True if the input array is an array of strings.
158
- */
159
- export declare function isStringArray(arr: any[]): arr is string[];
160
- /**
161
- * Converts an ArrayBuffer to hex string.
162
- * See: https://stackoverflow.com/a/55200387
163
- * @param arrayBuffer The input array buffer.
164
- * @returns The resulting hex string.
165
- */
166
- export declare function arrayBufferToHex(arrayBuffer: ArrayBuffer): string;
167
- /**
168
- * Converts an ArrayBuffer to a base-64 encoded string.
169
- * @param arrayBuffer The input array buffer.
170
- * @returns The base-64 encoded string.
171
- */
172
- export declare function arrayBufferToBase64(arrayBuffer: ArrayBuffer): string;
173
- export declare function capitalize(word: string): string;
174
- export declare function isLowerCase(c: string): boolean;
175
- /**
176
- * Tries to find a code string for a given system within a given codeable concept.
177
- * @param concept The codeable concept.
178
- * @param system The system string.
179
- * @returns The code if found; otherwise undefined.
180
- */
181
- export declare function getCodeBySystem(concept: CodeableConcept, system: string): string | undefined;
182
- /**
183
- * Sets a code for a given system within a given codeable concept.
184
- * @param concept The codeable concept.
185
- * @param system The system string.
186
- * @param code The code value.
187
- */
188
- export declare function setCodeBySystem(concept: CodeableConcept, system: string, code: string): void;
189
- /**
190
- * Tries to find an observation interval for the given patient and value.
191
- * @param definition The observation definition.
192
- * @param patient The patient.
193
- * @param value The observation value.
194
- * @returns The observation interval if found; otherwise undefined.
195
- */
196
- export declare function findObservationInterval(definition: ObservationDefinition, patient: Patient, value: number, category?: 'reference' | 'critical' | 'absolute'): ObservationDefinitionQualifiedInterval | undefined;
197
- /**
198
- * Tries to find an observation reference range for the given patient and condition names.
199
- * @param definition The observation definition.
200
- * @param patient The patient.
201
- * @param names The condition names.
202
- * @returns The observation interval if found; otherwise undefined.
203
- */
204
- export declare function findObservationReferenceRange(definition: ObservationDefinition, patient: Patient, names: string[]): ObservationDefinitionQualifiedInterval | undefined;
205
- /**
206
- * Returns true if the value is in the range accounting for precision.
207
- * @param value The numeric value.
208
- * @param range The numeric range.
209
- * @param precision Optional precision in number of digits.
210
- * @returns True if the value is within the range.
211
- */
212
- export declare function matchesRange(value: number, range: Range, precision?: number): boolean;
213
- /**
214
- * Returns the input number rounded to the specified number of digits.
215
- * @param a The input number.
216
- * @param precision The precision in number of digits.
217
- * @returns The number rounded to the specified number of digits.
218
- */
219
- export declare function preciseRound(a: number, precision: number): number;
220
- /**
221
- * Returns true if the two numbers are equal to the given precision.
222
- * @param a The first number.
223
- * @param b The second number.
224
- * @param precision Optional precision in number of digits.
225
- * @returns True if the two numbers are equal to the given precision.
226
- */
227
- export declare function preciseEquals(a: number, b: number, precision?: number): boolean;
228
- /**
229
- * Returns true if the first number is less than the second number to the given precision.
230
- * @param a The first number.
231
- * @param b The second number.
232
- * @param precision Optional precision in number of digits.
233
- * @returns True if the first number is less than the second number to the given precision.
234
- */
235
- export declare function preciseLessThan(a: number, b: number, precision?: number): boolean;
236
- /**
237
- * Returns true if the first number is greater than the second number to the given precision.
238
- * @param a The first number.
239
- * @param b The second number.
240
- * @param precision Optional precision in number of digits.
241
- * @returns True if the first number is greater than the second number to the given precision.
242
- */
243
- export declare function preciseGreaterThan(a: number, b: number, precision?: number): boolean;
244
- /**
245
- * Returns true if the first number is less than or equal to the second number to the given precision.
246
- * @param a The first number.
247
- * @param b The second number.
248
- * @param precision Optional precision in number of digits.
249
- * @returns True if the first number is less than or equal to the second number to the given precision.
250
- */
251
- export declare function preciseLessThanOrEquals(a: number, b: number, precision?: number): boolean;
252
- /**
253
- * Returns true if the first number is greater than or equal to the second number to the given precision.
254
- * @param a The first number.
255
- * @param b The second number.
256
- * @param precision Optional precision in number of digits.
257
- * @returns True if the first number is greater than or equal to the second number to the given precision.
258
- */
259
- export declare function preciseGreaterThanOrEquals(a: number, b: number, precision?: number): boolean;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes