@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.
- package/dist/cjs/index.cjs +905 -46
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.min.cjs +1 -1
- package/dist/esm/client.mjs +16 -22
- package/dist/esm/client.mjs.map +1 -1
- package/dist/esm/fhirlexer/tokenize.mjs +13 -4
- package/dist/esm/fhirlexer/tokenize.mjs.map +1 -1
- package/dist/esm/fhirmapper/parse.mjs +317 -0
- package/dist/esm/fhirmapper/parse.mjs.map +1 -0
- package/dist/esm/fhirmapper/tokenize.mjs +15 -0
- package/dist/esm/fhirmapper/tokenize.mjs.map +1 -0
- package/dist/esm/fhirpath/atoms.mjs +2 -2
- package/dist/esm/fhirpath/atoms.mjs.map +1 -1
- package/dist/esm/fhirpath/functions.mjs +2 -2
- package/dist/esm/fhirpath/functions.mjs.map +1 -1
- package/dist/esm/fhirpath/utils.mjs +4 -4
- package/dist/esm/fhirpath/utils.mjs.map +1 -1
- package/dist/esm/filter/parse.mjs +51 -0
- package/dist/esm/filter/parse.mjs.map +1 -0
- package/dist/esm/filter/tokenize.mjs +18 -0
- package/dist/esm/filter/tokenize.mjs.map +1 -0
- package/dist/esm/filter/types.mjs +34 -0
- package/dist/esm/filter/types.mjs.map +1 -0
- package/dist/esm/index.min.mjs +1 -1
- package/dist/esm/index.mjs +8 -2
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/node_modules/tslib/tslib.es6.mjs.map +1 -1
- package/dist/esm/outcomes.mjs +31 -2
- package/dist/esm/outcomes.mjs.map +1 -1
- package/dist/esm/schema.mjs +397 -0
- package/dist/esm/schema.mjs.map +1 -0
- package/dist/esm/search/match.mjs +9 -4
- package/dist/esm/search/match.mjs.map +1 -1
- package/dist/esm/types.mjs +34 -8
- package/dist/esm/types.mjs.map +1 -1
- package/dist/{esm → types}/client.d.ts +20 -8
- package/dist/{cjs → types}/fhirlexer/tokenize.d.ts +5 -1
- package/dist/types/fhirmapper/index.d.ts +1 -0
- package/dist/types/filter/index.d.ts +2 -0
- package/dist/types/filter/parse.d.ts +7 -0
- package/dist/types/filter/types.d.ts +31 -0
- package/dist/{esm → types}/index.d.ts +4 -0
- package/dist/{esm → types}/outcomes.d.ts +8 -1
- package/dist/types/schema.d.ts +120 -0
- package/dist/{esm → types}/types.d.ts +19 -5
- package/package.json +4 -4
- package/tsconfig.build.json +9 -0
- package/dist/cjs/client.d.ts +0 -1218
- package/dist/cjs/index.d.ts +0 -14
- package/dist/cjs/outcomes.d.ts +0 -31
- package/dist/cjs/types.d.ts +0 -200
- package/dist/esm/cache.d.ts +0 -34
- package/dist/esm/crypto.d.ts +0 -9
- package/dist/esm/eventtarget.d.ts +0 -13
- package/dist/esm/fhirlexer/index.d.ts +0 -2
- package/dist/esm/fhirlexer/parse.d.ts +0 -47
- package/dist/esm/fhirlexer/tokenize.d.ts +0 -14
- package/dist/esm/fhirmapper/parse.d.ts +0 -7
- package/dist/esm/fhirpath/atoms.d.ts +0 -120
- package/dist/esm/fhirpath/date.d.ts +0 -1
- package/dist/esm/fhirpath/functions.d.ts +0 -6
- package/dist/esm/fhirpath/index.d.ts +0 -4
- package/dist/esm/fhirpath/parse.d.ts +0 -64
- package/dist/esm/fhirpath/tokenize.d.ts +0 -4
- package/dist/esm/fhirpath/utils.d.ts +0 -95
- package/dist/esm/format.d.ts +0 -118
- package/dist/esm/hl7.d.ts +0 -136
- package/dist/esm/jwt.d.ts +0 -5
- package/dist/esm/readablepromise.d.ts +0 -48
- package/dist/esm/search/details.d.ts +0 -33
- package/dist/esm/search/match.d.ts +0 -9
- package/dist/esm/search/parse.d.ts +0 -17
- package/dist/esm/search/search.d.ts +0 -66
- package/dist/esm/storage.d.ts +0 -47
- package/dist/esm/utils.d.ts +0 -259
- /package/dist/{cjs → types}/cache.d.ts +0 -0
- /package/dist/{cjs → types}/crypto.d.ts +0 -0
- /package/dist/{cjs → types}/eventtarget.d.ts +0 -0
- /package/dist/{cjs → types}/fhirlexer/index.d.ts +0 -0
- /package/dist/{cjs → types}/fhirlexer/parse.d.ts +0 -0
- /package/dist/{cjs → types}/fhirmapper/parse.d.ts +0 -0
- /package/dist/{cjs → types}/fhirmapper/tokenize.d.ts +0 -0
- /package/dist/{cjs → types}/fhirpath/atoms.d.ts +0 -0
- /package/dist/{cjs → types}/fhirpath/date.d.ts +0 -0
- /package/dist/{cjs → types}/fhirpath/functions.d.ts +0 -0
- /package/dist/{cjs → types}/fhirpath/index.d.ts +0 -0
- /package/dist/{cjs → types}/fhirpath/parse.d.ts +0 -0
- /package/dist/{cjs → types}/fhirpath/tokenize.d.ts +0 -0
- /package/dist/{cjs → types}/fhirpath/utils.d.ts +0 -0
- /package/dist/{esm/fhirmapper → types/filter}/tokenize.d.ts +0 -0
- /package/dist/{cjs → types}/format.d.ts +0 -0
- /package/dist/{cjs → types}/hl7.d.ts +0 -0
- /package/dist/{cjs → types}/jwt.d.ts +0 -0
- /package/dist/{cjs → types}/readablepromise.d.ts +0 -0
- /package/dist/{cjs → types}/search/details.d.ts +0 -0
- /package/dist/{cjs → types}/search/match.d.ts +0 -0
- /package/dist/{cjs → types}/search/parse.d.ts +0 -0
- /package/dist/{cjs → types}/search/search.d.ts +0 -0
- /package/dist/{cjs → types}/storage.d.ts +0 -0
- /package/dist/{cjs → types}/utils.d.ts +0 -0
package/dist/cjs/index.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export * from './cache';
|
|
2
|
-
export * from './client';
|
|
3
|
-
export * from './fhirpath';
|
|
4
|
-
export * from './format';
|
|
5
|
-
export * from './hl7';
|
|
6
|
-
export * from './jwt';
|
|
7
|
-
export * from './outcomes';
|
|
8
|
-
export * from './readablepromise';
|
|
9
|
-
export * from './search/details';
|
|
10
|
-
export * from './search/match';
|
|
11
|
-
export * from './search/parse';
|
|
12
|
-
export * from './search/search';
|
|
13
|
-
export * from './types';
|
|
14
|
-
export * from './utils';
|
package/dist/cjs/outcomes.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { OperationOutcome } from '@medplum/fhirtypes';
|
|
2
|
-
export declare const allOk: OperationOutcome;
|
|
3
|
-
export declare const created: OperationOutcome;
|
|
4
|
-
export declare const notModified: OperationOutcome;
|
|
5
|
-
export declare const notFound: OperationOutcome;
|
|
6
|
-
export declare const unauthorized: OperationOutcome;
|
|
7
|
-
export declare const forbidden: OperationOutcome;
|
|
8
|
-
export declare const gone: OperationOutcome;
|
|
9
|
-
export declare const tooManyRequests: OperationOutcome;
|
|
10
|
-
export declare function badRequest(details: string, expression?: string): OperationOutcome;
|
|
11
|
-
export declare function isOperationOutcome(value: unknown): value is OperationOutcome;
|
|
12
|
-
export declare function isOk(outcome: OperationOutcome): boolean;
|
|
13
|
-
export declare function isNotFound(outcome: OperationOutcome): boolean;
|
|
14
|
-
export declare function isGone(outcome: OperationOutcome): boolean;
|
|
15
|
-
export declare function getStatus(outcome: OperationOutcome): number;
|
|
16
|
-
/**
|
|
17
|
-
* Asserts that the operation completed successfully and that the resource is defined.
|
|
18
|
-
* @param outcome The operation outcome.
|
|
19
|
-
* @param resource The resource that may or may not have been returned.
|
|
20
|
-
*/
|
|
21
|
-
export declare function assertOk<T>(outcome: OperationOutcome, resource: T | undefined): asserts resource is T;
|
|
22
|
-
export declare class OperationOutcomeError extends Error {
|
|
23
|
-
readonly outcome: OperationOutcome;
|
|
24
|
-
constructor(outcome: OperationOutcome);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Normalizes an error object into a displayable error string.
|
|
28
|
-
* @param error The error value which could be a string, Error, OperationOutcome, or other unknown type.
|
|
29
|
-
* @returns A display string for the error.
|
|
30
|
-
*/
|
|
31
|
-
export declare function normalizeErrorString(error: unknown): string;
|
package/dist/cjs/types.d.ts
DELETED
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import { Bundle, ElementDefinition, SearchParameter, StructureDefinition } from '@medplum/fhirtypes';
|
|
2
|
-
import { SearchParameterDetails } from './search/details';
|
|
3
|
-
export interface TypedValue {
|
|
4
|
-
readonly type: string;
|
|
5
|
-
readonly value: any;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* List of property types.
|
|
9
|
-
* http://www.hl7.org/fhir/valueset-defined-types.html
|
|
10
|
-
* The list here includes additions found from StructureDefinition resources.
|
|
11
|
-
*/
|
|
12
|
-
export declare enum PropertyType {
|
|
13
|
-
Address = "Address",
|
|
14
|
-
Age = "Age",
|
|
15
|
-
Annotation = "Annotation",
|
|
16
|
-
Attachment = "Attachment",
|
|
17
|
-
BackboneElement = "BackboneElement",
|
|
18
|
-
CodeableConcept = "CodeableConcept",
|
|
19
|
-
Coding = "Coding",
|
|
20
|
-
ContactDetail = "ContactDetail",
|
|
21
|
-
ContactPoint = "ContactPoint",
|
|
22
|
-
Contributor = "Contributor",
|
|
23
|
-
Count = "Count",
|
|
24
|
-
DataRequirement = "DataRequirement",
|
|
25
|
-
Distance = "Distance",
|
|
26
|
-
Dosage = "Dosage",
|
|
27
|
-
Duration = "Duration",
|
|
28
|
-
Expression = "Expression",
|
|
29
|
-
Extension = "Extension",
|
|
30
|
-
HumanName = "HumanName",
|
|
31
|
-
Identifier = "Identifier",
|
|
32
|
-
MarketingStatus = "MarketingStatus",
|
|
33
|
-
Meta = "Meta",
|
|
34
|
-
Money = "Money",
|
|
35
|
-
Narrative = "Narrative",
|
|
36
|
-
ParameterDefinition = "ParameterDefinition",
|
|
37
|
-
Period = "Period",
|
|
38
|
-
Population = "Population",
|
|
39
|
-
ProdCharacteristic = "ProdCharacteristic",
|
|
40
|
-
ProductShelfLife = "ProductShelfLife",
|
|
41
|
-
Quantity = "Quantity",
|
|
42
|
-
Range = "Range",
|
|
43
|
-
Ratio = "Ratio",
|
|
44
|
-
Reference = "Reference",
|
|
45
|
-
RelatedArtifact = "RelatedArtifact",
|
|
46
|
-
SampledData = "SampledData",
|
|
47
|
-
Signature = "Signature",
|
|
48
|
-
SubstanceAmount = "SubstanceAmount",
|
|
49
|
-
SystemString = "http://hl7.org/fhirpath/System.String",
|
|
50
|
-
Timing = "Timing",
|
|
51
|
-
TriggerDefinition = "TriggerDefinition",
|
|
52
|
-
UsageContext = "UsageContext",
|
|
53
|
-
base64Binary = "base64Binary",
|
|
54
|
-
boolean = "boolean",
|
|
55
|
-
canonical = "canonical",
|
|
56
|
-
code = "code",
|
|
57
|
-
date = "date",
|
|
58
|
-
dateTime = "dateTime",
|
|
59
|
-
decimal = "decimal",
|
|
60
|
-
id = "id",
|
|
61
|
-
instant = "instant",
|
|
62
|
-
integer = "integer",
|
|
63
|
-
markdown = "markdown",
|
|
64
|
-
oid = "oid",
|
|
65
|
-
positiveInt = "positiveInt",
|
|
66
|
-
string = "string",
|
|
67
|
-
time = "time",
|
|
68
|
-
unsignedInt = "unsignedInt",
|
|
69
|
-
uri = "uri",
|
|
70
|
-
url = "url",
|
|
71
|
-
uuid = "uuid"
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* An IndexedStructureDefinition is a lookup-optimized version of a StructureDefinition.
|
|
75
|
-
*
|
|
76
|
-
* StructureDefinition resources contain schema information for other resource types.
|
|
77
|
-
* These schemas can be used to automatically generate user interface elements for
|
|
78
|
-
* resources.
|
|
79
|
-
*
|
|
80
|
-
* However, a StructureDefinition resource is not optimized for realtime lookups. All
|
|
81
|
-
* resource types, sub types, and property definitions are stored in a flat array of
|
|
82
|
-
* ElementDefinition objects. Therefore, to lookup the schema for a property (i.e., "Patient.name")
|
|
83
|
-
* requires a linear scan of all ElementDefinition objects
|
|
84
|
-
*
|
|
85
|
-
* A StructureDefinition resource contains information about one or more types.
|
|
86
|
-
* For example, the "Patient" StructureDefinition includes "Patient", "Patient_Contact",
|
|
87
|
-
* "Patient_Communication", and "Patient_Link". This is inefficient.
|
|
88
|
-
*
|
|
89
|
-
* Instead, we create an indexed version of the StructureDefinition, called IndexedStructureDefinition.
|
|
90
|
-
* In an IndexedStructureDefinition, retrieving a property definition is a hashtable lookup.
|
|
91
|
-
*
|
|
92
|
-
* The hierarchy is:
|
|
93
|
-
* IndexedStructureDefinition - top level for one resource type
|
|
94
|
-
* TypeSchema - one per resource type and all contained BackboneElements
|
|
95
|
-
* PropertySchema - one per property/field
|
|
96
|
-
*/
|
|
97
|
-
export interface IndexedStructureDefinition {
|
|
98
|
-
types: {
|
|
99
|
-
[resourceType: string]: TypeSchema;
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* An indexed TypeSchema.
|
|
104
|
-
*
|
|
105
|
-
* Example: The IndexedStructureDefinition for "Patient" would include the following TypeSchemas:
|
|
106
|
-
* 1) Patient
|
|
107
|
-
* 2) Patient_Contact
|
|
108
|
-
* 3) Patient_Communication
|
|
109
|
-
* 4) Patient_Link
|
|
110
|
-
*/
|
|
111
|
-
export interface TypeSchema {
|
|
112
|
-
structureDefinition: StructureDefinition;
|
|
113
|
-
elementDefinition: ElementDefinition;
|
|
114
|
-
display: string;
|
|
115
|
-
properties: {
|
|
116
|
-
[name: string]: ElementDefinition;
|
|
117
|
-
};
|
|
118
|
-
searchParams?: {
|
|
119
|
-
[code: string]: SearchParameter;
|
|
120
|
-
};
|
|
121
|
-
searchParamsDetails?: {
|
|
122
|
-
[code: string]: SearchParameterDetails;
|
|
123
|
-
};
|
|
124
|
-
description?: string;
|
|
125
|
-
parentType?: string;
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Indexes a bundle of StructureDefinitions for faster lookup.
|
|
129
|
-
* @param bundle A FHIR bundle StructureDefinition resources.
|
|
130
|
-
* @see {@link IndexedStructureDefinition} for more details on indexed StructureDefinitions.
|
|
131
|
-
*/
|
|
132
|
-
export declare function indexStructureDefinitionBundle(bundle: Bundle): void;
|
|
133
|
-
/**
|
|
134
|
-
* Indexes a StructureDefinition for fast lookup.
|
|
135
|
-
* @param structureDefinition The original StructureDefinition.
|
|
136
|
-
* @see {@link IndexedStructureDefinition} for more details on indexed StructureDefinitions.
|
|
137
|
-
*/
|
|
138
|
-
export declare function indexStructureDefinition(structureDefinition: StructureDefinition): void;
|
|
139
|
-
/**
|
|
140
|
-
* Indexes a bundle of SearchParameter resources for faster lookup.
|
|
141
|
-
* @param bundle A FHIR bundle SearchParameter resources.
|
|
142
|
-
* @see {@link IndexedStructureDefinition} for more details on indexed StructureDefinitions.
|
|
143
|
-
*/
|
|
144
|
-
export declare function indexSearchParameterBundle(bundle: Bundle<SearchParameter>): void;
|
|
145
|
-
/**
|
|
146
|
-
* Indexes a SearchParameter resource for fast lookup.
|
|
147
|
-
* Indexes by SearchParameter.code, which is the query string parameter name.
|
|
148
|
-
* @param searchParam The SearchParameter resource.
|
|
149
|
-
* @see {@link IndexedStructureDefinition} for more details on indexed StructureDefinitions.
|
|
150
|
-
*/
|
|
151
|
-
export declare function indexSearchParameter(searchParam: SearchParameter): void;
|
|
152
|
-
/**
|
|
153
|
-
* Returns the type name for an ElementDefinition.
|
|
154
|
-
* @param elementDefinition The element definition.
|
|
155
|
-
* @returns The Medplum type name.
|
|
156
|
-
*/
|
|
157
|
-
export declare function getElementDefinitionTypeName(elementDefinition: ElementDefinition): string;
|
|
158
|
-
export declare function buildTypeName(components: string[]): string;
|
|
159
|
-
/**
|
|
160
|
-
* Returns true if the type schema is a DomainResource.
|
|
161
|
-
* @param typeSchema The type schema to check.
|
|
162
|
-
* @returns True if the type schema is a DomainResource.
|
|
163
|
-
*/
|
|
164
|
-
export declare function isResourceType(typeSchema: TypeSchema): boolean;
|
|
165
|
-
/**
|
|
166
|
-
* Returns an array of all resource types.
|
|
167
|
-
* Note that this is based on globalSchema, and will only return resource types that are currently in memory.
|
|
168
|
-
* @returns An array of all resource types.
|
|
169
|
-
*/
|
|
170
|
-
export declare function getResourceTypes(): string[];
|
|
171
|
-
/**
|
|
172
|
-
* Returns the type schema for the resource type.
|
|
173
|
-
* @param resourceType The resource type.
|
|
174
|
-
* @returns The type schema for the resource type.
|
|
175
|
-
*/
|
|
176
|
-
export declare function getResourceTypeSchema(resourceType: string): TypeSchema;
|
|
177
|
-
/**
|
|
178
|
-
* Returns the search parameters for the resource type indexed by search code.
|
|
179
|
-
* @param resourceType The resource type.
|
|
180
|
-
* @returns The search parameters for the resource type indexed by search code.
|
|
181
|
-
*/
|
|
182
|
-
export declare function getSearchParameters(resourceType: string): Record<string, SearchParameter> | undefined;
|
|
183
|
-
/**
|
|
184
|
-
* Returns a human friendly display name for a FHIR element definition path.
|
|
185
|
-
* @param path The FHIR element definition path.
|
|
186
|
-
* @returns The best guess of the display name.
|
|
187
|
-
*/
|
|
188
|
-
export declare function getPropertyDisplayName(path: string): string;
|
|
189
|
-
/**
|
|
190
|
-
* Returns an element definition by type and property name.
|
|
191
|
-
* Handles content references.
|
|
192
|
-
* @param typeName The type name.
|
|
193
|
-
* @param propertyName The property name.
|
|
194
|
-
* @returns The element definition if found.
|
|
195
|
-
*/
|
|
196
|
-
export declare function getElementDefinition(typeName: string, propertyName: string): ElementDefinition | undefined;
|
|
197
|
-
/**
|
|
198
|
-
* Global schema singleton.
|
|
199
|
-
*/
|
|
200
|
-
export declare const globalSchema: IndexedStructureDefinition;
|
package/dist/esm/cache.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LRU cache (least recently used)
|
|
3
|
-
* Source: https://stackoverflow.com/a/46432113
|
|
4
|
-
*/
|
|
5
|
-
export declare class LRUCache<T> {
|
|
6
|
-
#private;
|
|
7
|
-
constructor(max?: number);
|
|
8
|
-
/**
|
|
9
|
-
* Deletes all values from the cache.
|
|
10
|
-
*/
|
|
11
|
-
clear(): void;
|
|
12
|
-
/**
|
|
13
|
-
* Returns the value for the given key.
|
|
14
|
-
* @param key The key to retrieve.
|
|
15
|
-
* @returns The value if found; undefined otherwise.
|
|
16
|
-
*/
|
|
17
|
-
get(key: string): T | undefined;
|
|
18
|
-
/**
|
|
19
|
-
* Sets the value for the given key.
|
|
20
|
-
* @param key The key to set.
|
|
21
|
-
* @param val The value to set.
|
|
22
|
-
*/
|
|
23
|
-
set(key: string, val: T): void;
|
|
24
|
-
/**
|
|
25
|
-
* Deletes the value for the given key.
|
|
26
|
-
* @param key The key to delete.
|
|
27
|
-
*/
|
|
28
|
-
delete(key: string): void;
|
|
29
|
-
/**
|
|
30
|
-
* Returns the list of all keys in the cache.
|
|
31
|
-
* @returns The array of keys in the cache.
|
|
32
|
-
*/
|
|
33
|
-
keys(): IterableIterator<string>;
|
|
34
|
-
}
|
package/dist/esm/crypto.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
interface Event {
|
|
2
|
-
readonly type: string;
|
|
3
|
-
readonly defaultPrevented?: boolean;
|
|
4
|
-
}
|
|
5
|
-
type EventListener = (e: Event) => void;
|
|
6
|
-
export declare class EventTarget {
|
|
7
|
-
#private;
|
|
8
|
-
constructor();
|
|
9
|
-
addEventListener(type: string, callback: EventListener): void;
|
|
10
|
-
removeEventListeneer(type: string, callback: EventListener): void;
|
|
11
|
-
dispatchEvent(event: Event): boolean;
|
|
12
|
-
}
|
|
13
|
-
export {};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { TypedValue } from '../types';
|
|
2
|
-
import { Token } from './tokenize';
|
|
3
|
-
export interface Atom {
|
|
4
|
-
eval(context: TypedValue[]): TypedValue[];
|
|
5
|
-
}
|
|
6
|
-
export declare abstract class PrefixOperatorAtom implements Atom {
|
|
7
|
-
readonly operator: string;
|
|
8
|
-
readonly child: Atom;
|
|
9
|
-
constructor(operator: string, child: Atom);
|
|
10
|
-
abstract eval(context: TypedValue[]): TypedValue[];
|
|
11
|
-
toString(): string;
|
|
12
|
-
}
|
|
13
|
-
export declare abstract class InfixOperatorAtom implements Atom {
|
|
14
|
-
readonly operator: string;
|
|
15
|
-
readonly left: Atom;
|
|
16
|
-
readonly right: Atom;
|
|
17
|
-
constructor(operator: string, left: Atom, right: Atom);
|
|
18
|
-
abstract eval(context: TypedValue[]): TypedValue[];
|
|
19
|
-
toString(): string;
|
|
20
|
-
}
|
|
21
|
-
export interface PrefixParselet {
|
|
22
|
-
parse(parser: Parser, token: Token): Atom;
|
|
23
|
-
}
|
|
24
|
-
export interface InfixParselet {
|
|
25
|
-
precedence: number;
|
|
26
|
-
parse?(parser: Parser, left: Atom, token: Token): Atom;
|
|
27
|
-
}
|
|
28
|
-
export declare class ParserBuilder {
|
|
29
|
-
#private;
|
|
30
|
-
registerInfix(tokenType: string, parselet: InfixParselet): ParserBuilder;
|
|
31
|
-
registerPrefix(tokenType: string, parselet: PrefixParselet): ParserBuilder;
|
|
32
|
-
prefix(tokenType: string, precedence: number, builder: (token: Token, right: Atom) => Atom): ParserBuilder;
|
|
33
|
-
infixLeft(tokenType: string, precedence: number, builder: (left: Atom, token: Token, right: Atom) => Atom): ParserBuilder;
|
|
34
|
-
construct(input: Token[]): Parser;
|
|
35
|
-
}
|
|
36
|
-
export declare class Parser {
|
|
37
|
-
#private;
|
|
38
|
-
constructor(tokens: Token[], prefixParselets: Record<string, PrefixParselet>, infixParselets: Record<string, InfixParselet>);
|
|
39
|
-
hasMore(): boolean;
|
|
40
|
-
match(expected: string): boolean;
|
|
41
|
-
consumeAndParse(precedence?: number): Atom;
|
|
42
|
-
getPrecedence(): number;
|
|
43
|
-
consume(expectedId?: string, expectedValue?: string): Token;
|
|
44
|
-
peek(): Token | undefined;
|
|
45
|
-
removeComments(): void;
|
|
46
|
-
getInfixParselet(token: Token): InfixParselet | undefined;
|
|
47
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export interface Marker {
|
|
2
|
-
index: number;
|
|
3
|
-
line: number;
|
|
4
|
-
column: number;
|
|
5
|
-
}
|
|
6
|
-
export interface Token extends Marker {
|
|
7
|
-
id: string;
|
|
8
|
-
value: string;
|
|
9
|
-
}
|
|
10
|
-
export declare class Tokenizer {
|
|
11
|
-
#private;
|
|
12
|
-
constructor(str: string, keywords: string[], operators: string[]);
|
|
13
|
-
tokenize(): Token[];
|
|
14
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { StructureMap } from '@medplum/fhirtypes';
|
|
2
|
-
/**
|
|
3
|
-
* Parses a FHIR Mapping Language document into an AST.
|
|
4
|
-
* @param input The FHIR Mapping Language document to parse.
|
|
5
|
-
* @returns The AST representing the document.
|
|
6
|
-
*/
|
|
7
|
-
export declare function parseMappingLanguage(input: string): StructureMap;
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { Atom, InfixOperatorAtom, PrefixOperatorAtom } from '../fhirlexer';
|
|
2
|
-
import { TypedValue } from '../types';
|
|
3
|
-
export declare class FhirPathAtom implements Atom {
|
|
4
|
-
readonly original: string;
|
|
5
|
-
readonly child: Atom;
|
|
6
|
-
constructor(original: string, child: Atom);
|
|
7
|
-
eval(context: TypedValue[]): TypedValue[];
|
|
8
|
-
toString(): string;
|
|
9
|
-
}
|
|
10
|
-
export declare class LiteralAtom implements Atom {
|
|
11
|
-
readonly value: TypedValue;
|
|
12
|
-
constructor(value: TypedValue);
|
|
13
|
-
eval(): TypedValue[];
|
|
14
|
-
toString(): string;
|
|
15
|
-
}
|
|
16
|
-
export declare class SymbolAtom implements Atom {
|
|
17
|
-
#private;
|
|
18
|
-
readonly name: string;
|
|
19
|
-
constructor(name: string);
|
|
20
|
-
eval(context: TypedValue[]): TypedValue[];
|
|
21
|
-
toString(): string;
|
|
22
|
-
}
|
|
23
|
-
export declare class EmptySetAtom implements Atom {
|
|
24
|
-
eval(): [];
|
|
25
|
-
toString(): string;
|
|
26
|
-
}
|
|
27
|
-
export declare class UnaryOperatorAtom extends PrefixOperatorAtom {
|
|
28
|
-
readonly impl: (x: TypedValue[]) => TypedValue[];
|
|
29
|
-
constructor(operator: string, child: Atom, impl: (x: TypedValue[]) => TypedValue[]);
|
|
30
|
-
eval(context: TypedValue[]): TypedValue[];
|
|
31
|
-
toString(): string;
|
|
32
|
-
}
|
|
33
|
-
export declare class AsAtom extends InfixOperatorAtom {
|
|
34
|
-
constructor(left: Atom, right: Atom);
|
|
35
|
-
eval(context: TypedValue[]): TypedValue[];
|
|
36
|
-
}
|
|
37
|
-
export declare class ArithemticOperatorAtom extends InfixOperatorAtom {
|
|
38
|
-
readonly impl: (x: number, y: number) => number | boolean;
|
|
39
|
-
constructor(operator: string, left: Atom, right: Atom, impl: (x: number, y: number) => number | boolean);
|
|
40
|
-
eval(context: TypedValue[]): TypedValue[];
|
|
41
|
-
}
|
|
42
|
-
export declare class ConcatAtom extends InfixOperatorAtom {
|
|
43
|
-
constructor(left: Atom, right: Atom);
|
|
44
|
-
eval(context: TypedValue[]): TypedValue[];
|
|
45
|
-
}
|
|
46
|
-
export declare class ContainsAtom extends InfixOperatorAtom {
|
|
47
|
-
constructor(left: Atom, right: Atom);
|
|
48
|
-
eval(context: TypedValue[]): TypedValue[];
|
|
49
|
-
}
|
|
50
|
-
export declare class InAtom extends InfixOperatorAtom {
|
|
51
|
-
constructor(left: Atom, right: Atom);
|
|
52
|
-
eval(context: TypedValue[]): TypedValue[];
|
|
53
|
-
}
|
|
54
|
-
export declare class DotAtom extends InfixOperatorAtom {
|
|
55
|
-
constructor(left: Atom, right: Atom);
|
|
56
|
-
eval(context: TypedValue[]): TypedValue[];
|
|
57
|
-
toString(): string;
|
|
58
|
-
}
|
|
59
|
-
export declare class UnionAtom extends InfixOperatorAtom {
|
|
60
|
-
constructor(left: Atom, right: Atom);
|
|
61
|
-
eval(context: TypedValue[]): TypedValue[];
|
|
62
|
-
}
|
|
63
|
-
export declare class EqualsAtom extends InfixOperatorAtom {
|
|
64
|
-
constructor(left: Atom, right: Atom);
|
|
65
|
-
eval(context: TypedValue[]): TypedValue[];
|
|
66
|
-
}
|
|
67
|
-
export declare class NotEqualsAtom extends InfixOperatorAtom {
|
|
68
|
-
constructor(left: Atom, right: Atom);
|
|
69
|
-
eval(context: TypedValue[]): TypedValue[];
|
|
70
|
-
}
|
|
71
|
-
export declare class EquivalentAtom extends InfixOperatorAtom {
|
|
72
|
-
constructor(left: Atom, right: Atom);
|
|
73
|
-
eval(context: TypedValue[]): TypedValue[];
|
|
74
|
-
}
|
|
75
|
-
export declare class NotEquivalentAtom extends InfixOperatorAtom {
|
|
76
|
-
constructor(left: Atom, right: Atom);
|
|
77
|
-
eval(context: TypedValue[]): TypedValue[];
|
|
78
|
-
}
|
|
79
|
-
export declare class IsAtom extends InfixOperatorAtom {
|
|
80
|
-
constructor(left: Atom, right: Atom);
|
|
81
|
-
eval(context: TypedValue[]): TypedValue[];
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* 6.5.1. and
|
|
85
|
-
* Returns true if both operands evaluate to true,
|
|
86
|
-
* false if either operand evaluates to false,
|
|
87
|
-
* and the empty collection otherwise.
|
|
88
|
-
*/
|
|
89
|
-
export declare class AndAtom extends InfixOperatorAtom {
|
|
90
|
-
constructor(left: Atom, right: Atom);
|
|
91
|
-
eval(context: TypedValue[]): TypedValue[];
|
|
92
|
-
}
|
|
93
|
-
export declare class OrAtom extends InfixOperatorAtom {
|
|
94
|
-
constructor(left: Atom, right: Atom);
|
|
95
|
-
eval(context: TypedValue[]): TypedValue[];
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* 6.5.4. xor
|
|
99
|
-
* Returns true if exactly one of the operands evaluates to true,
|
|
100
|
-
* false if either both operands evaluate to true or both operands evaluate to false,
|
|
101
|
-
* and the empty collection otherwise.
|
|
102
|
-
*/
|
|
103
|
-
export declare class XorAtom extends InfixOperatorAtom {
|
|
104
|
-
constructor(left: Atom, right: Atom);
|
|
105
|
-
eval(context: TypedValue[]): TypedValue[];
|
|
106
|
-
}
|
|
107
|
-
export declare class FunctionAtom implements Atom {
|
|
108
|
-
readonly name: string;
|
|
109
|
-
readonly args: Atom[];
|
|
110
|
-
constructor(name: string, args: Atom[]);
|
|
111
|
-
eval(context: TypedValue[]): TypedValue[];
|
|
112
|
-
toString(): string;
|
|
113
|
-
}
|
|
114
|
-
export declare class IndexerAtom implements Atom {
|
|
115
|
-
readonly left: Atom;
|
|
116
|
-
readonly expr: Atom;
|
|
117
|
-
constructor(left: Atom, expr: Atom);
|
|
118
|
-
eval(context: TypedValue[]): TypedValue[];
|
|
119
|
-
toString(): string;
|
|
120
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function parseDateString(str: string): string;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { ParserBuilder } from '../fhirlexer';
|
|
2
|
-
import { TypedValue } from '../types';
|
|
3
|
-
import { FhirPathAtom } from './atoms';
|
|
4
|
-
/**
|
|
5
|
-
* Operator precedence
|
|
6
|
-
* See: https://hl7.org/fhirpath/#operator-precedence
|
|
7
|
-
*/
|
|
8
|
-
export declare const enum OperatorPrecedence {
|
|
9
|
-
FunctionCall = 0,
|
|
10
|
-
Dot = 1,
|
|
11
|
-
Indexer = 2,
|
|
12
|
-
UnaryAdd = 3,
|
|
13
|
-
UnarySubtract = 3,
|
|
14
|
-
Multiply = 4,
|
|
15
|
-
Divide = 4,
|
|
16
|
-
IntegerDivide = 4,
|
|
17
|
-
Modulo = 4,
|
|
18
|
-
Add = 5,
|
|
19
|
-
Subtract = 5,
|
|
20
|
-
Ampersand = 5,
|
|
21
|
-
Is = 6,
|
|
22
|
-
As = 6,
|
|
23
|
-
Union = 7,
|
|
24
|
-
GreaterThan = 8,
|
|
25
|
-
GreaterThanOrEquals = 8,
|
|
26
|
-
LessThan = 8,
|
|
27
|
-
LessThanOrEquals = 8,
|
|
28
|
-
Equals = 9,
|
|
29
|
-
Equivalent = 9,
|
|
30
|
-
NotEquals = 9,
|
|
31
|
-
NotEquivalent = 9,
|
|
32
|
-
In = 10,
|
|
33
|
-
Contains = 10,
|
|
34
|
-
And = 11,
|
|
35
|
-
Xor = 12,
|
|
36
|
-
Or = 12,
|
|
37
|
-
Implies = 13,
|
|
38
|
-
Arrow = 100,
|
|
39
|
-
Semicolon = 200
|
|
40
|
-
}
|
|
41
|
-
export declare function initFhirPathParserBuilder(): ParserBuilder;
|
|
42
|
-
/**
|
|
43
|
-
* Parses a FHIRPath expression into an AST.
|
|
44
|
-
* The result can be used to evaluate the expression against a resource or other object.
|
|
45
|
-
* This method is useful if you know that you will evaluate the same expression many times
|
|
46
|
-
* against different resources.
|
|
47
|
-
* @param input The FHIRPath expression to parse.
|
|
48
|
-
* @returns The AST representing the expression.
|
|
49
|
-
*/
|
|
50
|
-
export declare function parseFhirPath(input: string): FhirPathAtom;
|
|
51
|
-
/**
|
|
52
|
-
* Evaluates a FHIRPath expression against a resource or other object.
|
|
53
|
-
* @param expression The FHIRPath expression to parse.
|
|
54
|
-
* @param input The resource or object to evaluate the expression against.
|
|
55
|
-
* @returns The result of the FHIRPath expression against the resource or object.
|
|
56
|
-
*/
|
|
57
|
-
export declare function evalFhirPath(expression: string, input: unknown): unknown[];
|
|
58
|
-
/**
|
|
59
|
-
* Evaluates a FHIRPath expression against a resource or other object.
|
|
60
|
-
* @param expression The FHIRPath expression to parse.
|
|
61
|
-
* @param input The resource or object to evaluate the expression against.
|
|
62
|
-
* @returns The result of the FHIRPath expression against the resource or object.
|
|
63
|
-
*/
|
|
64
|
-
export declare function evalFhirPathTyped(expression: string, input: TypedValue[]): TypedValue[];
|