@medplum/core 2.0.23 → 2.0.25

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 (84) hide show
  1. package/dist/cjs/index.cjs +6 -13364
  2. package/dist/cjs/index.cjs.map +7 -1
  3. package/dist/esm/index.mjs +31 -26
  4. package/dist/esm/index.mjs.map +7 -1
  5. package/dist/types/access.d.ts +48 -0
  6. package/dist/types/client.d.ts +15 -20
  7. package/dist/types/fhirlexer/parse.d.ts +5 -4
  8. package/dist/types/fhirpath/functions.d.ts +1 -3
  9. package/dist/types/index.d.ts +3 -0
  10. package/dist/types/outcomes.d.ts +3 -1
  11. package/dist/types/search/search.d.ts +7 -0
  12. package/dist/types/typeschema/types.d.ts +5 -2
  13. package/dist/types/typeschema/validation.d.ts +2 -0
  14. package/dist/types/utils.d.ts +14 -0
  15. package/package.json +2 -2
  16. package/dist/cjs/index.min.cjs +0 -1
  17. package/dist/esm/base-schema.json.mjs +0 -4408
  18. package/dist/esm/base-schema.json.mjs.map +0 -1
  19. package/dist/esm/base64.mjs +0 -33
  20. package/dist/esm/base64.mjs.map +0 -1
  21. package/dist/esm/bundle.mjs +0 -36
  22. package/dist/esm/bundle.mjs.map +0 -1
  23. package/dist/esm/cache.mjs +0 -64
  24. package/dist/esm/cache.mjs.map +0 -1
  25. package/dist/esm/client.mjs +0 -2144
  26. package/dist/esm/client.mjs.map +0 -1
  27. package/dist/esm/crypto.mjs +0 -22
  28. package/dist/esm/crypto.mjs.map +0 -1
  29. package/dist/esm/eventtarget.mjs +0 -36
  30. package/dist/esm/eventtarget.mjs.map +0 -1
  31. package/dist/esm/fhirlexer/parse.mjs +0 -122
  32. package/dist/esm/fhirlexer/parse.mjs.map +0 -1
  33. package/dist/esm/fhirlexer/tokenize.mjs +0 -231
  34. package/dist/esm/fhirlexer/tokenize.mjs.map +0 -1
  35. package/dist/esm/fhirmapper/parse.mjs +0 -329
  36. package/dist/esm/fhirmapper/parse.mjs.map +0 -1
  37. package/dist/esm/fhirmapper/tokenize.mjs +0 -13
  38. package/dist/esm/fhirmapper/tokenize.mjs.map +0 -1
  39. package/dist/esm/fhirpath/atoms.mjs +0 -347
  40. package/dist/esm/fhirpath/atoms.mjs.map +0 -1
  41. package/dist/esm/fhirpath/date.mjs +0 -24
  42. package/dist/esm/fhirpath/date.mjs.map +0 -1
  43. package/dist/esm/fhirpath/functions.mjs +0 -1626
  44. package/dist/esm/fhirpath/functions.mjs.map +0 -1
  45. package/dist/esm/fhirpath/parse.mjs +0 -144
  46. package/dist/esm/fhirpath/parse.mjs.map +0 -1
  47. package/dist/esm/fhirpath/tokenize.mjs +0 -10
  48. package/dist/esm/fhirpath/tokenize.mjs.map +0 -1
  49. package/dist/esm/fhirpath/utils.mjs +0 -378
  50. package/dist/esm/fhirpath/utils.mjs.map +0 -1
  51. package/dist/esm/filter/parse.mjs +0 -101
  52. package/dist/esm/filter/parse.mjs.map +0 -1
  53. package/dist/esm/filter/tokenize.mjs +0 -16
  54. package/dist/esm/filter/tokenize.mjs.map +0 -1
  55. package/dist/esm/filter/types.mjs +0 -34
  56. package/dist/esm/filter/types.mjs.map +0 -1
  57. package/dist/esm/format.mjs +0 -390
  58. package/dist/esm/format.mjs.map +0 -1
  59. package/dist/esm/hl7.mjs +0 -242
  60. package/dist/esm/hl7.mjs.map +0 -1
  61. package/dist/esm/index.min.mjs +0 -1
  62. package/dist/esm/jwt.mjs +0 -30
  63. package/dist/esm/jwt.mjs.map +0 -1
  64. package/dist/esm/node_modules/tslib/package.json +0 -1
  65. package/dist/esm/outcomes.mjs +0 -271
  66. package/dist/esm/outcomes.mjs.map +0 -1
  67. package/dist/esm/readablepromise.mjs +0 -82
  68. package/dist/esm/readablepromise.mjs.map +0 -1
  69. package/dist/esm/schema.mjs +0 -417
  70. package/dist/esm/schema.mjs.map +0 -1
  71. package/dist/esm/search/details.mjs +0 -164
  72. package/dist/esm/search/details.mjs.map +0 -1
  73. package/dist/esm/search/match.mjs +0 -164
  74. package/dist/esm/search/match.mjs.map +0 -1
  75. package/dist/esm/search/search.mjs +0 -369
  76. package/dist/esm/search/search.mjs.map +0 -1
  77. package/dist/esm/sftp.mjs +0 -24
  78. package/dist/esm/sftp.mjs.map +0 -1
  79. package/dist/esm/storage.mjs +0 -95
  80. package/dist/esm/storage.mjs.map +0 -1
  81. package/dist/esm/types.mjs +0 -370
  82. package/dist/esm/types.mjs.map +0 -1
  83. package/dist/esm/utils.mjs +0 -632
  84. package/dist/esm/utils.mjs.map +0 -1
@@ -1,378 +0,0 @@
1
- import { PropertyType, isResource, getElementDefinition, buildTypeName } from '../types.mjs';
2
- import { capitalize, isEmpty } from '../utils.mjs';
3
-
4
- /**
5
- * Returns a single element array with a typed boolean value.
6
- * @param value The primitive boolean value.
7
- * @returns Single element array with a typed boolean value.
8
- */
9
- function booleanToTypedValue(value) {
10
- return [{ type: PropertyType.boolean, value }];
11
- }
12
- /**
13
- * Returns a "best guess" TypedValue for a given value.
14
- * @param value The unknown value to check.
15
- * @returns A "best guess" TypedValue for the given value.
16
- */
17
- function toTypedValue(value) {
18
- if (value === null || value === undefined) {
19
- return { type: 'undefined', value: undefined };
20
- }
21
- else if (Number.isSafeInteger(value)) {
22
- return { type: PropertyType.integer, value };
23
- }
24
- else if (typeof value === 'number') {
25
- return { type: PropertyType.decimal, value };
26
- }
27
- else if (typeof value === 'boolean') {
28
- return { type: PropertyType.boolean, value };
29
- }
30
- else if (typeof value === 'string') {
31
- return { type: PropertyType.string, value };
32
- }
33
- else if (isQuantity(value)) {
34
- return { type: PropertyType.Quantity, value };
35
- }
36
- else if (isResource(value)) {
37
- return { type: value.resourceType, value };
38
- }
39
- else {
40
- return { type: PropertyType.BackboneElement, value };
41
- }
42
- }
43
- /**
44
- * Converts unknown object into a JavaScript boolean.
45
- * Note that this is different than the FHIRPath "toBoolean",
46
- * which has particular semantics around arrays, empty arrays, and type conversions.
47
- * @param obj Any value or array of values.
48
- * @returns The converted boolean value according to FHIRPath rules.
49
- */
50
- function toJsBoolean(obj) {
51
- return obj.length === 0 ? false : !!obj[0].value;
52
- }
53
- /**
54
- * Returns the value of the property and the property type.
55
- * Some property definitions support multiple types.
56
- * For example, "Observation.value[x]" can be "valueString", "valueInteger", "valueQuantity", etc.
57
- * According to the spec, there can only be one property for a given element definition.
58
- * This function returns the value and the type.
59
- * @param input The base context (FHIR resource or backbone element).
60
- * @param path The property path.
61
- * @returns The value of the property and the property type.
62
- */
63
- function getTypedPropertyValue(input, path) {
64
- if (!input?.value) {
65
- return undefined;
66
- }
67
- const elementDefinition = getElementDefinition(input.type, path);
68
- if (elementDefinition) {
69
- const typedResult = getTypedPropertyValueWithSchema(input, path, elementDefinition);
70
- if (typedResult) {
71
- return typedResult;
72
- }
73
- }
74
- return getTypedPropertyValueWithoutSchema(input, path);
75
- }
76
- /**
77
- * Returns the value of the property and the property type using a type schema.
78
- * @param input The base context (FHIR resource or backbone element).
79
- * @param path The property path.
80
- * @param property The property element definition.
81
- * @returns The value of the property and the property type.
82
- */
83
- function getTypedPropertyValueWithSchema(input, path, property) {
84
- const types = property.type;
85
- if (!types || types.length === 0) {
86
- return undefined;
87
- }
88
- let resultValue = undefined;
89
- let resultType = 'undefined';
90
- if (types.length === 1) {
91
- resultValue = input.value[path];
92
- resultType = types[0].code;
93
- }
94
- else {
95
- for (const type of types) {
96
- const path2 = path.replace('[x]', '') + capitalize(type.code);
97
- if (path2 in input.value) {
98
- resultValue = input.value[path2];
99
- resultType = type.code;
100
- break;
101
- }
102
- }
103
- }
104
- if (isEmpty(resultValue)) {
105
- return undefined;
106
- }
107
- if (resultType === 'Element' || resultType === 'BackboneElement') {
108
- resultType = buildTypeName(property.path?.split('.'));
109
- }
110
- if (Array.isArray(resultValue)) {
111
- return resultValue.map((element) => toTypedValueWithType(element, resultType));
112
- }
113
- else {
114
- return toTypedValueWithType(resultValue, resultType);
115
- }
116
- }
117
- function toTypedValueWithType(value, type) {
118
- if (type === 'Resource' && isResource(value)) {
119
- type = value.resourceType;
120
- }
121
- return { type, value };
122
- }
123
- /**
124
- * Returns the value of the property and the property type using a type schema.
125
- * Note that because the type schema is not available, this function may be inaccurate.
126
- * In some cases, that is the desired behavior.
127
- * @param typedValue The base context (FHIR resource or backbone element).
128
- * @param path The property path.
129
- * @returns The value of the property and the property type.
130
- */
131
- function getTypedPropertyValueWithoutSchema(typedValue, path) {
132
- const input = typedValue.value;
133
- if (!input || typeof input !== 'object') {
134
- return undefined;
135
- }
136
- let result = undefined;
137
- if (path in input) {
138
- result = input[path];
139
- }
140
- else {
141
- // Only support property names that would be valid types
142
- // Examples:
143
- // value + valueString = ok, because "string" is valid
144
- // value + valueDecimal = ok, because "decimal" is valid
145
- // id + identifier = not ok, because "entifier" is not a valid type
146
- // resource + resourceType = not ok, because "type" is not a valid type
147
- for (const propertyType in PropertyType) {
148
- const propertyName = path + capitalize(propertyType);
149
- if (propertyName in input) {
150
- result = input[propertyName];
151
- break;
152
- }
153
- }
154
- }
155
- if (isEmpty(result)) {
156
- return undefined;
157
- }
158
- if (Array.isArray(result)) {
159
- return result.map(toTypedValue);
160
- }
161
- else {
162
- return toTypedValue(result);
163
- }
164
- }
165
- /**
166
- * Removes duplicates in array using FHIRPath equality rules.
167
- * @param arr The input array.
168
- * @returns The result array with duplicates removed.
169
- */
170
- function removeDuplicates(arr) {
171
- const result = [];
172
- for (const i of arr) {
173
- let found = false;
174
- for (const j of result) {
175
- if (toJsBoolean(fhirPathEquals(i, j))) {
176
- found = true;
177
- break;
178
- }
179
- }
180
- if (!found) {
181
- result.push(i);
182
- }
183
- }
184
- return result;
185
- }
186
- /**
187
- * Returns a negated FHIRPath boolean expression.
188
- * @param input The input array.
189
- * @returns The negated type value array.
190
- */
191
- function fhirPathNot(input) {
192
- return booleanToTypedValue(!toJsBoolean(input));
193
- }
194
- /**
195
- * Determines if two arrays are equal according to FHIRPath equality rules.
196
- * @param x The first array.
197
- * @param y The second array.
198
- * @returns FHIRPath true if the arrays are equal.
199
- */
200
- function fhirPathArrayEquals(x, y) {
201
- if (x.length === 0 || y.length === 0) {
202
- return [];
203
- }
204
- if (x.length !== y.length) {
205
- return booleanToTypedValue(false);
206
- }
207
- return booleanToTypedValue(x.every((val, index) => toJsBoolean(fhirPathEquals(val, y[index]))));
208
- }
209
- /**
210
- * Determines if two values are equal according to FHIRPath equality rules.
211
- * @param x The first value.
212
- * @param y The second value.
213
- * @returns True if equal.
214
- */
215
- function fhirPathEquals(x, y) {
216
- const xValue = x.value;
217
- const yValue = y.value;
218
- if (typeof xValue === 'number' && typeof yValue === 'number') {
219
- return booleanToTypedValue(Math.abs(xValue - yValue) < 1e-8);
220
- }
221
- if (isQuantity(xValue) && isQuantity(yValue)) {
222
- return booleanToTypedValue(isQuantityEquivalent(xValue, yValue));
223
- }
224
- if (typeof xValue === 'object' && typeof yValue === 'object') {
225
- return booleanToTypedValue(deepEquals(x, y));
226
- }
227
- return booleanToTypedValue(xValue === yValue);
228
- }
229
- /**
230
- * Determines if two arrays are equivalent according to FHIRPath equality rules.
231
- * @param x The first array.
232
- * @param y The second array.
233
- * @returns FHIRPath true if the arrays are equivalent.
234
- */
235
- function fhirPathArrayEquivalent(x, y) {
236
- if (x.length === 0 && y.length === 0) {
237
- return booleanToTypedValue(true);
238
- }
239
- if (x.length !== y.length) {
240
- return booleanToTypedValue(false);
241
- }
242
- x.sort(fhirPathEquivalentCompare);
243
- y.sort(fhirPathEquivalentCompare);
244
- return booleanToTypedValue(x.every((val, index) => toJsBoolean(fhirPathEquivalent(val, y[index]))));
245
- }
246
- /**
247
- * Determines if two values are equivalent according to FHIRPath equality rules.
248
- * @param x The first value.
249
- * @param y The second value.
250
- * @returns True if equivalent.
251
- */
252
- function fhirPathEquivalent(x, y) {
253
- const xValue = x.value;
254
- const yValue = y.value;
255
- if (typeof xValue === 'number' && typeof yValue === 'number') {
256
- // Use more generous threshold than equality
257
- // Decimal: values must be equal, comparison is done on values rounded to the precision of the least precise operand.
258
- // Trailing zeroes after the decimal are ignored in determining precision.
259
- return booleanToTypedValue(Math.abs(xValue - yValue) < 0.01);
260
- }
261
- if (isQuantity(xValue) && isQuantity(yValue)) {
262
- return booleanToTypedValue(isQuantityEquivalent(xValue, yValue));
263
- }
264
- if (typeof xValue === 'object' && typeof yValue === 'object') {
265
- return booleanToTypedValue(deepEquals(xValue, yValue));
266
- }
267
- if (typeof xValue === 'string' && typeof yValue === 'string') {
268
- // String: the strings must be the same, ignoring case and locale, and normalizing whitespace
269
- // (see String Equivalence for more details).
270
- return booleanToTypedValue(xValue.toLowerCase() === yValue.toLowerCase());
271
- }
272
- return booleanToTypedValue(xValue === yValue);
273
- }
274
- /**
275
- * Returns the sort order of two values for FHIRPath array equivalence.
276
- * @param x The first value.
277
- * @param y The second value.
278
- * @returns The sort order of the values.
279
- */
280
- function fhirPathEquivalentCompare(x, y) {
281
- const xValue = x.value;
282
- const yValue = y.value;
283
- if (typeof xValue === 'number' && typeof yValue === 'number') {
284
- return xValue - yValue;
285
- }
286
- if (typeof xValue === 'string' && typeof yValue === 'string') {
287
- return xValue.localeCompare(yValue);
288
- }
289
- return 0;
290
- }
291
- /**
292
- * Determines if the typed value is the desired type.
293
- * @param typedValue The typed value to check.
294
- * @param desiredType The desired type name.
295
- * @returns True if the typed value is of the desired type.
296
- */
297
- function fhirPathIs(typedValue, desiredType) {
298
- const { value } = typedValue;
299
- if (value === undefined || value === null) {
300
- return false;
301
- }
302
- switch (desiredType) {
303
- case 'Boolean':
304
- return typeof value === 'boolean';
305
- case 'Decimal':
306
- case 'Integer':
307
- return typeof value === 'number';
308
- case 'Date':
309
- return typeof value === 'string' && !!value.match(/^\d{4}(-\d{2}(-\d{2})?)?/);
310
- case 'DateTime':
311
- return typeof value === 'string' && !!value.match(/^\d{4}(-\d{2}(-\d{2})?)?T/);
312
- case 'Time':
313
- return typeof value === 'string' && !!value.match(/^T\d/);
314
- case 'Period':
315
- return isPeriod(value);
316
- case 'Quantity':
317
- return isQuantity(value);
318
- default:
319
- return typeof value === 'object' && value?.resourceType === desiredType;
320
- }
321
- }
322
- /**
323
- * Determines if the input is a Period object.
324
- * This is heuristic based, as we do not have strong typing at runtime.
325
- * @param input The input value.
326
- * @returns True if the input is a period.
327
- */
328
- function isPeriod(input) {
329
- return !!(input && typeof input === 'object' && 'start' in input);
330
- }
331
- /**
332
- * Determines if the input is a Quantity object.
333
- * This is heuristic based, as we do not have strong typing at runtime.
334
- * @param input The input value.
335
- * @returns True if the input is a quantity.
336
- */
337
- function isQuantity(input) {
338
- return !!(input && typeof input === 'object' && 'value' in input && typeof input.value === 'number');
339
- }
340
- function isQuantityEquivalent(x, y) {
341
- return (Math.abs(x.value - y.value) < 0.01 &&
342
- (x.unit === y.unit || x.code === y.code || x.unit === y.code || x.code === y.unit));
343
- }
344
- /**
345
- * Resource equality.
346
- * See: https://dmitripavlutin.com/how-to-compare-objects-in-javascript/#4-deep-equality
347
- * @param object1 The first object.
348
- * @param object2 The second object.
349
- * @returns True if the objects are equal.
350
- */
351
- function deepEquals(object1, object2) {
352
- const keys1 = Object.keys(object1);
353
- const keys2 = Object.keys(object2);
354
- if (keys1.length !== keys2.length) {
355
- return false;
356
- }
357
- for (const key of keys1) {
358
- const val1 = object1[key];
359
- const val2 = object2[key];
360
- if (isObject(val1) && isObject(val2)) {
361
- if (!deepEquals(val1, val2)) {
362
- return false;
363
- }
364
- }
365
- else {
366
- if (val1 !== val2) {
367
- return false;
368
- }
369
- }
370
- }
371
- return true;
372
- }
373
- function isObject(obj) {
374
- return obj !== null && typeof obj === 'object';
375
- }
376
-
377
- export { booleanToTypedValue, fhirPathArrayEquals, fhirPathArrayEquivalent, fhirPathEquals, fhirPathEquivalent, fhirPathIs, fhirPathNot, getTypedPropertyValue, isPeriod, isQuantity, isQuantityEquivalent, removeDuplicates, toJsBoolean, toTypedValue };
378
- //# sourceMappingURL=utils.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.mjs","sources":["../../../src/fhirpath/utils.ts"],"sourcesContent":["import { ElementDefinition, Period, Quantity } from '@medplum/fhirtypes';\nimport { buildTypeName, getElementDefinition, isResource, PropertyType, TypedValue } from '../types';\nimport { capitalize, isEmpty } from '../utils';\n\n/**\n * Returns a single element array with a typed boolean value.\n * @param value The primitive boolean value.\n * @returns Single element array with a typed boolean value.\n */\nexport function booleanToTypedValue(value: boolean): [TypedValue] {\n return [{ type: PropertyType.boolean, value }];\n}\n\n/**\n * Returns a \"best guess\" TypedValue for a given value.\n * @param value The unknown value to check.\n * @returns A \"best guess\" TypedValue for the given value.\n */\nexport function toTypedValue(value: unknown): TypedValue {\n if (value === null || value === undefined) {\n return { type: 'undefined', value: undefined };\n } else if (Number.isSafeInteger(value)) {\n return { type: PropertyType.integer, value };\n } else if (typeof value === 'number') {\n return { type: PropertyType.decimal, value };\n } else if (typeof value === 'boolean') {\n return { type: PropertyType.boolean, value };\n } else if (typeof value === 'string') {\n return { type: PropertyType.string, value };\n } else if (isQuantity(value)) {\n return { type: PropertyType.Quantity, value };\n } else if (isResource(value)) {\n return { type: value.resourceType, value };\n } else {\n return { type: PropertyType.BackboneElement, value };\n }\n}\n\n/**\n * Converts unknown object into a JavaScript boolean.\n * Note that this is different than the FHIRPath \"toBoolean\",\n * which has particular semantics around arrays, empty arrays, and type conversions.\n * @param obj Any value or array of values.\n * @returns The converted boolean value according to FHIRPath rules.\n */\nexport function toJsBoolean(obj: TypedValue[]): boolean {\n return obj.length === 0 ? false : !!obj[0].value;\n}\n\n/**\n * Returns the value of the property and the property type.\n * Some property definitions support multiple types.\n * For example, \"Observation.value[x]\" can be \"valueString\", \"valueInteger\", \"valueQuantity\", etc.\n * According to the spec, there can only be one property for a given element definition.\n * This function returns the value and the type.\n * @param input The base context (FHIR resource or backbone element).\n * @param path The property path.\n * @returns The value of the property and the property type.\n */\nexport function getTypedPropertyValue(input: TypedValue, path: string): TypedValue[] | TypedValue | undefined {\n if (!input?.value) {\n return undefined;\n }\n\n const elementDefinition = getElementDefinition(input.type, path);\n if (elementDefinition) {\n const typedResult = getTypedPropertyValueWithSchema(input, path, elementDefinition);\n if (typedResult) {\n return typedResult;\n }\n }\n\n return getTypedPropertyValueWithoutSchema(input, path);\n}\n\n/**\n * Returns the value of the property and the property type using a type schema.\n * @param input The base context (FHIR resource or backbone element).\n * @param path The property path.\n * @param property The property element definition.\n * @returns The value of the property and the property type.\n */\nfunction getTypedPropertyValueWithSchema(\n input: TypedValue,\n path: string,\n property: ElementDefinition\n): TypedValue[] | TypedValue | undefined {\n const types = property.type;\n if (!types || types.length === 0) {\n return undefined;\n }\n\n let resultValue: any = undefined;\n let resultType = 'undefined';\n\n if (types.length === 1) {\n resultValue = input.value[path];\n resultType = types[0].code as string;\n } else {\n for (const type of types) {\n const path2 = path.replace('[x]', '') + capitalize(type.code as string);\n if (path2 in input.value) {\n resultValue = input.value[path2];\n resultType = type.code as string;\n break;\n }\n }\n }\n\n if (isEmpty(resultValue)) {\n return undefined;\n }\n\n if (resultType === 'Element' || resultType === 'BackboneElement') {\n resultType = buildTypeName(property.path?.split('.') as string[]);\n }\n\n if (Array.isArray(resultValue)) {\n return resultValue.map((element) => toTypedValueWithType(element, resultType));\n } else {\n return toTypedValueWithType(resultValue, resultType);\n }\n}\n\nfunction toTypedValueWithType(value: any, type: string): TypedValue {\n if (type === 'Resource' && isResource(value)) {\n type = value.resourceType;\n }\n return { type, value };\n}\n\n/**\n * Returns the value of the property and the property type using a type schema.\n * Note that because the type schema is not available, this function may be inaccurate.\n * In some cases, that is the desired behavior.\n * @param typedValue The base context (FHIR resource or backbone element).\n * @param path The property path.\n * @returns The value of the property and the property type.\n */\nfunction getTypedPropertyValueWithoutSchema(\n typedValue: TypedValue,\n path: string\n): TypedValue[] | TypedValue | undefined {\n const input = typedValue.value;\n if (!input || typeof input !== 'object') {\n return undefined;\n }\n\n let result: any = undefined;\n if (path in input) {\n result = (input as { [key: string]: unknown })[path];\n } else {\n // Only support property names that would be valid types\n // Examples:\n // value + valueString = ok, because \"string\" is valid\n // value + valueDecimal = ok, because \"decimal\" is valid\n // id + identifier = not ok, because \"entifier\" is not a valid type\n // resource + resourceType = not ok, because \"type\" is not a valid type\n for (const propertyType in PropertyType) {\n const propertyName = path + capitalize(propertyType);\n if (propertyName in input) {\n result = (input as { [key: string]: unknown })[propertyName];\n break;\n }\n }\n }\n\n if (isEmpty(result)) {\n return undefined;\n }\n\n if (Array.isArray(result)) {\n return result.map(toTypedValue);\n } else {\n return toTypedValue(result);\n }\n}\n\n/**\n * Removes duplicates in array using FHIRPath equality rules.\n * @param arr The input array.\n * @returns The result array with duplicates removed.\n */\nexport function removeDuplicates(arr: TypedValue[]): TypedValue[] {\n const result: TypedValue[] = [];\n for (const i of arr) {\n let found = false;\n for (const j of result) {\n if (toJsBoolean(fhirPathEquals(i, j))) {\n found = true;\n break;\n }\n }\n if (!found) {\n result.push(i);\n }\n }\n return result;\n}\n\n/**\n * Returns a negated FHIRPath boolean expression.\n * @param input The input array.\n * @returns The negated type value array.\n */\nexport function fhirPathNot(input: TypedValue[]): TypedValue[] {\n return booleanToTypedValue(!toJsBoolean(input));\n}\n\n/**\n * Determines if two arrays are equal according to FHIRPath equality rules.\n * @param x The first array.\n * @param y The second array.\n * @returns FHIRPath true if the arrays are equal.\n */\nexport function fhirPathArrayEquals(x: TypedValue[], y: TypedValue[]): TypedValue[] {\n if (x.length === 0 || y.length === 0) {\n return [];\n }\n if (x.length !== y.length) {\n return booleanToTypedValue(false);\n }\n return booleanToTypedValue(x.every((val, index) => toJsBoolean(fhirPathEquals(val, y[index]))));\n}\n\n/**\n * Determines if two values are equal according to FHIRPath equality rules.\n * @param x The first value.\n * @param y The second value.\n * @returns True if equal.\n */\nexport function fhirPathEquals(x: TypedValue, y: TypedValue): TypedValue[] {\n const xValue = x.value;\n const yValue = y.value;\n if (typeof xValue === 'number' && typeof yValue === 'number') {\n return booleanToTypedValue(Math.abs(xValue - yValue) < 1e-8);\n }\n if (isQuantity(xValue) && isQuantity(yValue)) {\n return booleanToTypedValue(isQuantityEquivalent(xValue, yValue));\n }\n if (typeof xValue === 'object' && typeof yValue === 'object') {\n return booleanToTypedValue(deepEquals(x, y));\n }\n return booleanToTypedValue(xValue === yValue);\n}\n\n/**\n * Determines if two arrays are equivalent according to FHIRPath equality rules.\n * @param x The first array.\n * @param y The second array.\n * @returns FHIRPath true if the arrays are equivalent.\n */\nexport function fhirPathArrayEquivalent(x: TypedValue[], y: TypedValue[]): TypedValue[] {\n if (x.length === 0 && y.length === 0) {\n return booleanToTypedValue(true);\n }\n if (x.length !== y.length) {\n return booleanToTypedValue(false);\n }\n x.sort(fhirPathEquivalentCompare);\n y.sort(fhirPathEquivalentCompare);\n return booleanToTypedValue(x.every((val, index) => toJsBoolean(fhirPathEquivalent(val, y[index]))));\n}\n\n/**\n * Determines if two values are equivalent according to FHIRPath equality rules.\n * @param x The first value.\n * @param y The second value.\n * @returns True if equivalent.\n */\nexport function fhirPathEquivalent(x: TypedValue, y: TypedValue): TypedValue[] {\n const xValue = x.value;\n const yValue = y.value;\n if (typeof xValue === 'number' && typeof yValue === 'number') {\n // Use more generous threshold than equality\n // Decimal: values must be equal, comparison is done on values rounded to the precision of the least precise operand.\n // Trailing zeroes after the decimal are ignored in determining precision.\n return booleanToTypedValue(Math.abs(xValue - yValue) < 0.01);\n }\n if (isQuantity(xValue) && isQuantity(yValue)) {\n return booleanToTypedValue(isQuantityEquivalent(xValue, yValue));\n }\n if (typeof xValue === 'object' && typeof yValue === 'object') {\n return booleanToTypedValue(deepEquals(xValue, yValue));\n }\n if (typeof xValue === 'string' && typeof yValue === 'string') {\n // String: the strings must be the same, ignoring case and locale, and normalizing whitespace\n // (see String Equivalence for more details).\n return booleanToTypedValue(xValue.toLowerCase() === yValue.toLowerCase());\n }\n return booleanToTypedValue(xValue === yValue);\n}\n\n/**\n * Returns the sort order of two values for FHIRPath array equivalence.\n * @param x The first value.\n * @param y The second value.\n * @returns The sort order of the values.\n */\nfunction fhirPathEquivalentCompare(x: TypedValue, y: TypedValue): number {\n const xValue = x.value;\n const yValue = y.value;\n if (typeof xValue === 'number' && typeof yValue === 'number') {\n return xValue - yValue;\n }\n if (typeof xValue === 'string' && typeof yValue === 'string') {\n return xValue.localeCompare(yValue);\n }\n return 0;\n}\n\n/**\n * Determines if the typed value is the desired type.\n * @param typedValue The typed value to check.\n * @param desiredType The desired type name.\n * @returns True if the typed value is of the desired type.\n */\nexport function fhirPathIs(typedValue: TypedValue, desiredType: string): boolean {\n const { value } = typedValue;\n if (value === undefined || value === null) {\n return false;\n }\n\n switch (desiredType) {\n case 'Boolean':\n return typeof value === 'boolean';\n case 'Decimal':\n case 'Integer':\n return typeof value === 'number';\n case 'Date':\n return typeof value === 'string' && !!value.match(/^\\d{4}(-\\d{2}(-\\d{2})?)?/);\n case 'DateTime':\n return typeof value === 'string' && !!value.match(/^\\d{4}(-\\d{2}(-\\d{2})?)?T/);\n case 'Time':\n return typeof value === 'string' && !!value.match(/^T\\d/);\n case 'Period':\n return isPeriod(value);\n case 'Quantity':\n return isQuantity(value);\n default:\n return typeof value === 'object' && value?.resourceType === desiredType;\n }\n}\n\n/**\n * Determines if the input is a Period object.\n * This is heuristic based, as we do not have strong typing at runtime.\n * @param input The input value.\n * @returns True if the input is a period.\n */\nexport function isPeriod(input: unknown): input is Period {\n return !!(input && typeof input === 'object' && 'start' in input);\n}\n\n/**\n * Determines if the input is a Quantity object.\n * This is heuristic based, as we do not have strong typing at runtime.\n * @param input The input value.\n * @returns True if the input is a quantity.\n */\nexport function isQuantity(input: unknown): input is Quantity {\n return !!(input && typeof input === 'object' && 'value' in input && typeof (input as Quantity).value === 'number');\n}\n\nexport function isQuantityEquivalent(x: Quantity, y: Quantity): boolean {\n return (\n Math.abs((x.value as number) - (y.value as number)) < 0.01 &&\n (x.unit === y.unit || x.code === y.code || x.unit === y.code || x.code === y.unit)\n );\n}\n\n/**\n * Resource equality.\n * See: https://dmitripavlutin.com/how-to-compare-objects-in-javascript/#4-deep-equality\n * @param object1 The first object.\n * @param object2 The second object.\n * @returns True if the objects are equal.\n */\nfunction deepEquals<T1 extends object, T2 extends object>(object1: T1, object2: T2): boolean {\n const keys1 = Object.keys(object1) as (keyof T1)[];\n const keys2 = Object.keys(object2) as (keyof T2)[];\n if (keys1.length !== keys2.length) {\n return false;\n }\n for (const key of keys1) {\n const val1 = object1[key] as unknown;\n const val2 = object2[key as unknown as keyof T2] as unknown;\n if (isObject(val1) && isObject(val2)) {\n if (!deepEquals(val1, val2)) {\n return false;\n }\n } else {\n if (val1 !== val2) {\n return false;\n }\n }\n }\n return true;\n}\n\nfunction isObject(obj: unknown): obj is object {\n return obj !== null && typeof obj === 'object';\n}\n"],"names":[],"mappings":";;;AAIA;;;;AAIG;AACG,SAAU,mBAAmB,CAAC,KAAc,EAAA;IAChD,OAAO,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;AACjD,CAAC;AAED;;;;AAIG;AACG,SAAU,YAAY,CAAC,KAAc,EAAA;AACzC,IAAA,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;QACzC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AAChD,KAAA;AAAM,SAAA,IAAI,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE;QACtC,OAAO,EAAE,IAAI,EAAE,YAAY,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;AAC9C,KAAA;AAAM,SAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QACpC,OAAO,EAAE,IAAI,EAAE,YAAY,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;AAC9C,KAAA;AAAM,SAAA,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE;QACrC,OAAO,EAAE,IAAI,EAAE,YAAY,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;AAC9C,KAAA;AAAM,SAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QACpC,OAAO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,MAAM,EAAE;AACjC,QAAA,OAAO,KAAK,CAAC;AACd,KAAA;AACD,IAAA,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE;AACvB,QAAA,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAY,CAAC;AACrC,QAAA,MAAM,IAAI,GAAG,OAAO,CAAC,GAA0B,CAAY,CAAC;QAC5D,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,EAAE;AACpC,YAAA,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE;AAC3B,gBAAA,OAAO,KAAK,CAAC;AACd,aAAA;AACF,SAAA;AAAM,aAAA;YACL,IAAI,IAAI,KAAK,IAAI,EAAE;AACjB,gBAAA,OAAO,KAAK,CAAC;AACd,aAAA;AACF,SAAA;AACF,KAAA;AACD,IAAA,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,QAAQ,CAAC,GAAY,EAAA;IAC5B,OAAO,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,CAAC;AACjD;;;;"}
@@ -1,101 +0,0 @@
1
- import '../types.mjs';
2
- import '../utils.mjs';
3
- import { initFhirPathParserBuilder } from '../fhirpath/parse.mjs';
4
- import { OperationOutcomeError, badRequest } from '../outcomes.mjs';
5
- import { Operator } from '../search/search.mjs';
6
- import { tokenize } from './tokenize.mjs';
7
- import { FhirFilterNegation, FhirFilterComparison, FhirFilterConnective } from './types.mjs';
8
-
9
- /**
10
- * The operatorMap maps FHIR _filter operators to Medplum search operators.
11
- * See _filter operators: https://www.hl7.org/fhir/search_filter.html#ops
12
- */
13
- const operatorMap = {
14
- // eq - an item in the set has an equal value
15
- eq: Operator.EQUALS,
16
- // ne - An item in the set has an unequal value
17
- ne: Operator.NOT_EQUALS,
18
- // co - An item in the set contains this value
19
- co: Operator.CONTAINS,
20
- // sw - An item in the set starts with this value
21
- sw: undefined,
22
- // ew - An item in the set ends with this value
23
- ew: undefined,
24
- // gt / lt / ge / le - A value in the set is (greater than, less than, greater or equal, less or equal) the given value
25
- gt: Operator.GREATER_THAN,
26
- lt: Operator.LESS_THAN,
27
- ge: Operator.GREATER_THAN_OR_EQUALS,
28
- le: Operator.LESS_THAN_OR_EQUALS,
29
- // ap - A value in the set is approximately the same as this value.
30
- // Note that the recommended value for the approximation is 10% of the stated value (or for a date, 10% of the gap between now and the date), but systems may choose other values where appropriate
31
- ap: Operator.APPROXIMATELY,
32
- // sa - The value starts after the specified value
33
- sa: Operator.STARTS_AFTER,
34
- // eb - The value ends before the specified value
35
- eb: Operator.ENDS_BEFORE,
36
- // pr - The set is empty or not (value is false or true)
37
- pr: Operator.MISSING,
38
- // po - True if a (implied) date period in the set overlaps with the implied period in the value
39
- po: undefined,
40
- // ss - True if the value subsumes a concept in the set
41
- ss: undefined,
42
- // sb - True if the value is subsumed by a concept in the set
43
- sb: undefined,
44
- // in - True if one of the concepts is in the nominated value set by URI, either a relative, literal or logical vs
45
- in: Operator.IN,
46
- // ni - True if none of the concepts are in the nominated value set by URI, either a relative, literal or logical vs
47
- ni: Operator.NOT_IN,
48
- // re - True if one of the references in set points to the given URL
49
- re: undefined,
50
- // identifier - True if the identifier is in the identifier set (Medplum extension)
51
- identifier: Operator.IDENTIFIER,
52
- };
53
- function getOperator(value) {
54
- const operator = operatorMap[value];
55
- if (!operator) {
56
- throw new OperationOutcomeError(badRequest('Invalid operator: ' + value));
57
- }
58
- return operator;
59
- }
60
- class FilterParameterParser {
61
- constructor(parser) {
62
- this.parser = parser;
63
- }
64
- parse() {
65
- let result;
66
- if (this.parser.peek()?.value === '(') {
67
- this.parser.consume('(');
68
- result = this.parse();
69
- this.parser.consume(')');
70
- }
71
- else if (this.parser.peek()?.value === 'not') {
72
- this.parser.consume('Symbol', 'not');
73
- this.parser.consume('(');
74
- result = new FhirFilterNegation(this.parse());
75
- this.parser.consume(')');
76
- }
77
- else {
78
- result = new FhirFilterComparison(this.parser.consume('Symbol').value, getOperator(this.parser.consume('Symbol').value), this.parser.consume().value);
79
- }
80
- const next = this.parser.peek()?.value;
81
- if (next === 'and' || next === 'or') {
82
- this.parser.consume('Symbol', next);
83
- return new FhirFilterConnective(next, result, this.parse());
84
- }
85
- return result;
86
- }
87
- }
88
- const fhirPathParserBuilder = initFhirPathParserBuilder();
89
- /**
90
- * Parses a FHIR _filter parameter expression into an AST.
91
- * @param input The FHIR _filter parameter expression.
92
- * @returns The AST representing the filters.
93
- */
94
- function parseFilterParameter(input) {
95
- const parser = fhirPathParserBuilder.construct(tokenize(input));
96
- parser.removeComments();
97
- return new FilterParameterParser(parser).parse();
98
- }
99
-
100
- export { parseFilterParameter };
101
- //# sourceMappingURL=parse.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parse.mjs","sources":["../../../src/filter/parse.ts"],"sourcesContent":["import { Parser } from '../fhirlexer';\nimport { initFhirPathParserBuilder } from '../fhirpath';\nimport { OperationOutcomeError, badRequest } from '../outcomes';\nimport { Operator } from '../search/search';\nimport { tokenize } from './tokenize';\nimport { FhirFilterComparison, FhirFilterConnective, FhirFilterExpression, FhirFilterNegation } from './types';\n\n/**\n * The operatorMap maps FHIR _filter operators to Medplum search operators.\n * See _filter operators: https://www.hl7.org/fhir/search_filter.html#ops\n */\nconst operatorMap: Record<string, Operator | undefined> = {\n // eq - an item in the set has an equal value\n eq: Operator.EQUALS,\n // ne - An item in the set has an unequal value\n ne: Operator.NOT_EQUALS,\n // co - An item in the set contains this value\n co: Operator.CONTAINS,\n // sw - An item in the set starts with this value\n sw: undefined,\n // ew - An item in the set ends with this value\n ew: undefined,\n // gt / lt / ge / le - A value in the set is (greater than, less than, greater or equal, less or equal) the given value\n gt: Operator.GREATER_THAN,\n lt: Operator.LESS_THAN,\n ge: Operator.GREATER_THAN_OR_EQUALS,\n le: Operator.LESS_THAN_OR_EQUALS,\n // ap - A value in the set is approximately the same as this value.\n // Note that the recommended value for the approximation is 10% of the stated value (or for a date, 10% of the gap between now and the date), but systems may choose other values where appropriate\n ap: Operator.APPROXIMATELY,\n // sa - The value starts after the specified value\n sa: Operator.STARTS_AFTER,\n // eb - The value ends before the specified value\n eb: Operator.ENDS_BEFORE,\n // pr - The set is empty or not (value is false or true)\n pr: Operator.MISSING,\n // po - True if a (implied) date period in the set overlaps with the implied period in the value\n po: undefined,\n // ss - True if the value subsumes a concept in the set\n ss: undefined,\n // sb - True if the value is subsumed by a concept in the set\n sb: undefined,\n // in - True if one of the concepts is in the nominated value set by URI, either a relative, literal or logical vs\n in: Operator.IN,\n // ni - True if none of the concepts are in the nominated value set by URI, either a relative, literal or logical vs\n ni: Operator.NOT_IN,\n // re - True if one of the references in set points to the given URL\n re: undefined,\n // identifier - True if the identifier is in the identifier set (Medplum extension)\n identifier: Operator.IDENTIFIER,\n};\n\nfunction getOperator(value: string): Operator {\n const operator = operatorMap[value];\n if (!operator) {\n throw new OperationOutcomeError(badRequest('Invalid operator: ' + value));\n }\n return operator;\n}\n\nclass FilterParameterParser {\n constructor(readonly parser: Parser) {}\n\n parse(): FhirFilterExpression {\n let result: FhirFilterExpression;\n\n if (this.parser.peek()?.value === '(') {\n this.parser.consume('(');\n result = this.parse();\n this.parser.consume(')');\n } else if (this.parser.peek()?.value === 'not') {\n this.parser.consume('Symbol', 'not');\n this.parser.consume('(');\n result = new FhirFilterNegation(this.parse());\n this.parser.consume(')');\n } else {\n result = new FhirFilterComparison(\n this.parser.consume('Symbol').value,\n getOperator(this.parser.consume('Symbol').value),\n this.parser.consume().value\n );\n }\n\n const next = this.parser.peek()?.value;\n if (next === 'and' || next === 'or') {\n this.parser.consume('Symbol', next);\n return new FhirFilterConnective(next, result, this.parse());\n }\n\n return result;\n }\n}\n\nconst fhirPathParserBuilder = initFhirPathParserBuilder();\n\n/**\n * Parses a FHIR _filter parameter expression into an AST.\n * @param input The FHIR _filter parameter expression.\n * @returns The AST representing the filters.\n */\nexport function parseFilterParameter(input: string): FhirFilterExpression {\n const parser = fhirPathParserBuilder.construct(tokenize(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oB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;AAC7D,SAAA;AAED,QAAA,OAAO,MAAM,CAAC;KACf;AACF,CAAA;AAED,MAAM,qBAAqB,GAAG,yBAAyB,EAAE,CAAC;AAE1D;;;;AAIG;AACG,SAAU,oBAAoB,CAAC,KAAa,EAAA;IAChD,MAAM,MAAM,GAAG,qBAAqB,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IAChE,MAAM,CAAC,cAAc,EAAE,CAAC;IACxB,OAAO,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,CAAC;AACnD;;;;"}
@@ -1,16 +0,0 @@
1
- import { Tokenizer } from '../fhirlexer/tokenize.mjs';
2
- import '../types.mjs';
3
- import '../utils.mjs';
4
- import '../fhirpath/parse.mjs';
5
- import { FHIRPATH_OPERATORS, FHIRPATH_KEYWORDS } from '../fhirpath/tokenize.mjs';
6
-
7
- const MAPPING_LANGUAGE_OPERATORS = [...FHIRPATH_OPERATORS, 'eq', 'ne', 'co'];
8
- function tokenize(str) {
9
- return new Tokenizer(str, FHIRPATH_KEYWORDS, MAPPING_LANGUAGE_OPERATORS, {
10
- dateTimeLiterals: true,
11
- symbolRegex: /[^\s\])]/,
12
- }).tokenize();
13
- }
14
-
15
- export { tokenize };
16
- //# sourceMappingURL=tokenize.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tokenize.mjs","sources":["../../../src/filter/tokenize.ts"],"sourcesContent":["import { Token, Tokenizer } from '../fhirlexer';\nimport { FHIRPATH_KEYWORDS, FHIRPATH_OPERATORS } from '../fhirpath';\n\nconst MAPPING_LANGUAGE_OPERATORS = [...FHIRPATH_OPERATORS, 'eq', 'ne', 'co'];\n\nexport function tokenize(str: string): Token[] {\n return new Tokenizer(str, FHIRPATH_KEYWORDS, MAPPING_LANGUAGE_OPERATORS, {\n dateTimeLiterals: true,\n symbolRegex: /[^\\s\\])]/,\n }).tokenize();\n}\n"],"names":[],"mappings":";;;;;;AAGA,MAAM,0BAA0B,GAAG,CAAC,GAAG,kBAAkB,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAEvE,SAAU,QAAQ,CAAC,GAAW,EAAA;IAClC,OAAO,IAAI,SAAS,CAAC,GAAG,EAAE,iBAAiB,EAAE,0BAA0B,EAAE;AACvE,QAAA,gBAAgB,EAAE,IAAI;AACtB,QAAA,WAAW,EAAE,UAAU;KACxB,CAAC,CAAC,QAAQ,EAAE,CAAC;AAChB;;;;"}
@@ -1,34 +0,0 @@
1
- // See: https://hl7.org/fhir/search_filter.html
2
- /**
3
- * The FhirFilterComparison class represents a comparison expression.
4
- */
5
- class FhirFilterComparison {
6
- constructor(path, operator, value) {
7
- this.path = path;
8
- this.operator = operator;
9
- this.value = value;
10
- }
11
- }
12
- /**
13
- * The FhirFilterNegation class represents a negation expression.
14
- * It contains a single child expression.
15
- */
16
- class FhirFilterNegation {
17
- constructor(child) {
18
- this.child = child;
19
- }
20
- }
21
- /**
22
- * The FhirFilterConnective class represents a connective expression.
23
- * It contains a list of child expressions.
24
- */
25
- class FhirFilterConnective {
26
- constructor(keyword, left, right) {
27
- this.keyword = keyword;
28
- this.left = left;
29
- this.right = right;
30
- }
31
- }
32
-
33
- export { FhirFilterComparison, FhirFilterConnective, FhirFilterNegation };
34
- //# sourceMappingURL=types.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.mjs","sources":["../../../src/filter/types.ts"],"sourcesContent":["// See: https://hl7.org/fhir/search_filter.html\n\nimport { Operator } from '../search/search';\n\n/**\n * The FhirFilterExpression type is the base type of all filter expressions.\n */\nexport type FhirFilterExpression = FhirFilterComparison | FhirFilterNegation | FhirFilterConnective;\n\n/**\n * The FhirFilterComparison class represents a comparison expression.\n */\nexport class FhirFilterComparison {\n constructor(readonly path: string, readonly operator: Operator, readonly value: string) {}\n}\n\n/**\n * The FhirFilterNegation class represents a negation expression.\n * It contains a single child expression.\n */\nexport class FhirFilterNegation {\n constructor(readonly child: FhirFilterExpression) {}\n}\n\n/**\n * The FhirFilterConnective class represents a connective expression.\n * It contains a list of child expressions.\n */\nexport class FhirFilterConnective {\n constructor(\n readonly keyword: 'and' | 'or',\n readonly left: FhirFilterExpression,\n readonly right: FhirFilterExpression\n ) {}\n}\n"],"names":[],"mappings":"AAAA;AASA;;AAEG;MACU,oBAAoB,CAAA;AAC/B,IAAA,WAAA,CAAqB,IAAY,EAAW,QAAkB,EAAW,KAAa,EAAA;QAAjE,IAAI,CAAA,IAAA,GAAJ,IAAI,CAAQ;QAAW,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAU;QAAW,IAAK,CAAA,KAAA,GAAL,KAAK,CAAQ;KAAI;AAC3F,CAAA;AAED;;;AAGG;MACU,kBAAkB,CAAA;AAC7B,IAAA,WAAA,CAAqB,KAA2B,EAAA;QAA3B,IAAK,CAAA,KAAA,GAAL,KAAK,CAAsB;KAAI;AACrD,CAAA;AAED;;;AAGG;MACU,oBAAoB,CAAA;AAC/B,IAAA,WAAA,CACW,OAAqB,EACrB,IAA0B,EAC1B,KAA2B,EAAA;QAF3B,IAAO,CAAA,OAAA,GAAP,OAAO,CAAc;QACrB,IAAI,CAAA,IAAA,GAAJ,IAAI,CAAsB;QAC1B,IAAK,CAAA,KAAA,GAAL,KAAK,CAAsB;KAClC;AACL;;;;"}