@medplum/core 2.0.3 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +477 -209
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.min.cjs +1 -1
- package/dist/esm/client.mjs +18 -21
- package/dist/esm/client.mjs.map +1 -1
- package/dist/esm/index.min.mjs +1 -1
- package/dist/esm/index.mjs +6 -5
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/outcomes.mjs +17 -2
- package/dist/esm/outcomes.mjs.map +1 -1
- package/dist/esm/{searchparams.mjs → search/details.mjs} +9 -11
- package/dist/esm/search/details.mjs.map +1 -0
- package/dist/esm/{match.mjs → search/match.mjs} +16 -11
- package/dist/esm/search/match.mjs.map +1 -0
- package/dist/esm/search/parse.mjs +218 -0
- package/dist/esm/search/parse.mjs.map +1 -0
- package/dist/esm/{search.mjs → search/search.mjs} +0 -3
- package/dist/esm/search/search.mjs.map +1 -0
- package/dist/esm/types.mjs +63 -25
- package/dist/esm/types.mjs.map +1 -1
- package/dist/{esm → types}/client.d.ts +5 -3
- package/dist/{esm → types}/index.d.ts +4 -3
- package/dist/{esm → types}/outcomes.d.ts +7 -1
- package/dist/types/search/parse.d.ts +17 -0
- package/dist/{cjs → types}/types.d.ts +30 -7
- package/package.json +4 -4
- package/tsconfig.build.json +9 -0
- package/dist/cjs/client.d.ts +0 -1216
- package/dist/cjs/index.d.ts +0 -13
- package/dist/cjs/outcomes.d.ts +0 -31
- 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/fhirmapper/tokenize.d.ts +0 -2
- 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/match.d.ts +0 -9
- package/dist/esm/match.mjs.map +0 -1
- package/dist/esm/readablepromise.d.ts +0 -48
- package/dist/esm/search.d.ts +0 -66
- package/dist/esm/search.mjs.map +0 -1
- package/dist/esm/searchparams.d.ts +0 -33
- package/dist/esm/searchparams.mjs.map +0 -1
- package/dist/esm/storage.d.ts +0 -47
- package/dist/esm/types.d.ts +0 -177
- 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}/fhirlexer/tokenize.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/{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/searchparams.d.ts → types/search/details.d.ts} +0 -0
- /package/dist/{cjs → types/search}/match.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,13 +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 './match';
|
|
8
|
-
export * from './outcomes';
|
|
9
|
-
export * from './readablepromise';
|
|
10
|
-
export * from './search';
|
|
11
|
-
export * from './searchparams';
|
|
12
|
-
export * from './types';
|
|
13
|
-
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/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[];
|
|
@@ -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;
|
package/dist/esm/format.d.ts
DELETED
|
@@ -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;
|