@medplum/core 0.9.4 → 0.9.7
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/README.md +3 -23
- package/dist/cjs/index.js +5265 -2632
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.min.js +1 -1
- package/dist/cjs/index.min.js.map +1 -1
- package/dist/cjs/package.json +1 -0
- package/dist/esm/index.js +5234 -2605
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +1 -1
- package/dist/esm/index.min.js.map +1 -1
- package/dist/esm/package.json +1 -0
- package/dist/types/cache.d.ts +12 -12
- package/dist/types/client.d.ts +854 -713
- package/dist/types/crypto.d.ts +9 -9
- package/dist/types/eventtarget.d.ts +13 -13
- package/dist/types/fhirpath/atoms.d.ts +150 -0
- package/dist/types/fhirpath/date.d.ts +1 -0
- package/dist/types/fhirpath/functions.d.ts +964 -0
- package/dist/types/fhirpath/index.d.ts +2 -0
- package/dist/types/fhirpath/parse.d.ts +17 -0
- package/dist/types/fhirpath/tokenize.d.ts +5 -0
- package/dist/types/fhirpath/utils.d.ts +65 -0
- package/dist/types/format.d.ts +15 -15
- package/dist/types/hl7.d.ts +43 -43
- package/dist/types/index.d.ts +11 -10
- package/dist/types/jwt.d.ts +5 -5
- package/dist/types/outcomes.d.ts +22 -22
- package/dist/types/readablepromise.d.ts +43 -43
- package/dist/types/search.d.ts +62 -62
- package/dist/types/searchparams.d.ts +35 -35
- package/dist/types/storage.d.ts +47 -47
- package/dist/types/types.d.ts +139 -139
- package/dist/types/utils.d.ts +143 -131
- package/package.json +2 -3
- package/dist/types/fix-ro-iddentifiers.d.ts +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FhirPathAtom } from './atoms';
|
|
2
|
+
/**
|
|
3
|
+
* Parses a FHIRPath expression into an AST.
|
|
4
|
+
* The result can be used to evaluate the expression against a resource or other object.
|
|
5
|
+
* This method is useful if you know that you will evaluate the same expression many times
|
|
6
|
+
* against different resources.
|
|
7
|
+
* @param input The FHIRPath expression to parse.
|
|
8
|
+
* @returns The AST representing the expression.
|
|
9
|
+
*/
|
|
10
|
+
export declare function parseFhirPath(input: string): FhirPathAtom;
|
|
11
|
+
/**
|
|
12
|
+
* Evaluates a FHIRPath expression against a resource or other object.
|
|
13
|
+
* @param input The FHIRPath expression to parse.
|
|
14
|
+
* @param context The resource or object to evaluate the expression against.
|
|
15
|
+
* @returns The result of the FHIRPath expression against the resource or object.
|
|
16
|
+
*/
|
|
17
|
+
export declare function evalFhirPath(input: string, context: unknown): unknown[];
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Period, Quantity } from '@medplum/fhirtypes';
|
|
2
|
+
/**
|
|
3
|
+
* Ensures that the value is wrapped in an array.
|
|
4
|
+
* @param input The input as a an array or a value.
|
|
5
|
+
* @returns The input as an array.
|
|
6
|
+
*/
|
|
7
|
+
export declare function ensureArray(input: unknown): unknown[];
|
|
8
|
+
/**
|
|
9
|
+
* Applies a function to single value or an array of values.
|
|
10
|
+
* @param context The context which will be passed to the function.
|
|
11
|
+
* @param fn The function to apply.
|
|
12
|
+
* @returns The result of the function.
|
|
13
|
+
*/
|
|
14
|
+
export declare function applyMaybeArray(context: unknown, fn: (context: unknown) => unknown): unknown;
|
|
15
|
+
/**
|
|
16
|
+
* Determines if the input is an empty array.
|
|
17
|
+
* @param obj Any value or array of values.
|
|
18
|
+
* @returns True if the input is an empty array.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isEmptyArray(obj: unknown): boolean;
|
|
21
|
+
export declare function isFalsy(obj: unknown): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Converts unknown object into a JavaScript boolean.
|
|
24
|
+
* Note that this is different than the FHIRPath "toBoolean",
|
|
25
|
+
* which has particular semantics around arrays, empty arrays, and type conversions.
|
|
26
|
+
* @param obj Any value or array of values.
|
|
27
|
+
* @returns The converted boolean value according to FHIRPath rules.
|
|
28
|
+
*/
|
|
29
|
+
export declare function toJsBoolean(obj: unknown): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Removes duplicates in array using FHIRPath equality rules.
|
|
32
|
+
* @param arr The input array.
|
|
33
|
+
* @returns The result array with duplicates removed.
|
|
34
|
+
*/
|
|
35
|
+
export declare function removeDuplicates(arr: unknown[]): unknown[];
|
|
36
|
+
/**
|
|
37
|
+
* Determines if two values are equal according to FHIRPath equality rules.
|
|
38
|
+
* @param x The first value.
|
|
39
|
+
* @param y The second value.
|
|
40
|
+
* @returns True if equal.
|
|
41
|
+
*/
|
|
42
|
+
export declare function fhirPathEquals(x: unknown, y: unknown): boolean | [];
|
|
43
|
+
/**
|
|
44
|
+
* Determines if two values are equal according to FHIRPath equality rules.
|
|
45
|
+
* @param x The first value.
|
|
46
|
+
* @param y The second value.
|
|
47
|
+
* @returns True if equal.
|
|
48
|
+
*/
|
|
49
|
+
export declare function fhirPathEquivalent(x: unknown, y: unknown): boolean | [];
|
|
50
|
+
export declare function fhirPathIs(value: unknown, desiredType: unknown): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Determines if the input is a Period object.
|
|
53
|
+
* This is heuristic based, as we do not have strong typing at runtime.
|
|
54
|
+
* @param input The input value.
|
|
55
|
+
* @returns True if the input is a period.
|
|
56
|
+
*/
|
|
57
|
+
export declare function isPeriod(input: unknown): input is Period;
|
|
58
|
+
/**
|
|
59
|
+
* Determines if the input is a Quantity object.
|
|
60
|
+
* This is heuristic based, as we do not have strong typing at runtime.
|
|
61
|
+
* @param input The input value.
|
|
62
|
+
* @returns True if the input is a quantity.
|
|
63
|
+
*/
|
|
64
|
+
export declare function isQuantity(input: unknown): input is Quantity;
|
|
65
|
+
export declare function isQuantityEquivalent(x: Quantity, y: Quantity): boolean;
|
package/dist/types/format.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Address, HumanName } from '@medplum/fhirtypes';
|
|
2
|
-
export interface AddressFormatOptions {
|
|
3
|
-
all?: boolean;
|
|
4
|
-
use?: boolean;
|
|
5
|
-
}
|
|
6
|
-
export interface HumanNameFormatOptions {
|
|
7
|
-
all?: boolean;
|
|
8
|
-
prefix?: boolean;
|
|
9
|
-
suffix?: boolean;
|
|
10
|
-
use?: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare function formatAddress(address: Address, options?: AddressFormatOptions): string;
|
|
13
|
-
export declare function formatHumanName(name: HumanName, options?: HumanNameFormatOptions): string;
|
|
14
|
-
export declare function formatGivenName(name: HumanName): string;
|
|
15
|
-
export declare function formatFamilyName(name: HumanName): string;
|
|
1
|
+
import { Address, HumanName } from '@medplum/fhirtypes';
|
|
2
|
+
export interface AddressFormatOptions {
|
|
3
|
+
all?: boolean;
|
|
4
|
+
use?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface HumanNameFormatOptions {
|
|
7
|
+
all?: boolean;
|
|
8
|
+
prefix?: boolean;
|
|
9
|
+
suffix?: boolean;
|
|
10
|
+
use?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function formatAddress(address: Address, options?: AddressFormatOptions): string;
|
|
13
|
+
export declare function formatHumanName(name: HumanName, options?: HumanNameFormatOptions): string;
|
|
14
|
+
export declare function formatGivenName(name: HumanName): string;
|
|
15
|
+
export declare function formatFamilyName(name: HumanName): string;
|
package/dist/types/hl7.d.ts
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
export declare const SEGMENT_SEPARATOR = "\r";
|
|
2
|
-
export declare const FIELD_SEPARATOR = "|";
|
|
3
|
-
export declare const COMPONENT_SEPARATOR = "^";
|
|
4
|
-
/**
|
|
5
|
-
* The Hl7Message class represents one HL7 message.
|
|
6
|
-
* A message is a collection of segments.
|
|
7
|
-
* Note that we do not strictly parse messages, and only use default delimeters.
|
|
8
|
-
*/
|
|
9
|
-
export declare class Hl7Message {
|
|
10
|
-
readonly segments: Hl7Segment[];
|
|
11
|
-
constructor(segments: Hl7Segment[]);
|
|
12
|
-
get(index: number | string): Hl7Segment | undefined;
|
|
13
|
-
getAll(name: string): Hl7Segment[];
|
|
14
|
-
toString(): string;
|
|
15
|
-
buildAck(): Hl7Message;
|
|
16
|
-
static parse(text: string): Hl7Message;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* The Hl7Segment class represents one HL7 segment.
|
|
20
|
-
* A segment is a collection of fields.
|
|
21
|
-
* The name field is the first field.
|
|
22
|
-
* Note that we do not strictly parse messages, and only use default delimeters.
|
|
23
|
-
*/
|
|
24
|
-
export declare class Hl7Segment {
|
|
25
|
-
readonly name: string;
|
|
26
|
-
readonly fields: Hl7Field[];
|
|
27
|
-
constructor(fields: Hl7Field[] | string[]);
|
|
28
|
-
get(index: number): Hl7Field;
|
|
29
|
-
toString(): string;
|
|
30
|
-
static parse(text: string): Hl7Segment;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* The Hl7Field class represents one HL7 field.
|
|
34
|
-
* A field is a collection of components.
|
|
35
|
-
* Note that we do not strictly parse messages, and only use default delimeters.
|
|
36
|
-
*/
|
|
37
|
-
export declare class Hl7Field {
|
|
38
|
-
readonly components: string[];
|
|
39
|
-
constructor(components: string[]);
|
|
40
|
-
get(index: number): string;
|
|
41
|
-
toString(): string;
|
|
42
|
-
static parse(text: string): Hl7Field;
|
|
43
|
-
}
|
|
1
|
+
export declare const SEGMENT_SEPARATOR = "\r";
|
|
2
|
+
export declare const FIELD_SEPARATOR = "|";
|
|
3
|
+
export declare const COMPONENT_SEPARATOR = "^";
|
|
4
|
+
/**
|
|
5
|
+
* The Hl7Message class represents one HL7 message.
|
|
6
|
+
* A message is a collection of segments.
|
|
7
|
+
* Note that we do not strictly parse messages, and only use default delimeters.
|
|
8
|
+
*/
|
|
9
|
+
export declare class Hl7Message {
|
|
10
|
+
readonly segments: Hl7Segment[];
|
|
11
|
+
constructor(segments: Hl7Segment[]);
|
|
12
|
+
get(index: number | string): Hl7Segment | undefined;
|
|
13
|
+
getAll(name: string): Hl7Segment[];
|
|
14
|
+
toString(): string;
|
|
15
|
+
buildAck(): Hl7Message;
|
|
16
|
+
static parse(text: string): Hl7Message;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The Hl7Segment class represents one HL7 segment.
|
|
20
|
+
* A segment is a collection of fields.
|
|
21
|
+
* The name field is the first field.
|
|
22
|
+
* Note that we do not strictly parse messages, and only use default delimeters.
|
|
23
|
+
*/
|
|
24
|
+
export declare class Hl7Segment {
|
|
25
|
+
readonly name: string;
|
|
26
|
+
readonly fields: Hl7Field[];
|
|
27
|
+
constructor(fields: Hl7Field[] | string[]);
|
|
28
|
+
get(index: number): Hl7Field;
|
|
29
|
+
toString(): string;
|
|
30
|
+
static parse(text: string): Hl7Segment;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The Hl7Field class represents one HL7 field.
|
|
34
|
+
* A field is a collection of components.
|
|
35
|
+
* Note that we do not strictly parse messages, and only use default delimeters.
|
|
36
|
+
*/
|
|
37
|
+
export declare class Hl7Field {
|
|
38
|
+
readonly components: string[];
|
|
39
|
+
constructor(components: string[]);
|
|
40
|
+
get(index: number): string;
|
|
41
|
+
toString(): string;
|
|
42
|
+
static parse(text: string): Hl7Field;
|
|
43
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export * from './cache';
|
|
2
|
-
export * from './client';
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './
|
|
1
|
+
export * from './cache';
|
|
2
|
+
export * from './client';
|
|
3
|
+
export * from './fhirpath';
|
|
4
|
+
export * from './format';
|
|
5
|
+
export * from './hl7';
|
|
6
|
+
export * from './outcomes';
|
|
7
|
+
export * from './readablepromise';
|
|
8
|
+
export * from './search';
|
|
9
|
+
export * from './searchparams';
|
|
10
|
+
export * from './types';
|
|
11
|
+
export * from './utils';
|
package/dist/types/jwt.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parses the JWT payload.
|
|
3
|
-
* @param token JWT token
|
|
4
|
-
*/
|
|
5
|
-
export declare function parseJWTPayload(token: string): Record<string, number | string>;
|
|
1
|
+
/**
|
|
2
|
+
* Parses the JWT payload.
|
|
3
|
+
* @param token JWT token
|
|
4
|
+
*/
|
|
5
|
+
export declare function parseJWTPayload(token: string): Record<string, number | string>;
|
package/dist/types/outcomes.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
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 gone: OperationOutcome;
|
|
7
|
-
export declare const accessDenied: OperationOutcome;
|
|
8
|
-
export declare function badRequest(details: string, expression?: string): OperationOutcome;
|
|
9
|
-
export declare function isOk(outcome: OperationOutcome): boolean;
|
|
10
|
-
export declare function isNotFound(outcome: OperationOutcome): boolean;
|
|
11
|
-
export declare function isGone(outcome: OperationOutcome): boolean;
|
|
12
|
-
export declare function getStatus(outcome: OperationOutcome): number;
|
|
13
|
-
/**
|
|
14
|
-
* Asserts that the operation completed successfully and that the resource is defined.
|
|
15
|
-
* @param outcome The operation outcome.
|
|
16
|
-
* @param resource The resource that may or may not have been returned.
|
|
17
|
-
*/
|
|
18
|
-
export declare function assertOk<T>(outcome: OperationOutcome, resource: T | undefined): asserts resource is T;
|
|
19
|
-
export declare class OperationOutcomeError extends Error {
|
|
20
|
-
readonly outcome: OperationOutcome;
|
|
21
|
-
constructor(outcome: OperationOutcome);
|
|
22
|
-
}
|
|
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 gone: OperationOutcome;
|
|
7
|
+
export declare const accessDenied: OperationOutcome;
|
|
8
|
+
export declare function badRequest(details: string, expression?: string): OperationOutcome;
|
|
9
|
+
export declare function isOk(outcome: OperationOutcome): boolean;
|
|
10
|
+
export declare function isNotFound(outcome: OperationOutcome): boolean;
|
|
11
|
+
export declare function isGone(outcome: OperationOutcome): boolean;
|
|
12
|
+
export declare function getStatus(outcome: OperationOutcome): number;
|
|
13
|
+
/**
|
|
14
|
+
* Asserts that the operation completed successfully and that the resource is defined.
|
|
15
|
+
* @param outcome The operation outcome.
|
|
16
|
+
* @param resource The resource that may or may not have been returned.
|
|
17
|
+
*/
|
|
18
|
+
export declare function assertOk<T>(outcome: OperationOutcome, resource: T | undefined): asserts resource is T;
|
|
19
|
+
export declare class OperationOutcomeError extends Error {
|
|
20
|
+
readonly outcome: OperationOutcome;
|
|
21
|
+
constructor(outcome: OperationOutcome);
|
|
22
|
+
}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The ReadablePromise class wraps a request promise suitable for React Suspense.
|
|
3
|
-
* See: https://blog.logrocket.com/react-suspense-data-fetching/#wrappromise-js
|
|
4
|
-
* See: https://github.com/ovieokeh/suspense-data-fetching/blob/master/lib/api/wrapPromise.js
|
|
5
|
-
*/
|
|
6
|
-
export declare class ReadablePromise<T> implements Promise<T> {
|
|
7
|
-
#private;
|
|
8
|
-
readonly [Symbol.toStringTag]: string;
|
|
9
|
-
constructor(requestPromise: Promise<T>);
|
|
10
|
-
/**
|
|
11
|
-
* Returns true if the promise is pending.
|
|
12
|
-
* @returns True if the Promise is pending.
|
|
13
|
-
*/
|
|
14
|
-
isPending(): boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Attempts to read the value of the promise.
|
|
17
|
-
* If the promise is pending, this method will throw a promise.
|
|
18
|
-
* If the promise rejected, this method will throw the rejection reason.
|
|
19
|
-
* If the promise resolved, this method will return the resolved value.
|
|
20
|
-
* @returns The resolved value of the Promise.
|
|
21
|
-
*/
|
|
22
|
-
read(): T;
|
|
23
|
-
/**
|
|
24
|
-
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
|
25
|
-
* @param onfulfilled The callback to execute when the Promise is resolved.
|
|
26
|
-
* @param onrejected The callback to execute when the Promise is rejected.
|
|
27
|
-
* @returns A Promise for the completion of which ever callback is executed.
|
|
28
|
-
*/
|
|
29
|
-
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
|
|
30
|
-
/**
|
|
31
|
-
* Attaches a callback for only the rejection of the Promise.
|
|
32
|
-
* @param onrejected The callback to execute when the Promise is rejected.
|
|
33
|
-
* @returns A Promise for the completion of the callback.
|
|
34
|
-
*/
|
|
35
|
-
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
|
|
36
|
-
/**
|
|
37
|
-
* Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The
|
|
38
|
-
* resolved value cannot be modified from the callback.
|
|
39
|
-
* @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected).
|
|
40
|
-
* @returns A Promise for the completion of the callback.
|
|
41
|
-
*/
|
|
42
|
-
finally(onfinally?: (() => void) | undefined | null): Promise<T>;
|
|
43
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* The ReadablePromise class wraps a request promise suitable for React Suspense.
|
|
3
|
+
* See: https://blog.logrocket.com/react-suspense-data-fetching/#wrappromise-js
|
|
4
|
+
* See: https://github.com/ovieokeh/suspense-data-fetching/blob/master/lib/api/wrapPromise.js
|
|
5
|
+
*/
|
|
6
|
+
export declare class ReadablePromise<T> implements Promise<T> {
|
|
7
|
+
#private;
|
|
8
|
+
readonly [Symbol.toStringTag]: string;
|
|
9
|
+
constructor(requestPromise: Promise<T>);
|
|
10
|
+
/**
|
|
11
|
+
* Returns true if the promise is pending.
|
|
12
|
+
* @returns True if the Promise is pending.
|
|
13
|
+
*/
|
|
14
|
+
isPending(): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Attempts to read the value of the promise.
|
|
17
|
+
* If the promise is pending, this method will throw a promise.
|
|
18
|
+
* If the promise rejected, this method will throw the rejection reason.
|
|
19
|
+
* If the promise resolved, this method will return the resolved value.
|
|
20
|
+
* @returns The resolved value of the Promise.
|
|
21
|
+
*/
|
|
22
|
+
read(): T;
|
|
23
|
+
/**
|
|
24
|
+
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
|
25
|
+
* @param onfulfilled The callback to execute when the Promise is resolved.
|
|
26
|
+
* @param onrejected The callback to execute when the Promise is rejected.
|
|
27
|
+
* @returns A Promise for the completion of which ever callback is executed.
|
|
28
|
+
*/
|
|
29
|
+
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
|
|
30
|
+
/**
|
|
31
|
+
* Attaches a callback for only the rejection of the Promise.
|
|
32
|
+
* @param onrejected The callback to execute when the Promise is rejected.
|
|
33
|
+
* @returns A Promise for the completion of the callback.
|
|
34
|
+
*/
|
|
35
|
+
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
|
|
36
|
+
/**
|
|
37
|
+
* Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The
|
|
38
|
+
* resolved value cannot be modified from the callback.
|
|
39
|
+
* @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected).
|
|
40
|
+
* @returns A Promise for the completion of the callback.
|
|
41
|
+
*/
|
|
42
|
+
finally(onfinally?: (() => void) | undefined | null): Promise<T>;
|
|
43
|
+
}
|
package/dist/types/search.d.ts
CHANGED
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
export declare const DEFAULT_SEARCH_COUNT = 20;
|
|
2
|
-
export interface SearchRequest {
|
|
3
|
-
readonly resourceType: string;
|
|
4
|
-
filters?: Filter[];
|
|
5
|
-
sortRules?: SortRule[];
|
|
6
|
-
offset?: number;
|
|
7
|
-
count?: number;
|
|
8
|
-
fields?: string[];
|
|
9
|
-
name?: string;
|
|
10
|
-
total?: 'none' | 'estimate' | 'accurate';
|
|
11
|
-
}
|
|
12
|
-
export interface Filter {
|
|
13
|
-
code: string;
|
|
14
|
-
operator: Operator;
|
|
15
|
-
value: string;
|
|
16
|
-
unitSystem?: string;
|
|
17
|
-
unitCode?: string;
|
|
18
|
-
}
|
|
19
|
-
export interface SortRule {
|
|
20
|
-
code: string;
|
|
21
|
-
descending?: boolean;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Search operators.
|
|
25
|
-
* These operators represent "modifiers" and "prefixes" in FHIR search.
|
|
26
|
-
* See: https://www.hl7.org/fhir/search.html
|
|
27
|
-
*/
|
|
28
|
-
export declare enum Operator {
|
|
29
|
-
EQUALS = "eq",
|
|
30
|
-
NOT_EQUALS = "ne",
|
|
31
|
-
GREATER_THAN = "gt",
|
|
32
|
-
LESS_THAN = "lt",
|
|
33
|
-
GREATER_THAN_OR_EQUALS = "ge",
|
|
34
|
-
LESS_THAN_OR_EQUALS = "le",
|
|
35
|
-
STARTS_AFTER = "sa",
|
|
36
|
-
ENDS_BEFORE = "eb",
|
|
37
|
-
APPROXIMATELY = "ap",
|
|
38
|
-
CONTAINS = "contains",
|
|
39
|
-
EXACT = "exact",
|
|
40
|
-
TEXT = "text",
|
|
41
|
-
ABOVE = "above",
|
|
42
|
-
BELOW = "below",
|
|
43
|
-
IN = "in",
|
|
44
|
-
NOT_IN = "not-in",
|
|
45
|
-
OF_TYPE = "of-type"
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Parses a URL into a SearchRequest.
|
|
49
|
-
*
|
|
50
|
-
* See the FHIR search spec: http://hl7.org/fhir/r4/search.html
|
|
51
|
-
*
|
|
52
|
-
* @param url The URL to parse.
|
|
53
|
-
* @returns Parsed search definition.
|
|
54
|
-
*/
|
|
55
|
-
export declare function parseSearchDefinition(url: string): SearchRequest;
|
|
56
|
-
/**
|
|
57
|
-
* Formats a search definition object into a query string.
|
|
58
|
-
* Note: The return value does not include the resource type.
|
|
59
|
-
* @param {!SearchRequest} definition The search definition.
|
|
60
|
-
* @returns Formatted URL.
|
|
61
|
-
*/
|
|
62
|
-
export declare function formatSearchQuery(definition: SearchRequest): string;
|
|
1
|
+
export declare const DEFAULT_SEARCH_COUNT = 20;
|
|
2
|
+
export interface SearchRequest {
|
|
3
|
+
readonly resourceType: string;
|
|
4
|
+
filters?: Filter[];
|
|
5
|
+
sortRules?: SortRule[];
|
|
6
|
+
offset?: number;
|
|
7
|
+
count?: number;
|
|
8
|
+
fields?: string[];
|
|
9
|
+
name?: string;
|
|
10
|
+
total?: 'none' | 'estimate' | 'accurate';
|
|
11
|
+
}
|
|
12
|
+
export interface Filter {
|
|
13
|
+
code: string;
|
|
14
|
+
operator: Operator;
|
|
15
|
+
value: string;
|
|
16
|
+
unitSystem?: string;
|
|
17
|
+
unitCode?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface SortRule {
|
|
20
|
+
code: string;
|
|
21
|
+
descending?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Search operators.
|
|
25
|
+
* These operators represent "modifiers" and "prefixes" in FHIR search.
|
|
26
|
+
* See: https://www.hl7.org/fhir/search.html
|
|
27
|
+
*/
|
|
28
|
+
export declare enum Operator {
|
|
29
|
+
EQUALS = "eq",
|
|
30
|
+
NOT_EQUALS = "ne",
|
|
31
|
+
GREATER_THAN = "gt",
|
|
32
|
+
LESS_THAN = "lt",
|
|
33
|
+
GREATER_THAN_OR_EQUALS = "ge",
|
|
34
|
+
LESS_THAN_OR_EQUALS = "le",
|
|
35
|
+
STARTS_AFTER = "sa",
|
|
36
|
+
ENDS_BEFORE = "eb",
|
|
37
|
+
APPROXIMATELY = "ap",
|
|
38
|
+
CONTAINS = "contains",
|
|
39
|
+
EXACT = "exact",
|
|
40
|
+
TEXT = "text",
|
|
41
|
+
ABOVE = "above",
|
|
42
|
+
BELOW = "below",
|
|
43
|
+
IN = "in",
|
|
44
|
+
NOT_IN = "not-in",
|
|
45
|
+
OF_TYPE = "of-type"
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Parses a URL into a SearchRequest.
|
|
49
|
+
*
|
|
50
|
+
* See the FHIR search spec: http://hl7.org/fhir/r4/search.html
|
|
51
|
+
*
|
|
52
|
+
* @param url The URL to parse.
|
|
53
|
+
* @returns Parsed search definition.
|
|
54
|
+
*/
|
|
55
|
+
export declare function parseSearchDefinition(url: string): SearchRequest;
|
|
56
|
+
/**
|
|
57
|
+
* Formats a search definition object into a query string.
|
|
58
|
+
* Note: The return value does not include the resource type.
|
|
59
|
+
* @param {!SearchRequest} definition The search definition.
|
|
60
|
+
* @returns Formatted URL.
|
|
61
|
+
*/
|
|
62
|
+
export declare function formatSearchQuery(definition: SearchRequest): string;
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { ElementDefinition, SearchParameter } from '@medplum/fhirtypes';
|
|
2
|
-
import { IndexedStructureDefinition } from './types';
|
|
3
|
-
export declare enum SearchParameterType {
|
|
4
|
-
BOOLEAN = "BOOLEAN",
|
|
5
|
-
NUMBER = "NUMBER",
|
|
6
|
-
QUANTITY = "QUANTITY",
|
|
7
|
-
TEXT = "TEXT",
|
|
8
|
-
REFERENCE = "REFERENCE",
|
|
9
|
-
DATE = "DATE",
|
|
10
|
-
DATETIME = "DATETIME",
|
|
11
|
-
PERIOD = "PERIOD"
|
|
12
|
-
}
|
|
13
|
-
export interface SearchParameterDetails {
|
|
14
|
-
readonly columnName: string;
|
|
15
|
-
readonly type: SearchParameterType;
|
|
16
|
-
readonly elementDefinition?: ElementDefinition;
|
|
17
|
-
readonly array?: boolean;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Returns the type details of a SearchParameter.
|
|
21
|
-
*
|
|
22
|
-
* The SearchParameter resource has a "type" parameter, but that is missing some critical information.
|
|
23
|
-
*
|
|
24
|
-
* For example:
|
|
25
|
-
* 1) The "date" type includes "date", "datetime", and "period".
|
|
26
|
-
* 2) The "token" type includes enums and booleans.
|
|
27
|
-
* 3) Arrays/multiple values are not reflected at all.
|
|
28
|
-
*
|
|
29
|
-
* @param structureDefinitions Collection of StructureDefinition resources indexed by name.
|
|
30
|
-
* @param resourceType The root resource type.
|
|
31
|
-
* @param searchParam The search parameter.
|
|
32
|
-
* @returns The search parameter type details.
|
|
33
|
-
*/
|
|
34
|
-
export declare function getSearchParameterDetails(structureDefinitions: IndexedStructureDefinition, resourceType: string, searchParam: SearchParameter): SearchParameterDetails;
|
|
35
|
-
export declare function getExpressionForResourceType(resourceType: string, expression: string): string | undefined;
|
|
1
|
+
import { ElementDefinition, SearchParameter } from '@medplum/fhirtypes';
|
|
2
|
+
import { IndexedStructureDefinition } from './types';
|
|
3
|
+
export declare enum SearchParameterType {
|
|
4
|
+
BOOLEAN = "BOOLEAN",
|
|
5
|
+
NUMBER = "NUMBER",
|
|
6
|
+
QUANTITY = "QUANTITY",
|
|
7
|
+
TEXT = "TEXT",
|
|
8
|
+
REFERENCE = "REFERENCE",
|
|
9
|
+
DATE = "DATE",
|
|
10
|
+
DATETIME = "DATETIME",
|
|
11
|
+
PERIOD = "PERIOD"
|
|
12
|
+
}
|
|
13
|
+
export interface SearchParameterDetails {
|
|
14
|
+
readonly columnName: string;
|
|
15
|
+
readonly type: SearchParameterType;
|
|
16
|
+
readonly elementDefinition?: ElementDefinition;
|
|
17
|
+
readonly array?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Returns the type details of a SearchParameter.
|
|
21
|
+
*
|
|
22
|
+
* The SearchParameter resource has a "type" parameter, but that is missing some critical information.
|
|
23
|
+
*
|
|
24
|
+
* For example:
|
|
25
|
+
* 1) The "date" type includes "date", "datetime", and "period".
|
|
26
|
+
* 2) The "token" type includes enums and booleans.
|
|
27
|
+
* 3) Arrays/multiple values are not reflected at all.
|
|
28
|
+
*
|
|
29
|
+
* @param structureDefinitions Collection of StructureDefinition resources indexed by name.
|
|
30
|
+
* @param resourceType The root resource type.
|
|
31
|
+
* @param searchParam The search parameter.
|
|
32
|
+
* @returns The search parameter type details.
|
|
33
|
+
*/
|
|
34
|
+
export declare function getSearchParameterDetails(structureDefinitions: IndexedStructureDefinition, resourceType: string, searchParam: SearchParameter): SearchParameterDetails;
|
|
35
|
+
export declare function getExpressionForResourceType(resourceType: string, expression: string): string | undefined;
|