@medplum/core 2.1.9 → 2.1.11

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 (52) hide show
  1. package/api-extractor.json +7 -0
  2. package/dist/cjs/index.cjs +4 -4
  3. package/dist/cjs/index.cjs.map +3 -3
  4. package/dist/esm/index.mjs +4 -4
  5. package/dist/esm/index.mjs.map +3 -3
  6. package/dist/types.d.ts +4592 -0
  7. package/package.json +33 -31
  8. package/test.setup.cjs +7 -0
  9. package/tsdoc.json +4 -0
  10. package/dist/types/access.d.ts +0 -77
  11. package/dist/types/base-schema.d.ts +0 -7
  12. package/dist/types/base64.d.ts +0 -14
  13. package/dist/types/bundle.d.ts +0 -32
  14. package/dist/types/cache.d.ts +0 -36
  15. package/dist/types/client.d.ts +0 -1728
  16. package/dist/types/config.d.ts +0 -127
  17. package/dist/types/constants.d.ts +0 -6
  18. package/dist/types/contenttype.d.ts +0 -18
  19. package/dist/types/crypto.d.ts +0 -19
  20. package/dist/types/eventtarget.d.ts +0 -18
  21. package/dist/types/fhircast/index.d.ts +0 -115
  22. package/dist/types/fhircast/test-utils.d.ts +0 -2
  23. package/dist/types/fhirlexer/parse.d.ts +0 -55
  24. package/dist/types/fhirlexer/tokenize.d.ts +0 -45
  25. package/dist/types/fhirmapper/parse.d.ts +0 -7
  26. package/dist/types/fhirmapper/tokenize.d.ts +0 -2
  27. package/dist/types/fhirpath/atoms.d.ts +0 -139
  28. package/dist/types/fhirpath/date.d.ts +0 -1
  29. package/dist/types/fhirpath/functions.d.ts +0 -4
  30. package/dist/types/fhirpath/parse.d.ts +0 -65
  31. package/dist/types/fhirpath/tokenize.d.ts +0 -4
  32. package/dist/types/fhirpath/utils.d.ts +0 -96
  33. package/dist/types/filter/parse.d.ts +0 -7
  34. package/dist/types/filter/tokenize.d.ts +0 -2
  35. package/dist/types/filter/types.d.ts +0 -32
  36. package/dist/types/format.d.ts +0 -120
  37. package/dist/types/hl7.d.ts +0 -242
  38. package/dist/types/index.d.ts +0 -34
  39. package/dist/types/jwt.d.ts +0 -18
  40. package/dist/types/outcomes.d.ts +0 -58
  41. package/dist/types/readablepromise.d.ts +0 -51
  42. package/dist/types/schema.d.ts +0 -43
  43. package/dist/types/search/details.d.ts +0 -37
  44. package/dist/types/search/match.d.ts +0 -9
  45. package/dist/types/search/search.d.ts +0 -102
  46. package/dist/types/sftp.d.ts +0 -9
  47. package/dist/types/storage.d.ts +0 -55
  48. package/dist/types/types.d.ts +0 -203
  49. package/dist/types/typeschema/crawler.d.ts +0 -12
  50. package/dist/types/typeschema/types.d.ts +0 -92
  51. package/dist/types/typeschema/validation.d.ts +0 -25
  52. package/dist/types/utils.d.ts +0 -326
@@ -1,127 +0,0 @@
1
- import { TypeName } from './types';
2
- export declare const ExternalSecretSystems: {
3
- readonly aws_ssm_parameter_store: "aws_ssm_parameter_store";
4
- };
5
- export type ExternalSecretSystem = keyof typeof ExternalSecretSystems;
6
- export type ExternalSecretPrimitive = string | boolean | number;
7
- export type ExternalSecretPrimitiveType = 'string' | 'boolean' | 'number';
8
- export type ExternalSecret<T extends ExternalSecretPrimitive = ExternalSecretPrimitive> = {
9
- system: ExternalSecretSystem;
10
- key: string;
11
- type: TypeName<T>;
12
- };
13
- export type ValueOrExternalSecret<T extends ExternalSecretPrimitive> = T | ExternalSecret<T>;
14
- export interface MedplumSourceInfraConfig {
15
- name: ValueOrExternalSecret<string>;
16
- stackName: ValueOrExternalSecret<string>;
17
- accountNumber: ValueOrExternalSecret<string>;
18
- region: string;
19
- domainName: ValueOrExternalSecret<string>;
20
- vpcId: ValueOrExternalSecret<string>;
21
- apiPort: ValueOrExternalSecret<number>;
22
- apiDomainName: ValueOrExternalSecret<string>;
23
- apiSslCertArn: ValueOrExternalSecret<string>;
24
- apiInternetFacing?: ValueOrExternalSecret<boolean>;
25
- appDomainName: ValueOrExternalSecret<string>;
26
- appSslCertArn: ValueOrExternalSecret<string>;
27
- appApiProxy?: ValueOrExternalSecret<boolean>;
28
- appLoggingBucket?: ValueOrExternalSecret<string>;
29
- appLoggingPrefix?: ValueOrExternalSecret<string>;
30
- storageBucketName: ValueOrExternalSecret<string>;
31
- storageDomainName: ValueOrExternalSecret<string>;
32
- storageSslCertArn: ValueOrExternalSecret<string>;
33
- signingKeyId: ValueOrExternalSecret<string>;
34
- storagePublicKey: ValueOrExternalSecret<string>;
35
- storageLoggingBucket?: ValueOrExternalSecret<string>;
36
- storageLoggingPrefix?: ValueOrExternalSecret<string>;
37
- baseUrl: ValueOrExternalSecret<string>;
38
- maxAzs: ValueOrExternalSecret<number>;
39
- rdsInstances: ValueOrExternalSecret<number>;
40
- rdsInstanceType: ValueOrExternalSecret<string>;
41
- rdsSecretsArn?: ValueOrExternalSecret<string>;
42
- cacheNodeType?: ValueOrExternalSecret<string>;
43
- desiredServerCount: ValueOrExternalSecret<number>;
44
- serverImage: ValueOrExternalSecret<string>;
45
- serverMemory: ValueOrExternalSecret<number>;
46
- serverCpu: ValueOrExternalSecret<number>;
47
- loadBalancerLoggingBucket?: ValueOrExternalSecret<string>;
48
- loadBalancerLoggingPrefix?: ValueOrExternalSecret<string>;
49
- clamscanEnabled: ValueOrExternalSecret<boolean>;
50
- clamscanLoggingBucket: ValueOrExternalSecret<string>;
51
- clamscanLoggingPrefix: ValueOrExternalSecret<string>;
52
- skipDns?: ValueOrExternalSecret<boolean>;
53
- additionalContainers?: {
54
- name: ValueOrExternalSecret<string>;
55
- image: ValueOrExternalSecret<string>;
56
- cpu?: ValueOrExternalSecret<number>;
57
- memory?: ValueOrExternalSecret<number>;
58
- essential?: ValueOrExternalSecret<boolean>;
59
- command?: ValueOrExternalSecret<string>[];
60
- environment?: {
61
- [key: string]: ValueOrExternalSecret<string>;
62
- };
63
- }[];
64
- cloudTrailAlarms?: {
65
- logGroupName: ValueOrExternalSecret<string>;
66
- logGroupCreate?: ValueOrExternalSecret<boolean>;
67
- snsTopicArn?: ValueOrExternalSecret<string>;
68
- snsTopicName?: ValueOrExternalSecret<string>;
69
- };
70
- }
71
- export interface MedplumInfraConfig {
72
- name: string;
73
- stackName: string;
74
- accountNumber: string;
75
- region: string;
76
- domainName: string;
77
- vpcId: string;
78
- apiPort: number;
79
- apiDomainName: string;
80
- apiSslCertArn: string;
81
- apiInternetFacing?: boolean;
82
- appDomainName: string;
83
- appSslCertArn: string;
84
- appApiProxy?: boolean;
85
- appLoggingBucket?: string;
86
- appLoggingPrefix?: string;
87
- storageBucketName: string;
88
- storageDomainName: string;
89
- storageSslCertArn: string;
90
- signingKeyId: string;
91
- storagePublicKey: string;
92
- storageLoggingBucket?: string;
93
- storageLoggingPrefix?: string;
94
- baseUrl: string;
95
- maxAzs: number;
96
- rdsInstances: number;
97
- rdsInstanceType: string;
98
- rdsSecretsArn?: string;
99
- cacheNodeType?: string;
100
- desiredServerCount: number;
101
- serverImage: string;
102
- serverMemory: number;
103
- serverCpu: number;
104
- loadBalancerLoggingBucket?: string;
105
- loadBalancerLoggingPrefix?: string;
106
- clamscanEnabled: boolean;
107
- clamscanLoggingBucket: string;
108
- clamscanLoggingPrefix: string;
109
- skipDns?: boolean;
110
- additionalContainers?: {
111
- name: string;
112
- image: string;
113
- cpu?: number;
114
- memory?: number;
115
- essential?: boolean;
116
- command?: string[];
117
- environment?: {
118
- [key: string]: string;
119
- };
120
- }[];
121
- cloudTrailAlarms?: {
122
- logGroupName: string;
123
- logGroupCreate?: boolean;
124
- snsTopicArn?: string;
125
- snsTopicName?: string;
126
- };
127
- }
@@ -1,6 +0,0 @@
1
- export declare const UCUM = "http://unitsofmeasure.org";
2
- export declare const LOINC = "http://loinc.org";
3
- export declare const SNOMED = "http://snomed.info/sct";
4
- export declare const RXNORM = "http://www.nlm.nih.gov/research/umls/rxnorm";
5
- export declare const CPT = "http://www.ama-assn.org/go/cpt";
6
- export declare const ICD10 = "http://hl7.org/fhir/sid/icd-10";
@@ -1,18 +0,0 @@
1
- /**
2
- * Content type constants.
3
- */
4
- export declare const ContentType: {
5
- CSS: string;
6
- FAVICON: string;
7
- FHIR_JSON: string;
8
- FORM_URL_ENCODED: string;
9
- HL7_V2: string;
10
- HTML: string;
11
- JAVASCRIPT: string;
12
- JSON: string;
13
- JSON_PATCH: string;
14
- PNG: string;
15
- SVG: string;
16
- TEXT: string;
17
- TYPESCRIPT: string;
18
- };
@@ -1,19 +0,0 @@
1
- /**
2
- * Returns a cryptographically secure random string.
3
- * @returns A cryptographically secure random string.
4
- */
5
- export declare function getRandomString(): string;
6
- /**
7
- * Encrypts a string with SHA256 encryption.
8
- * @param str The unencrypted input string.
9
- * @returns The encrypted value in an ArrayBuffer.
10
- */
11
- export declare function encryptSHA256(str: string): Promise<ArrayBuffer>;
12
- /**
13
- * Cross platform random UUID generator
14
- * Note that this is not intended for production use, but rather for testing
15
- * This should be replaced when crypto.randomUUID is fully supported
16
- * See: https://stackoverflow.com/revisions/2117523/28
17
- * @returns A random UUID.
18
- */
19
- export declare function generateId(): string;
@@ -1,18 +0,0 @@
1
- export interface Event {
2
- readonly type: string;
3
- readonly defaultPrevented?: boolean;
4
- }
5
- export type EventListener = (e: Event) => void;
6
- export declare class EventTarget {
7
- private readonly listeners;
8
- constructor();
9
- addEventListener(type: string, callback: EventListener): void;
10
- removeEventListener(type: string, callback: EventListener): void;
11
- dispatchEvent(event: Event): boolean;
12
- }
13
- export declare class TypedEventTarget<TEvents extends Record<string, Event>> {
14
- private emitter;
15
- dispatchEvent<TEventType extends keyof TEvents & string>(event: TEvents[TEventType]): void;
16
- addEventListener<TEventType extends keyof TEvents & string>(type: TEventType, handler: (event: TEvents[TEventType]) => void): void;
17
- removeEventListener<TEventType extends keyof TEvents & string>(type: TEventType, handler: (event: TEvents[TEventType]) => void): void;
18
- }
@@ -1,115 +0,0 @@
1
- import type { Resource } from '@medplum/fhirtypes';
2
- import { TypedEventTarget } from '../eventtarget';
3
- declare const FHIRCAST_EVENT_NAMES: {
4
- readonly 'patient-open': "patient-open";
5
- readonly 'patient-close': "patient-close";
6
- readonly 'imagingstudy-open': "imagingstudy-open";
7
- readonly 'imagingstudy-close': "imagingstudy-close";
8
- };
9
- declare const FHIRCAST_RESOURCE_TYPES: readonly ["Patient", "Encounter", "ImagingStudy"];
10
- export type FhircastEventName = keyof typeof FHIRCAST_EVENT_NAMES;
11
- export type FhircastResourceType = (typeof FHIRCAST_RESOURCE_TYPES)[number];
12
- /**
13
- * Checks if a `ResourceType` can be used in a `FHIRcast` context.
14
- *
15
- * @param resourceType A `ResourceType` to test.
16
- * @returns `true` if this is a resource type associated with `FHIRcast` contexts, otherwise returns `false`.
17
- */
18
- export declare function isFhircastResourceType(resourceType: FhircastResourceType): boolean;
19
- /**
20
- * A `FHIRcast` subscription request.
21
- *
22
- * Can be passed to `MedplumClient.fhircastConnect` or `MedplumClient.fhircastUnsubscribe` to either open a `FHIRcast` connection, or unsubscribe from the subscription.
23
- */
24
- export type SubscriptionRequest = {
25
- channelType: 'websocket';
26
- mode: 'subscribe' | 'unsubscribe';
27
- events: FhircastEventName[];
28
- topic: string;
29
- endpoint: string;
30
- };
31
- export type PendingSubscriptionRequest = Omit<SubscriptionRequest, 'endpoint'>;
32
- declare const FHIRCAST_CONTEXT_KEY_LOOKUP: {
33
- readonly study: "ImagingStudy";
34
- readonly patient: "Patient";
35
- readonly encounter: "Encounter";
36
- };
37
- type FhircastEventContextMap = typeof FHIRCAST_CONTEXT_KEY_LOOKUP;
38
- type FhircastEventContextKey = keyof FhircastEventContextMap;
39
- export type FhircastEventContext<K extends FhircastEventContextKey = FhircastEventContextKey> = {
40
- key: K;
41
- resource: Resource & {
42
- resourceType: FhircastEventContextMap[K];
43
- id: string;
44
- };
45
- };
46
- export type FhircastEventPayload = {
47
- 'hub.topic': string;
48
- 'hub.event': string;
49
- context: FhircastEventContext[];
50
- };
51
- export type FhircastMessagePayload = {
52
- timestamp: string;
53
- id: string;
54
- event: FhircastEventPayload;
55
- };
56
- export declare function isCompletedSubscriptionRequest(subscriptionRequest: SubscriptionRequest | PendingSubscriptionRequest): subscriptionRequest is SubscriptionRequest;
57
- /**
58
- * Creates a serialized url-encoded payload for a `FHIRcast` subscription from a `SubscriptionRequest` object that can be directly used in an HTTP request to the Hub.
59
- *
60
- * @param subscriptionRequest An object representing a subscription request.
61
- * @returns A serialized subscription in url-encoded form.
62
- */
63
- export declare function serializeFhircastSubscriptionRequest(subscriptionRequest: SubscriptionRequest | PendingSubscriptionRequest): string;
64
- /**
65
- * Validates that a `SubscriptionRequest`.
66
- *
67
- * @param subscriptionRequest The `SubscriptionRequest` to validate.
68
- * @returns A `boolean` indicating whether or not the `SubscriptionRequest` is valid.
69
- */
70
- export declare function validateFhircastSubscriptionRequest(subscriptionRequest: SubscriptionRequest | PendingSubscriptionRequest): boolean;
71
- /**
72
- * Creates a serializable JSON payload for the `FHIRcast` protocol
73
- *
74
- * @param topic The topic that this message will be published on. Usually a UUID.
75
- * @param event The event name, ie. "patient-open" or "patient-close".
76
- * @param context The updated context, containing new versions of resources related to this event.
77
- * @returns A serializable `FhircastMessagePayload`.
78
- */
79
- export declare function createFhircastMessagePayload(topic: string, event: FhircastEventName, context: FhircastEventContext | FhircastEventContext[]): FhircastMessagePayload;
80
- export type FhircastConnectEvent = {
81
- type: 'connect';
82
- };
83
- export type FhircastMessageEvent = {
84
- type: 'message';
85
- payload: FhircastMessagePayload;
86
- };
87
- export type FhircastDisconnectEvent = {
88
- type: 'disconnect';
89
- };
90
- export type FhircastSubscriptionEventMap = {
91
- connect: FhircastConnectEvent;
92
- message: FhircastMessageEvent;
93
- disconnect: FhircastDisconnectEvent;
94
- };
95
- /**
96
- * A class representing a `FHIRcast` connection.
97
- *
98
- * `FhircastConnection` extends `EventTarget` and emits 3 lifecycle events:
99
- * 1. `connect` - An event to signal when a WebSocket connection has been opened. Fired as soon as a WebSocket emits `open`.
100
- * 2. `message` - Contains a `payload` field containing a `FHIRcast` message payload exactly as it comes in over WebSockets.
101
- * 3. `disconnect` - An event to signal when a WebSocket connection has been closed. Fired as soon as a WebSocket emits `close`.
102
- *
103
- * To close the connection, call `connection.disconnect()` and listen to the `disconnect` event to know when the connection has been disconnected.
104
- */
105
- export declare class FhircastConnection extends TypedEventTarget<FhircastSubscriptionEventMap> {
106
- subRequest: SubscriptionRequest;
107
- private websocket;
108
- /**
109
- * Creates a new `FhircastConnection`.
110
- * @param subRequest The subscription request to initialize the connection from.
111
- */
112
- constructor(subRequest: SubscriptionRequest);
113
- disconnect(): void;
114
- }
115
- export {};
@@ -1,2 +0,0 @@
1
- import { FhircastEventContext, FhircastResourceType } from '.';
2
- export declare function createFhircastMessageContext(resourceType: Lowercase<FhircastResourceType>, resourceId: string): FhircastEventContext;
@@ -1,55 +0,0 @@
1
- import { TypedValue } from '../types';
2
- import { Token } from './tokenize';
3
- export interface AtomContext {
4
- parent?: AtomContext;
5
- variables: Record<string, TypedValue>;
6
- }
7
- export interface Atom {
8
- eval(context: AtomContext, input: TypedValue[]): TypedValue[];
9
- toString(): string;
10
- }
11
- export declare abstract class PrefixOperatorAtom implements Atom {
12
- readonly operator: string;
13
- readonly child: Atom;
14
- constructor(operator: string, child: Atom);
15
- abstract eval(context: AtomContext, input: TypedValue[]): TypedValue[];
16
- toString(): string;
17
- }
18
- export declare abstract class InfixOperatorAtom implements Atom {
19
- readonly operator: string;
20
- readonly left: Atom;
21
- readonly right: Atom;
22
- constructor(operator: string, left: Atom, right: Atom);
23
- abstract eval(context: AtomContext, input: TypedValue[]): TypedValue[];
24
- toString(): string;
25
- }
26
- export interface PrefixParselet {
27
- parse(parser: Parser, token: Token): Atom;
28
- }
29
- export interface InfixParselet {
30
- precedence: number;
31
- parse?(parser: Parser, left: Atom, token: Token): Atom;
32
- }
33
- export declare class ParserBuilder {
34
- private readonly prefixParselets;
35
- private readonly infixParselets;
36
- registerInfix(tokenType: string, parselet: InfixParselet): this;
37
- registerPrefix(tokenType: string, parselet: PrefixParselet): this;
38
- prefix(tokenType: string, precedence: number, builder: (token: Token, right: Atom) => Atom): this;
39
- infixLeft(tokenType: string, precedence: number, builder: (left: Atom, token: Token, right: Atom) => Atom): this;
40
- construct(input: Token[]): Parser;
41
- }
42
- export declare class Parser {
43
- private tokens;
44
- private prefixParselets;
45
- private infixParselets;
46
- constructor(tokens: Token[], prefixParselets: Record<string, PrefixParselet>, infixParselets: Record<string, InfixParselet>);
47
- hasMore(): boolean;
48
- match(expected: string): boolean;
49
- consumeAndParse(precedence?: number): Atom;
50
- getPrecedence(): number;
51
- consume(expectedId?: string, expectedValue?: string): Token;
52
- peek(): Token | undefined;
53
- removeComments(): void;
54
- getInfixParselet(token: Token): InfixParselet | undefined;
55
- }
@@ -1,45 +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 interface TokenizerOptions {
11
- dateTimeLiterals?: boolean;
12
- symbolRegex?: RegExp;
13
- }
14
- export declare class Tokenizer {
15
- private readonly str;
16
- private readonly keywords;
17
- private readonly operators;
18
- private readonly dateTimeLiterals;
19
- private readonly symbolRegex;
20
- private readonly result;
21
- private readonly pos;
22
- private readonly markStack;
23
- constructor(str: string, keywords: string[], operators: string[], options?: TokenizerOptions);
24
- tokenize(): Token[];
25
- private prevToken;
26
- private peekToken;
27
- private consumeToken;
28
- private consumeWhitespace;
29
- private consumeMultiLineComment;
30
- private consumeSingleLineComment;
31
- private consumeString;
32
- private consumeBacktickSymbol;
33
- private consumeDateTime;
34
- private consumeNumber;
35
- private consumeSymbol;
36
- private consumeOperator;
37
- private consumeWhile;
38
- private curr;
39
- private prev;
40
- private peek;
41
- private mark;
42
- private reset;
43
- private advance;
44
- private buildToken;
45
- }
@@ -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,2 +0,0 @@
1
- import { Token } from '../fhirlexer/tokenize';
2
- export declare function tokenize(str: string): Token[];
@@ -1,139 +0,0 @@
1
- import { Atom, AtomContext, InfixOperatorAtom, PrefixOperatorAtom } from '../fhirlexer/parse';
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: AtomContext, input: 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
- readonly name: string;
18
- constructor(name: string);
19
- eval(context: AtomContext, input: TypedValue[]): TypedValue[];
20
- private evalValue;
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: AtomContext, input: TypedValue[]): TypedValue[];
31
- toString(): string;
32
- }
33
- export declare class AsAtom extends InfixOperatorAtom {
34
- constructor(left: Atom, right: Atom);
35
- eval(context: AtomContext, input: TypedValue[]): TypedValue[];
36
- }
37
- export declare abstract class BooleanInfixOperatorAtom extends InfixOperatorAtom {
38
- abstract eval(context: AtomContext, input: TypedValue[]): TypedValue[];
39
- }
40
- export declare class ArithemticOperatorAtom extends BooleanInfixOperatorAtom {
41
- readonly impl: (x: number, y: number) => number | boolean;
42
- constructor(operator: string, left: Atom, right: Atom, impl: (x: number, y: number) => number | boolean);
43
- eval(context: AtomContext, input: TypedValue[]): TypedValue[];
44
- }
45
- export declare class ConcatAtom extends InfixOperatorAtom {
46
- constructor(left: Atom, right: Atom);
47
- eval(context: AtomContext, input: TypedValue[]): TypedValue[];
48
- }
49
- export declare class ContainsAtom extends BooleanInfixOperatorAtom {
50
- constructor(left: Atom, right: Atom);
51
- eval(context: AtomContext, input: TypedValue[]): TypedValue[];
52
- }
53
- export declare class InAtom extends BooleanInfixOperatorAtom {
54
- constructor(left: Atom, right: Atom);
55
- eval(context: AtomContext, input: TypedValue[]): TypedValue[];
56
- }
57
- export declare class DotAtom extends InfixOperatorAtom {
58
- constructor(left: Atom, right: Atom);
59
- eval(context: AtomContext, input: TypedValue[]): TypedValue[];
60
- toString(): string;
61
- }
62
- export declare class UnionAtom extends InfixOperatorAtom {
63
- constructor(left: Atom, right: Atom);
64
- eval(context: AtomContext, input: TypedValue[]): TypedValue[];
65
- }
66
- export declare class EqualsAtom extends BooleanInfixOperatorAtom {
67
- constructor(left: Atom, right: Atom);
68
- eval(context: AtomContext, input: TypedValue[]): TypedValue[];
69
- }
70
- export declare class NotEqualsAtom extends BooleanInfixOperatorAtom {
71
- constructor(left: Atom, right: Atom);
72
- eval(context: AtomContext, input: TypedValue[]): TypedValue[];
73
- }
74
- export declare class EquivalentAtom extends BooleanInfixOperatorAtom {
75
- constructor(left: Atom, right: Atom);
76
- eval(context: AtomContext, input: TypedValue[]): TypedValue[];
77
- }
78
- export declare class NotEquivalentAtom extends BooleanInfixOperatorAtom {
79
- constructor(left: Atom, right: Atom);
80
- eval(context: AtomContext, input: TypedValue[]): TypedValue[];
81
- }
82
- export declare class IsAtom extends BooleanInfixOperatorAtom {
83
- constructor(left: Atom, right: Atom);
84
- eval(context: AtomContext, input: TypedValue[]): TypedValue[];
85
- }
86
- /**
87
- * 6.5.1. and
88
- * Returns true if both operands evaluate to true,
89
- * false if either operand evaluates to false,
90
- * and the empty collection otherwise.
91
- */
92
- export declare class AndAtom extends BooleanInfixOperatorAtom {
93
- constructor(left: Atom, right: Atom);
94
- eval(context: AtomContext, input: TypedValue[]): TypedValue[];
95
- }
96
- /**
97
- * 6.5.2. or
98
- * Returns false if both operands evaluate to false,
99
- * true if either operand evaluates to true,
100
- * and empty ({ }) otherwise:
101
- */
102
- export declare class OrAtom extends BooleanInfixOperatorAtom {
103
- constructor(left: Atom, right: Atom);
104
- eval(context: AtomContext, input: TypedValue[]): TypedValue[];
105
- }
106
- /**
107
- * 6.5.4. xor
108
- * Returns true if exactly one of the operands evaluates to true,
109
- * false if either both operands evaluate to true or both operands evaluate to false,
110
- * and the empty collection otherwise.
111
- */
112
- export declare class XorAtom extends BooleanInfixOperatorAtom {
113
- constructor(left: Atom, right: Atom);
114
- eval(context: AtomContext, input: TypedValue[]): TypedValue[];
115
- }
116
- /**
117
- * 6.5.5. implies
118
- * Returns true if left is true and right is true,
119
- * true left is false and right true, false or empty
120
- * true left is empty
121
- */
122
- export declare class ImpliesAtom extends BooleanInfixOperatorAtom {
123
- constructor(left: Atom, right: Atom);
124
- eval(context: AtomContext, input: TypedValue[]): TypedValue[];
125
- }
126
- export declare class FunctionAtom implements Atom {
127
- readonly name: string;
128
- readonly args: Atom[];
129
- constructor(name: string, args: Atom[]);
130
- eval(context: AtomContext, input: TypedValue[]): TypedValue[];
131
- toString(): string;
132
- }
133
- export declare class IndexerAtom implements Atom {
134
- readonly left: Atom;
135
- readonly expr: Atom;
136
- constructor(left: Atom, expr: Atom);
137
- eval(context: AtomContext, input: TypedValue[]): TypedValue[];
138
- toString(): string;
139
- }
@@ -1 +0,0 @@
1
- export declare function parseDateString(str: string): string;
@@ -1,4 +0,0 @@
1
- import { Atom, AtomContext } from '../fhirlexer/parse';
2
- import { TypedValue } from '../types';
3
- export type FhirPathFunction = (context: AtomContext, input: TypedValue[], ...args: Atom[]) => TypedValue[];
4
- export declare const functions: Record<string, FhirPathFunction>;
@@ -1,65 +0,0 @@
1
- import { ParserBuilder } from '../fhirlexer/parse';
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 OperatorPrecedence: {
9
- FunctionCall: number;
10
- Dot: number;
11
- Indexer: number;
12
- UnaryAdd: number;
13
- UnarySubtract: number;
14
- Multiply: number;
15
- Divide: number;
16
- IntegerDivide: number;
17
- Modulo: number;
18
- Add: number;
19
- Subtract: number;
20
- Ampersand: number;
21
- Is: number;
22
- As: number;
23
- Union: number;
24
- GreaterThan: number;
25
- GreaterThanOrEquals: number;
26
- LessThan: number;
27
- LessThanOrEquals: number;
28
- Equals: number;
29
- Equivalent: number;
30
- NotEquals: number;
31
- NotEquivalent: number;
32
- In: number;
33
- Contains: number;
34
- And: number;
35
- Xor: number;
36
- Or: number;
37
- Implies: number;
38
- Arrow: number;
39
- Semicolon: number;
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
- * @param variables A map of variables for eval input.
63
- * @returns The result of the FHIRPath expression against the resource or object.
64
- */
65
- export declare function evalFhirPathTyped(expression: string, input: TypedValue[], variables?: Record<string, TypedValue>): TypedValue[];
@@ -1,4 +0,0 @@
1
- import { Token } from '../fhirlexer/tokenize';
2
- export declare const FHIRPATH_KEYWORDS: string[];
3
- export declare const FHIRPATH_OPERATORS: string[];
4
- export declare function tokenize(str: string): Token[];