@medplum/core 2.0.4 → 2.0.6

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 (100) hide show
  1. package/dist/cjs/index.cjs +905 -46
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs/index.min.cjs +1 -1
  4. package/dist/esm/client.mjs +16 -22
  5. package/dist/esm/client.mjs.map +1 -1
  6. package/dist/esm/fhirlexer/tokenize.mjs +13 -4
  7. package/dist/esm/fhirlexer/tokenize.mjs.map +1 -1
  8. package/dist/esm/fhirmapper/parse.mjs +317 -0
  9. package/dist/esm/fhirmapper/parse.mjs.map +1 -0
  10. package/dist/esm/fhirmapper/tokenize.mjs +15 -0
  11. package/dist/esm/fhirmapper/tokenize.mjs.map +1 -0
  12. package/dist/esm/fhirpath/atoms.mjs +2 -2
  13. package/dist/esm/fhirpath/atoms.mjs.map +1 -1
  14. package/dist/esm/fhirpath/functions.mjs +2 -2
  15. package/dist/esm/fhirpath/functions.mjs.map +1 -1
  16. package/dist/esm/fhirpath/utils.mjs +4 -4
  17. package/dist/esm/fhirpath/utils.mjs.map +1 -1
  18. package/dist/esm/filter/parse.mjs +51 -0
  19. package/dist/esm/filter/parse.mjs.map +1 -0
  20. package/dist/esm/filter/tokenize.mjs +18 -0
  21. package/dist/esm/filter/tokenize.mjs.map +1 -0
  22. package/dist/esm/filter/types.mjs +34 -0
  23. package/dist/esm/filter/types.mjs.map +1 -0
  24. package/dist/esm/index.min.mjs +1 -1
  25. package/dist/esm/index.mjs +8 -2
  26. package/dist/esm/index.mjs.map +1 -1
  27. package/dist/esm/node_modules/tslib/tslib.es6.mjs.map +1 -1
  28. package/dist/esm/outcomes.mjs +31 -2
  29. package/dist/esm/outcomes.mjs.map +1 -1
  30. package/dist/esm/schema.mjs +397 -0
  31. package/dist/esm/schema.mjs.map +1 -0
  32. package/dist/esm/search/match.mjs +9 -4
  33. package/dist/esm/search/match.mjs.map +1 -1
  34. package/dist/esm/types.mjs +34 -8
  35. package/dist/esm/types.mjs.map +1 -1
  36. package/dist/{esm → types}/client.d.ts +20 -8
  37. package/dist/{cjs → types}/fhirlexer/tokenize.d.ts +5 -1
  38. package/dist/types/fhirmapper/index.d.ts +1 -0
  39. package/dist/types/filter/index.d.ts +2 -0
  40. package/dist/types/filter/parse.d.ts +7 -0
  41. package/dist/types/filter/types.d.ts +31 -0
  42. package/dist/{esm → types}/index.d.ts +4 -0
  43. package/dist/{esm → types}/outcomes.d.ts +8 -1
  44. package/dist/types/schema.d.ts +120 -0
  45. package/dist/{esm → types}/types.d.ts +19 -5
  46. package/package.json +4 -4
  47. package/tsconfig.build.json +9 -0
  48. package/dist/cjs/client.d.ts +0 -1218
  49. package/dist/cjs/index.d.ts +0 -14
  50. package/dist/cjs/outcomes.d.ts +0 -31
  51. package/dist/cjs/types.d.ts +0 -200
  52. package/dist/esm/cache.d.ts +0 -34
  53. package/dist/esm/crypto.d.ts +0 -9
  54. package/dist/esm/eventtarget.d.ts +0 -13
  55. package/dist/esm/fhirlexer/index.d.ts +0 -2
  56. package/dist/esm/fhirlexer/parse.d.ts +0 -47
  57. package/dist/esm/fhirlexer/tokenize.d.ts +0 -14
  58. package/dist/esm/fhirmapper/parse.d.ts +0 -7
  59. package/dist/esm/fhirpath/atoms.d.ts +0 -120
  60. package/dist/esm/fhirpath/date.d.ts +0 -1
  61. package/dist/esm/fhirpath/functions.d.ts +0 -6
  62. package/dist/esm/fhirpath/index.d.ts +0 -4
  63. package/dist/esm/fhirpath/parse.d.ts +0 -64
  64. package/dist/esm/fhirpath/tokenize.d.ts +0 -4
  65. package/dist/esm/fhirpath/utils.d.ts +0 -95
  66. package/dist/esm/format.d.ts +0 -118
  67. package/dist/esm/hl7.d.ts +0 -136
  68. package/dist/esm/jwt.d.ts +0 -5
  69. package/dist/esm/readablepromise.d.ts +0 -48
  70. package/dist/esm/search/details.d.ts +0 -33
  71. package/dist/esm/search/match.d.ts +0 -9
  72. package/dist/esm/search/parse.d.ts +0 -17
  73. package/dist/esm/search/search.d.ts +0 -66
  74. package/dist/esm/storage.d.ts +0 -47
  75. package/dist/esm/utils.d.ts +0 -259
  76. /package/dist/{cjs → types}/cache.d.ts +0 -0
  77. /package/dist/{cjs → types}/crypto.d.ts +0 -0
  78. /package/dist/{cjs → types}/eventtarget.d.ts +0 -0
  79. /package/dist/{cjs → types}/fhirlexer/index.d.ts +0 -0
  80. /package/dist/{cjs → types}/fhirlexer/parse.d.ts +0 -0
  81. /package/dist/{cjs → types}/fhirmapper/parse.d.ts +0 -0
  82. /package/dist/{cjs → types}/fhirmapper/tokenize.d.ts +0 -0
  83. /package/dist/{cjs → types}/fhirpath/atoms.d.ts +0 -0
  84. /package/dist/{cjs → types}/fhirpath/date.d.ts +0 -0
  85. /package/dist/{cjs → types}/fhirpath/functions.d.ts +0 -0
  86. /package/dist/{cjs → types}/fhirpath/index.d.ts +0 -0
  87. /package/dist/{cjs → types}/fhirpath/parse.d.ts +0 -0
  88. /package/dist/{cjs → types}/fhirpath/tokenize.d.ts +0 -0
  89. /package/dist/{cjs → types}/fhirpath/utils.d.ts +0 -0
  90. /package/dist/{esm/fhirmapper → types/filter}/tokenize.d.ts +0 -0
  91. /package/dist/{cjs → types}/format.d.ts +0 -0
  92. /package/dist/{cjs → types}/hl7.d.ts +0 -0
  93. /package/dist/{cjs → types}/jwt.d.ts +0 -0
  94. /package/dist/{cjs → types}/readablepromise.d.ts +0 -0
  95. /package/dist/{cjs → types}/search/details.d.ts +0 -0
  96. /package/dist/{cjs → types}/search/match.d.ts +0 -0
  97. /package/dist/{cjs → types}/search/parse.d.ts +0 -0
  98. /package/dist/{cjs → types}/search/search.d.ts +0 -0
  99. /package/dist/{cjs → types}/storage.d.ts +0 -0
  100. /package/dist/{cjs → types}/utils.d.ts +0 -0
@@ -1,95 +0,0 @@
1
- import { Period, Quantity } from '@medplum/fhirtypes';
2
- import { TypedValue } from '../types';
3
- /**
4
- * Returns a single element array with a typed boolean value.
5
- * @param value The primitive boolean value.
6
- * @returns Single element array with a typed boolean value.
7
- */
8
- export declare function booleanToTypedValue(value: boolean): [TypedValue];
9
- /**
10
- * Returns a "best guess" TypedValue for a given value.
11
- * @param value The unknown value to check.
12
- * @returns A "best guess" TypedValue for the given value.
13
- */
14
- export declare function toTypedValue(value: unknown): TypedValue;
15
- /**
16
- * Converts unknown object into a JavaScript boolean.
17
- * Note that this is different than the FHIRPath "toBoolean",
18
- * which has particular semantics around arrays, empty arrays, and type conversions.
19
- * @param obj Any value or array of values.
20
- * @returns The converted boolean value according to FHIRPath rules.
21
- */
22
- export declare function toJsBoolean(obj: TypedValue[]): boolean;
23
- /**
24
- * Returns the value of the property and the property type.
25
- * Some property definitions support multiple types.
26
- * For example, "Observation.value[x]" can be "valueString", "valueInteger", "valueQuantity", etc.
27
- * According to the spec, there can only be one property for a given element definition.
28
- * This function returns the value and the type.
29
- * @param input The base context (FHIR resource or backbone element).
30
- * @param path The property path.
31
- * @returns The value of the property and the property type.
32
- */
33
- export declare function getTypedPropertyValue(input: TypedValue, path: string): TypedValue[] | TypedValue | undefined;
34
- /**
35
- * Removes duplicates in array using FHIRPath equality rules.
36
- * @param arr The input array.
37
- * @returns The result array with duplicates removed.
38
- */
39
- export declare function removeDuplicates(arr: TypedValue[]): TypedValue[];
40
- /**
41
- * Returns a negated FHIRPath boolean expression.
42
- * @param input The input array.
43
- * @returns The negated type value array.
44
- */
45
- export declare function fhirPathNot(input: TypedValue[]): TypedValue[];
46
- /**
47
- * Determines if two arrays are equal according to FHIRPath equality rules.
48
- * @param x The first array.
49
- * @param y The second array.
50
- * @returns FHIRPath true if the arrays are equal.
51
- */
52
- export declare function fhirPathArrayEquals(x: TypedValue[], y: TypedValue[]): TypedValue[];
53
- /**
54
- * Determines if two values are equal according to FHIRPath equality rules.
55
- * @param x The first value.
56
- * @param y The second value.
57
- * @returns True if equal.
58
- */
59
- export declare function fhirPathEquals(x: TypedValue, y: TypedValue): TypedValue[];
60
- /**
61
- * Determines if two arrays are equivalent according to FHIRPath equality rules.
62
- * @param x The first array.
63
- * @param y The second array.
64
- * @returns FHIRPath true if the arrays are equivalent.
65
- */
66
- export declare function fhirPathArrayEquivalent(x: TypedValue[], y: TypedValue[]): TypedValue[];
67
- /**
68
- * Determines if two values are equivalent according to FHIRPath equality rules.
69
- * @param x The first value.
70
- * @param y The second value.
71
- * @returns True if equivalent.
72
- */
73
- export declare function fhirPathEquivalent(x: TypedValue, y: TypedValue): TypedValue[];
74
- /**
75
- * Determines if the typed value is the desired type.
76
- * @param typedValue The typed value to check.
77
- * @param desiredType The desired type name.
78
- * @returns True if the typed value is of the desired type.
79
- */
80
- export declare function fhirPathIs(typedValue: TypedValue, desiredType: string): boolean;
81
- /**
82
- * Determines if the input is a Period object.
83
- * This is heuristic based, as we do not have strong typing at runtime.
84
- * @param input The input value.
85
- * @returns True if the input is a period.
86
- */
87
- export declare function isPeriod(input: unknown): input is Period;
88
- /**
89
- * Determines if the input is a Quantity object.
90
- * This is heuristic based, as we do not have strong typing at runtime.
91
- * @param input The input value.
92
- * @returns True if the input is a quantity.
93
- */
94
- export declare function isQuantity(input: unknown): input is Quantity;
95
- export declare function isQuantityEquivalent(x: Quantity, y: Quantity): boolean;
@@ -1,118 +0,0 @@
1
- import { Address, CodeableConcept, Coding, HumanName, Money, Observation, ObservationComponent, Period, Quantity, Range, Timing } from '@medplum/fhirtypes';
2
- export interface AddressFormatOptions {
3
- all?: boolean;
4
- use?: boolean;
5
- lineSeparator?: string;
6
- }
7
- export interface HumanNameFormatOptions {
8
- all?: boolean;
9
- prefix?: boolean;
10
- suffix?: boolean;
11
- use?: boolean;
12
- }
13
- /**
14
- * Formats a FHIR Address as a string.
15
- * @param address The address to format.
16
- * @param options Optional address format options.
17
- * @returns The formatted address string.
18
- */
19
- export declare function formatAddress(address: Address, options?: AddressFormatOptions): string;
20
- /**
21
- * Formats a FHIR HumanName as a string.
22
- * @param name The name to format.
23
- * @param options Optional name format options.
24
- * @returns The formatted name string.
25
- */
26
- export declare function formatHumanName(name: HumanName, options?: HumanNameFormatOptions): string;
27
- /**
28
- * Formats the given name portion of a FHIR HumanName element.
29
- * @param name The name to format.
30
- * @returns The formatted given name string.
31
- */
32
- export declare function formatGivenName(name: HumanName): string;
33
- /**
34
- * Formats the family name portion of a FHIR HumanName element.
35
- * @param name The name to format.
36
- * @returns The formatted family name string.
37
- */
38
- export declare function formatFamilyName(name: HumanName): string;
39
- /**
40
- * Returns true if the given date object is a valid date.
41
- * Dates can be invalid if created by parsing an invalid string.
42
- * @param date A date object.
43
- * @returns Returns true if the date is a valid date.
44
- */
45
- export declare function isValidDate(date: Date): boolean;
46
- /**
47
- * Formats a FHIR date string as a human readable string.
48
- * Handles missing values and invalid dates.
49
- * @param date The date to format.
50
- * @param locales Optional locales.
51
- * @param options Optional date format options.
52
- * @returns The formatted date string.
53
- */
54
- export declare function formatDate(date: string | undefined, locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions | undefined): string;
55
- /**
56
- * Formats a FHIR time string as a human readable string.
57
- * Handles missing values and invalid dates.
58
- * @param time The date to format.
59
- * @param locales Optional locales.
60
- * @param options Optional time format options.
61
- * @returns The formatted time string.
62
- */
63
- export declare function formatTime(time: string | undefined, locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions | undefined): string;
64
- /**
65
- * Formats a FHIR dateTime string as a human readable string.
66
- * Handles missing values and invalid dates.
67
- * @param dateTime The dateTime to format.
68
- * @param locales Optional locales.
69
- * @param options Optional dateTime format options.
70
- * @returns The formatted dateTime string.
71
- */
72
- export declare function formatDateTime(dateTime: string | undefined, locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions | undefined): string;
73
- /**
74
- * Formats a FHIR Period as a human readable string.
75
- * @param period The period to format.
76
- * @param locales Optional locales.
77
- * @param options Optional period format options.
78
- * @returns The formatted period string.
79
- */
80
- export declare function formatPeriod(period: Period | undefined, locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions | undefined): string;
81
- /**
82
- * Formats a FHIR Timing as a human readable string.
83
- * @param timing The timing to format.
84
- * @returns The formatted timing string.
85
- */
86
- export declare function formatTiming(timing: Timing | undefined): string;
87
- /**
88
- * Returns a human-readable string for a FHIR Range datatype, taking into account comparators and one-sided ranges
89
- * @param range A FHIR Range element
90
- * @param exclusive If true, one-sided ranges will be rendered with the '>' or '<' bounds rather than '>=' or '<='
91
- * @returns A human-readable string representation of the Range
92
- */
93
- export declare function formatRange(range: Range | undefined, precision?: number, exclusive?: boolean): string;
94
- /**
95
- * Returns a human-readable string for a FHIR Quantity datatype, taking into account units and comparators
96
- * @param quantity A FHIR Quantity element
97
- * @returns A human-readable string representation of the Quantity
98
- */
99
- export declare function formatQuantity(quantity: Quantity | undefined, precision?: number): string;
100
- export declare function formatMoney(money: Money | undefined): string;
101
- /**
102
- * Formats a CodeableConcept element as a string.
103
- * @param codeableConcept A FHIR CodeableConcept element
104
- * @returns The codeable concept as a string.
105
- */
106
- export declare function formatCodeableConcept(codeableConcept: CodeableConcept | undefined): string;
107
- /**
108
- * Formats a Coding element as a string.
109
- * @param coding A FHIR Coding element
110
- * @returns The coding as a string.
111
- */
112
- export declare function formatCoding(coding: Coding | undefined): string;
113
- /**
114
- * Formats a FHIR Observation resource value as a string.
115
- * @param obs A FHIR Observation resource.
116
- * @returns A human-readable string representation of the Observation.
117
- */
118
- export declare function formatObservationValue(obs: Observation | ObservationComponent | undefined): string;
package/dist/esm/hl7.d.ts DELETED
@@ -1,136 +0,0 @@
1
- /**
2
- * The Hl7Context class represents the parsing context for an HL7 message.
3
- *
4
- * MSH-1:
5
- * https://hl7-definition.caristix.com/v2/HL7v2.6/Fields/MSH.1
6
- *
7
- * MSH-2:
8
- * https://hl7-definition.caristix.com/v2/HL7v2.6/Fields/MSH.2
9
- *
10
- * See this tutorial on MSH, and why it's a bad idea to use anything other than the default values:
11
- * https://www.hl7soup.com/HL7TutorialMSH.html
12
- */
13
- export declare class Hl7Context {
14
- readonly segmentSeparator: string;
15
- readonly fieldSeparator: string;
16
- readonly componentSeparator: string;
17
- readonly repetitionSeparator: string;
18
- readonly escapeCharacter: string;
19
- readonly subcomponentSeparator: string;
20
- constructor(segmentSeparator?: string, fieldSeparator?: string, componentSeparator?: string, repetitionSeparator?: string, escapeCharacter?: string, subcomponentSeparator?: string);
21
- /**
22
- * Returns the MSH-2 field value based on the configured separators.
23
- * @returns The HL7 MSH-2 field value.
24
- */
25
- getMsh2(): string;
26
- }
27
- /**
28
- * The Hl7Message class represents one HL7 message.
29
- * A message is a collection of segments.
30
- */
31
- export declare class Hl7Message {
32
- readonly context: Hl7Context;
33
- readonly segments: Hl7Segment[];
34
- /**
35
- * Creates a new HL7 message.
36
- * @param segments The HL7 segments.
37
- * @param context Optional HL7 parsing context.
38
- */
39
- constructor(segments: Hl7Segment[], context?: Hl7Context);
40
- /**
41
- * Returns an HL7 segment by index or by name.
42
- * @param index The HL7 segment index or name.
43
- * @returns The HL7 segment if found; otherwise, undefined.
44
- */
45
- get(index: number | string): Hl7Segment | undefined;
46
- /**
47
- * Returns all HL7 segments of a given name.
48
- * @param name The HL7 segment name.
49
- * @returns An array of HL7 segments with the specified name.
50
- */
51
- getAll(name: string): Hl7Segment[];
52
- /**
53
- * Returns the HL7 message as a string.
54
- * @returns The HL7 message as a string.
55
- */
56
- toString(): string;
57
- /**
58
- * Returns an HL7 "ACK" (acknowledgement) message for this message.
59
- * @returns The HL7 "ACK" message.
60
- */
61
- buildAck(): Hl7Message;
62
- /**
63
- * Parses an HL7 message string into an Hl7Message object.
64
- * @param text The HL7 message text.
65
- * @returns The parsed HL7 message.
66
- */
67
- static parse(text: string): Hl7Message;
68
- }
69
- /**
70
- * The Hl7Segment class represents one HL7 segment.
71
- * A segment is a collection of fields.
72
- * The name field is the first field.
73
- */
74
- export declare class Hl7Segment {
75
- readonly context: Hl7Context;
76
- readonly name: string;
77
- readonly fields: Hl7Field[];
78
- /**
79
- * Creates a new HL7 segment.
80
- * @param fields The HL7 fields.
81
- * @param context Optional HL7 parsing context.
82
- */
83
- constructor(fields: Hl7Field[] | string[], context?: Hl7Context);
84
- /**
85
- * Returns an HL7 field by index.
86
- * @param index The HL7 field index.
87
- * @returns The HL7 field.
88
- */
89
- get(index: number): Hl7Field;
90
- /**
91
- * Returns the HL7 segment as a string.
92
- * @returns The HL7 segment as a string.
93
- */
94
- toString(): string;
95
- /**
96
- * Parses an HL7 segment string into an Hl7Segment object.
97
- * @param text The HL7 segment text.
98
- * @param context Optional HL7 parsing context.
99
- * @returns The parsed HL7 segment.
100
- */
101
- static parse(text: string, context?: Hl7Context): Hl7Segment;
102
- }
103
- /**
104
- * The Hl7Field class represents one HL7 field.
105
- * A field is a collection of components.
106
- */
107
- export declare class Hl7Field {
108
- readonly context: Hl7Context;
109
- readonly components: string[][];
110
- /**
111
- * Creates a new HL7 field.
112
- * @param components The HL7 components.
113
- * @param context Optional HL7 parsing context.
114
- */
115
- constructor(components: string[][], context?: Hl7Context);
116
- /**
117
- * Returns an HL7 component by index.
118
- * @param component The component index.
119
- * @param subcomponent Optional subcomponent index.
120
- * @param repetition Optional repetition index.
121
- * @returns The string value of the specified component.
122
- */
123
- get(component: number, subcomponent?: number, repetition?: number): string;
124
- /**
125
- * Returns the HL7 field as a string.
126
- * @returns The HL7 field as a string.
127
- */
128
- toString(): string;
129
- /**
130
- * Parses an HL7 field string into an Hl7Field object.
131
- * @param text The HL7 field text.
132
- * @param context Optional HL7 parsing context.
133
- * @returns The parsed HL7 field.
134
- */
135
- static parse(text: string, context?: Hl7Context): Hl7Field;
136
- }
package/dist/esm/jwt.d.ts DELETED
@@ -1,5 +0,0 @@
1
- /**
2
- * Parses the JWT payload.
3
- * @param token JWT token
4
- */
5
- export declare function parseJWTPayload(token: string): Record<string, number | string>;
@@ -1,48 +0,0 @@
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
- }
@@ -1,33 +0,0 @@
1
- import { ElementDefinition, SearchParameter } from '@medplum/fhirtypes';
2
- export declare enum SearchParameterType {
3
- BOOLEAN = "BOOLEAN",
4
- NUMBER = "NUMBER",
5
- QUANTITY = "QUANTITY",
6
- TEXT = "TEXT",
7
- REFERENCE = "REFERENCE",
8
- DATE = "DATE",
9
- DATETIME = "DATETIME",
10
- PERIOD = "PERIOD"
11
- }
12
- export interface SearchParameterDetails {
13
- readonly columnName: string;
14
- readonly type: SearchParameterType;
15
- readonly elementDefinition?: ElementDefinition;
16
- readonly array?: boolean;
17
- }
18
- /**
19
- * Returns the type details of a SearchParameter.
20
- *
21
- * The SearchParameter resource has a "type" parameter, but that is missing some critical information.
22
- *
23
- * For example:
24
- * 1) The "date" type includes "date", "datetime", and "period".
25
- * 2) The "token" type includes enums and booleans.
26
- * 3) Arrays/multiple values are not reflected at all.
27
- *
28
- * @param resourceType The root resource type.
29
- * @param searchParam The search parameter.
30
- * @returns The search parameter type details.
31
- */
32
- export declare function getSearchParameterDetails(resourceType: string, searchParam: SearchParameter): SearchParameterDetails;
33
- export declare function getExpressionForResourceType(resourceType: string, expression: string): string | undefined;
@@ -1,9 +0,0 @@
1
- import { Resource } from '@medplum/fhirtypes';
2
- import { SearchRequest } from './search';
3
- /**
4
- * Determines if the resource matches the search request.
5
- * @param resource The resource that was created or updated.
6
- * @param searchRequest The subscription criteria as a search request.
7
- * @returns True if the resource satisfies the search request.
8
- */
9
- export declare function matchesSearchRequest(resource: Resource, searchRequest: SearchRequest): boolean;
@@ -1,17 +0,0 @@
1
- /// <reference types="node" />
2
- import { ResourceType } from '@medplum/fhirtypes';
3
- import { URL } from 'url';
4
- import { SearchRequest } from './search';
5
- /**
6
- * Parses a search URL into a search request.
7
- * @param resourceType The FHIR resource type.
8
- * @param query The collection of query string parameters.
9
- * @returns A parsed SearchRequest.
10
- */
11
- export declare function parseSearchRequest(resourceType: ResourceType, query: Record<string, string[] | string | undefined>): SearchRequest;
12
- /**
13
- * Parses a search URL into a search request.
14
- * @param url The search URL.
15
- * @returns A parsed SearchRequest.
16
- */
17
- export declare function parseSearchUrl(url: URL): SearchRequest;
@@ -1,66 +0,0 @@
1
- import { ResourceType } from '@medplum/fhirtypes';
2
- export declare const DEFAULT_SEARCH_COUNT = 20;
3
- export interface SearchRequest {
4
- readonly resourceType: ResourceType;
5
- filters?: Filter[];
6
- sortRules?: SortRule[];
7
- offset?: number;
8
- count?: number;
9
- fields?: string[];
10
- name?: string;
11
- total?: 'none' | 'estimate' | 'accurate';
12
- revInclude?: string;
13
- }
14
- export interface Filter {
15
- code: string;
16
- operator: Operator;
17
- value: string;
18
- unitSystem?: string;
19
- unitCode?: string;
20
- }
21
- export interface SortRule {
22
- code: string;
23
- descending?: boolean;
24
- }
25
- /**
26
- * Search operators.
27
- * These operators represent "modifiers" and "prefixes" in FHIR search.
28
- * See: https://www.hl7.org/fhir/search.html
29
- */
30
- export declare enum Operator {
31
- EQUALS = "eq",
32
- NOT_EQUALS = "ne",
33
- GREATER_THAN = "gt",
34
- LESS_THAN = "lt",
35
- GREATER_THAN_OR_EQUALS = "ge",
36
- LESS_THAN_OR_EQUALS = "le",
37
- STARTS_AFTER = "sa",
38
- ENDS_BEFORE = "eb",
39
- APPROXIMATELY = "ap",
40
- CONTAINS = "contains",
41
- EXACT = "exact",
42
- TEXT = "text",
43
- NOT = "not",
44
- ABOVE = "above",
45
- BELOW = "below",
46
- IN = "in",
47
- NOT_IN = "not-in",
48
- OF_TYPE = "of-type",
49
- MISSING = "missing"
50
- }
51
- /**
52
- * Parses a URL into a SearchRequest.
53
- *
54
- * See the FHIR search spec: http://hl7.org/fhir/r4/search.html
55
- *
56
- * @param url The URL to parse.
57
- * @returns Parsed search definition.
58
- */
59
- export declare function parseSearchDefinition(url: string): SearchRequest;
60
- /**
61
- * Formats a search definition object into a query string.
62
- * Note: The return value does not include the resource type.
63
- * @param {!SearchRequest} definition The search definition.
64
- * @returns Formatted URL.
65
- */
66
- export declare function formatSearchQuery(definition: SearchRequest): string;
@@ -1,47 +0,0 @@
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
- }