@medplum/core 3.2.24 → 3.2.26

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.
@@ -1342,6 +1342,17 @@ export declare const fhirTypeToJsType: {
1342
1342
  readonly 'http://hl7.org/fhirpath/System.String': "string";
1343
1343
  };
1344
1344
 
1345
+ export declare class FileBuilder {
1346
+ private readonly indent;
1347
+ private readonly b;
1348
+ indentCount: number;
1349
+ constructor(indent?: string, header?: boolean);
1350
+ newLine(): void;
1351
+ appendNoWrap(line: string): void;
1352
+ append(line: string): void;
1353
+ toString(): string;
1354
+ }
1355
+
1345
1356
  export declare interface Filter {
1346
1357
  code: string;
1347
1358
  operator: Operator;
@@ -1487,6 +1498,13 @@ export declare function formatQuantity(quantity: Quantity | undefined, precision
1487
1498
  */
1488
1499
  export declare function formatRange(range: Range_2 | undefined, precision?: number, exclusive?: boolean): string;
1489
1500
 
1501
+ /**
1502
+ * Formats a FHIR Reference as a string.
1503
+ * @param value - The reference to format.
1504
+ * @returns The formatted reference string.
1505
+ */
1506
+ export declare function formatReferenceString(value: Reference | undefined): string;
1507
+
1490
1508
  /**
1491
1509
  * Formats a search definition object into a query string.
1492
1510
  * Note: The return value does not include the resource type.
@@ -2807,6 +2825,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
2807
2825
  private readonly tokenUrl;
2808
2826
  private readonly logoutUrl;
2809
2827
  private readonly fhircastHubUrl;
2828
+ private readonly defaultHeaders;
2810
2829
  private readonly onUnauthenticated?;
2811
2830
  private readonly autoBatchTime;
2812
2831
  private readonly autoBatchQueue;
@@ -2877,6 +2896,13 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
2877
2896
  * @returns The current FHIRcast Hub URL.
2878
2897
  */
2879
2898
  getFhircastHubUrl(): string;
2899
+ /**
2900
+ * Returns default headers to include in all requests.
2901
+ * This can be used to set custom headers such as Cookies or Authorization headers.
2902
+ * @category HTTP
2903
+ * @returns Default headers to include in all requests.
2904
+ */
2905
+ getDefaultHeaders(): Record<string, string>;
2880
2906
  /**
2881
2907
  * Clears all auth state including local storage and session storage.
2882
2908
  * @category Authentication
@@ -3842,6 +3868,14 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
3842
3868
  * @category Authentication
3843
3869
  */
3844
3870
  getAccessToken(): string | undefined;
3871
+ /**
3872
+ * Returns whether the client has a valid access token or not.
3873
+ * @param gracePeriod - Optional grace period in milliseconds. If not specified, uses the client configured grace period (default 5 minutes).
3874
+ * @returns Boolean indicating whether or not the client is authenticated.
3875
+ *
3876
+ * **NOTE: Does not check whether the auth token has been revoked server-side.**
3877
+ */
3878
+ isAuthenticated(gracePeriod?: number): boolean;
3845
3879
  /**
3846
3880
  * Sets the current access token.
3847
3881
  * @param accessToken - The new access token.
@@ -4513,6 +4547,11 @@ export declare interface MedplumClientOptions {
4513
4547
  * Default is true.
4514
4548
  */
4515
4549
  extendedMode?: boolean;
4550
+ /**
4551
+ * Default headers to include in all requests.
4552
+ * This can be used to set custom headers such as Cookies or Authorization headers.
4553
+ */
4554
+ defaultHeaders?: Record<string, string>;
4516
4555
  }
4517
4556
 
4518
4557
  export declare interface MedplumInfraConfig {
@@ -4773,6 +4812,8 @@ export declare class MockAsyncClientStorage extends ClientStorage implements ICl
4773
4812
 
4774
4813
  export declare const multipleMatches: OperationOutcome;
4775
4814
 
4815
+ export declare const NDC = "http://hl7.org/fhir/sid/ndc";
4816
+
4776
4817
  export declare interface NewPatientRequest {
4777
4818
  readonly login: string;
4778
4819
  readonly projectId: string;
@@ -4925,6 +4966,7 @@ export declare enum Operator {
4925
4966
  ENDS_BEFORE = "eb",
4926
4967
  APPROXIMATELY = "ap",
4927
4968
  CONTAINS = "contains",
4969
+ STARTS_WITH = "sw",
4928
4970
  EXACT = "exact",
4929
4971
  TEXT = "text",
4930
4972
  NOT = "not",
@@ -5574,7 +5616,6 @@ export declare const RXNORM = "http://www.nlm.nih.gov/research/umls/rxnorm";
5574
5616
  export declare function satisfiedAccessPolicy(resource: Resource, interaction: AccessPolicyInteraction, accessPolicy: AccessPolicy | undefined): AccessPolicyResource | undefined;
5575
5617
 
5576
5618
  export declare interface SearchParameterDetails {
5577
- readonly columnName: string;
5578
5619
  readonly type: SearchParameterType;
5579
5620
  readonly elementDefinitions?: InternalSchemaElement[];
5580
5621
  readonly array?: boolean;
@@ -6026,6 +6067,13 @@ export declare interface TypedValue {
6026
6067
  readonly value: any;
6027
6068
  }
6028
6069
 
6070
+ /**
6071
+ * Converts a typed value to a string.
6072
+ * @param typedValue - The typed value to convert to a string.
6073
+ * @returns The string representation of the typed value.
6074
+ */
6075
+ export declare function typedValueToString(typedValue: TypedValue | undefined): string;
6076
+
6029
6077
  export declare type TypedValueWithPath = TypedValue & {
6030
6078
  path: string;
6031
6079
  };
@@ -6149,6 +6197,15 @@ declare type WebSocketEventMap_2 = {
6149
6197
  };
6150
6198
  export { WebSocketEventMap_2 as WebSocketEventMap }
6151
6199
 
6200
+ /**
6201
+ * Returns a word-wrapped string.
6202
+ * Based on: https://stackoverflow.com/a/38709683
6203
+ * @param text - Original input string.
6204
+ * @param maxLength - Width in number of characters.
6205
+ * @returns Array of lines.
6206
+ */
6207
+ export declare function wordWrap(text: string, maxLength: number): string[];
6208
+
6152
6209
  /**
6153
6210
  * 6.5.4. xor
6154
6211
  * Returns true if exactly one of the operands evaluates to true,
@@ -1342,6 +1342,17 @@ export declare const fhirTypeToJsType: {
1342
1342
  readonly 'http://hl7.org/fhirpath/System.String': "string";
1343
1343
  };
1344
1344
 
1345
+ export declare class FileBuilder {
1346
+ private readonly indent;
1347
+ private readonly b;
1348
+ indentCount: number;
1349
+ constructor(indent?: string, header?: boolean);
1350
+ newLine(): void;
1351
+ appendNoWrap(line: string): void;
1352
+ append(line: string): void;
1353
+ toString(): string;
1354
+ }
1355
+
1345
1356
  export declare interface Filter {
1346
1357
  code: string;
1347
1358
  operator: Operator;
@@ -1487,6 +1498,13 @@ export declare function formatQuantity(quantity: Quantity | undefined, precision
1487
1498
  */
1488
1499
  export declare function formatRange(range: Range_2 | undefined, precision?: number, exclusive?: boolean): string;
1489
1500
 
1501
+ /**
1502
+ * Formats a FHIR Reference as a string.
1503
+ * @param value - The reference to format.
1504
+ * @returns The formatted reference string.
1505
+ */
1506
+ export declare function formatReferenceString(value: Reference | undefined): string;
1507
+
1490
1508
  /**
1491
1509
  * Formats a search definition object into a query string.
1492
1510
  * Note: The return value does not include the resource type.
@@ -2807,6 +2825,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
2807
2825
  private readonly tokenUrl;
2808
2826
  private readonly logoutUrl;
2809
2827
  private readonly fhircastHubUrl;
2828
+ private readonly defaultHeaders;
2810
2829
  private readonly onUnauthenticated?;
2811
2830
  private readonly autoBatchTime;
2812
2831
  private readonly autoBatchQueue;
@@ -2877,6 +2896,13 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
2877
2896
  * @returns The current FHIRcast Hub URL.
2878
2897
  */
2879
2898
  getFhircastHubUrl(): string;
2899
+ /**
2900
+ * Returns default headers to include in all requests.
2901
+ * This can be used to set custom headers such as Cookies or Authorization headers.
2902
+ * @category HTTP
2903
+ * @returns Default headers to include in all requests.
2904
+ */
2905
+ getDefaultHeaders(): Record<string, string>;
2880
2906
  /**
2881
2907
  * Clears all auth state including local storage and session storage.
2882
2908
  * @category Authentication
@@ -3842,6 +3868,14 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
3842
3868
  * @category Authentication
3843
3869
  */
3844
3870
  getAccessToken(): string | undefined;
3871
+ /**
3872
+ * Returns whether the client has a valid access token or not.
3873
+ * @param gracePeriod - Optional grace period in milliseconds. If not specified, uses the client configured grace period (default 5 minutes).
3874
+ * @returns Boolean indicating whether or not the client is authenticated.
3875
+ *
3876
+ * **NOTE: Does not check whether the auth token has been revoked server-side.**
3877
+ */
3878
+ isAuthenticated(gracePeriod?: number): boolean;
3845
3879
  /**
3846
3880
  * Sets the current access token.
3847
3881
  * @param accessToken - The new access token.
@@ -4513,6 +4547,11 @@ export declare interface MedplumClientOptions {
4513
4547
  * Default is true.
4514
4548
  */
4515
4549
  extendedMode?: boolean;
4550
+ /**
4551
+ * Default headers to include in all requests.
4552
+ * This can be used to set custom headers such as Cookies or Authorization headers.
4553
+ */
4554
+ defaultHeaders?: Record<string, string>;
4516
4555
  }
4517
4556
 
4518
4557
  export declare interface MedplumInfraConfig {
@@ -4773,6 +4812,8 @@ export declare class MockAsyncClientStorage extends ClientStorage implements ICl
4773
4812
 
4774
4813
  export declare const multipleMatches: OperationOutcome;
4775
4814
 
4815
+ export declare const NDC = "http://hl7.org/fhir/sid/ndc";
4816
+
4776
4817
  export declare interface NewPatientRequest {
4777
4818
  readonly login: string;
4778
4819
  readonly projectId: string;
@@ -4925,6 +4966,7 @@ export declare enum Operator {
4925
4966
  ENDS_BEFORE = "eb",
4926
4967
  APPROXIMATELY = "ap",
4927
4968
  CONTAINS = "contains",
4969
+ STARTS_WITH = "sw",
4928
4970
  EXACT = "exact",
4929
4971
  TEXT = "text",
4930
4972
  NOT = "not",
@@ -5574,7 +5616,6 @@ export declare const RXNORM = "http://www.nlm.nih.gov/research/umls/rxnorm";
5574
5616
  export declare function satisfiedAccessPolicy(resource: Resource, interaction: AccessPolicyInteraction, accessPolicy: AccessPolicy | undefined): AccessPolicyResource | undefined;
5575
5617
 
5576
5618
  export declare interface SearchParameterDetails {
5577
- readonly columnName: string;
5578
5619
  readonly type: SearchParameterType;
5579
5620
  readonly elementDefinitions?: InternalSchemaElement[];
5580
5621
  readonly array?: boolean;
@@ -6026,6 +6067,13 @@ export declare interface TypedValue {
6026
6067
  readonly value: any;
6027
6068
  }
6028
6069
 
6070
+ /**
6071
+ * Converts a typed value to a string.
6072
+ * @param typedValue - The typed value to convert to a string.
6073
+ * @returns The string representation of the typed value.
6074
+ */
6075
+ export declare function typedValueToString(typedValue: TypedValue | undefined): string;
6076
+
6029
6077
  export declare type TypedValueWithPath = TypedValue & {
6030
6078
  path: string;
6031
6079
  };
@@ -6149,6 +6197,15 @@ declare type WebSocketEventMap_2 = {
6149
6197
  };
6150
6198
  export { WebSocketEventMap_2 as WebSocketEventMap }
6151
6199
 
6200
+ /**
6201
+ * Returns a word-wrapped string.
6202
+ * Based on: https://stackoverflow.com/a/38709683
6203
+ * @param text - Original input string.
6204
+ * @param maxLength - Width in number of characters.
6205
+ * @returns Array of lines.
6206
+ */
6207
+ export declare function wordWrap(text: string, maxLength: number): string[];
6208
+
6152
6209
  /**
6153
6210
  * 6.5.4. xor
6154
6211
  * Returns true if exactly one of the operands evaluates to true,