@medplum/core 5.1.16 → 5.1.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.
- package/dist/cjs/index.cjs +8 -8
- package/dist/cjs/index.cjs.map +3 -3
- package/dist/cjs/index.d.ts +35 -10
- package/dist/esm/index.d.ts +35 -10
- package/dist/esm/index.mjs +7 -7
- package/dist/esm/index.mjs.map +3 -3
- package/package.json +3 -3
package/dist/cjs/index.d.ts
CHANGED
|
@@ -3355,31 +3355,40 @@ export declare function isValidMedplumSemver(version: string): boolean;
|
|
|
3355
3355
|
|
|
3356
3356
|
/**
|
|
3357
3357
|
* Generic interface that an implementation of `WebSocket` must satisfy to be used with `ReconnectingWebSocket`.
|
|
3358
|
-
* This is a slightly modified fork of the `WebSocket` global type used in Node
|
|
3358
|
+
* This is a slightly modified fork of the `WebSocket` global type used in Node, narrowed to exactly the members
|
|
3359
|
+
* `ReconnectingWebSocket` actually depends on.
|
|
3359
3360
|
*
|
|
3360
|
-
*
|
|
3361
|
-
*
|
|
3361
|
+
* `addEventListener`/`removeEventListener` declare a typed overload against `IWebSocketEventMap` (the global event
|
|
3362
|
+
* interfaces, used here rather than the local `WebSocketEventMap` since they are generic enough to describe the
|
|
3363
|
+
* events `ReconnectingWebSocket` attaches to). They also declare the permissive string overload that the real
|
|
3364
|
+
* `WebSocket` types carry, which is what lets conformant implementations whose event types do not structurally
|
|
3365
|
+
* match the global ones (e.g. the `ws` library, whose events are a minimal subset and use `target: WebSocket`)
|
|
3366
|
+
* still satisfy this interface.
|
|
3367
|
+
*
|
|
3368
|
+
* The `onopen`/`onclose`/`onmessage`/`onerror` handler properties are intentionally omitted: `ReconnectingWebSocket`
|
|
3369
|
+
* never assigns to them (it uses `addEventListener`), and because they are function-valued properties their
|
|
3370
|
+
* parameters are checked contravariantly, which no single precise event type can satisfy across implementations
|
|
3371
|
+
* (e.g. `ws`'s events use `target: WebSocket` while the DOM's use `target: EventTarget | null`).
|
|
3372
|
+
*
|
|
3373
|
+
* `binaryType` is widened to `string` and `send()` accepts the full `Message` union; a particular implementation
|
|
3374
|
+
* should narrow each of these implementation-specific types.
|
|
3362
3375
|
*/
|
|
3363
3376
|
export declare interface IWebSocket {
|
|
3364
3377
|
binaryType: string;
|
|
3365
3378
|
readonly bufferedAmount: number;
|
|
3366
3379
|
readonly extensions: string;
|
|
3367
|
-
onclose: ((...args: any[]) => any) | null;
|
|
3368
|
-
onerror: ((...args: any[]) => any) | null;
|
|
3369
|
-
onmessage: ((...args: any[]) => any) | null;
|
|
3370
|
-
onopen: ((...args: any[]) => any) | null;
|
|
3371
3380
|
readonly protocol: string;
|
|
3372
3381
|
readonly readyState: number;
|
|
3373
3382
|
readonly url: string;
|
|
3374
3383
|
close(code?: number, reason?: string): void;
|
|
3375
|
-
send(data:
|
|
3384
|
+
send(data: Message): void;
|
|
3376
3385
|
readonly CLOSED: number;
|
|
3377
3386
|
readonly CLOSING: number;
|
|
3378
3387
|
readonly CONNECTING: number;
|
|
3379
3388
|
readonly OPEN: number;
|
|
3380
|
-
addEventListener<K extends keyof
|
|
3389
|
+
addEventListener<K extends keyof IWebSocketEventMap>(type: K, listener: (event: IWebSocketEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
|
|
3381
3390
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
3382
|
-
removeEventListener<K extends keyof
|
|
3391
|
+
removeEventListener<K extends keyof IWebSocketEventMap>(type: K, listener: (event: IWebSocketEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
3383
3392
|
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
3384
3393
|
}
|
|
3385
3394
|
|
|
@@ -6407,6 +6416,22 @@ export declare function normalizeCreateBinaryOptions(arg1: BinarySource | Create
|
|
|
6407
6416
|
|
|
6408
6417
|
export declare function normalizeCreatePdfOptions(arg1: TDocumentDefinitions | CreatePdfOptions, arg2: string | undefined | MedplumRequestOptions, arg3: Record<string, CustomTableLayout> | undefined, arg4: TFontDictionary | undefined): CreatePdfOptions;
|
|
6409
6418
|
|
|
6419
|
+
/**
|
|
6420
|
+
* Normalizes the various `error` event shapes dispatched by different `WebSocket` implementations
|
|
6421
|
+
* into a single `ErrorEvent` carrying a real `Error`, so downstream listeners always get `message`
|
|
6422
|
+
* and `error` regardless of the underlying implementation:
|
|
6423
|
+
*
|
|
6424
|
+
* - Browsers dispatch a plain `Event` with no error details (per the WHATWG WebSocket spec).
|
|
6425
|
+
* - Node's `ws` library and Node's built-in (undici) `WebSocket` dispatch an `ErrorEvent` with both
|
|
6426
|
+
* `message` and `error`.
|
|
6427
|
+
* - Bun dispatches a plain `Event` with a `message` string but no `error`.
|
|
6428
|
+
*
|
|
6429
|
+
* @param event - The `error` event as dispatched by the underlying `WebSocket`.
|
|
6430
|
+
* @param target - The `ReconnectingWebSocket` instance the normalized event is dispatched from.
|
|
6431
|
+
* @returns An `ErrorEvent` with a populated `message` and `error`.
|
|
6432
|
+
*/
|
|
6433
|
+
export declare function normalizeErrorEvent(event: Event | ErrorEvent_2, target: unknown): ErrorEvent_2;
|
|
6434
|
+
|
|
6410
6435
|
/**
|
|
6411
6436
|
* Normalizes an error object into a displayable error string.
|
|
6412
6437
|
* @param error - The error value which could be a string, Error, OperationOutcome, or other unknown type.
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -3355,31 +3355,40 @@ export declare function isValidMedplumSemver(version: string): boolean;
|
|
|
3355
3355
|
|
|
3356
3356
|
/**
|
|
3357
3357
|
* Generic interface that an implementation of `WebSocket` must satisfy to be used with `ReconnectingWebSocket`.
|
|
3358
|
-
* This is a slightly modified fork of the `WebSocket` global type used in Node
|
|
3358
|
+
* This is a slightly modified fork of the `WebSocket` global type used in Node, narrowed to exactly the members
|
|
3359
|
+
* `ReconnectingWebSocket` actually depends on.
|
|
3359
3360
|
*
|
|
3360
|
-
*
|
|
3361
|
-
*
|
|
3361
|
+
* `addEventListener`/`removeEventListener` declare a typed overload against `IWebSocketEventMap` (the global event
|
|
3362
|
+
* interfaces, used here rather than the local `WebSocketEventMap` since they are generic enough to describe the
|
|
3363
|
+
* events `ReconnectingWebSocket` attaches to). They also declare the permissive string overload that the real
|
|
3364
|
+
* `WebSocket` types carry, which is what lets conformant implementations whose event types do not structurally
|
|
3365
|
+
* match the global ones (e.g. the `ws` library, whose events are a minimal subset and use `target: WebSocket`)
|
|
3366
|
+
* still satisfy this interface.
|
|
3367
|
+
*
|
|
3368
|
+
* The `onopen`/`onclose`/`onmessage`/`onerror` handler properties are intentionally omitted: `ReconnectingWebSocket`
|
|
3369
|
+
* never assigns to them (it uses `addEventListener`), and because they are function-valued properties their
|
|
3370
|
+
* parameters are checked contravariantly, which no single precise event type can satisfy across implementations
|
|
3371
|
+
* (e.g. `ws`'s events use `target: WebSocket` while the DOM's use `target: EventTarget | null`).
|
|
3372
|
+
*
|
|
3373
|
+
* `binaryType` is widened to `string` and `send()` accepts the full `Message` union; a particular implementation
|
|
3374
|
+
* should narrow each of these implementation-specific types.
|
|
3362
3375
|
*/
|
|
3363
3376
|
export declare interface IWebSocket {
|
|
3364
3377
|
binaryType: string;
|
|
3365
3378
|
readonly bufferedAmount: number;
|
|
3366
3379
|
readonly extensions: string;
|
|
3367
|
-
onclose: ((...args: any[]) => any) | null;
|
|
3368
|
-
onerror: ((...args: any[]) => any) | null;
|
|
3369
|
-
onmessage: ((...args: any[]) => any) | null;
|
|
3370
|
-
onopen: ((...args: any[]) => any) | null;
|
|
3371
3380
|
readonly protocol: string;
|
|
3372
3381
|
readonly readyState: number;
|
|
3373
3382
|
readonly url: string;
|
|
3374
3383
|
close(code?: number, reason?: string): void;
|
|
3375
|
-
send(data:
|
|
3384
|
+
send(data: Message): void;
|
|
3376
3385
|
readonly CLOSED: number;
|
|
3377
3386
|
readonly CLOSING: number;
|
|
3378
3387
|
readonly CONNECTING: number;
|
|
3379
3388
|
readonly OPEN: number;
|
|
3380
|
-
addEventListener<K extends keyof
|
|
3389
|
+
addEventListener<K extends keyof IWebSocketEventMap>(type: K, listener: (event: IWebSocketEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
|
|
3381
3390
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
3382
|
-
removeEventListener<K extends keyof
|
|
3391
|
+
removeEventListener<K extends keyof IWebSocketEventMap>(type: K, listener: (event: IWebSocketEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
3383
3392
|
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
3384
3393
|
}
|
|
3385
3394
|
|
|
@@ -6407,6 +6416,22 @@ export declare function normalizeCreateBinaryOptions(arg1: BinarySource | Create
|
|
|
6407
6416
|
|
|
6408
6417
|
export declare function normalizeCreatePdfOptions(arg1: TDocumentDefinitions | CreatePdfOptions, arg2: string | undefined | MedplumRequestOptions, arg3: Record<string, CustomTableLayout> | undefined, arg4: TFontDictionary | undefined): CreatePdfOptions;
|
|
6409
6418
|
|
|
6419
|
+
/**
|
|
6420
|
+
* Normalizes the various `error` event shapes dispatched by different `WebSocket` implementations
|
|
6421
|
+
* into a single `ErrorEvent` carrying a real `Error`, so downstream listeners always get `message`
|
|
6422
|
+
* and `error` regardless of the underlying implementation:
|
|
6423
|
+
*
|
|
6424
|
+
* - Browsers dispatch a plain `Event` with no error details (per the WHATWG WebSocket spec).
|
|
6425
|
+
* - Node's `ws` library and Node's built-in (undici) `WebSocket` dispatch an `ErrorEvent` with both
|
|
6426
|
+
* `message` and `error`.
|
|
6427
|
+
* - Bun dispatches a plain `Event` with a `message` string but no `error`.
|
|
6428
|
+
*
|
|
6429
|
+
* @param event - The `error` event as dispatched by the underlying `WebSocket`.
|
|
6430
|
+
* @param target - The `ReconnectingWebSocket` instance the normalized event is dispatched from.
|
|
6431
|
+
* @returns An `ErrorEvent` with a populated `message` and `error`.
|
|
6432
|
+
*/
|
|
6433
|
+
export declare function normalizeErrorEvent(event: Event | ErrorEvent_2, target: unknown): ErrorEvent_2;
|
|
6434
|
+
|
|
6410
6435
|
/**
|
|
6411
6436
|
* Normalizes an error object into a displayable error string.
|
|
6412
6437
|
* @param error - The error value which could be a string, Error, OperationOutcome, or other unknown type.
|