@medplum/core 3.2.25 → 3.2.27

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.
@@ -417,10 +417,11 @@ export declare function checkForNull(value: unknown, path: string, issues: Opera
417
417
 
418
418
  /**
419
419
  * Tests that a given version string is a valid existing Medplum release version.
420
+ * @param appName - The name of the app to check the version for.
420
421
  * @param version - A version to be checked against the existing Medplum repo releases.
421
422
  * @returns `true` if `version` is a valid semver version that corresponds to an existing release, otherwise `false`.
422
423
  */
423
- export declare function checkIfValidMedplumVersion(version: string): Promise<boolean>;
424
+ export declare function checkIfValidMedplumVersion(appName: string, version: string): Promise<boolean>;
424
425
 
425
426
  /**
426
427
  * Clears the locally-cached `ReleaseManifest`s for all versions.
@@ -962,17 +963,22 @@ export declare const ExternalSecretSystems: {
962
963
  };
963
964
 
964
965
  /**
966
+ * Fetches the latest Medplum release version string.
967
+ * @param appName - The name of the app to fetch the latest version for.
965
968
  * @returns A version string corresponding to the latest Medplum release version.
966
969
  */
967
- export declare function fetchLatestVersionString(): Promise<string>;
970
+ export declare function fetchLatestVersionString(appName: string): Promise<string>;
968
971
 
969
972
  export declare type FetchLike = (url: string, options?: any) => Promise<any>;
970
973
 
971
974
  /**
975
+ * Fetches the manifest for a given Medplum release version.
976
+ * @param appName - The name of the app to fetch the manifest for.
972
977
  * @param version - The version to fetch. If no `version` is provided, defaults to the `latest` version.
978
+ * @param params - An optional list of key-value pairs to be appended to the URL query string.
973
979
  * @returns - The manifest for the specified or latest version.
974
980
  */
975
- export declare function fetchVersionManifest(version?: string): Promise<ReleaseManifest>;
981
+ export declare function fetchVersionManifest(appName: string, version?: string, params?: Record<string, string>): Promise<ReleaseManifest>;
976
982
 
977
983
  export declare const FHIRCAST_EVENT_NAMES: {
978
984
  readonly 'Patient-open': "Patient-open";
@@ -1342,6 +1348,17 @@ export declare const fhirTypeToJsType: {
1342
1348
  readonly 'http://hl7.org/fhirpath/System.String': "string";
1343
1349
  };
1344
1350
 
1351
+ export declare class FileBuilder {
1352
+ private readonly indent;
1353
+ private readonly b;
1354
+ indentCount: number;
1355
+ constructor(indent?: string, header?: boolean);
1356
+ newLine(): void;
1357
+ appendNoWrap(line: string): void;
1358
+ append(line: string): void;
1359
+ toString(): string;
1360
+ }
1361
+
1345
1362
  export declare interface Filter {
1346
1363
  code: string;
1347
1364
  operator: Operator;
@@ -1487,6 +1504,13 @@ export declare function formatQuantity(quantity: Quantity | undefined, precision
1487
1504
  */
1488
1505
  export declare function formatRange(range: Range_2 | undefined, precision?: number, exclusive?: boolean): string;
1489
1506
 
1507
+ /**
1508
+ * Formats a FHIR Reference as a string.
1509
+ * @param value - The reference to format.
1510
+ * @returns The formatted reference string.
1511
+ */
1512
+ export declare function formatReferenceString(value: Reference | undefined): string;
1513
+
1490
1514
  /**
1491
1515
  * Formats a search definition object into a query string.
1492
1516
  * Note: The return value does not include the resource type.
@@ -1778,8 +1802,6 @@ export declare function getValueSliceName(value: any, slices: SliceDefinitionWit
1778
1802
  */
1779
1803
  export declare function getWebSocketUrl(baseUrl: URL | string, path: string): string;
1780
1804
 
1781
- export declare const GITHUB_RELEASES_URL = "https://api.github.com/repos/medplum/medplum/releases";
1782
-
1783
1805
  /**
1784
1806
  * Global schema singleton.
1785
1807
  */
@@ -2735,6 +2757,8 @@ export declare function matchesSearchRequest(resource: Resource, searchRequest:
2735
2757
 
2736
2758
  export declare const MEDPLUM_CLI_CLIENT_ID = "medplum-cli";
2737
2759
 
2760
+ export declare const MEDPLUM_RELEASES_URL = "https://meta.medplum.com/releases";
2761
+
2738
2762
  export declare const MEDPLUM_VERSION: string;
2739
2763
 
2740
2764
  /**
@@ -3850,6 +3874,14 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
3850
3874
  * @category Authentication
3851
3875
  */
3852
3876
  getAccessToken(): string | undefined;
3877
+ /**
3878
+ * Returns whether the client has a valid access token or not.
3879
+ * @param gracePeriod - Optional grace period in milliseconds. If not specified, uses the client configured grace period (default 5 minutes).
3880
+ * @returns Boolean indicating whether or not the client is authenticated.
3881
+ *
3882
+ * **NOTE: Does not check whether the auth token has been revoked server-side.**
3883
+ */
3884
+ isAuthenticated(gracePeriod?: number): boolean;
3853
3885
  /**
3854
3886
  * Sets the current access token.
3855
3887
  * @param accessToken - The new access token.
@@ -4524,7 +4556,6 @@ export declare interface MedplumClientOptions {
4524
4556
  /**
4525
4557
  * Default headers to include in all requests.
4526
4558
  * This can be used to set custom headers such as Cookies or Authorization headers.
4527
- * @default {}
4528
4559
  */
4529
4560
  defaultHeaders?: Record<string, string>;
4530
4561
  }
@@ -5591,7 +5622,6 @@ export declare const RXNORM = "http://www.nlm.nih.gov/research/umls/rxnorm";
5591
5622
  export declare function satisfiedAccessPolicy(resource: Resource, interaction: AccessPolicyInteraction, accessPolicy: AccessPolicy | undefined): AccessPolicyResource | undefined;
5592
5623
 
5593
5624
  export declare interface SearchParameterDetails {
5594
- readonly columnName: string;
5595
5625
  readonly type: SearchParameterType;
5596
5626
  readonly elementDefinitions?: InternalSchemaElement[];
5597
5627
  readonly array?: boolean;
@@ -6043,6 +6073,13 @@ export declare interface TypedValue {
6043
6073
  readonly value: any;
6044
6074
  }
6045
6075
 
6076
+ /**
6077
+ * Converts a typed value to a string.
6078
+ * @param typedValue - The typed value to convert to a string.
6079
+ * @returns The string representation of the typed value.
6080
+ */
6081
+ export declare function typedValueToString(typedValue: TypedValue | undefined): string;
6082
+
6046
6083
  export declare type TypedValueWithPath = TypedValue & {
6047
6084
  path: string;
6048
6085
  };
@@ -6158,6 +6195,13 @@ export declare interface ValueSetExpandParams {
6158
6195
  count?: number;
6159
6196
  }
6160
6197
 
6198
+ /**
6199
+ * Checks if a newer version of Medplum is available and logs a warning if so.
6200
+ * @param appName - The name of the app to check the version for.
6201
+ * @param params - An optional list of key-value pairs to be appended to the URL query string.
6202
+ */
6203
+ export declare function warnIfNewerVersionAvailable(appName: string, params?: Record<string, string>): Promise<void>;
6204
+
6161
6205
  declare type WebSocketEventMap_2 = {
6162
6206
  close: CloseEvent_2;
6163
6207
  error: ErrorEvent_2;
@@ -6166,6 +6210,15 @@ declare type WebSocketEventMap_2 = {
6166
6210
  };
6167
6211
  export { WebSocketEventMap_2 as WebSocketEventMap }
6168
6212
 
6213
+ /**
6214
+ * Returns a word-wrapped string.
6215
+ * Based on: https://stackoverflow.com/a/38709683
6216
+ * @param text - Original input string.
6217
+ * @param maxLength - Width in number of characters.
6218
+ * @returns Array of lines.
6219
+ */
6220
+ export declare function wordWrap(text: string, maxLength: number): string[];
6221
+
6169
6222
  /**
6170
6223
  * 6.5.4. xor
6171
6224
  * Returns true if exactly one of the operands evaluates to true,
@@ -417,10 +417,11 @@ export declare function checkForNull(value: unknown, path: string, issues: Opera
417
417
 
418
418
  /**
419
419
  * Tests that a given version string is a valid existing Medplum release version.
420
+ * @param appName - The name of the app to check the version for.
420
421
  * @param version - A version to be checked against the existing Medplum repo releases.
421
422
  * @returns `true` if `version` is a valid semver version that corresponds to an existing release, otherwise `false`.
422
423
  */
423
- export declare function checkIfValidMedplumVersion(version: string): Promise<boolean>;
424
+ export declare function checkIfValidMedplumVersion(appName: string, version: string): Promise<boolean>;
424
425
 
425
426
  /**
426
427
  * Clears the locally-cached `ReleaseManifest`s for all versions.
@@ -962,17 +963,22 @@ export declare const ExternalSecretSystems: {
962
963
  };
963
964
 
964
965
  /**
966
+ * Fetches the latest Medplum release version string.
967
+ * @param appName - The name of the app to fetch the latest version for.
965
968
  * @returns A version string corresponding to the latest Medplum release version.
966
969
  */
967
- export declare function fetchLatestVersionString(): Promise<string>;
970
+ export declare function fetchLatestVersionString(appName: string): Promise<string>;
968
971
 
969
972
  export declare type FetchLike = (url: string, options?: any) => Promise<any>;
970
973
 
971
974
  /**
975
+ * Fetches the manifest for a given Medplum release version.
976
+ * @param appName - The name of the app to fetch the manifest for.
972
977
  * @param version - The version to fetch. If no `version` is provided, defaults to the `latest` version.
978
+ * @param params - An optional list of key-value pairs to be appended to the URL query string.
973
979
  * @returns - The manifest for the specified or latest version.
974
980
  */
975
- export declare function fetchVersionManifest(version?: string): Promise<ReleaseManifest>;
981
+ export declare function fetchVersionManifest(appName: string, version?: string, params?: Record<string, string>): Promise<ReleaseManifest>;
976
982
 
977
983
  export declare const FHIRCAST_EVENT_NAMES: {
978
984
  readonly 'Patient-open': "Patient-open";
@@ -1342,6 +1348,17 @@ export declare const fhirTypeToJsType: {
1342
1348
  readonly 'http://hl7.org/fhirpath/System.String': "string";
1343
1349
  };
1344
1350
 
1351
+ export declare class FileBuilder {
1352
+ private readonly indent;
1353
+ private readonly b;
1354
+ indentCount: number;
1355
+ constructor(indent?: string, header?: boolean);
1356
+ newLine(): void;
1357
+ appendNoWrap(line: string): void;
1358
+ append(line: string): void;
1359
+ toString(): string;
1360
+ }
1361
+
1345
1362
  export declare interface Filter {
1346
1363
  code: string;
1347
1364
  operator: Operator;
@@ -1487,6 +1504,13 @@ export declare function formatQuantity(quantity: Quantity | undefined, precision
1487
1504
  */
1488
1505
  export declare function formatRange(range: Range_2 | undefined, precision?: number, exclusive?: boolean): string;
1489
1506
 
1507
+ /**
1508
+ * Formats a FHIR Reference as a string.
1509
+ * @param value - The reference to format.
1510
+ * @returns The formatted reference string.
1511
+ */
1512
+ export declare function formatReferenceString(value: Reference | undefined): string;
1513
+
1490
1514
  /**
1491
1515
  * Formats a search definition object into a query string.
1492
1516
  * Note: The return value does not include the resource type.
@@ -1778,8 +1802,6 @@ export declare function getValueSliceName(value: any, slices: SliceDefinitionWit
1778
1802
  */
1779
1803
  export declare function getWebSocketUrl(baseUrl: URL | string, path: string): string;
1780
1804
 
1781
- export declare const GITHUB_RELEASES_URL = "https://api.github.com/repos/medplum/medplum/releases";
1782
-
1783
1805
  /**
1784
1806
  * Global schema singleton.
1785
1807
  */
@@ -2735,6 +2757,8 @@ export declare function matchesSearchRequest(resource: Resource, searchRequest:
2735
2757
 
2736
2758
  export declare const MEDPLUM_CLI_CLIENT_ID = "medplum-cli";
2737
2759
 
2760
+ export declare const MEDPLUM_RELEASES_URL = "https://meta.medplum.com/releases";
2761
+
2738
2762
  export declare const MEDPLUM_VERSION: string;
2739
2763
 
2740
2764
  /**
@@ -3850,6 +3874,14 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
3850
3874
  * @category Authentication
3851
3875
  */
3852
3876
  getAccessToken(): string | undefined;
3877
+ /**
3878
+ * Returns whether the client has a valid access token or not.
3879
+ * @param gracePeriod - Optional grace period in milliseconds. If not specified, uses the client configured grace period (default 5 minutes).
3880
+ * @returns Boolean indicating whether or not the client is authenticated.
3881
+ *
3882
+ * **NOTE: Does not check whether the auth token has been revoked server-side.**
3883
+ */
3884
+ isAuthenticated(gracePeriod?: number): boolean;
3853
3885
  /**
3854
3886
  * Sets the current access token.
3855
3887
  * @param accessToken - The new access token.
@@ -4524,7 +4556,6 @@ export declare interface MedplumClientOptions {
4524
4556
  /**
4525
4557
  * Default headers to include in all requests.
4526
4558
  * This can be used to set custom headers such as Cookies or Authorization headers.
4527
- * @default {}
4528
4559
  */
4529
4560
  defaultHeaders?: Record<string, string>;
4530
4561
  }
@@ -5591,7 +5622,6 @@ export declare const RXNORM = "http://www.nlm.nih.gov/research/umls/rxnorm";
5591
5622
  export declare function satisfiedAccessPolicy(resource: Resource, interaction: AccessPolicyInteraction, accessPolicy: AccessPolicy | undefined): AccessPolicyResource | undefined;
5592
5623
 
5593
5624
  export declare interface SearchParameterDetails {
5594
- readonly columnName: string;
5595
5625
  readonly type: SearchParameterType;
5596
5626
  readonly elementDefinitions?: InternalSchemaElement[];
5597
5627
  readonly array?: boolean;
@@ -6043,6 +6073,13 @@ export declare interface TypedValue {
6043
6073
  readonly value: any;
6044
6074
  }
6045
6075
 
6076
+ /**
6077
+ * Converts a typed value to a string.
6078
+ * @param typedValue - The typed value to convert to a string.
6079
+ * @returns The string representation of the typed value.
6080
+ */
6081
+ export declare function typedValueToString(typedValue: TypedValue | undefined): string;
6082
+
6046
6083
  export declare type TypedValueWithPath = TypedValue & {
6047
6084
  path: string;
6048
6085
  };
@@ -6158,6 +6195,13 @@ export declare interface ValueSetExpandParams {
6158
6195
  count?: number;
6159
6196
  }
6160
6197
 
6198
+ /**
6199
+ * Checks if a newer version of Medplum is available and logs a warning if so.
6200
+ * @param appName - The name of the app to check the version for.
6201
+ * @param params - An optional list of key-value pairs to be appended to the URL query string.
6202
+ */
6203
+ export declare function warnIfNewerVersionAvailable(appName: string, params?: Record<string, string>): Promise<void>;
6204
+
6161
6205
  declare type WebSocketEventMap_2 = {
6162
6206
  close: CloseEvent_2;
6163
6207
  error: ErrorEvent_2;
@@ -6166,6 +6210,15 @@ declare type WebSocketEventMap_2 = {
6166
6210
  };
6167
6211
  export { WebSocketEventMap_2 as WebSocketEventMap }
6168
6212
 
6213
+ /**
6214
+ * Returns a word-wrapped string.
6215
+ * Based on: https://stackoverflow.com/a/38709683
6216
+ * @param text - Original input string.
6217
+ * @param maxLength - Width in number of characters.
6218
+ * @returns Array of lines.
6219
+ */
6220
+ export declare function wordWrap(text: string, maxLength: number): string[];
6221
+
6169
6222
  /**
6170
6223
  * 6.5.4. xor
6171
6224
  * Returns true if exactly one of the operands evaluates to true,