@medplum/core 3.2.19 → 3.2.20

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
@@ -4904,8 +4956,9 @@ export declare const OperatorPrecedence: {
4904
4956
  Semicolon: number;
4905
4957
  };
4906
4958
 
4907
- export declare type Options = {
4959
+ export declare type Options<WS extends IWebSocket = WebSocket> = {
4908
4960
  WebSocket?: any;
4961
+ binaryType?: WS['binaryType'];
4909
4962
  maxReconnectionDelay?: number;
4910
4963
  minReconnectionDelay?: number;
4911
4964
  reconnectionDelayGrowFactor?: number;
@@ -5302,7 +5355,7 @@ export declare class ReadablePromise<T> implements Promise<T> {
5302
5355
  finally(onfinally?: (() => void) | null): Promise<T>;
5303
5356
  }
5304
5357
 
5305
- export declare class ReconnectingWebSocket extends TypedEventTarget<WebSocketEventMap_2> implements IReconnectingWebSocket {
5358
+ export declare class ReconnectingWebSocket<WS extends IWebSocket = WebSocket> extends TypedEventTarget<WebSocketEventMap_2> implements IReconnectingWebSocket {
5306
5359
  private _ws;
5307
5360
  private _retryCount;
5308
5361
  private _uptimeTimeout;
@@ -5315,8 +5368,8 @@ export declare class ReconnectingWebSocket extends TypedEventTarget<WebSocketEve
5315
5368
  private _debugLogger;
5316
5369
  protected _url: string;
5317
5370
  protected _protocols?: ProtocolsProvider;
5318
- protected _options: Options;
5319
- constructor(url: string, protocols?: ProtocolsProvider, options?: Options);
5371
+ protected _options: Options<WS>;
5372
+ constructor(url: string, protocols?: ProtocolsProvider, options?: Options<WS>);
5320
5373
  static get CONNECTING(): number;
5321
5374
  static get OPEN(): number;
5322
5375
  static get CLOSING(): number;
@@ -5325,8 +5378,8 @@ export declare class ReconnectingWebSocket extends TypedEventTarget<WebSocketEve
5325
5378
  get OPEN(): number;
5326
5379
  get CLOSING(): number;
5327
5380
  get CLOSED(): number;
5328
- get binaryType(): 'arraybuffer' | 'blob';
5329
- set binaryType(value: BinaryType);
5381
+ get binaryType(): WS['binaryType'];
5382
+ set binaryType(value: WS['binaryType']);
5330
5383
  /**
5331
5384
  * @returns The number or connection retries.
5332
5385
  */
@@ -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
@@ -4904,8 +4956,9 @@ export declare const OperatorPrecedence: {
4904
4956
  Semicolon: number;
4905
4957
  };
4906
4958
 
4907
- export declare type Options = {
4959
+ export declare type Options<WS extends IWebSocket = WebSocket> = {
4908
4960
  WebSocket?: any;
4961
+ binaryType?: WS['binaryType'];
4909
4962
  maxReconnectionDelay?: number;
4910
4963
  minReconnectionDelay?: number;
4911
4964
  reconnectionDelayGrowFactor?: number;
@@ -5302,7 +5355,7 @@ export declare class ReadablePromise<T> implements Promise<T> {
5302
5355
  finally(onfinally?: (() => void) | null): Promise<T>;
5303
5356
  }
5304
5357
 
5305
- export declare class ReconnectingWebSocket extends TypedEventTarget<WebSocketEventMap_2> implements IReconnectingWebSocket {
5358
+ export declare class ReconnectingWebSocket<WS extends IWebSocket = WebSocket> extends TypedEventTarget<WebSocketEventMap_2> implements IReconnectingWebSocket {
5306
5359
  private _ws;
5307
5360
  private _retryCount;
5308
5361
  private _uptimeTimeout;
@@ -5315,8 +5368,8 @@ export declare class ReconnectingWebSocket extends TypedEventTarget<WebSocketEve
5315
5368
  private _debugLogger;
5316
5369
  protected _url: string;
5317
5370
  protected _protocols?: ProtocolsProvider;
5318
- protected _options: Options;
5319
- constructor(url: string, protocols?: ProtocolsProvider, options?: Options);
5371
+ protected _options: Options<WS>;
5372
+ constructor(url: string, protocols?: ProtocolsProvider, options?: Options<WS>);
5320
5373
  static get CONNECTING(): number;
5321
5374
  static get OPEN(): number;
5322
5375
  static get CLOSING(): number;
@@ -5325,8 +5378,8 @@ export declare class ReconnectingWebSocket extends TypedEventTarget<WebSocketEve
5325
5378
  get OPEN(): number;
5326
5379
  get CLOSING(): number;
5327
5380
  get CLOSED(): number;
5328
- get binaryType(): 'arraybuffer' | 'blob';
5329
- set binaryType(value: BinaryType);
5381
+ get binaryType(): WS['binaryType'];
5382
+ set binaryType(value: WS['binaryType']);
5330
5383
  /**
5331
5384
  * @returns The number or connection retries.
5332
5385
  */