@medplum/core 2.2.5 → 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.
@@ -11,6 +11,7 @@ import { Bundle } from '@medplum/fhirtypes';
11
11
  import { CodeableConcept } from '@medplum/fhirtypes';
12
12
  import { Coding } from '@medplum/fhirtypes';
13
13
  import { Communication } from '@medplum/fhirtypes';
14
+ import { ConceptMap } from '@medplum/fhirtypes';
14
15
  import type { CustomTableLayout } from 'pdfmake/interfaces';
15
16
  import { Device } from '@medplum/fhirtypes';
16
17
  import { ElementDefinition } from '@medplum/fhirtypes';
@@ -261,7 +262,7 @@ export declare function calculateAge(birthDateStr: string, endDateStr?: string):
261
262
  */
262
263
  export declare function calculateAgeString(birthDateStr: string, endDateStr?: string): string | undefined;
263
264
 
264
- declare type CanBePopulated = {
265
+ export declare type CanBePopulated = {
265
266
  length: number;
266
267
  } | object;
267
268
 
@@ -337,6 +338,29 @@ export declare class ConcatAtom extends InfixOperatorAtom {
337
338
  eval(context: AtomContext, input: TypedValue[]): TypedValue[];
338
339
  }
339
340
 
341
+ export declare function conceptMapTranslate(map: ConceptMap, params: ConceptMapTranslateParameters): ConceptMapTranslateOutput;
342
+
343
+ export declare interface ConceptMapTranslateMatch {
344
+ equivalence?: string;
345
+ concept?: Coding;
346
+ }
347
+
348
+ export declare interface ConceptMapTranslateOutput {
349
+ result: boolean;
350
+ message?: string;
351
+ match?: ConceptMapTranslateMatch[];
352
+ }
353
+
354
+ export declare interface ConceptMapTranslateParameters {
355
+ url?: string;
356
+ source?: string;
357
+ code?: string;
358
+ system?: string;
359
+ coding?: Coding;
360
+ codeableConcept?: CodeableConcept;
361
+ targetsystem?: string;
362
+ }
363
+
340
364
  export declare interface Constraint {
341
365
  key: string;
342
366
  severity: 'error' | 'warning';
@@ -1564,6 +1588,8 @@ export declare class Hl7Segment {
1564
1588
  static parse(text: string, context?: Hl7Context): Hl7Segment;
1565
1589
  }
1566
1590
 
1591
+ export declare const HTTP_HL7_ORG = "http://hl7.org";
1592
+
1567
1593
  export declare interface HumanNameFormatOptions {
1568
1594
  all?: boolean;
1569
1595
  prefix?: boolean;
@@ -1889,6 +1915,13 @@ export declare function isUUID(input: string): input is string;
1889
1915
  */
1890
1916
  export declare function isValidDate(date: Date): boolean;
1891
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
+
1892
1925
  export declare class LiteralAtom implements Atom {
1893
1926
  readonly value: TypedValue;
1894
1927
  constructor(value: TypedValue);
@@ -2129,6 +2162,7 @@ export declare class MedplumClient extends EventTarget_2 {
2129
2162
  private clientSecret?;
2130
2163
  private autoBatchTimerId?;
2131
2164
  private accessToken?;
2165
+ private accessTokenExpires?;
2132
2166
  private refreshToken?;
2133
2167
  private refreshPromise?;
2134
2168
  private profilePromise?;
@@ -2525,8 +2559,18 @@ export declare class MedplumClient extends EventTarget_2 {
2525
2559
  * @param filter - The search string.
2526
2560
  * @param options - Optional fetch options.
2527
2561
  * @returns Promise to expanded ValueSet.
2562
+ * @deprecated Use `valueSetExpand()` instead.
2528
2563
  */
2529
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>;
2530
2574
  /**
2531
2575
  * Returns a cached resource if it is available.
2532
2576
  * @category Caching
@@ -3298,6 +3342,11 @@ export declare class MedplumClient extends EventTarget_2 {
3298
3342
  * @category Authentication
3299
3343
  */
3300
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>;
3301
3350
  /**
3302
3351
  * Tries to refresh the auth tokens.
3303
3352
  * @returns The refresh promise if available; otherwise undefined.
@@ -4079,9 +4128,7 @@ export declare class ParserBuilder {
4079
4128
  * @param reference - A reference to a FHIR resource.
4080
4129
  * @returns A tuple containing the `ResourceType` and the ID of the resource or `undefined` when `undefined` or an invalid reference is passed.
4081
4130
  */
4082
- export declare function parseReference(reference: Reference): [ResourceType, string] | undefined;
4083
-
4084
- export declare function parseReference(reference: undefined): undefined;
4131
+ export declare function parseReference(reference: Reference | undefined): [ResourceType, string];
4085
4132
 
4086
4133
  /**
4087
4134
  * Parses a URL string into a SearchRequest.
@@ -4547,6 +4594,16 @@ export declare function stringify(value: any, pretty?: boolean): string;
4547
4594
  */
4548
4595
  export declare function stringifyTypedValue(v: TypedValue): string;
4549
4596
 
4597
+ /**
4598
+ * Transforms input values using a FHIR StructureMap.
4599
+ *
4600
+ * See: https://www.hl7.org/fhir/mapping-language.html
4601
+ *
4602
+ * @param structureMap - The StructureMap to transform.
4603
+ * @param input - The input values.
4604
+ * @param loader - Optional loader function for loading imported StructureMaps.
4605
+ * @returns The transformed values.
4606
+ */
4550
4607
  export declare function structureMapTransform(structureMap: StructureMap, input: TypedValue[], loader?: (url: string) => StructureMap[]): TypedValue[];
4551
4608
 
4552
4609
  /**
@@ -4653,6 +4710,13 @@ export declare function toTypedValue(value: unknown): TypedValue;
4653
4710
 
4654
4711
  export declare function tryGetDataType(type: string, profileUrl?: string): InternalTypeSchema | undefined;
4655
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
+
4656
4720
  export declare function tryGetProfile(profileUrl: string): InternalTypeSchema | undefined;
4657
4721
 
4658
4722
  export declare class TypedEventTarget<TEvents extends Record<string, Event_2>> {
@@ -4752,6 +4816,18 @@ export declare function validationError(details: string): OperationOutcome;
4752
4816
 
4753
4817
  export declare type ValueOrExternalSecret<T extends ExternalSecretPrimitive> = T | ExternalSecret<T>;
4754
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
+
4755
4831
  /**
4756
4832
  * 6.5.4. xor
4757
4833
  * Returns true if exactly one of the operands evaluates to true,
@@ -11,6 +11,7 @@ import { Bundle } from '@medplum/fhirtypes';
11
11
  import { CodeableConcept } from '@medplum/fhirtypes';
12
12
  import { Coding } from '@medplum/fhirtypes';
13
13
  import { Communication } from '@medplum/fhirtypes';
14
+ import { ConceptMap } from '@medplum/fhirtypes';
14
15
  import type { CustomTableLayout } from 'pdfmake/interfaces';
15
16
  import { Device } from '@medplum/fhirtypes';
16
17
  import { ElementDefinition } from '@medplum/fhirtypes';
@@ -261,7 +262,7 @@ export declare function calculateAge(birthDateStr: string, endDateStr?: string):
261
262
  */
262
263
  export declare function calculateAgeString(birthDateStr: string, endDateStr?: string): string | undefined;
263
264
 
264
- declare type CanBePopulated = {
265
+ export declare type CanBePopulated = {
265
266
  length: number;
266
267
  } | object;
267
268
 
@@ -337,6 +338,29 @@ export declare class ConcatAtom extends InfixOperatorAtom {
337
338
  eval(context: AtomContext, input: TypedValue[]): TypedValue[];
338
339
  }
339
340
 
341
+ export declare function conceptMapTranslate(map: ConceptMap, params: ConceptMapTranslateParameters): ConceptMapTranslateOutput;
342
+
343
+ export declare interface ConceptMapTranslateMatch {
344
+ equivalence?: string;
345
+ concept?: Coding;
346
+ }
347
+
348
+ export declare interface ConceptMapTranslateOutput {
349
+ result: boolean;
350
+ message?: string;
351
+ match?: ConceptMapTranslateMatch[];
352
+ }
353
+
354
+ export declare interface ConceptMapTranslateParameters {
355
+ url?: string;
356
+ source?: string;
357
+ code?: string;
358
+ system?: string;
359
+ coding?: Coding;
360
+ codeableConcept?: CodeableConcept;
361
+ targetsystem?: string;
362
+ }
363
+
340
364
  export declare interface Constraint {
341
365
  key: string;
342
366
  severity: 'error' | 'warning';
@@ -1564,6 +1588,8 @@ export declare class Hl7Segment {
1564
1588
  static parse(text: string, context?: Hl7Context): Hl7Segment;
1565
1589
  }
1566
1590
 
1591
+ export declare const HTTP_HL7_ORG = "http://hl7.org";
1592
+
1567
1593
  export declare interface HumanNameFormatOptions {
1568
1594
  all?: boolean;
1569
1595
  prefix?: boolean;
@@ -1889,6 +1915,13 @@ export declare function isUUID(input: string): input is string;
1889
1915
  */
1890
1916
  export declare function isValidDate(date: Date): boolean;
1891
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
+
1892
1925
  export declare class LiteralAtom implements Atom {
1893
1926
  readonly value: TypedValue;
1894
1927
  constructor(value: TypedValue);
@@ -2129,6 +2162,7 @@ export declare class MedplumClient extends EventTarget_2 {
2129
2162
  private clientSecret?;
2130
2163
  private autoBatchTimerId?;
2131
2164
  private accessToken?;
2165
+ private accessTokenExpires?;
2132
2166
  private refreshToken?;
2133
2167
  private refreshPromise?;
2134
2168
  private profilePromise?;
@@ -2525,8 +2559,18 @@ export declare class MedplumClient extends EventTarget_2 {
2525
2559
  * @param filter - The search string.
2526
2560
  * @param options - Optional fetch options.
2527
2561
  * @returns Promise to expanded ValueSet.
2562
+ * @deprecated Use `valueSetExpand()` instead.
2528
2563
  */
2529
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>;
2530
2574
  /**
2531
2575
  * Returns a cached resource if it is available.
2532
2576
  * @category Caching
@@ -3298,6 +3342,11 @@ export declare class MedplumClient extends EventTarget_2 {
3298
3342
  * @category Authentication
3299
3343
  */
3300
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>;
3301
3350
  /**
3302
3351
  * Tries to refresh the auth tokens.
3303
3352
  * @returns The refresh promise if available; otherwise undefined.
@@ -4079,9 +4128,7 @@ export declare class ParserBuilder {
4079
4128
  * @param reference - A reference to a FHIR resource.
4080
4129
  * @returns A tuple containing the `ResourceType` and the ID of the resource or `undefined` when `undefined` or an invalid reference is passed.
4081
4130
  */
4082
- export declare function parseReference(reference: Reference): [ResourceType, string] | undefined;
4083
-
4084
- export declare function parseReference(reference: undefined): undefined;
4131
+ export declare function parseReference(reference: Reference | undefined): [ResourceType, string];
4085
4132
 
4086
4133
  /**
4087
4134
  * Parses a URL string into a SearchRequest.
@@ -4547,6 +4594,16 @@ export declare function stringify(value: any, pretty?: boolean): string;
4547
4594
  */
4548
4595
  export declare function stringifyTypedValue(v: TypedValue): string;
4549
4596
 
4597
+ /**
4598
+ * Transforms input values using a FHIR StructureMap.
4599
+ *
4600
+ * See: https://www.hl7.org/fhir/mapping-language.html
4601
+ *
4602
+ * @param structureMap - The StructureMap to transform.
4603
+ * @param input - The input values.
4604
+ * @param loader - Optional loader function for loading imported StructureMaps.
4605
+ * @returns The transformed values.
4606
+ */
4550
4607
  export declare function structureMapTransform(structureMap: StructureMap, input: TypedValue[], loader?: (url: string) => StructureMap[]): TypedValue[];
4551
4608
 
4552
4609
  /**
@@ -4653,6 +4710,13 @@ export declare function toTypedValue(value: unknown): TypedValue;
4653
4710
 
4654
4711
  export declare function tryGetDataType(type: string, profileUrl?: string): InternalTypeSchema | undefined;
4655
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
+
4656
4720
  export declare function tryGetProfile(profileUrl: string): InternalTypeSchema | undefined;
4657
4721
 
4658
4722
  export declare class TypedEventTarget<TEvents extends Record<string, Event_2>> {
@@ -4752,6 +4816,18 @@ export declare function validationError(details: string): OperationOutcome;
4752
4816
 
4753
4817
  export declare type ValueOrExternalSecret<T extends ExternalSecretPrimitive> = T | ExternalSecret<T>;
4754
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
+
4755
4831
  /**
4756
4832
  * 6.5.4. xor
4757
4833
  * Returns true if exactly one of the operands evaluates to true,