@medplum/core 3.2.19 → 3.2.21

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.
@@ -1744,6 +1744,16 @@ export declare interface GetTypedPropertyValueOptions {
1744
1744
  profileUrl?: string;
1745
1745
  }
1746
1746
 
1747
+ /**
1748
+ * Returns the value of the property and the property type using a type schema.
1749
+ * Note that because the type schema is not available, this function may be inaccurate.
1750
+ * In some cases, that is the desired behavior.
1751
+ * @param typedValue - The base context (FHIR resource or backbone element).
1752
+ * @param path - The property path.
1753
+ * @returns The value of the property and the property type.
1754
+ */
1755
+ export declare function getTypedPropertyValueWithoutSchema(typedValue: TypedValue, path: string): TypedValue[] | TypedValue | undefined;
1756
+
1747
1757
  export declare function getTypedPropertyValueWithPath(input: TypedValue | TypedValueWithPath, path: string, options?: GetTypedPropertyValueOptions): TypedValueWithPath[] | TypedValueWithPath;
1748
1758
 
1749
1759
  /**
@@ -2459,6 +2469,48 @@ export declare function isValidHostname(input: string): boolean;
2459
2469
  */
2460
2470
  export declare function isValidMedplumSemver(version: string): boolean;
2461
2471
 
2472
+ /**
2473
+ * Generic interface that an implementation of `WebSocket` must satisfy to be used with `ReconnectingWebSocket`.
2474
+ * This is a slightly modified fork of the `WebSocket` global type used in Node.
2475
+ *
2476
+ * The main key difference is making all the `onclose`, `onerror`, etc. functions have `any[]` args, making `data` in `send()` of type `any`, and making `binaryType` of type string,
2477
+ * though the particular implementation should narrow each of these implementation-specific types.
2478
+ */
2479
+ export declare interface IWebSocket {
2480
+ binaryType: string;
2481
+ readonly bufferedAmount: number;
2482
+ readonly extensions: string;
2483
+ onclose: ((...args: any[]) => any) | null;
2484
+ onerror: ((...args: any[]) => any) | null;
2485
+ onmessage: ((...args: any[]) => any) | null;
2486
+ onopen: ((...args: any[]) => any) | null;
2487
+ readonly protocol: string;
2488
+ readonly readyState: number;
2489
+ readonly url: string;
2490
+ close(code?: number, reason?: string): void;
2491
+ send(data: any): void;
2492
+ readonly CLOSED: number;
2493
+ readonly CLOSING: number;
2494
+ readonly CONNECTING: number;
2495
+ readonly OPEN: number;
2496
+ addEventListener<K extends keyof WebSocketEventMap_2>(type: K, listener: (ev: WebSocketEventMap_2[K]) => any, options?: boolean | AddEventListenerOptions): void;
2497
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
2498
+ removeEventListener<K extends keyof WebSocketEventMap_2>(type: K, listener: (ev: WebSocketEventMap_2[K]) => any, options?: boolean | EventListenerOptions): void;
2499
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
2500
+ }
2501
+
2502
+ /**
2503
+ * This map exists separately from `WebSocketEventMap`, which is the actual event map used for the `ReconnectingWebSocket` class itself,
2504
+ * due to slight difference in the type between the events as we use them, and the events as they exist as global interfaces. We need the global interfaces
2505
+ * to be generic enough to satisfy conformant implementations that don't exactly match the events we export and use in `ReconnectingWebSocket` itself.
2506
+ */
2507
+ export declare type IWebSocketEventMap = {
2508
+ close: globalThis.CloseEvent;
2509
+ error: globalThis.ErrorEvent;
2510
+ message: globalThis.MessageEvent;
2511
+ open: Event;
2512
+ };
2513
+
2462
2514
  /**
2463
2515
  * Memoizes the result of a parameterless function
2464
2516
  * @param fn - The function to be wrapped
@@ -4451,6 +4503,14 @@ export declare interface MedplumClientOptions {
4451
4503
  * When the verbose flag is set, the client will log all requests and responses to the console.
4452
4504
  */
4453
4505
  verbose?: boolean;
4506
+ /**
4507
+ * Optional flag to enable or disable Medplum extended mode.
4508
+ *
4509
+ * Medplum extended mode includes a few non-standard FHIR properties such as meta.author and meta.project.
4510
+ *
4511
+ * Default is true.
4512
+ */
4513
+ extendedMode?: boolean;
4454
4514
  }
4455
4515
 
4456
4516
  export declare interface MedplumInfraConfig {
@@ -4904,8 +4964,9 @@ export declare const OperatorPrecedence: {
4904
4964
  Semicolon: number;
4905
4965
  };
4906
4966
 
4907
- export declare type Options = {
4967
+ export declare type Options<WS extends IWebSocket = WebSocket> = {
4908
4968
  WebSocket?: any;
4969
+ binaryType?: WS['binaryType'];
4909
4970
  maxReconnectionDelay?: number;
4910
4971
  minReconnectionDelay?: number;
4911
4972
  reconnectionDelayGrowFactor?: number;
@@ -5302,7 +5363,7 @@ export declare class ReadablePromise<T> implements Promise<T> {
5302
5363
  finally(onfinally?: (() => void) | null): Promise<T>;
5303
5364
  }
5304
5365
 
5305
- export declare class ReconnectingWebSocket extends TypedEventTarget<WebSocketEventMap_2> implements IReconnectingWebSocket {
5366
+ export declare class ReconnectingWebSocket<WS extends IWebSocket = WebSocket> extends TypedEventTarget<WebSocketEventMap_2> implements IReconnectingWebSocket {
5306
5367
  private _ws;
5307
5368
  private _retryCount;
5308
5369
  private _uptimeTimeout;
@@ -5315,8 +5376,8 @@ export declare class ReconnectingWebSocket extends TypedEventTarget<WebSocketEve
5315
5376
  private _debugLogger;
5316
5377
  protected _url: string;
5317
5378
  protected _protocols?: ProtocolsProvider;
5318
- protected _options: Options;
5319
- constructor(url: string, protocols?: ProtocolsProvider, options?: Options);
5379
+ protected _options: Options<WS>;
5380
+ constructor(url: string, protocols?: ProtocolsProvider, options?: Options<WS>);
5320
5381
  static get CONNECTING(): number;
5321
5382
  static get OPEN(): number;
5322
5383
  static get CLOSING(): number;
@@ -5325,8 +5386,8 @@ export declare class ReconnectingWebSocket extends TypedEventTarget<WebSocketEve
5325
5386
  get OPEN(): number;
5326
5387
  get CLOSING(): number;
5327
5388
  get CLOSED(): number;
5328
- get binaryType(): 'arraybuffer' | 'blob';
5329
- set binaryType(value: BinaryType);
5389
+ get binaryType(): WS['binaryType'];
5390
+ set binaryType(value: WS['binaryType']);
5330
5391
  /**
5331
5392
  * @returns The number or connection retries.
5332
5393
  */
@@ -1744,6 +1744,16 @@ export declare interface GetTypedPropertyValueOptions {
1744
1744
  profileUrl?: string;
1745
1745
  }
1746
1746
 
1747
+ /**
1748
+ * Returns the value of the property and the property type using a type schema.
1749
+ * Note that because the type schema is not available, this function may be inaccurate.
1750
+ * In some cases, that is the desired behavior.
1751
+ * @param typedValue - The base context (FHIR resource or backbone element).
1752
+ * @param path - The property path.
1753
+ * @returns The value of the property and the property type.
1754
+ */
1755
+ export declare function getTypedPropertyValueWithoutSchema(typedValue: TypedValue, path: string): TypedValue[] | TypedValue | undefined;
1756
+
1747
1757
  export declare function getTypedPropertyValueWithPath(input: TypedValue | TypedValueWithPath, path: string, options?: GetTypedPropertyValueOptions): TypedValueWithPath[] | TypedValueWithPath;
1748
1758
 
1749
1759
  /**
@@ -2459,6 +2469,48 @@ export declare function isValidHostname(input: string): boolean;
2459
2469
  */
2460
2470
  export declare function isValidMedplumSemver(version: string): boolean;
2461
2471
 
2472
+ /**
2473
+ * Generic interface that an implementation of `WebSocket` must satisfy to be used with `ReconnectingWebSocket`.
2474
+ * This is a slightly modified fork of the `WebSocket` global type used in Node.
2475
+ *
2476
+ * The main key difference is making all the `onclose`, `onerror`, etc. functions have `any[]` args, making `data` in `send()` of type `any`, and making `binaryType` of type string,
2477
+ * though the particular implementation should narrow each of these implementation-specific types.
2478
+ */
2479
+ export declare interface IWebSocket {
2480
+ binaryType: string;
2481
+ readonly bufferedAmount: number;
2482
+ readonly extensions: string;
2483
+ onclose: ((...args: any[]) => any) | null;
2484
+ onerror: ((...args: any[]) => any) | null;
2485
+ onmessage: ((...args: any[]) => any) | null;
2486
+ onopen: ((...args: any[]) => any) | null;
2487
+ readonly protocol: string;
2488
+ readonly readyState: number;
2489
+ readonly url: string;
2490
+ close(code?: number, reason?: string): void;
2491
+ send(data: any): void;
2492
+ readonly CLOSED: number;
2493
+ readonly CLOSING: number;
2494
+ readonly CONNECTING: number;
2495
+ readonly OPEN: number;
2496
+ addEventListener<K extends keyof WebSocketEventMap_2>(type: K, listener: (ev: WebSocketEventMap_2[K]) => any, options?: boolean | AddEventListenerOptions): void;
2497
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
2498
+ removeEventListener<K extends keyof WebSocketEventMap_2>(type: K, listener: (ev: WebSocketEventMap_2[K]) => any, options?: boolean | EventListenerOptions): void;
2499
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
2500
+ }
2501
+
2502
+ /**
2503
+ * This map exists separately from `WebSocketEventMap`, which is the actual event map used for the `ReconnectingWebSocket` class itself,
2504
+ * due to slight difference in the type between the events as we use them, and the events as they exist as global interfaces. We need the global interfaces
2505
+ * to be generic enough to satisfy conformant implementations that don't exactly match the events we export and use in `ReconnectingWebSocket` itself.
2506
+ */
2507
+ export declare type IWebSocketEventMap = {
2508
+ close: globalThis.CloseEvent;
2509
+ error: globalThis.ErrorEvent;
2510
+ message: globalThis.MessageEvent;
2511
+ open: Event;
2512
+ };
2513
+
2462
2514
  /**
2463
2515
  * Memoizes the result of a parameterless function
2464
2516
  * @param fn - The function to be wrapped
@@ -4451,6 +4503,14 @@ export declare interface MedplumClientOptions {
4451
4503
  * When the verbose flag is set, the client will log all requests and responses to the console.
4452
4504
  */
4453
4505
  verbose?: boolean;
4506
+ /**
4507
+ * Optional flag to enable or disable Medplum extended mode.
4508
+ *
4509
+ * Medplum extended mode includes a few non-standard FHIR properties such as meta.author and meta.project.
4510
+ *
4511
+ * Default is true.
4512
+ */
4513
+ extendedMode?: boolean;
4454
4514
  }
4455
4515
 
4456
4516
  export declare interface MedplumInfraConfig {
@@ -4904,8 +4964,9 @@ export declare const OperatorPrecedence: {
4904
4964
  Semicolon: number;
4905
4965
  };
4906
4966
 
4907
- export declare type Options = {
4967
+ export declare type Options<WS extends IWebSocket = WebSocket> = {
4908
4968
  WebSocket?: any;
4969
+ binaryType?: WS['binaryType'];
4909
4970
  maxReconnectionDelay?: number;
4910
4971
  minReconnectionDelay?: number;
4911
4972
  reconnectionDelayGrowFactor?: number;
@@ -5302,7 +5363,7 @@ export declare class ReadablePromise<T> implements Promise<T> {
5302
5363
  finally(onfinally?: (() => void) | null): Promise<T>;
5303
5364
  }
5304
5365
 
5305
- export declare class ReconnectingWebSocket extends TypedEventTarget<WebSocketEventMap_2> implements IReconnectingWebSocket {
5366
+ export declare class ReconnectingWebSocket<WS extends IWebSocket = WebSocket> extends TypedEventTarget<WebSocketEventMap_2> implements IReconnectingWebSocket {
5306
5367
  private _ws;
5307
5368
  private _retryCount;
5308
5369
  private _uptimeTimeout;
@@ -5315,8 +5376,8 @@ export declare class ReconnectingWebSocket extends TypedEventTarget<WebSocketEve
5315
5376
  private _debugLogger;
5316
5377
  protected _url: string;
5317
5378
  protected _protocols?: ProtocolsProvider;
5318
- protected _options: Options;
5319
- constructor(url: string, protocols?: ProtocolsProvider, options?: Options);
5379
+ protected _options: Options<WS>;
5380
+ constructor(url: string, protocols?: ProtocolsProvider, options?: Options<WS>);
5320
5381
  static get CONNECTING(): number;
5321
5382
  static get OPEN(): number;
5322
5383
  static get CLOSING(): number;
@@ -5325,8 +5386,8 @@ export declare class ReconnectingWebSocket extends TypedEventTarget<WebSocketEve
5325
5386
  get OPEN(): number;
5326
5387
  get CLOSING(): number;
5327
5388
  get CLOSED(): number;
5328
- get binaryType(): 'arraybuffer' | 'blob';
5329
- set binaryType(value: BinaryType);
5389
+ get binaryType(): WS['binaryType'];
5390
+ set binaryType(value: WS['binaryType']);
5330
5391
  /**
5331
5392
  * @returns The number or connection retries.
5332
5393
  */