@medplum/core 5.0.10 → 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 -8
- package/dist/esm/index.d.ts +55 -8
- 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[];
|
|
@@ -3383,7 +3396,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
3383
3396
|
private readonly fetch;
|
|
3384
3397
|
private readonly createPdfImpl?;
|
|
3385
3398
|
private readonly storage;
|
|
3386
|
-
|
|
3399
|
+
protected readonly requestCache: LRUCache<RequestCacheEntry> | undefined;
|
|
3387
3400
|
private readonly cacheTime;
|
|
3388
3401
|
private readonly baseUrl;
|
|
3389
3402
|
private readonly fhirBaseUrl;
|
|
@@ -3889,9 +3902,10 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
3889
3902
|
* If the schema is already cached, the promise is resolved immediately.
|
|
3890
3903
|
* @category Schema
|
|
3891
3904
|
* @param resourceType - The FHIR resource type.
|
|
3905
|
+
* @param options - Optional fetch options.
|
|
3892
3906
|
* @returns Promise to a schema with the requested resource type.
|
|
3893
3907
|
*/
|
|
3894
|
-
requestSchema(resourceType: string): Promise<void>;
|
|
3908
|
+
requestSchema(resourceType: string, options?: MedplumRequestOptions): Promise<void>;
|
|
3895
3909
|
/**
|
|
3896
3910
|
* Requests the schema for a profile.
|
|
3897
3911
|
* If the schema is already cached, the promise is resolved immediately.
|
|
@@ -4618,6 +4632,12 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
4618
4632
|
* @returns Promise to the bundle.
|
|
4619
4633
|
*/
|
|
4620
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;
|
|
4621
4641
|
/**
|
|
4622
4642
|
* Returns the cache entry if available and not expired.
|
|
4623
4643
|
* @param key - The cache key to retrieve.
|
|
@@ -4629,6 +4649,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
4629
4649
|
* Adds a readable promise to the cache.
|
|
4630
4650
|
* @param key - The cache key to store.
|
|
4631
4651
|
* @param value - The readable promise to store.
|
|
4652
|
+
* @param options - Optional fetch options for cache settings.
|
|
4632
4653
|
*/
|
|
4633
4654
|
private setCacheEntry;
|
|
4634
4655
|
/**
|
|
@@ -4636,6 +4657,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
4636
4657
|
* This is used in cases where the resource is loaded indirectly.
|
|
4637
4658
|
* For example, when a resource is loaded as part of a Bundle.
|
|
4638
4659
|
* @param resource - The resource to cache.
|
|
4660
|
+
* @param options - Optional fetch options for cache settings.
|
|
4639
4661
|
*/
|
|
4640
4662
|
private cacheResource;
|
|
4641
4663
|
/**
|
|
@@ -4679,6 +4701,13 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
4679
4701
|
* @param contentType - The new content type to set.
|
|
4680
4702
|
*/
|
|
4681
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;
|
|
4682
4711
|
/**
|
|
4683
4712
|
* Sets a header on fetch options.
|
|
4684
4713
|
* @param options - The fetch options.
|
|
@@ -4908,6 +4937,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
4908
4937
|
* @returns Promise that returns a project membership or an operation outcome.
|
|
4909
4938
|
*/
|
|
4910
4939
|
invite(projectId: string, body: InviteRequest): Promise<ProjectMembership | OperationOutcome>;
|
|
4940
|
+
private handleTokenError;
|
|
4911
4941
|
/**
|
|
4912
4942
|
* Makes a POST request to the tokens endpoint.
|
|
4913
4943
|
* See {@link https://openid.net/specs/openid-connect-core-1_0.html#TokenEndpoint | OpenID Connect Core 1.0 TokenEndpoint} for full details.
|
|
@@ -5231,7 +5261,7 @@ export declare interface MedplumClientOptions {
|
|
|
5231
5261
|
* - 'basic': Log method, URL, and status code only (no sensitive headers)
|
|
5232
5262
|
* - 'verbose': Log all details including headers (may include sensitive data like tokens)
|
|
5233
5263
|
*
|
|
5234
|
-
* @
|
|
5264
|
+
* @defaultValue 'none'
|
|
5235
5265
|
*/
|
|
5236
5266
|
logLevel?: ClientLogLevel;
|
|
5237
5267
|
/**
|
|
@@ -5719,14 +5749,14 @@ export declare class OperationOutcomeError extends Error {
|
|
|
5719
5749
|
}
|
|
5720
5750
|
|
|
5721
5751
|
/**
|
|
5722
|
-
* Returns a string
|
|
5752
|
+
* Returns a string representation of the operation outcome issue.
|
|
5723
5753
|
* @param issue - The operation outcome issue.
|
|
5724
5754
|
* @returns The string representation of the operation outcome issue.
|
|
5725
5755
|
*/
|
|
5726
5756
|
export declare function operationOutcomeIssueToString(issue: OperationOutcomeIssue): string;
|
|
5727
5757
|
|
|
5728
5758
|
/**
|
|
5729
|
-
* Returns a string
|
|
5759
|
+
* Returns a string representation of the operation outcome.
|
|
5730
5760
|
* @param outcome - The operation outcome.
|
|
5731
5761
|
* @returns The string representation of the operation outcome.
|
|
5732
5762
|
*/
|
|
@@ -6391,7 +6421,12 @@ export declare class ParserBuilder {
|
|
|
6391
6421
|
*/
|
|
6392
6422
|
export declare function replaceQueryVariables(user: CdsUserResource, context: Record<string, unknown>, query: string): string;
|
|
6393
6423
|
|
|
6394
|
-
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 {
|
|
6395
6430
|
/** (optional) Whether to include nested profiles, e.g. from extensions. Defaults to false. */
|
|
6396
6431
|
expandProfile?: boolean;
|
|
6397
6432
|
}
|
|
@@ -6551,10 +6586,21 @@ export declare class ParserBuilder {
|
|
|
6551
6586
|
|
|
6552
6587
|
/**
|
|
6553
6588
|
* Sleeps for the specified number of milliseconds.
|
|
6554
|
-
* @param ms - Time delay in milliseconds
|
|
6589
|
+
* @param ms - Time delay in milliseconds.
|
|
6590
|
+
* @param options - Optional sleep options.
|
|
6555
6591
|
* @returns A promise that resolves after the specified number of milliseconds.
|
|
6556
6592
|
*/
|
|
6557
|
-
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
|
+
}
|
|
6558
6604
|
|
|
6559
6605
|
export declare interface SliceDefinition extends Omit<InternalSchemaElement, 'slicing'> {
|
|
6560
6606
|
name: string;
|
|
@@ -7072,6 +7118,7 @@ export declare class ParserBuilder {
|
|
|
7072
7118
|
date?: string;
|
|
7073
7119
|
offset?: number;
|
|
7074
7120
|
count?: number;
|
|
7121
|
+
displayLanguage?: string;
|
|
7075
7122
|
}
|
|
7076
7123
|
|
|
7077
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[];
|
|
@@ -3383,7 +3396,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
3383
3396
|
private readonly fetch;
|
|
3384
3397
|
private readonly createPdfImpl?;
|
|
3385
3398
|
private readonly storage;
|
|
3386
|
-
|
|
3399
|
+
protected readonly requestCache: LRUCache<RequestCacheEntry> | undefined;
|
|
3387
3400
|
private readonly cacheTime;
|
|
3388
3401
|
private readonly baseUrl;
|
|
3389
3402
|
private readonly fhirBaseUrl;
|
|
@@ -3889,9 +3902,10 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
3889
3902
|
* If the schema is already cached, the promise is resolved immediately.
|
|
3890
3903
|
* @category Schema
|
|
3891
3904
|
* @param resourceType - The FHIR resource type.
|
|
3905
|
+
* @param options - Optional fetch options.
|
|
3892
3906
|
* @returns Promise to a schema with the requested resource type.
|
|
3893
3907
|
*/
|
|
3894
|
-
requestSchema(resourceType: string): Promise<void>;
|
|
3908
|
+
requestSchema(resourceType: string, options?: MedplumRequestOptions): Promise<void>;
|
|
3895
3909
|
/**
|
|
3896
3910
|
* Requests the schema for a profile.
|
|
3897
3911
|
* If the schema is already cached, the promise is resolved immediately.
|
|
@@ -4618,6 +4632,12 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
4618
4632
|
* @returns Promise to the bundle.
|
|
4619
4633
|
*/
|
|
4620
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;
|
|
4621
4641
|
/**
|
|
4622
4642
|
* Returns the cache entry if available and not expired.
|
|
4623
4643
|
* @param key - The cache key to retrieve.
|
|
@@ -4629,6 +4649,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
4629
4649
|
* Adds a readable promise to the cache.
|
|
4630
4650
|
* @param key - The cache key to store.
|
|
4631
4651
|
* @param value - The readable promise to store.
|
|
4652
|
+
* @param options - Optional fetch options for cache settings.
|
|
4632
4653
|
*/
|
|
4633
4654
|
private setCacheEntry;
|
|
4634
4655
|
/**
|
|
@@ -4636,6 +4657,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
4636
4657
|
* This is used in cases where the resource is loaded indirectly.
|
|
4637
4658
|
* For example, when a resource is loaded as part of a Bundle.
|
|
4638
4659
|
* @param resource - The resource to cache.
|
|
4660
|
+
* @param options - Optional fetch options for cache settings.
|
|
4639
4661
|
*/
|
|
4640
4662
|
private cacheResource;
|
|
4641
4663
|
/**
|
|
@@ -4679,6 +4701,13 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
4679
4701
|
* @param contentType - The new content type to set.
|
|
4680
4702
|
*/
|
|
4681
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;
|
|
4682
4711
|
/**
|
|
4683
4712
|
* Sets a header on fetch options.
|
|
4684
4713
|
* @param options - The fetch options.
|
|
@@ -4908,6 +4937,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
4908
4937
|
* @returns Promise that returns a project membership or an operation outcome.
|
|
4909
4938
|
*/
|
|
4910
4939
|
invite(projectId: string, body: InviteRequest): Promise<ProjectMembership | OperationOutcome>;
|
|
4940
|
+
private handleTokenError;
|
|
4911
4941
|
/**
|
|
4912
4942
|
* Makes a POST request to the tokens endpoint.
|
|
4913
4943
|
* See {@link https://openid.net/specs/openid-connect-core-1_0.html#TokenEndpoint | OpenID Connect Core 1.0 TokenEndpoint} for full details.
|
|
@@ -5231,7 +5261,7 @@ export declare interface MedplumClientOptions {
|
|
|
5231
5261
|
* - 'basic': Log method, URL, and status code only (no sensitive headers)
|
|
5232
5262
|
* - 'verbose': Log all details including headers (may include sensitive data like tokens)
|
|
5233
5263
|
*
|
|
5234
|
-
* @
|
|
5264
|
+
* @defaultValue 'none'
|
|
5235
5265
|
*/
|
|
5236
5266
|
logLevel?: ClientLogLevel;
|
|
5237
5267
|
/**
|
|
@@ -5719,14 +5749,14 @@ export declare class OperationOutcomeError extends Error {
|
|
|
5719
5749
|
}
|
|
5720
5750
|
|
|
5721
5751
|
/**
|
|
5722
|
-
* Returns a string
|
|
5752
|
+
* Returns a string representation of the operation outcome issue.
|
|
5723
5753
|
* @param issue - The operation outcome issue.
|
|
5724
5754
|
* @returns The string representation of the operation outcome issue.
|
|
5725
5755
|
*/
|
|
5726
5756
|
export declare function operationOutcomeIssueToString(issue: OperationOutcomeIssue): string;
|
|
5727
5757
|
|
|
5728
5758
|
/**
|
|
5729
|
-
* Returns a string
|
|
5759
|
+
* Returns a string representation of the operation outcome.
|
|
5730
5760
|
* @param outcome - The operation outcome.
|
|
5731
5761
|
* @returns The string representation of the operation outcome.
|
|
5732
5762
|
*/
|
|
@@ -6391,7 +6421,12 @@ export declare class ParserBuilder {
|
|
|
6391
6421
|
*/
|
|
6392
6422
|
export declare function replaceQueryVariables(user: CdsUserResource, context: Record<string, unknown>, query: string): string;
|
|
6393
6423
|
|
|
6394
|
-
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 {
|
|
6395
6430
|
/** (optional) Whether to include nested profiles, e.g. from extensions. Defaults to false. */
|
|
6396
6431
|
expandProfile?: boolean;
|
|
6397
6432
|
}
|
|
@@ -6551,10 +6586,21 @@ export declare class ParserBuilder {
|
|
|
6551
6586
|
|
|
6552
6587
|
/**
|
|
6553
6588
|
* Sleeps for the specified number of milliseconds.
|
|
6554
|
-
* @param ms - Time delay in milliseconds
|
|
6589
|
+
* @param ms - Time delay in milliseconds.
|
|
6590
|
+
* @param options - Optional sleep options.
|
|
6555
6591
|
* @returns A promise that resolves after the specified number of milliseconds.
|
|
6556
6592
|
*/
|
|
6557
|
-
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
|
+
}
|
|
6558
6604
|
|
|
6559
6605
|
export declare interface SliceDefinition extends Omit<InternalSchemaElement, 'slicing'> {
|
|
6560
6606
|
name: string;
|
|
@@ -7072,6 +7118,7 @@ export declare class ParserBuilder {
|
|
|
7072
7118
|
date?: string;
|
|
7073
7119
|
offset?: number;
|
|
7074
7120
|
count?: number;
|
|
7121
|
+
displayLanguage?: string;
|
|
7075
7122
|
}
|
|
7076
7123
|
|
|
7077
7124
|
/**
|