@medplum/core 5.0.9 → 5.0.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.
- package/dist/cjs/index.cjs +8 -8
- package/dist/cjs/index.cjs.map +3 -3
- package/dist/cjs/index.d.ts +55 -11
- package/dist/esm/index.d.ts +55 -11
- package/dist/esm/index.mjs +8 -8
- package/dist/esm/index.mjs.map +3 -3
- package/package.json +4 -4
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1102,6 +1102,9 @@ export declare interface EmailPasswordLoginRequest extends BaseLoginRequest {
|
|
|
1102
1102
|
readonly remember?: boolean;
|
|
1103
1103
|
}
|
|
1104
1104
|
|
|
1105
|
+
/** Constant empty array. */
|
|
1106
|
+
export declare const EMPTY: readonly [];
|
|
1107
|
+
|
|
1105
1108
|
export declare class EmptySetAtom implements Atom {
|
|
1106
1109
|
eval(): [];
|
|
1107
1110
|
toString(): string;
|
|
@@ -1911,6 +1914,16 @@ export declare function formatTime(time: string | undefined, locales?: Intl.Loca
|
|
|
1911
1914
|
*/
|
|
1912
1915
|
export declare function formatTiming(timing: Timing | undefined): string;
|
|
1913
1916
|
|
|
1917
|
+
/**
|
|
1918
|
+
* Formats a FHIR time string as a human readable string.
|
|
1919
|
+
* The viewer's timezone does not affect the display.
|
|
1920
|
+
* @param time - The time to format, a string like `HH:mm` or `HH:mm:ss`
|
|
1921
|
+
* @param locales - Optional locales.
|
|
1922
|
+
* @param options - Optional time format options.
|
|
1923
|
+
* @returns The formatted time string.
|
|
1924
|
+
*/
|
|
1925
|
+
export declare function formatWallTime(time: string | undefined, locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string;
|
|
1926
|
+
|
|
1914
1927
|
export declare class FunctionAtom implements Atom {
|
|
1915
1928
|
readonly name: string;
|
|
1916
1929
|
readonly args: Atom[];
|
|
@@ -1921,9 +1934,6 @@ export declare class FunctionAtom implements Atom {
|
|
|
1921
1934
|
|
|
1922
1935
|
/**
|
|
1923
1936
|
* Cross platform random UUID generator
|
|
1924
|
-
* Note that this is not intended for production use, but rather for testing
|
|
1925
|
-
* This should be replaced when crypto.randomUUID is fully supported
|
|
1926
|
-
* See: https://stackoverflow.com/revisions/2117523/28
|
|
1927
1937
|
* @returns A random UUID.
|
|
1928
1938
|
*/
|
|
1929
1939
|
export declare function generateId(): string;
|
|
@@ -3386,7 +3396,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
3386
3396
|
private readonly fetch;
|
|
3387
3397
|
private readonly createPdfImpl?;
|
|
3388
3398
|
private readonly storage;
|
|
3389
|
-
|
|
3399
|
+
protected readonly requestCache: LRUCache<RequestCacheEntry> | undefined;
|
|
3390
3400
|
private readonly cacheTime;
|
|
3391
3401
|
private readonly baseUrl;
|
|
3392
3402
|
private readonly fhirBaseUrl;
|
|
@@ -3892,9 +3902,10 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
3892
3902
|
* If the schema is already cached, the promise is resolved immediately.
|
|
3893
3903
|
* @category Schema
|
|
3894
3904
|
* @param resourceType - The FHIR resource type.
|
|
3905
|
+
* @param options - Optional fetch options.
|
|
3895
3906
|
* @returns Promise to a schema with the requested resource type.
|
|
3896
3907
|
*/
|
|
3897
|
-
requestSchema(resourceType: string): Promise<void>;
|
|
3908
|
+
requestSchema(resourceType: string, options?: MedplumRequestOptions): Promise<void>;
|
|
3898
3909
|
/**
|
|
3899
3910
|
* Requests the schema for a profile.
|
|
3900
3911
|
* If the schema is already cached, the promise is resolved immediately.
|
|
@@ -4621,6 +4632,12 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
4621
4632
|
* @returns Promise to the bundle.
|
|
4622
4633
|
*/
|
|
4623
4634
|
private getBundle;
|
|
4635
|
+
/**
|
|
4636
|
+
* Returns true if caching is enabled for the given request options.
|
|
4637
|
+
* @param options - Optional fetch options for cache settings.
|
|
4638
|
+
* @returns True if caching is enabled.
|
|
4639
|
+
*/
|
|
4640
|
+
private isCacheEnabled;
|
|
4624
4641
|
/**
|
|
4625
4642
|
* Returns the cache entry if available and not expired.
|
|
4626
4643
|
* @param key - The cache key to retrieve.
|
|
@@ -4632,6 +4649,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
4632
4649
|
* Adds a readable promise to the cache.
|
|
4633
4650
|
* @param key - The cache key to store.
|
|
4634
4651
|
* @param value - The readable promise to store.
|
|
4652
|
+
* @param options - Optional fetch options for cache settings.
|
|
4635
4653
|
*/
|
|
4636
4654
|
private setCacheEntry;
|
|
4637
4655
|
/**
|
|
@@ -4639,6 +4657,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
4639
4657
|
* This is used in cases where the resource is loaded indirectly.
|
|
4640
4658
|
* For example, when a resource is loaded as part of a Bundle.
|
|
4641
4659
|
* @param resource - The resource to cache.
|
|
4660
|
+
* @param options - Optional fetch options for cache settings.
|
|
4642
4661
|
*/
|
|
4643
4662
|
private cacheResource;
|
|
4644
4663
|
/**
|
|
@@ -4682,6 +4701,13 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
4682
4701
|
* @param contentType - The new content type to set.
|
|
4683
4702
|
*/
|
|
4684
4703
|
private setRequestContentType;
|
|
4704
|
+
/**
|
|
4705
|
+
* Returns a header from fetch options.
|
|
4706
|
+
* @param options - The fetch options.
|
|
4707
|
+
* @param key - The header key.
|
|
4708
|
+
* @returns The header value if found.
|
|
4709
|
+
*/
|
|
4710
|
+
private getRequestHeader;
|
|
4685
4711
|
/**
|
|
4686
4712
|
* Sets a header on fetch options.
|
|
4687
4713
|
* @param options - The fetch options.
|
|
@@ -4911,6 +4937,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
4911
4937
|
* @returns Promise that returns a project membership or an operation outcome.
|
|
4912
4938
|
*/
|
|
4913
4939
|
invite(projectId: string, body: InviteRequest): Promise<ProjectMembership | OperationOutcome>;
|
|
4940
|
+
private handleTokenError;
|
|
4914
4941
|
/**
|
|
4915
4942
|
* Makes a POST request to the tokens endpoint.
|
|
4916
4943
|
* See {@link https://openid.net/specs/openid-connect-core-1_0.html#TokenEndpoint | OpenID Connect Core 1.0 TokenEndpoint} for full details.
|
|
@@ -5234,7 +5261,7 @@ export declare interface MedplumClientOptions {
|
|
|
5234
5261
|
* - 'basic': Log method, URL, and status code only (no sensitive headers)
|
|
5235
5262
|
* - 'verbose': Log all details including headers (may include sensitive data like tokens)
|
|
5236
5263
|
*
|
|
5237
|
-
* @
|
|
5264
|
+
* @defaultValue 'none'
|
|
5238
5265
|
*/
|
|
5239
5266
|
logLevel?: ClientLogLevel;
|
|
5240
5267
|
/**
|
|
@@ -5722,14 +5749,14 @@ export declare class OperationOutcomeError extends Error {
|
|
|
5722
5749
|
}
|
|
5723
5750
|
|
|
5724
5751
|
/**
|
|
5725
|
-
* Returns a string
|
|
5752
|
+
* Returns a string representation of the operation outcome issue.
|
|
5726
5753
|
* @param issue - The operation outcome issue.
|
|
5727
5754
|
* @returns The string representation of the operation outcome issue.
|
|
5728
5755
|
*/
|
|
5729
5756
|
export declare function operationOutcomeIssueToString(issue: OperationOutcomeIssue): string;
|
|
5730
5757
|
|
|
5731
5758
|
/**
|
|
5732
|
-
* Returns a string
|
|
5759
|
+
* Returns a string representation of the operation outcome.
|
|
5733
5760
|
* @param outcome - The operation outcome.
|
|
5734
5761
|
* @returns The string representation of the operation outcome.
|
|
5735
5762
|
*/
|
|
@@ -6394,7 +6421,12 @@ export declare class ParserBuilder {
|
|
|
6394
6421
|
*/
|
|
6395
6422
|
export declare function replaceQueryVariables(user: CdsUserResource, context: Record<string, unknown>, query: string): string;
|
|
6396
6423
|
|
|
6397
|
-
export declare interface
|
|
6424
|
+
export declare interface RequestCacheEntry {
|
|
6425
|
+
readonly requestTime: number;
|
|
6426
|
+
readonly value: ReadablePromise<any>;
|
|
6427
|
+
}
|
|
6428
|
+
|
|
6429
|
+
export declare interface RequestProfileSchemaOptions extends MedplumRequestOptions {
|
|
6398
6430
|
/** (optional) Whether to include nested profiles, e.g. from extensions. Defaults to false. */
|
|
6399
6431
|
expandProfile?: boolean;
|
|
6400
6432
|
}
|
|
@@ -6554,10 +6586,21 @@ export declare class ParserBuilder {
|
|
|
6554
6586
|
|
|
6555
6587
|
/**
|
|
6556
6588
|
* Sleeps for the specified number of milliseconds.
|
|
6557
|
-
* @param ms - Time delay in milliseconds
|
|
6589
|
+
* @param ms - Time delay in milliseconds.
|
|
6590
|
+
* @param options - Optional sleep options.
|
|
6558
6591
|
* @returns A promise that resolves after the specified number of milliseconds.
|
|
6559
6592
|
*/
|
|
6560
|
-
export declare const sleep: (ms: number) => Promise<void>;
|
|
6593
|
+
export declare const sleep: (ms: number, options?: SleepOptions) => Promise<void>;
|
|
6594
|
+
|
|
6595
|
+
/**
|
|
6596
|
+
* Sleep options.
|
|
6597
|
+
*/
|
|
6598
|
+
export declare interface SleepOptions {
|
|
6599
|
+
/**
|
|
6600
|
+
* Optional `AbortSignal` that can be used to cancel the scheduled sleep.
|
|
6601
|
+
*/
|
|
6602
|
+
readonly signal?: AbortSignal | null;
|
|
6603
|
+
}
|
|
6561
6604
|
|
|
6562
6605
|
export declare interface SliceDefinition extends Omit<InternalSchemaElement, 'slicing'> {
|
|
6563
6606
|
name: string;
|
|
@@ -7075,6 +7118,7 @@ export declare class ParserBuilder {
|
|
|
7075
7118
|
date?: string;
|
|
7076
7119
|
offset?: number;
|
|
7077
7120
|
count?: number;
|
|
7121
|
+
displayLanguage?: string;
|
|
7078
7122
|
}
|
|
7079
7123
|
|
|
7080
7124
|
/**
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1102,6 +1102,9 @@ export declare interface EmailPasswordLoginRequest extends BaseLoginRequest {
|
|
|
1102
1102
|
readonly remember?: boolean;
|
|
1103
1103
|
}
|
|
1104
1104
|
|
|
1105
|
+
/** Constant empty array. */
|
|
1106
|
+
export declare const EMPTY: readonly [];
|
|
1107
|
+
|
|
1105
1108
|
export declare class EmptySetAtom implements Atom {
|
|
1106
1109
|
eval(): [];
|
|
1107
1110
|
toString(): string;
|
|
@@ -1911,6 +1914,16 @@ export declare function formatTime(time: string | undefined, locales?: Intl.Loca
|
|
|
1911
1914
|
*/
|
|
1912
1915
|
export declare function formatTiming(timing: Timing | undefined): string;
|
|
1913
1916
|
|
|
1917
|
+
/**
|
|
1918
|
+
* Formats a FHIR time string as a human readable string.
|
|
1919
|
+
* The viewer's timezone does not affect the display.
|
|
1920
|
+
* @param time - The time to format, a string like `HH:mm` or `HH:mm:ss`
|
|
1921
|
+
* @param locales - Optional locales.
|
|
1922
|
+
* @param options - Optional time format options.
|
|
1923
|
+
* @returns The formatted time string.
|
|
1924
|
+
*/
|
|
1925
|
+
export declare function formatWallTime(time: string | undefined, locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string;
|
|
1926
|
+
|
|
1914
1927
|
export declare class FunctionAtom implements Atom {
|
|
1915
1928
|
readonly name: string;
|
|
1916
1929
|
readonly args: Atom[];
|
|
@@ -1921,9 +1934,6 @@ export declare class FunctionAtom implements Atom {
|
|
|
1921
1934
|
|
|
1922
1935
|
/**
|
|
1923
1936
|
* Cross platform random UUID generator
|
|
1924
|
-
* Note that this is not intended for production use, but rather for testing
|
|
1925
|
-
* This should be replaced when crypto.randomUUID is fully supported
|
|
1926
|
-
* See: https://stackoverflow.com/revisions/2117523/28
|
|
1927
1937
|
* @returns A random UUID.
|
|
1928
1938
|
*/
|
|
1929
1939
|
export declare function generateId(): string;
|
|
@@ -3386,7 +3396,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
3386
3396
|
private readonly fetch;
|
|
3387
3397
|
private readonly createPdfImpl?;
|
|
3388
3398
|
private readonly storage;
|
|
3389
|
-
|
|
3399
|
+
protected readonly requestCache: LRUCache<RequestCacheEntry> | undefined;
|
|
3390
3400
|
private readonly cacheTime;
|
|
3391
3401
|
private readonly baseUrl;
|
|
3392
3402
|
private readonly fhirBaseUrl;
|
|
@@ -3892,9 +3902,10 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
3892
3902
|
* If the schema is already cached, the promise is resolved immediately.
|
|
3893
3903
|
* @category Schema
|
|
3894
3904
|
* @param resourceType - The FHIR resource type.
|
|
3905
|
+
* @param options - Optional fetch options.
|
|
3895
3906
|
* @returns Promise to a schema with the requested resource type.
|
|
3896
3907
|
*/
|
|
3897
|
-
requestSchema(resourceType: string): Promise<void>;
|
|
3908
|
+
requestSchema(resourceType: string, options?: MedplumRequestOptions): Promise<void>;
|
|
3898
3909
|
/**
|
|
3899
3910
|
* Requests the schema for a profile.
|
|
3900
3911
|
* If the schema is already cached, the promise is resolved immediately.
|
|
@@ -4621,6 +4632,12 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
4621
4632
|
* @returns Promise to the bundle.
|
|
4622
4633
|
*/
|
|
4623
4634
|
private getBundle;
|
|
4635
|
+
/**
|
|
4636
|
+
* Returns true if caching is enabled for the given request options.
|
|
4637
|
+
* @param options - Optional fetch options for cache settings.
|
|
4638
|
+
* @returns True if caching is enabled.
|
|
4639
|
+
*/
|
|
4640
|
+
private isCacheEnabled;
|
|
4624
4641
|
/**
|
|
4625
4642
|
* Returns the cache entry if available and not expired.
|
|
4626
4643
|
* @param key - The cache key to retrieve.
|
|
@@ -4632,6 +4649,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
4632
4649
|
* Adds a readable promise to the cache.
|
|
4633
4650
|
* @param key - The cache key to store.
|
|
4634
4651
|
* @param value - The readable promise to store.
|
|
4652
|
+
* @param options - Optional fetch options for cache settings.
|
|
4635
4653
|
*/
|
|
4636
4654
|
private setCacheEntry;
|
|
4637
4655
|
/**
|
|
@@ -4639,6 +4657,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
4639
4657
|
* This is used in cases where the resource is loaded indirectly.
|
|
4640
4658
|
* For example, when a resource is loaded as part of a Bundle.
|
|
4641
4659
|
* @param resource - The resource to cache.
|
|
4660
|
+
* @param options - Optional fetch options for cache settings.
|
|
4642
4661
|
*/
|
|
4643
4662
|
private cacheResource;
|
|
4644
4663
|
/**
|
|
@@ -4682,6 +4701,13 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
4682
4701
|
* @param contentType - The new content type to set.
|
|
4683
4702
|
*/
|
|
4684
4703
|
private setRequestContentType;
|
|
4704
|
+
/**
|
|
4705
|
+
* Returns a header from fetch options.
|
|
4706
|
+
* @param options - The fetch options.
|
|
4707
|
+
* @param key - The header key.
|
|
4708
|
+
* @returns The header value if found.
|
|
4709
|
+
*/
|
|
4710
|
+
private getRequestHeader;
|
|
4685
4711
|
/**
|
|
4686
4712
|
* Sets a header on fetch options.
|
|
4687
4713
|
* @param options - The fetch options.
|
|
@@ -4911,6 +4937,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
4911
4937
|
* @returns Promise that returns a project membership or an operation outcome.
|
|
4912
4938
|
*/
|
|
4913
4939
|
invite(projectId: string, body: InviteRequest): Promise<ProjectMembership | OperationOutcome>;
|
|
4940
|
+
private handleTokenError;
|
|
4914
4941
|
/**
|
|
4915
4942
|
* Makes a POST request to the tokens endpoint.
|
|
4916
4943
|
* See {@link https://openid.net/specs/openid-connect-core-1_0.html#TokenEndpoint | OpenID Connect Core 1.0 TokenEndpoint} for full details.
|
|
@@ -5234,7 +5261,7 @@ export declare interface MedplumClientOptions {
|
|
|
5234
5261
|
* - 'basic': Log method, URL, and status code only (no sensitive headers)
|
|
5235
5262
|
* - 'verbose': Log all details including headers (may include sensitive data like tokens)
|
|
5236
5263
|
*
|
|
5237
|
-
* @
|
|
5264
|
+
* @defaultValue 'none'
|
|
5238
5265
|
*/
|
|
5239
5266
|
logLevel?: ClientLogLevel;
|
|
5240
5267
|
/**
|
|
@@ -5722,14 +5749,14 @@ export declare class OperationOutcomeError extends Error {
|
|
|
5722
5749
|
}
|
|
5723
5750
|
|
|
5724
5751
|
/**
|
|
5725
|
-
* Returns a string
|
|
5752
|
+
* Returns a string representation of the operation outcome issue.
|
|
5726
5753
|
* @param issue - The operation outcome issue.
|
|
5727
5754
|
* @returns The string representation of the operation outcome issue.
|
|
5728
5755
|
*/
|
|
5729
5756
|
export declare function operationOutcomeIssueToString(issue: OperationOutcomeIssue): string;
|
|
5730
5757
|
|
|
5731
5758
|
/**
|
|
5732
|
-
* Returns a string
|
|
5759
|
+
* Returns a string representation of the operation outcome.
|
|
5733
5760
|
* @param outcome - The operation outcome.
|
|
5734
5761
|
* @returns The string representation of the operation outcome.
|
|
5735
5762
|
*/
|
|
@@ -6394,7 +6421,12 @@ export declare class ParserBuilder {
|
|
|
6394
6421
|
*/
|
|
6395
6422
|
export declare function replaceQueryVariables(user: CdsUserResource, context: Record<string, unknown>, query: string): string;
|
|
6396
6423
|
|
|
6397
|
-
export declare interface
|
|
6424
|
+
export declare interface RequestCacheEntry {
|
|
6425
|
+
readonly requestTime: number;
|
|
6426
|
+
readonly value: ReadablePromise<any>;
|
|
6427
|
+
}
|
|
6428
|
+
|
|
6429
|
+
export declare interface RequestProfileSchemaOptions extends MedplumRequestOptions {
|
|
6398
6430
|
/** (optional) Whether to include nested profiles, e.g. from extensions. Defaults to false. */
|
|
6399
6431
|
expandProfile?: boolean;
|
|
6400
6432
|
}
|
|
@@ -6554,10 +6586,21 @@ export declare class ParserBuilder {
|
|
|
6554
6586
|
|
|
6555
6587
|
/**
|
|
6556
6588
|
* Sleeps for the specified number of milliseconds.
|
|
6557
|
-
* @param ms - Time delay in milliseconds
|
|
6589
|
+
* @param ms - Time delay in milliseconds.
|
|
6590
|
+
* @param options - Optional sleep options.
|
|
6558
6591
|
* @returns A promise that resolves after the specified number of milliseconds.
|
|
6559
6592
|
*/
|
|
6560
|
-
export declare const sleep: (ms: number) => Promise<void>;
|
|
6593
|
+
export declare const sleep: (ms: number, options?: SleepOptions) => Promise<void>;
|
|
6594
|
+
|
|
6595
|
+
/**
|
|
6596
|
+
* Sleep options.
|
|
6597
|
+
*/
|
|
6598
|
+
export declare interface SleepOptions {
|
|
6599
|
+
/**
|
|
6600
|
+
* Optional `AbortSignal` that can be used to cancel the scheduled sleep.
|
|
6601
|
+
*/
|
|
6602
|
+
readonly signal?: AbortSignal | null;
|
|
6603
|
+
}
|
|
6561
6604
|
|
|
6562
6605
|
export declare interface SliceDefinition extends Omit<InternalSchemaElement, 'slicing'> {
|
|
6563
6606
|
name: string;
|
|
@@ -7075,6 +7118,7 @@ export declare class ParserBuilder {
|
|
|
7075
7118
|
date?: string;
|
|
7076
7119
|
offset?: number;
|
|
7077
7120
|
count?: number;
|
|
7121
|
+
displayLanguage?: string;
|
|
7078
7122
|
}
|
|
7079
7123
|
|
|
7080
7124
|
/**
|