@medplum/core 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -181,6 +181,7 @@ export interface GoogleLoginRequest extends BaseLoginRequest {
181
181
  }
182
182
  export interface LoginAuthenticationResponse {
183
183
  readonly login: string;
184
+ readonly mfaRequired?: boolean;
184
185
  readonly code?: string;
185
186
  readonly memberships?: ProjectMembership[];
186
187
  }
@@ -3,12 +3,27 @@ import { Token } from './tokenize';
3
3
  export interface Atom {
4
4
  eval(context: TypedValue[]): TypedValue[];
5
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
+ }
6
21
  export interface PrefixParselet {
7
22
  parse(parser: Parser, token: Token): Atom;
8
23
  }
9
24
  export interface InfixParselet {
10
25
  precedence: number;
11
- parse(parser: Parser, left: Atom, token: Token): Atom;
26
+ parse?(parser: Parser, left: Atom, token: Token): Atom;
12
27
  }
13
28
  export declare class ParserBuilder {
14
29
  #private;
@@ -25,7 +40,8 @@ export declare class Parser {
25
40
  match(expected: string): boolean;
26
41
  consumeAndParse(precedence?: number): Atom;
27
42
  getPrecedence(): number;
28
- consume(expected?: string): Token;
43
+ consume(expectedId?: string, expectedValue?: string): Token;
29
44
  peek(): Token | undefined;
30
45
  removeComments(): void;
46
+ getInfixParselet(token: Token): InfixParselet | undefined;
31
47
  }
@@ -1,7 +1,7 @@
1
- import { Atom } from '../fhirlexer';
1
+ import { StructureMap } from '@medplum/fhirtypes';
2
2
  /**
3
3
  * Parses a FHIR Mapping Language document into an AST.
4
4
  * @param input The FHIR Mapping Language document to parse.
5
5
  * @returns The AST representing the document.
6
6
  */
7
- export declare function parseMappingLanguage(input: string): Atom[];
7
+ export declare function parseMappingLanguage(input: string): StructureMap;
@@ -1,102 +1,82 @@
1
- import { Atom } from '../fhirlexer';
1
+ import { Atom, InfixOperatorAtom, PrefixOperatorAtom } from '../fhirlexer';
2
2
  import { TypedValue } from '../types';
3
- import { FhirPathFunction } from './functions';
4
3
  export declare class FhirPathAtom implements Atom {
5
4
  readonly original: string;
6
5
  readonly child: Atom;
7
6
  constructor(original: string, child: Atom);
8
7
  eval(context: TypedValue[]): TypedValue[];
8
+ toString(): string;
9
9
  }
10
10
  export declare class LiteralAtom implements Atom {
11
11
  readonly value: TypedValue;
12
12
  constructor(value: TypedValue);
13
13
  eval(): TypedValue[];
14
+ toString(): string;
14
15
  }
15
16
  export declare class SymbolAtom implements Atom {
16
17
  #private;
17
18
  readonly name: string;
18
19
  constructor(name: string);
19
20
  eval(context: TypedValue[]): TypedValue[];
21
+ toString(): string;
20
22
  }
21
23
  export declare class EmptySetAtom implements Atom {
22
24
  eval(): [];
25
+ toString(): string;
23
26
  }
24
- export declare class UnaryOperatorAtom implements Atom {
25
- readonly child: Atom;
27
+ export declare class UnaryOperatorAtom extends PrefixOperatorAtom {
26
28
  readonly impl: (x: TypedValue[]) => TypedValue[];
27
- constructor(child: Atom, impl: (x: TypedValue[]) => TypedValue[]);
29
+ constructor(operator: string, child: Atom, impl: (x: TypedValue[]) => TypedValue[]);
28
30
  eval(context: TypedValue[]): TypedValue[];
31
+ toString(): string;
29
32
  }
30
- export declare class AsAtom implements Atom {
31
- readonly left: Atom;
32
- readonly right: Atom;
33
+ export declare class AsAtom extends InfixOperatorAtom {
33
34
  constructor(left: Atom, right: Atom);
34
35
  eval(context: TypedValue[]): TypedValue[];
35
36
  }
36
- export declare class ArithemticOperatorAtom implements Atom {
37
- readonly left: Atom;
38
- readonly right: Atom;
37
+ export declare class ArithemticOperatorAtom extends InfixOperatorAtom {
39
38
  readonly impl: (x: number, y: number) => number | boolean;
40
- constructor(left: Atom, right: Atom, impl: (x: number, y: number) => number | boolean);
39
+ constructor(operator: string, left: Atom, right: Atom, impl: (x: number, y: number) => number | boolean);
41
40
  eval(context: TypedValue[]): TypedValue[];
42
41
  }
43
- export declare class ConcatAtom implements Atom {
44
- readonly left: Atom;
45
- readonly right: Atom;
42
+ export declare class ConcatAtom extends InfixOperatorAtom {
46
43
  constructor(left: Atom, right: Atom);
47
44
  eval(context: TypedValue[]): TypedValue[];
48
45
  }
49
- export declare class ContainsAtom implements Atom {
50
- readonly left: Atom;
51
- readonly right: Atom;
46
+ export declare class ContainsAtom extends InfixOperatorAtom {
52
47
  constructor(left: Atom, right: Atom);
53
48
  eval(context: TypedValue[]): TypedValue[];
54
49
  }
55
- export declare class InAtom implements Atom {
56
- readonly left: Atom;
57
- readonly right: Atom;
50
+ export declare class InAtom extends InfixOperatorAtom {
58
51
  constructor(left: Atom, right: Atom);
59
52
  eval(context: TypedValue[]): TypedValue[];
60
53
  }
61
- export declare class DotAtom implements Atom {
62
- readonly left: Atom;
63
- readonly right: Atom;
54
+ export declare class DotAtom extends InfixOperatorAtom {
64
55
  constructor(left: Atom, right: Atom);
65
56
  eval(context: TypedValue[]): TypedValue[];
57
+ toString(): string;
66
58
  }
67
- export declare class UnionAtom implements Atom {
68
- readonly left: Atom;
69
- readonly right: Atom;
59
+ export declare class UnionAtom extends InfixOperatorAtom {
70
60
  constructor(left: Atom, right: Atom);
71
61
  eval(context: TypedValue[]): TypedValue[];
72
62
  }
73
- export declare class EqualsAtom implements Atom {
74
- readonly left: Atom;
75
- readonly right: Atom;
63
+ export declare class EqualsAtom extends InfixOperatorAtom {
76
64
  constructor(left: Atom, right: Atom);
77
65
  eval(context: TypedValue[]): TypedValue[];
78
66
  }
79
- export declare class NotEqualsAtom implements Atom {
80
- readonly left: Atom;
81
- readonly right: Atom;
67
+ export declare class NotEqualsAtom extends InfixOperatorAtom {
82
68
  constructor(left: Atom, right: Atom);
83
69
  eval(context: TypedValue[]): TypedValue[];
84
70
  }
85
- export declare class EquivalentAtom implements Atom {
86
- readonly left: Atom;
87
- readonly right: Atom;
71
+ export declare class EquivalentAtom extends InfixOperatorAtom {
88
72
  constructor(left: Atom, right: Atom);
89
73
  eval(context: TypedValue[]): TypedValue[];
90
74
  }
91
- export declare class NotEquivalentAtom implements Atom {
92
- readonly left: Atom;
93
- readonly right: Atom;
75
+ export declare class NotEquivalentAtom extends InfixOperatorAtom {
94
76
  constructor(left: Atom, right: Atom);
95
77
  eval(context: TypedValue[]): TypedValue[];
96
78
  }
97
- export declare class IsAtom implements Atom {
98
- readonly left: Atom;
99
- readonly right: Atom;
79
+ export declare class IsAtom extends InfixOperatorAtom {
100
80
  constructor(left: Atom, right: Atom);
101
81
  eval(context: TypedValue[]): TypedValue[];
102
82
  }
@@ -106,15 +86,11 @@ export declare class IsAtom implements Atom {
106
86
  * false if either operand evaluates to false,
107
87
  * and the empty collection otherwise.
108
88
  */
109
- export declare class AndAtom implements Atom {
110
- readonly left: Atom;
111
- readonly right: Atom;
89
+ export declare class AndAtom extends InfixOperatorAtom {
112
90
  constructor(left: Atom, right: Atom);
113
91
  eval(context: TypedValue[]): TypedValue[];
114
92
  }
115
- export declare class OrAtom implements Atom {
116
- readonly left: Atom;
117
- readonly right: Atom;
93
+ export declare class OrAtom extends InfixOperatorAtom {
118
94
  constructor(left: Atom, right: Atom);
119
95
  eval(context: TypedValue[]): TypedValue[];
120
96
  }
@@ -124,22 +100,21 @@ export declare class OrAtom implements Atom {
124
100
  * false if either both operands evaluate to true or both operands evaluate to false,
125
101
  * and the empty collection otherwise.
126
102
  */
127
- export declare class XorAtom implements Atom {
128
- readonly left: Atom;
129
- readonly right: Atom;
103
+ export declare class XorAtom extends InfixOperatorAtom {
130
104
  constructor(left: Atom, right: Atom);
131
105
  eval(context: TypedValue[]): TypedValue[];
132
106
  }
133
107
  export declare class FunctionAtom implements Atom {
134
108
  readonly name: string;
135
109
  readonly args: Atom[];
136
- readonly impl: FhirPathFunction;
137
- constructor(name: string, args: Atom[], impl: FhirPathFunction);
110
+ constructor(name: string, args: Atom[]);
138
111
  eval(context: TypedValue[]): TypedValue[];
112
+ toString(): string;
139
113
  }
140
114
  export declare class IndexerAtom implements Atom {
141
115
  readonly left: Atom;
142
116
  readonly expr: Atom;
143
117
  constructor(left: Atom, expr: Atom);
144
118
  eval(context: TypedValue[]): TypedValue[];
119
+ toString(): string;
145
120
  }
@@ -1,6 +1,43 @@
1
1
  import { ParserBuilder } from '../fhirlexer';
2
2
  import { TypedValue } from '../types';
3
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
+ }
4
41
  export declare function initFhirPathParserBuilder(): ParserBuilder;
5
42
  /**
6
43
  * Parses a FHIRPath expression into an AST.