@medplum/core 2.2.6 → 2.2.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.
@@ -1915,6 +1915,13 @@ export declare function isUUID(input: string): input is string;
1915
1915
  */
1916
1916
  export declare function isValidDate(date: Date): boolean;
1917
1917
 
1918
+ /**
1919
+ * Memoizes the result of a parameterless function
1920
+ * @param fn - The function to be wrapped
1921
+ * @returns The result of the first invocation of the wrapped function
1922
+ */
1923
+ export declare function lazy<T>(fn: () => T): () => T;
1924
+
1918
1925
  export declare class LiteralAtom implements Atom {
1919
1926
  readonly value: TypedValue;
1920
1927
  constructor(value: TypedValue);
@@ -2155,6 +2162,7 @@ export declare class MedplumClient extends EventTarget_2 {
2155
2162
  private clientSecret?;
2156
2163
  private autoBatchTimerId?;
2157
2164
  private accessToken?;
2165
+ private accessTokenExpires?;
2158
2166
  private refreshToken?;
2159
2167
  private refreshPromise?;
2160
2168
  private profilePromise?;
@@ -2551,8 +2559,18 @@ export declare class MedplumClient extends EventTarget_2 {
2551
2559
  * @param filter - The search string.
2552
2560
  * @param options - Optional fetch options.
2553
2561
  * @returns Promise to expanded ValueSet.
2562
+ * @deprecated Use `valueSetExpand()` instead.
2554
2563
  */
2555
2564
  searchValueSet(system: string, filter: string, options?: RequestInit): ReadablePromise<ValueSet>;
2565
+ /**
2566
+ * Searches a ValueSet resource using the "expand" operation.
2567
+ * See: https://www.hl7.org/fhir/operation-valueset-expand.html
2568
+ * @category Search
2569
+ * @param params - The ValueSet expand parameters.
2570
+ * @param options - Optional fetch options.
2571
+ * @returns Promise to expanded ValueSet.
2572
+ */
2573
+ valueSetExpand(params: ValueSetExpandParams, options?: RequestInit): ReadablePromise<ValueSet>;
2556
2574
  /**
2557
2575
  * Returns a cached resource if it is available.
2558
2576
  * @category Caching
@@ -3324,6 +3342,11 @@ export declare class MedplumClient extends EventTarget_2 {
3324
3342
  * @category Authentication
3325
3343
  */
3326
3344
  processCode(code: string, loginParams?: Partial<BaseLoginRequest>): Promise<ProfileResource>;
3345
+ /**
3346
+ * Refreshes the access token using the refresh token if available.
3347
+ * @returns Promise to refresh the access token.
3348
+ */
3349
+ refreshIfExpired(): Promise<void>;
3327
3350
  /**
3328
3351
  * Tries to refresh the auth tokens.
3329
3352
  * @returns The refresh promise if available; otherwise undefined.
@@ -4105,9 +4128,7 @@ export declare class ParserBuilder {
4105
4128
  * @param reference - A reference to a FHIR resource.
4106
4129
  * @returns A tuple containing the `ResourceType` and the ID of the resource or `undefined` when `undefined` or an invalid reference is passed.
4107
4130
  */
4108
- export declare function parseReference(reference: Reference): [ResourceType, string] | undefined;
4109
-
4110
- export declare function parseReference(reference: undefined): undefined;
4131
+ export declare function parseReference(reference: Reference | undefined): [ResourceType, string];
4111
4132
 
4112
4133
  /**
4113
4134
  * Parses a URL string into a SearchRequest.
@@ -4689,6 +4710,13 @@ export declare function toTypedValue(value: unknown): TypedValue;
4689
4710
 
4690
4711
  export declare function tryGetDataType(type: string, profileUrl?: string): InternalTypeSchema | undefined;
4691
4712
 
4713
+ /**
4714
+ * Returns the JWT expiration time in number of milliseconds elapsed since the epoch.
4715
+ * @param token - The JWT token.
4716
+ * @returns The JWT expiration time in number of milliseconds elapsed since the epoch if available, undefined if unknown.
4717
+ */
4718
+ export declare function tryGetJwtExpiration(token: string): number | undefined;
4719
+
4692
4720
  export declare function tryGetProfile(profileUrl: string): InternalTypeSchema | undefined;
4693
4721
 
4694
4722
  export declare class TypedEventTarget<TEvents extends Record<string, Event_2>> {
@@ -4788,6 +4816,18 @@ export declare function validationError(details: string): OperationOutcome;
4788
4816
 
4789
4817
  export declare type ValueOrExternalSecret<T extends ExternalSecretPrimitive> = T | ExternalSecret<T>;
4790
4818
 
4819
+ /**
4820
+ * ValueSet $expand operation parameters.
4821
+ * See: https://hl7.org/fhir/r4/valueset-operation-expand.html
4822
+ */
4823
+ export declare interface ValueSetExpandParams {
4824
+ url?: string;
4825
+ filter?: string;
4826
+ date?: string;
4827
+ offset?: number;
4828
+ count?: number;
4829
+ }
4830
+
4791
4831
  /**
4792
4832
  * 6.5.4. xor
4793
4833
  * Returns true if exactly one of the operands evaluates to true,
@@ -1915,6 +1915,13 @@ export declare function isUUID(input: string): input is string;
1915
1915
  */
1916
1916
  export declare function isValidDate(date: Date): boolean;
1917
1917
 
1918
+ /**
1919
+ * Memoizes the result of a parameterless function
1920
+ * @param fn - The function to be wrapped
1921
+ * @returns The result of the first invocation of the wrapped function
1922
+ */
1923
+ export declare function lazy<T>(fn: () => T): () => T;
1924
+
1918
1925
  export declare class LiteralAtom implements Atom {
1919
1926
  readonly value: TypedValue;
1920
1927
  constructor(value: TypedValue);
@@ -2155,6 +2162,7 @@ export declare class MedplumClient extends EventTarget_2 {
2155
2162
  private clientSecret?;
2156
2163
  private autoBatchTimerId?;
2157
2164
  private accessToken?;
2165
+ private accessTokenExpires?;
2158
2166
  private refreshToken?;
2159
2167
  private refreshPromise?;
2160
2168
  private profilePromise?;
@@ -2551,8 +2559,18 @@ export declare class MedplumClient extends EventTarget_2 {
2551
2559
  * @param filter - The search string.
2552
2560
  * @param options - Optional fetch options.
2553
2561
  * @returns Promise to expanded ValueSet.
2562
+ * @deprecated Use `valueSetExpand()` instead.
2554
2563
  */
2555
2564
  searchValueSet(system: string, filter: string, options?: RequestInit): ReadablePromise<ValueSet>;
2565
+ /**
2566
+ * Searches a ValueSet resource using the "expand" operation.
2567
+ * See: https://www.hl7.org/fhir/operation-valueset-expand.html
2568
+ * @category Search
2569
+ * @param params - The ValueSet expand parameters.
2570
+ * @param options - Optional fetch options.
2571
+ * @returns Promise to expanded ValueSet.
2572
+ */
2573
+ valueSetExpand(params: ValueSetExpandParams, options?: RequestInit): ReadablePromise<ValueSet>;
2556
2574
  /**
2557
2575
  * Returns a cached resource if it is available.
2558
2576
  * @category Caching
@@ -3324,6 +3342,11 @@ export declare class MedplumClient extends EventTarget_2 {
3324
3342
  * @category Authentication
3325
3343
  */
3326
3344
  processCode(code: string, loginParams?: Partial<BaseLoginRequest>): Promise<ProfileResource>;
3345
+ /**
3346
+ * Refreshes the access token using the refresh token if available.
3347
+ * @returns Promise to refresh the access token.
3348
+ */
3349
+ refreshIfExpired(): Promise<void>;
3327
3350
  /**
3328
3351
  * Tries to refresh the auth tokens.
3329
3352
  * @returns The refresh promise if available; otherwise undefined.
@@ -4105,9 +4128,7 @@ export declare class ParserBuilder {
4105
4128
  * @param reference - A reference to a FHIR resource.
4106
4129
  * @returns A tuple containing the `ResourceType` and the ID of the resource or `undefined` when `undefined` or an invalid reference is passed.
4107
4130
  */
4108
- export declare function parseReference(reference: Reference): [ResourceType, string] | undefined;
4109
-
4110
- export declare function parseReference(reference: undefined): undefined;
4131
+ export declare function parseReference(reference: Reference | undefined): [ResourceType, string];
4111
4132
 
4112
4133
  /**
4113
4134
  * Parses a URL string into a SearchRequest.
@@ -4689,6 +4710,13 @@ export declare function toTypedValue(value: unknown): TypedValue;
4689
4710
 
4690
4711
  export declare function tryGetDataType(type: string, profileUrl?: string): InternalTypeSchema | undefined;
4691
4712
 
4713
+ /**
4714
+ * Returns the JWT expiration time in number of milliseconds elapsed since the epoch.
4715
+ * @param token - The JWT token.
4716
+ * @returns The JWT expiration time in number of milliseconds elapsed since the epoch if available, undefined if unknown.
4717
+ */
4718
+ export declare function tryGetJwtExpiration(token: string): number | undefined;
4719
+
4692
4720
  export declare function tryGetProfile(profileUrl: string): InternalTypeSchema | undefined;
4693
4721
 
4694
4722
  export declare class TypedEventTarget<TEvents extends Record<string, Event_2>> {
@@ -4788,6 +4816,18 @@ export declare function validationError(details: string): OperationOutcome;
4788
4816
 
4789
4817
  export declare type ValueOrExternalSecret<T extends ExternalSecretPrimitive> = T | ExternalSecret<T>;
4790
4818
 
4819
+ /**
4820
+ * ValueSet $expand operation parameters.
4821
+ * See: https://hl7.org/fhir/r4/valueset-operation-expand.html
4822
+ */
4823
+ export declare interface ValueSetExpandParams {
4824
+ url?: string;
4825
+ filter?: string;
4826
+ date?: string;
4827
+ offset?: number;
4828
+ count?: number;
4829
+ }
4830
+
4791
4831
  /**
4792
4832
  * 6.5.4. xor
4793
4833
  * Returns true if exactly one of the operands evaluates to true,