@medplum/core 3.2.17 → 3.2.19

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
  */
@@ -2420,6 +2451,14 @@ export declare function isValidDate(date: Date): boolean;
2420
2451
  */
2421
2452
  export declare function isValidHostname(input: string): boolean;
2422
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
+
2423
2462
  /**
2424
2463
  * Memoizes the result of a parameterless function
2425
2464
  * @param fn - The function to be wrapped
@@ -2445,11 +2484,11 @@ export declare class Logger {
2445
2484
  constructor(write: (msg: string) => void, metadata?: Record<string, any>, level?: LogLevel, options?: LoggerOptions | undefined);
2446
2485
  clone(override?: LoggerConfigOverride): Logger;
2447
2486
  private getLoggerConfig;
2448
- error(msg: string, data?: Record<string, any>): void;
2449
- warn(msg: string, data?: Record<string, any>): void;
2450
- info(msg: string, data?: Record<string, any>): void;
2451
- debug(msg: string, data?: Record<string, any>): void;
2452
- 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;
2453
2492
  }
2454
2493
 
2455
2494
  export declare interface LoggerConfig {
@@ -2713,6 +2752,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
2713
2752
  private readonly authorizeUrl;
2714
2753
  private readonly tokenUrl;
2715
2754
  private readonly logoutUrl;
2755
+ private readonly fhircastHubUrl;
2716
2756
  private readonly onUnauthenticated?;
2717
2757
  private readonly autoBatchTime;
2718
2758
  private readonly autoBatchQueue;
@@ -2775,6 +2815,14 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
2775
2815
  * @returns The current logout URL.
2776
2816
  */
2777
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;
2778
2826
  /**
2779
2827
  * Clears all auth state including local storage and session storage.
2780
2828
  * @category Authentication
@@ -4263,6 +4311,16 @@ export declare interface MedplumClientOptions {
4263
4311
  * Use this if you want to use a separate OAuth server.
4264
4312
  */
4265
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;
4266
4324
  /**
4267
4325
  * The client ID.
4268
4326
  *
@@ -5356,6 +5414,14 @@ export declare class ReconnectingWebSocket extends TypedEventTarget<WebSocketEve
5356
5414
  private _clearTimeouts;
5357
5415
  }
5358
5416
 
5417
+ export declare type ReleaseManifest = {
5418
+ tag_name: string;
5419
+ assets: {
5420
+ name: string;
5421
+ browser_download_url: string;
5422
+ }[];
5423
+ };
5424
+
5359
5425
  /**
5360
5426
  * Removes duplicates in array using FHIRPath equality rules.
5361
5427
  * @param arr - The input array.
@@ -5496,6 +5562,8 @@ export declare function serializeFhircastSubscriptionRequest(subscriptionRequest
5496
5562
 
5497
5563
  export declare function serverError(err: Error): OperationOutcome;
5498
5564
 
5565
+ export declare function serverTimeout(msg?: string): OperationOutcome;
5566
+
5499
5567
  /**
5500
5568
  * Sets a code for a given system within a given codeable concept.
5501
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
  */
@@ -2420,6 +2451,14 @@ export declare function isValidDate(date: Date): boolean;
2420
2451
  */
2421
2452
  export declare function isValidHostname(input: string): boolean;
2422
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
+
2423
2462
  /**
2424
2463
  * Memoizes the result of a parameterless function
2425
2464
  * @param fn - The function to be wrapped
@@ -2445,11 +2484,11 @@ export declare class Logger {
2445
2484
  constructor(write: (msg: string) => void, metadata?: Record<string, any>, level?: LogLevel, options?: LoggerOptions | undefined);
2446
2485
  clone(override?: LoggerConfigOverride): Logger;
2447
2486
  private getLoggerConfig;
2448
- error(msg: string, data?: Record<string, any>): void;
2449
- warn(msg: string, data?: Record<string, any>): void;
2450
- info(msg: string, data?: Record<string, any>): void;
2451
- debug(msg: string, data?: Record<string, any>): void;
2452
- 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;
2453
2492
  }
2454
2493
 
2455
2494
  export declare interface LoggerConfig {
@@ -2713,6 +2752,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
2713
2752
  private readonly authorizeUrl;
2714
2753
  private readonly tokenUrl;
2715
2754
  private readonly logoutUrl;
2755
+ private readonly fhircastHubUrl;
2716
2756
  private readonly onUnauthenticated?;
2717
2757
  private readonly autoBatchTime;
2718
2758
  private readonly autoBatchQueue;
@@ -2775,6 +2815,14 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
2775
2815
  * @returns The current logout URL.
2776
2816
  */
2777
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;
2778
2826
  /**
2779
2827
  * Clears all auth state including local storage and session storage.
2780
2828
  * @category Authentication
@@ -4263,6 +4311,16 @@ export declare interface MedplumClientOptions {
4263
4311
  * Use this if you want to use a separate OAuth server.
4264
4312
  */
4265
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;
4266
4324
  /**
4267
4325
  * The client ID.
4268
4326
  *
@@ -5356,6 +5414,14 @@ export declare class ReconnectingWebSocket extends TypedEventTarget<WebSocketEve
5356
5414
  private _clearTimeouts;
5357
5415
  }
5358
5416
 
5417
+ export declare type ReleaseManifest = {
5418
+ tag_name: string;
5419
+ assets: {
5420
+ name: string;
5421
+ browser_download_url: string;
5422
+ }[];
5423
+ };
5424
+
5359
5425
  /**
5360
5426
  * Removes duplicates in array using FHIRPath equality rules.
5361
5427
  * @param arr - The input array.
@@ -5496,6 +5562,8 @@ export declare function serializeFhircastSubscriptionRequest(subscriptionRequest
5496
5562
 
5497
5563
  export declare function serverError(err: Error): OperationOutcome;
5498
5564
 
5565
+ export declare function serverTimeout(msg?: string): OperationOutcome;
5566
+
5499
5567
  /**
5500
5568
  * Sets a code for a given system within a given codeable concept.
5501
5569
  * @param concept - The codeable concept.