@medplum/core 3.2.16 → 3.2.18

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.
@@ -245,6 +245,12 @@ export declare function assertContextVersionOptional(event: string): asserts eve
245
245
  */
246
246
  export declare function assertOk<T>(outcome: OperationOutcome, resource: T | undefined): asserts resource is T;
247
247
 
248
+ /**
249
+ * Asserts that a given candidate is a `ReleaseManifest`.
250
+ * @param candidate - An object assumed to be a `ReleaseManifest`.
251
+ */
252
+ export declare function assertReleaseManifest(candidate: unknown): asserts candidate is ReleaseManifest;
253
+
248
254
  export declare interface AsyncCrawlerVisitor {
249
255
  onEnterObject?: (path: string, value: TypedValueWithPath, schema: InternalTypeSchema) => Promise<void>;
250
256
  onExitObject?: (path: string, value: TypedValueWithPath, schema: InternalTypeSchema) => Promise<void>;
@@ -409,6 +415,18 @@ export declare function capitalize(word: string): string;
409
415
  */
410
416
  export declare function checkForNull(value: unknown, path: string, issues: OperationOutcomeIssue[]): void;
411
417
 
418
+ /**
419
+ * Tests that a given version string is a valid existing Medplum release version.
420
+ * @param version - A version to be checked against the existing Medplum repo releases.
421
+ * @returns `true` if `version` is a valid semver version that corresponds to an existing release, otherwise `false`.
422
+ */
423
+ export declare function checkIfValidMedplumVersion(version: string): Promise<boolean>;
424
+
425
+ /**
426
+ * Clears the locally-cached `ReleaseManifest`s for all versions.
427
+ */
428
+ export declare function clearReleaseCache(): void;
429
+
412
430
  /**
413
431
  * The ClientStorage class is a utility class for storing strings and objects.
414
432
  *
@@ -941,8 +959,19 @@ export declare const ExternalSecretSystems: {
941
959
  readonly aws_ssm_parameter_store: "aws_ssm_parameter_store";
942
960
  };
943
961
 
962
+ /**
963
+ * @returns A version string corresponding to the latest Medplum release version.
964
+ */
965
+ export declare function fetchLatestVersionString(): Promise<string>;
966
+
944
967
  export declare type FetchLike = (url: string, options?: any) => Promise<any>;
945
968
 
969
+ /**
970
+ * @param version - The version to fetch. If no `version` is provided, defaults to the `latest` version.
971
+ * @returns - The manifest for the specified or latest version.
972
+ */
973
+ export declare function fetchVersionManifest(version?: string): Promise<ReleaseManifest>;
974
+
946
975
  export declare const FHIRCAST_EVENT_NAMES: {
947
976
  readonly 'Patient-open': "Patient-open";
948
977
  readonly 'Patient-close': "Patient-close";
@@ -1737,6 +1766,8 @@ export declare function getValueSliceName(value: any, slices: SliceDefinitionWit
1737
1766
  */
1738
1767
  export declare function getWebSocketUrl(baseUrl: URL | string, path: string): string;
1739
1768
 
1769
+ export declare const GITHUB_RELEASES_URL = "https://api.github.com/repos/medplum/medplum/releases";
1770
+
1740
1771
  /**
1741
1772
  * Global schema singleton.
1742
1773
  */
@@ -2023,6 +2054,8 @@ export declare interface IncludeTarget {
2023
2054
  modifier?: 'iterate';
2024
2055
  }
2025
2056
 
2057
+ export declare function indexDefaultSearchParameters(bundle: Bundle): void;
2058
+
2026
2059
  /**
2027
2060
  * An IndexedStructureDefinition is a lookup-optimized version of a StructureDefinition.
2028
2061
  *
@@ -2418,6 +2451,14 @@ export declare function isValidDate(date: Date): boolean;
2418
2451
  */
2419
2452
  export declare function isValidHostname(input: string): boolean;
2420
2453
 
2454
+ /**
2455
+ * Tests that a given version string follows the basic semver pattern of `<int>.<int>.<int>`, which is used for Medplum versions.
2456
+ *
2457
+ * @param version - A version string that should be tested for valid semver semantics.
2458
+ * @returns `true` if `version` is a valid semver version that conforms to the Medplum versioning system, otherwise `false`.
2459
+ */
2460
+ export declare function isValidMedplumSemver(version: string): boolean;
2461
+
2421
2462
  /**
2422
2463
  * Memoizes the result of a parameterless function
2423
2464
  * @param fn - The function to be wrapped
@@ -2443,11 +2484,11 @@ export declare class Logger {
2443
2484
  constructor(write: (msg: string) => void, metadata?: Record<string, any>, level?: LogLevel, options?: LoggerOptions | undefined);
2444
2485
  clone(override?: LoggerConfigOverride): Logger;
2445
2486
  private getLoggerConfig;
2446
- error(msg: string, data?: Record<string, any>): void;
2447
- warn(msg: string, data?: Record<string, any>): void;
2448
- info(msg: string, data?: Record<string, any>): void;
2449
- debug(msg: string, data?: Record<string, any>): void;
2450
- log(level: LogLevel, msg: string, data?: Record<string, any>): void;
2487
+ error(msg: string, data?: Record<string, any> | Error): void;
2488
+ warn(msg: string, data?: Record<string, any> | Error): void;
2489
+ info(msg: string, data?: Record<string, any> | Error): void;
2490
+ debug(msg: string, data?: Record<string, any> | Error): void;
2491
+ log(level: LogLevel, msg: string, data?: Record<string, any> | Error): void;
2451
2492
  }
2452
2493
 
2453
2494
  export declare interface LoggerConfig {
@@ -2711,6 +2752,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
2711
2752
  private readonly authorizeUrl;
2712
2753
  private readonly tokenUrl;
2713
2754
  private readonly logoutUrl;
2755
+ private readonly fhircastHubUrl;
2714
2756
  private readonly onUnauthenticated?;
2715
2757
  private readonly autoBatchTime;
2716
2758
  private readonly autoBatchQueue;
@@ -2773,6 +2815,14 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
2773
2815
  * @returns The current logout URL.
2774
2816
  */
2775
2817
  getLogoutUrl(): string;
2818
+ /**
2819
+ * Returns the current FHIRcast Hub URL.
2820
+ * By default, this is set to `https://api.medplum.com/fhircast/STU3`.
2821
+ * This can be overridden by setting the `logoutUrl` option when creating the client.
2822
+ * @category HTTP
2823
+ * @returns The current FHIRcast Hub URL.
2824
+ */
2825
+ getFhircastHubUrl(): string;
2776
2826
  /**
2777
2827
  * Clears all auth state including local storage and session storage.
2778
2828
  * @category Authentication
@@ -2826,7 +2876,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
2826
2876
  * @param options - Optional fetch options.
2827
2877
  * @returns Promise to the response content.
2828
2878
  */
2829
- post(url: URL | string, body: any, contentType?: string, options?: MedplumRequestOptions): Promise<any>;
2879
+ post(url: URL | string, body?: any, contentType?: string, options?: MedplumRequestOptions): Promise<any>;
2830
2880
  /**
2831
2881
  * Makes an HTTP PUT request to the specified URL.
2832
2882
  *
@@ -4261,6 +4311,16 @@ export declare interface MedplumClientOptions {
4261
4311
  * Use this if you want to use a separate OAuth server.
4262
4312
  */
4263
4313
  logoutUrl?: string;
4314
+ /**
4315
+ * FHIRcast Hub URL.
4316
+ *
4317
+ * Default value is `fhircast/STU3`.
4318
+ *
4319
+ * Can be specified as absolute URL or relative to `baseUrl`.
4320
+ *
4321
+ * Use this if you want to use a different path when connecting to a FHIRcast hub.
4322
+ */
4323
+ fhircastHubUrl?: string;
4264
4324
  /**
4265
4325
  * The client ID.
4266
4326
  *
@@ -5354,6 +5414,14 @@ export declare class ReconnectingWebSocket extends TypedEventTarget<WebSocketEve
5354
5414
  private _clearTimeouts;
5355
5415
  }
5356
5416
 
5417
+ export declare type ReleaseManifest = {
5418
+ tag_name: string;
5419
+ assets: {
5420
+ name: string;
5421
+ browser_download_url: string;
5422
+ }[];
5423
+ };
5424
+
5357
5425
  /**
5358
5426
  * Removes duplicates in array using FHIRPath equality rules.
5359
5427
  * @param arr - The input array.
@@ -5494,6 +5562,8 @@ export declare function serializeFhircastSubscriptionRequest(subscriptionRequest
5494
5562
 
5495
5563
  export declare function serverError(err: Error): OperationOutcome;
5496
5564
 
5565
+ export declare function serverTimeout(msg?: string): OperationOutcome;
5566
+
5497
5567
  /**
5498
5568
  * Sets a code for a given system within a given codeable concept.
5499
5569
  * @param concept - The codeable concept.
@@ -245,6 +245,12 @@ export declare function assertContextVersionOptional(event: string): asserts eve
245
245
  */
246
246
  export declare function assertOk<T>(outcome: OperationOutcome, resource: T | undefined): asserts resource is T;
247
247
 
248
+ /**
249
+ * Asserts that a given candidate is a `ReleaseManifest`.
250
+ * @param candidate - An object assumed to be a `ReleaseManifest`.
251
+ */
252
+ export declare function assertReleaseManifest(candidate: unknown): asserts candidate is ReleaseManifest;
253
+
248
254
  export declare interface AsyncCrawlerVisitor {
249
255
  onEnterObject?: (path: string, value: TypedValueWithPath, schema: InternalTypeSchema) => Promise<void>;
250
256
  onExitObject?: (path: string, value: TypedValueWithPath, schema: InternalTypeSchema) => Promise<void>;
@@ -409,6 +415,18 @@ export declare function capitalize(word: string): string;
409
415
  */
410
416
  export declare function checkForNull(value: unknown, path: string, issues: OperationOutcomeIssue[]): void;
411
417
 
418
+ /**
419
+ * Tests that a given version string is a valid existing Medplum release version.
420
+ * @param version - A version to be checked against the existing Medplum repo releases.
421
+ * @returns `true` if `version` is a valid semver version that corresponds to an existing release, otherwise `false`.
422
+ */
423
+ export declare function checkIfValidMedplumVersion(version: string): Promise<boolean>;
424
+
425
+ /**
426
+ * Clears the locally-cached `ReleaseManifest`s for all versions.
427
+ */
428
+ export declare function clearReleaseCache(): void;
429
+
412
430
  /**
413
431
  * The ClientStorage class is a utility class for storing strings and objects.
414
432
  *
@@ -941,8 +959,19 @@ export declare const ExternalSecretSystems: {
941
959
  readonly aws_ssm_parameter_store: "aws_ssm_parameter_store";
942
960
  };
943
961
 
962
+ /**
963
+ * @returns A version string corresponding to the latest Medplum release version.
964
+ */
965
+ export declare function fetchLatestVersionString(): Promise<string>;
966
+
944
967
  export declare type FetchLike = (url: string, options?: any) => Promise<any>;
945
968
 
969
+ /**
970
+ * @param version - The version to fetch. If no `version` is provided, defaults to the `latest` version.
971
+ * @returns - The manifest for the specified or latest version.
972
+ */
973
+ export declare function fetchVersionManifest(version?: string): Promise<ReleaseManifest>;
974
+
946
975
  export declare const FHIRCAST_EVENT_NAMES: {
947
976
  readonly 'Patient-open': "Patient-open";
948
977
  readonly 'Patient-close': "Patient-close";
@@ -1737,6 +1766,8 @@ export declare function getValueSliceName(value: any, slices: SliceDefinitionWit
1737
1766
  */
1738
1767
  export declare function getWebSocketUrl(baseUrl: URL | string, path: string): string;
1739
1768
 
1769
+ export declare const GITHUB_RELEASES_URL = "https://api.github.com/repos/medplum/medplum/releases";
1770
+
1740
1771
  /**
1741
1772
  * Global schema singleton.
1742
1773
  */
@@ -2023,6 +2054,8 @@ export declare interface IncludeTarget {
2023
2054
  modifier?: 'iterate';
2024
2055
  }
2025
2056
 
2057
+ export declare function indexDefaultSearchParameters(bundle: Bundle): void;
2058
+
2026
2059
  /**
2027
2060
  * An IndexedStructureDefinition is a lookup-optimized version of a StructureDefinition.
2028
2061
  *
@@ -2418,6 +2451,14 @@ export declare function isValidDate(date: Date): boolean;
2418
2451
  */
2419
2452
  export declare function isValidHostname(input: string): boolean;
2420
2453
 
2454
+ /**
2455
+ * Tests that a given version string follows the basic semver pattern of `<int>.<int>.<int>`, which is used for Medplum versions.
2456
+ *
2457
+ * @param version - A version string that should be tested for valid semver semantics.
2458
+ * @returns `true` if `version` is a valid semver version that conforms to the Medplum versioning system, otherwise `false`.
2459
+ */
2460
+ export declare function isValidMedplumSemver(version: string): boolean;
2461
+
2421
2462
  /**
2422
2463
  * Memoizes the result of a parameterless function
2423
2464
  * @param fn - The function to be wrapped
@@ -2443,11 +2484,11 @@ export declare class Logger {
2443
2484
  constructor(write: (msg: string) => void, metadata?: Record<string, any>, level?: LogLevel, options?: LoggerOptions | undefined);
2444
2485
  clone(override?: LoggerConfigOverride): Logger;
2445
2486
  private getLoggerConfig;
2446
- error(msg: string, data?: Record<string, any>): void;
2447
- warn(msg: string, data?: Record<string, any>): void;
2448
- info(msg: string, data?: Record<string, any>): void;
2449
- debug(msg: string, data?: Record<string, any>): void;
2450
- log(level: LogLevel, msg: string, data?: Record<string, any>): void;
2487
+ error(msg: string, data?: Record<string, any> | Error): void;
2488
+ warn(msg: string, data?: Record<string, any> | Error): void;
2489
+ info(msg: string, data?: Record<string, any> | Error): void;
2490
+ debug(msg: string, data?: Record<string, any> | Error): void;
2491
+ log(level: LogLevel, msg: string, data?: Record<string, any> | Error): void;
2451
2492
  }
2452
2493
 
2453
2494
  export declare interface LoggerConfig {
@@ -2711,6 +2752,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
2711
2752
  private readonly authorizeUrl;
2712
2753
  private readonly tokenUrl;
2713
2754
  private readonly logoutUrl;
2755
+ private readonly fhircastHubUrl;
2714
2756
  private readonly onUnauthenticated?;
2715
2757
  private readonly autoBatchTime;
2716
2758
  private readonly autoBatchQueue;
@@ -2773,6 +2815,14 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
2773
2815
  * @returns The current logout URL.
2774
2816
  */
2775
2817
  getLogoutUrl(): string;
2818
+ /**
2819
+ * Returns the current FHIRcast Hub URL.
2820
+ * By default, this is set to `https://api.medplum.com/fhircast/STU3`.
2821
+ * This can be overridden by setting the `logoutUrl` option when creating the client.
2822
+ * @category HTTP
2823
+ * @returns The current FHIRcast Hub URL.
2824
+ */
2825
+ getFhircastHubUrl(): string;
2776
2826
  /**
2777
2827
  * Clears all auth state including local storage and session storage.
2778
2828
  * @category Authentication
@@ -2826,7 +2876,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
2826
2876
  * @param options - Optional fetch options.
2827
2877
  * @returns Promise to the response content.
2828
2878
  */
2829
- post(url: URL | string, body: any, contentType?: string, options?: MedplumRequestOptions): Promise<any>;
2879
+ post(url: URL | string, body?: any, contentType?: string, options?: MedplumRequestOptions): Promise<any>;
2830
2880
  /**
2831
2881
  * Makes an HTTP PUT request to the specified URL.
2832
2882
  *
@@ -4261,6 +4311,16 @@ export declare interface MedplumClientOptions {
4261
4311
  * Use this if you want to use a separate OAuth server.
4262
4312
  */
4263
4313
  logoutUrl?: string;
4314
+ /**
4315
+ * FHIRcast Hub URL.
4316
+ *
4317
+ * Default value is `fhircast/STU3`.
4318
+ *
4319
+ * Can be specified as absolute URL or relative to `baseUrl`.
4320
+ *
4321
+ * Use this if you want to use a different path when connecting to a FHIRcast hub.
4322
+ */
4323
+ fhircastHubUrl?: string;
4264
4324
  /**
4265
4325
  * The client ID.
4266
4326
  *
@@ -5354,6 +5414,14 @@ export declare class ReconnectingWebSocket extends TypedEventTarget<WebSocketEve
5354
5414
  private _clearTimeouts;
5355
5415
  }
5356
5416
 
5417
+ export declare type ReleaseManifest = {
5418
+ tag_name: string;
5419
+ assets: {
5420
+ name: string;
5421
+ browser_download_url: string;
5422
+ }[];
5423
+ };
5424
+
5357
5425
  /**
5358
5426
  * Removes duplicates in array using FHIRPath equality rules.
5359
5427
  * @param arr - The input array.
@@ -5494,6 +5562,8 @@ export declare function serializeFhircastSubscriptionRequest(subscriptionRequest
5494
5562
 
5495
5563
  export declare function serverError(err: Error): OperationOutcome;
5496
5564
 
5565
+ export declare function serverTimeout(msg?: string): OperationOutcome;
5566
+
5497
5567
  /**
5498
5568
  * Sets a code for a given system within a given codeable concept.
5499
5569
  * @param concept - The codeable concept.