@medplum/core 2.2.6 → 2.2.10

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.
@@ -3705,6 +3728,7 @@ export declare interface MedplumInfraConfig {
3705
3728
  snsTopicArn?: string;
3706
3729
  snsTopicName?: string;
3707
3730
  };
3731
+ environment?: StringMap;
3708
3732
  }
3709
3733
 
3710
3734
  export declare interface MedplumSourceInfraConfig {
@@ -3765,6 +3789,7 @@ export declare interface MedplumSourceInfraConfig {
3765
3789
  snsTopicArn?: ValueOrExternalSecret<string>;
3766
3790
  snsTopicName?: ValueOrExternalSecret<string>;
3767
3791
  };
3792
+ environment?: StringMap;
3768
3793
  }
3769
3794
 
3770
3795
  /**
@@ -4105,9 +4130,7 @@ export declare class ParserBuilder {
4105
4130
  * @param reference - A reference to a FHIR resource.
4106
4131
  * @returns A tuple containing the `ResourceType` and the ID of the resource or `undefined` when `undefined` or an invalid reference is passed.
4107
4132
  */
4108
- export declare function parseReference(reference: Reference): [ResourceType, string] | undefined;
4109
-
4110
- export declare function parseReference(reference: undefined): undefined;
4133
+ export declare function parseReference(reference: Reference | undefined): [ResourceType, string];
4111
4134
 
4112
4135
  /**
4113
4136
  * Parses a URL string into a SearchRequest.
@@ -4573,6 +4596,10 @@ export declare function stringify(value: any, pretty?: boolean): string;
4573
4596
  */
4574
4597
  export declare function stringifyTypedValue(v: TypedValue): string;
4575
4598
 
4599
+ export declare type StringMap = {
4600
+ [key: string]: string;
4601
+ };
4602
+
4576
4603
  /**
4577
4604
  * Transforms input values using a FHIR StructureMap.
4578
4605
  *
@@ -4689,6 +4716,13 @@ export declare function toTypedValue(value: unknown): TypedValue;
4689
4716
 
4690
4717
  export declare function tryGetDataType(type: string, profileUrl?: string): InternalTypeSchema | undefined;
4691
4718
 
4719
+ /**
4720
+ * Returns the JWT expiration time in number of milliseconds elapsed since the epoch.
4721
+ * @param token - The JWT token.
4722
+ * @returns The JWT expiration time in number of milliseconds elapsed since the epoch if available, undefined if unknown.
4723
+ */
4724
+ export declare function tryGetJwtExpiration(token: string): number | undefined;
4725
+
4692
4726
  export declare function tryGetProfile(profileUrl: string): InternalTypeSchema | undefined;
4693
4727
 
4694
4728
  export declare class TypedEventTarget<TEvents extends Record<string, Event_2>> {
@@ -4788,6 +4822,18 @@ export declare function validationError(details: string): OperationOutcome;
4788
4822
 
4789
4823
  export declare type ValueOrExternalSecret<T extends ExternalSecretPrimitive> = T | ExternalSecret<T>;
4790
4824
 
4825
+ /**
4826
+ * ValueSet $expand operation parameters.
4827
+ * See: https://hl7.org/fhir/r4/valueset-operation-expand.html
4828
+ */
4829
+ export declare interface ValueSetExpandParams {
4830
+ url?: string;
4831
+ filter?: string;
4832
+ date?: string;
4833
+ offset?: number;
4834
+ count?: number;
4835
+ }
4836
+
4791
4837
  /**
4792
4838
  * 6.5.4. xor
4793
4839
  * 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.
@@ -3705,6 +3728,7 @@ export declare interface MedplumInfraConfig {
3705
3728
  snsTopicArn?: string;
3706
3729
  snsTopicName?: string;
3707
3730
  };
3731
+ environment?: StringMap;
3708
3732
  }
3709
3733
 
3710
3734
  export declare interface MedplumSourceInfraConfig {
@@ -3765,6 +3789,7 @@ export declare interface MedplumSourceInfraConfig {
3765
3789
  snsTopicArn?: ValueOrExternalSecret<string>;
3766
3790
  snsTopicName?: ValueOrExternalSecret<string>;
3767
3791
  };
3792
+ environment?: StringMap;
3768
3793
  }
3769
3794
 
3770
3795
  /**
@@ -4105,9 +4130,7 @@ export declare class ParserBuilder {
4105
4130
  * @param reference - A reference to a FHIR resource.
4106
4131
  * @returns A tuple containing the `ResourceType` and the ID of the resource or `undefined` when `undefined` or an invalid reference is passed.
4107
4132
  */
4108
- export declare function parseReference(reference: Reference): [ResourceType, string] | undefined;
4109
-
4110
- export declare function parseReference(reference: undefined): undefined;
4133
+ export declare function parseReference(reference: Reference | undefined): [ResourceType, string];
4111
4134
 
4112
4135
  /**
4113
4136
  * Parses a URL string into a SearchRequest.
@@ -4573,6 +4596,10 @@ export declare function stringify(value: any, pretty?: boolean): string;
4573
4596
  */
4574
4597
  export declare function stringifyTypedValue(v: TypedValue): string;
4575
4598
 
4599
+ export declare type StringMap = {
4600
+ [key: string]: string;
4601
+ };
4602
+
4576
4603
  /**
4577
4604
  * Transforms input values using a FHIR StructureMap.
4578
4605
  *
@@ -4689,6 +4716,13 @@ export declare function toTypedValue(value: unknown): TypedValue;
4689
4716
 
4690
4717
  export declare function tryGetDataType(type: string, profileUrl?: string): InternalTypeSchema | undefined;
4691
4718
 
4719
+ /**
4720
+ * Returns the JWT expiration time in number of milliseconds elapsed since the epoch.
4721
+ * @param token - The JWT token.
4722
+ * @returns The JWT expiration time in number of milliseconds elapsed since the epoch if available, undefined if unknown.
4723
+ */
4724
+ export declare function tryGetJwtExpiration(token: string): number | undefined;
4725
+
4692
4726
  export declare function tryGetProfile(profileUrl: string): InternalTypeSchema | undefined;
4693
4727
 
4694
4728
  export declare class TypedEventTarget<TEvents extends Record<string, Event_2>> {
@@ -4788,6 +4822,18 @@ export declare function validationError(details: string): OperationOutcome;
4788
4822
 
4789
4823
  export declare type ValueOrExternalSecret<T extends ExternalSecretPrimitive> = T | ExternalSecret<T>;
4790
4824
 
4825
+ /**
4826
+ * ValueSet $expand operation parameters.
4827
+ * See: https://hl7.org/fhir/r4/valueset-operation-expand.html
4828
+ */
4829
+ export declare interface ValueSetExpandParams {
4830
+ url?: string;
4831
+ filter?: string;
4832
+ date?: string;
4833
+ offset?: number;
4834
+ count?: number;
4835
+ }
4836
+
4791
4837
  /**
4792
4838
  * 6.5.4. xor
4793
4839
  * Returns true if exactly one of the operands evaluates to true,