@genesislcap/foundation-comms 15.82.0 → 15.84.0

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.
Files changed (46) hide show
  1. package/dist/dts/connect/connect.d.ts +22 -10
  2. package/dist/dts/connect/connect.d.ts.map +1 -1
  3. package/dist/dts/connect/connect.errors.d.ts +120 -0
  4. package/dist/dts/connect/connect.errors.d.ts.map +1 -0
  5. package/dist/dts/connect/connect.types.d.ts +27 -0
  6. package/dist/dts/connect/connect.types.d.ts.map +1 -1
  7. package/dist/dts/connect/errorCodes.d.ts +6 -0
  8. package/dist/dts/connect/errorCodes.d.ts.map +1 -0
  9. package/dist/dts/connect/http.connect.d.ts +14 -5
  10. package/dist/dts/connect/http.connect.d.ts.map +1 -1
  11. package/dist/dts/connect/http.d.ts +1 -0
  12. package/dist/dts/connect/http.d.ts.map +1 -1
  13. package/dist/dts/connect/httpTransport.d.ts +12 -6
  14. package/dist/dts/connect/httpTransport.d.ts.map +1 -1
  15. package/dist/dts/connect/index.d.ts +1 -0
  16. package/dist/dts/connect/index.d.ts.map +1 -1
  17. package/dist/dts/connect/message.d.ts +18 -1
  18. package/dist/dts/connect/message.d.ts.map +1 -1
  19. package/dist/dts/connect/networkFailure.d.ts +7 -0
  20. package/dist/dts/connect/networkFailure.d.ts.map +1 -0
  21. package/dist/dts/connect/reconnectStrategy.d.ts +2 -1
  22. package/dist/dts/connect/reconnectStrategy.d.ts.map +1 -1
  23. package/dist/dts/connect/requestLifecycle.d.ts +23 -0
  24. package/dist/dts/connect/requestLifecycle.d.ts.map +1 -0
  25. package/dist/dts/connect/socket.d.ts +14 -3
  26. package/dist/dts/connect/socket.d.ts.map +1 -1
  27. package/dist/dts/connect/socket.types.d.ts +5 -0
  28. package/dist/dts/connect/socket.types.d.ts.map +1 -1
  29. package/dist/dts/utils/error-code.d.ts +2 -1
  30. package/dist/dts/utils/error-code.d.ts.map +1 -1
  31. package/dist/esm/connect/connect.errors.js +192 -0
  32. package/dist/esm/connect/connect.js +56 -28
  33. package/dist/esm/connect/errorCodes.js +20 -0
  34. package/dist/esm/connect/http.connect.js +166 -74
  35. package/dist/esm/connect/http.js +22 -9
  36. package/dist/esm/connect/httpTransport.js +35 -12
  37. package/dist/esm/connect/index.js +1 -0
  38. package/dist/esm/connect/message.js +6 -1
  39. package/dist/esm/connect/networkFailure.js +12 -0
  40. package/dist/esm/connect/reconnectStrategy.js +4 -3
  41. package/dist/esm/connect/requestLifecycle.js +96 -0
  42. package/dist/esm/connect/socket.js +57 -34
  43. package/dist/esm/utils/error-code.js +6 -2
  44. package/dist/foundation-comms.api.json +1572 -34
  45. package/dist/foundation-comms.d.ts +238 -24
  46. package/package.json +12 -12
@@ -219,6 +219,18 @@ declare type CommitEventDetail_2 = {
219
219
  message: Message_2;
220
220
  };
221
221
 
222
+ /**
223
+ * Options for `Connect.commitEvent`.
224
+ * @public
225
+ */
226
+ export declare interface CommitEventOptions extends ConnectRequestOptions {
227
+ /**
228
+ * Reject with a `ConnectNackError` when the server replies with an `EVENT_NACK`, instead of
229
+ * resolving with it. Default: false.
230
+ */
231
+ rejectEventNack?: boolean;
232
+ }
233
+
222
234
  /**
223
235
  * @public
224
236
  */
@@ -306,9 +318,10 @@ export declare interface Connect {
306
318
  * @param message - The message to send.
307
319
  * @typeParam T - The type of the Message's DETAILS payload.
308
320
  * @param needsHandling - Whether the response needs to be handled manually. Default: false.
321
+ * @param options - Timeout and abort signal for the reply.
309
322
  * @returns A promise that resolves with the server's response.
310
323
  */
311
- send<T>(message: Message<T | any>, needsHandling?: boolean): Promise<Message | any>;
324
+ send<T>(message: Message<T | any>, needsHandling?: boolean, options?: ConnectRequestOptions): Promise<Message | any>;
312
325
  /**
313
326
  * Returns whether the connection is in HTTP mode.
314
327
  * @internal
@@ -401,9 +414,10 @@ export declare interface Connect {
401
414
  * @public
402
415
  * @param resourceName - The name of the resource to retrieve the metadata for.
403
416
  * @param useCache - Whether to use the cached metadata if available. Default: true.
417
+ * @param options - Timeout and abort signal for the reply.
404
418
  * @returns A promise that resolves with the metadata.
405
419
  */
406
- getMetadata(resourceName: string, useCache?: boolean): Promise<Metadata>;
420
+ getMetadata(resourceName: string, useCache?: boolean, options?: ConnectRequestOptions): Promise<Metadata>;
407
421
  /**
408
422
  * Retrieves the JSON schema for the specified resource.
409
423
  * @public
@@ -418,9 +432,10 @@ export declare interface Connect {
418
432
  * @param useCache - Whether to return a cached response when one exists for the same
419
433
  * `resourceName` + `params` combination, and cache the response when a fresh request is made.
420
434
  * Default: false.
435
+ * @param options - Timeout and abort signal for the reply.
421
436
  * @returns A promise that resolves to a Message containing the server's response.
422
437
  */
423
- request(resourceName: string, params?: RequestParams, useCache?: boolean): Promise<Message>;
438
+ request(resourceName: string, params?: RequestParams, useCache?: boolean, options?: ConnectRequestOptions): Promise<Message>;
424
439
  /**
425
440
  * Sends a request to the server to get available resources.
426
441
  * @public
@@ -434,9 +449,10 @@ export declare interface Connect {
434
449
  * @public
435
450
  * @param resourceName - The name of the resource to request.
436
451
  * @param params - An object containing optional parameters to include in the request.
452
+ * @param options - Timeout and abort signal for the reply, and whether an `EVENT_NACK` rejects.
437
453
  * @returns A promise that resolves to a Message containing the server's response.
438
454
  */
439
- commitEvent(eventName: string, params?: CommitParams): Promise<Message>;
455
+ commitEvent(eventName: string, params?: CommitParams, options?: CommitEventOptions): Promise<Message>;
440
456
  /**
441
457
  * @returns The host provided.
442
458
  */
@@ -449,6 +465,19 @@ export declare interface Connect {
449
465
  */
450
466
  export declare const Connect: InterfaceSymbol<Connect>;
451
467
 
468
+ /**
469
+ * The request's `AbortSignal` aborted before a reply arrived.
470
+ * @public
471
+ */
472
+ export declare class ConnectAbortError extends ConnectError {
473
+ /** The signal's abort reason. */
474
+ readonly reason?: unknown;
475
+ get kind(): 'abort';
476
+ constructor(
477
+ /** The signal's abort reason. */
478
+ reason?: unknown);
479
+ }
480
+
452
481
  /**
453
482
  * Configuration options for the Connect (WS) instance.
454
483
  * @public
@@ -474,6 +503,24 @@ export declare interface ConnectConfig {
474
503
  */
475
504
  export declare const ConnectConfig: InterfaceSymbol<ConnectConfig>;
476
505
 
506
+ /**
507
+ * Base class of the errors Connect rejects with. Narrow with `instanceof` on a subclass or by `kind`.
508
+ * @public
509
+ */
510
+ export declare abstract class ConnectError extends Error {
511
+ /** What went wrong. */
512
+ abstract get kind(): ConnectErrorKind;
513
+ /** The underlying error, when there is one. */
514
+ readonly cause?: unknown;
515
+ protected constructor(message: string, cause?: unknown);
516
+ }
517
+
518
+ /**
519
+ * The kinds of {@link ConnectError}.
520
+ * @public
521
+ */
522
+ export declare type ConnectErrorKind = 'nack' | 'transport' | 'http' | 'timeout' | 'abort';
523
+
477
524
  /**
478
525
  * `ConnectEvents` provide hooks to respond to specific connect events.
479
526
  *
@@ -597,6 +644,27 @@ export declare class ConnectEventsMock {
597
644
  onCommitResponseEvent(eventName: string, response: Message_2): void;
598
645
  }
599
646
 
647
+ /**
648
+ * An HTTP request failed with a non-2xx status.
649
+ * @public
650
+ */
651
+ export declare class ConnectHttpError extends ConnectError implements HttpError {
652
+ /** The HTTP status code. */
653
+ readonly status: number;
654
+ /** The HTTP status text. */
655
+ readonly statusText: string;
656
+ /** The response body, parsed as JSON when it is JSON. It may hold a Genesis NACK. */
657
+ readonly body?: unknown;
658
+ get kind(): 'http';
659
+ constructor(
660
+ /** The HTTP status code. */
661
+ status: number,
662
+ /** The HTTP status text. */
663
+ statusText?: string,
664
+ /** The response body, parsed as JSON when it is JSON. It may hold a Genesis NACK. */
665
+ body?: unknown);
666
+ }
667
+
600
668
  /**
601
669
  * The connection status of the Genesis client.
602
670
  * @public
@@ -637,6 +705,83 @@ export declare class ConnectMock implements Connect {
637
705
  getJSONSchema(resourceName: string): Promise<any>;
638
706
  }
639
707
 
708
+ /**
709
+ * The server rejected the request with a NACK.
710
+ * @remarks
711
+ * Keeps `receivedMessage` and `sentMessage`, the shape Connect rejected NACKs with before.
712
+ * @public
713
+ */
714
+ export declare class ConnectNackError extends ConnectError {
715
+ /** The NACK the server replied with. */
716
+ readonly receivedMessage: Message;
717
+ /** The message that was NACKed. */
718
+ readonly sentMessage?: Message;
719
+ get kind(): 'nack';
720
+ constructor(
721
+ /** The NACK the server replied with. */
722
+ receivedMessage: Message,
723
+ /** The message that was NACKed. */
724
+ sentMessage?: Message);
725
+ /**
726
+ * The NACK's `MESSAGE_TYPE`: `MSG_NACK`, `LOGON_NACK`, `INVALID_INDEX_NACK`, or `EVENT_NACK` when
727
+ * `rejectEventNack` is set.
728
+ */
729
+ get messageType(): string | undefined;
730
+ /** The NACK's `ERROR` entries. */
731
+ get errors(): MessageError[];
732
+ /** The NACK's `WARNING` entries. */
733
+ get warnings(): MessageError[];
734
+ /** The `CODE` of the first `ERROR` entry. */
735
+ get code(): string | undefined;
736
+ }
737
+
738
+ /**
739
+ * Options for a single request/reply call.
740
+ * @public
741
+ */
742
+ export declare interface ConnectRequestOptions {
743
+ /**
744
+ * Milliseconds to wait for the reply before rejecting with a `ConnectTimeoutError`. Overrides
745
+ * the `requestTimeout` connect option; `0` or a negative value waits indefinitely, and values
746
+ * above 2147483647 (about 24.8 days) are capped to it.
747
+ */
748
+ timeout?: number;
749
+ /**
750
+ * Stops waiting for the reply when aborted, rejecting with a `ConnectAbortError`.
751
+ */
752
+ signal?: AbortSignal;
753
+ }
754
+
755
+ /**
756
+ * No reply arrived within the request's timeout.
757
+ * @public
758
+ */
759
+ export declare class ConnectTimeoutError extends ConnectError {
760
+ /** The timeout that elapsed, in milliseconds. */
761
+ readonly timeout: number;
762
+ get kind(): 'timeout';
763
+ constructor(
764
+ /** The timeout that elapsed, in milliseconds. */
765
+ timeout: number);
766
+ }
767
+
768
+ /**
769
+ * The connection closed or failed before a reply arrived, or a network error stopped an HTTP request.
770
+ * @public
771
+ */
772
+ export declare class ConnectTransportError extends ConnectError {
773
+ get kind(): 'transport';
774
+ /** The WebSocket close code, when the socket closed. */
775
+ readonly closeCode?: number;
776
+ /** The WebSocket close reason, when the socket closed. */
777
+ readonly closeReason?: string;
778
+ constructor(message: string, { closeCode, closeReason, cause, }?: {
779
+ closeCode?: number;
780
+ closeReason?: string;
781
+ cause?: unknown;
782
+ });
783
+ }
784
+
640
785
  /**
641
786
  * Enable intellisense for static core values, while allowing apps to overlay unknown values when needed?
642
787
  * Not sure how much value there is here until I speak with core server...
@@ -1993,7 +2138,7 @@ export declare class DefaultConnect implements Connect {
1993
2138
  * @deprecated - Please reference `User` from `@genesislcap/foundation-user` instead.
1994
2139
  */
1995
2140
  setValidSession(valid: boolean): void;
1996
- send<T>(message: Message<any>, needsHandling?: boolean): Promise<any>;
2141
+ send<T>(message: Message<any>, needsHandling?: boolean, options?: ConnectRequestOptions): Promise<any>;
1997
2142
  connect(host?: string): Promise<boolean>;
1998
2143
  disconnect(): void;
1999
2144
  snapshot(resourceName: string, params?: DataserverParams): Promise<Message>;
@@ -2003,12 +2148,20 @@ export declare class DefaultConnect implements Connect {
2003
2148
  getMoreRows(sourceRef: string, viewNumber?: number): Promise<Message>;
2004
2149
  getMoreColumns(sourceRef: string): Promise<Message>;
2005
2150
  dataLogoff(streamSourceRef: string): Promise<Message>;
2006
- getMetadata(resourceName: string, useCache?: boolean): Promise<Metadata>;
2151
+ private readonly inFlightMetadata;
2152
+ getMetadata(resourceName: string, useCache?: boolean, options?: ConnectRequestOptions): Promise<Metadata>;
2153
+ private fetchMetadata;
2007
2154
  getJSONSchema(resourceName: string, useCache?: boolean): Promise<SchemaResponse>;
2008
- private inFlightRequests;
2009
- request(resourceName: string, params?: RequestParams, useCache?: boolean): Promise<Message>;
2155
+ private readonly inFlightRequests;
2156
+ /**
2157
+ * How long one caller of a shared request waits: its own timeout, else `requestTimeout` on the
2158
+ * socket. The shared send itself has no timeout.
2159
+ */
2160
+ private callerOptions;
2161
+ request(resourceName: string, params?: RequestParams, useCache?: boolean, options?: ConnectRequestOptions): Promise<Message>;
2162
+ private sendRequest;
2010
2163
  getAvailableResources(params?: RequestParams, useCache?: boolean): Promise<ResourcesMessage>;
2011
- commitEvent(eventName: string, params?: CommitParams): Promise<Message>;
2164
+ commitEvent(eventName: string, params?: CommitParams, options?: CommitEventOptions): Promise<Message>;
2012
2165
  }
2013
2166
 
2014
2167
  /**
@@ -2333,7 +2486,8 @@ export declare class DefaultHttpConnect implements Connect {
2333
2486
  * @internal
2334
2487
  */
2335
2488
  private streams;
2336
- private inFlightRequests;
2489
+ private readonly inFlightRequests;
2490
+ private readonly inFlightMetadata;
2337
2491
  private readonly scdbDecoder;
2338
2492
  /** Guards the one-time warning when a columnar encoding is stripped from a dataserver HTTP call. */
2339
2493
  private dataserverEncodingStrippedWarned;
@@ -2342,6 +2496,7 @@ export declare class DefaultHttpConnect implements Connect {
2342
2496
  * @internal
2343
2497
  */
2344
2498
  private ongoingRefresh;
2499
+ private sessionGeneration;
2345
2500
  constructor(http: Http, messageBuilder: MessageBuilder, session: Session, metaCache: MetaCache, serializer: JSONSerializer, config: HttpConnectConfig, transport: HttpTransport);
2346
2501
  /**
2347
2502
  * Attempts to refresh the session when a 401 Unauthorized error is received.
@@ -2358,7 +2513,10 @@ export declare class DefaultHttpConnect implements Connect {
2358
2513
  * @returns A Promise that resolves to `true` if the host is available, and `false` otherwise.
2359
2514
  */
2360
2515
  private checkHost;
2361
- send<T>(message: Message<any>, needsHandling?: boolean): Promise<any>;
2516
+ send<T>(message: Message<any>, needsHandling?: boolean, options?: ConnectRequestOptions): Promise<any>;
2517
+ private withinDeadline;
2518
+ private waitForOngoingRefresh;
2519
+ private retryAfterSessionRefresh;
2362
2520
  httpMode(): boolean;
2363
2521
  /**
2364
2522
  * @deprecated - Please reference `User` from `@genesislcap/foundation-user` instead.
@@ -2368,15 +2526,18 @@ export declare class DefaultHttpConnect implements Connect {
2368
2526
  disconnect(): void;
2369
2527
  snapshot(resourceName: string, params?: any): Promise<Message>;
2370
2528
  stream(resourceName: string, onMessage: Function, onError: Function, params?: any): SocketObservable<Message>;
2529
+ private pollRetryDelay;
2371
2530
  streamState(resourceName: string, onMessage?: Function, onError?: Function, params?: any, initialState?: any[]): Observable<any[]>;
2372
2531
  streamWithoutAutoTeardown(resourceName: string, onMessage: Function, onError: Function, params?: any): SocketObservable<Message<any>>;
2373
2532
  private getMessage;
2374
2533
  getMoreRows(sourceRef: string): Promise<Message>;
2375
2534
  getMoreColumns(sourceRef: string): Promise<Message>;
2376
2535
  dataLogoff(streamSourceRef: string): Promise<Message>;
2377
- getMetadata(resourceName: string, useCache?: boolean): Promise<Metadata>;
2536
+ getMetadata(resourceName: string, useCache?: boolean, options?: ConnectRequestOptions): Promise<Metadata>;
2537
+ private fetchMetadata;
2378
2538
  getJSONSchema(resourceName: string): Promise<SchemaResponse>;
2379
- request(resourceName: string, params?: RequestParams, useCache?: boolean): Promise<Message>;
2539
+ request(resourceName: string, params?: RequestParams, useCache?: boolean, options?: ConnectRequestOptions): Promise<Message>;
2540
+ private sendRequest;
2380
2541
  /**
2381
2542
  * Removes a negotiated columnar `ENCODING` from a dataserver HTTP message. Dataserver columnar
2382
2543
  * encodings batch updates across a streamed connection in a way the HTTP poll/snapshot model
@@ -2385,7 +2546,7 @@ export declare class DefaultHttpConnect implements Connect {
2385
2546
  */
2386
2547
  private stripDataserverColumnarEncoding;
2387
2548
  getAvailableResources(params?: any, useCache?: boolean): Promise<ResourcesMessage>;
2388
- commitEvent(eventName: string, params?: CommitParams): Promise<Message>;
2549
+ commitEvent(eventName: string, params?: CommitParams, options?: CommitEventOptions): Promise<Message>;
2389
2550
  private maybeTurbo;
2390
2551
  private updateIntervals;
2391
2552
  private handlePollingIntervalMapUpdate;
@@ -2406,9 +2567,11 @@ export declare class DefaultHttpTransport implements HttpTransport {
2406
2567
  private messageBuilder;
2407
2568
  constructor(http: Http, messageBuilder: MessageBuilder);
2408
2569
  toHttpHost(host?: string): string;
2409
- post(host: string, message: Message<any>): Promise<Message>;
2410
- get(host: string, message: Message<any>): Promise<Message>;
2411
- requestServer(host: string, requestMessage: Message<any>): Promise<Message>;
2570
+ post(host: string, message: Message<any>, options?: ConnectRequestOptions): Promise<Message>;
2571
+ get(host: string, message: Message<any>, options?: ConnectRequestOptions): Promise<Message>;
2572
+ requestServer(host: string, requestMessage: Message<any>, options?: ConnectRequestOptions): Promise<Message>;
2573
+ private call;
2574
+ private static asConnectError;
2412
2575
  private static getBody;
2413
2576
  private static getUrl;
2414
2577
  }
@@ -2806,7 +2969,8 @@ export declare class DefaultSocket implements Socket {
2806
2969
  private reloadPage;
2807
2970
  reset(): void;
2808
2971
  private cleanMessages;
2809
- send<T>(message: Message<T | any>, needsHandling?: boolean): Promise<Message | any>;
2972
+ private rejectPendingRequests;
2973
+ send<T>(message: Message<T | any>, needsHandling?: boolean, options?: ConnectRequestOptions): Promise<Message | any>;
2810
2974
  sendForStream<T>(message: Message<T | any>, onMessage: Function, onError: Function, onComplete?: Function): Observable<Message>;
2811
2975
  sendForStreamWithoutTeardown<T>(message: Message<T | any>, onMessage: Function, onError: Function): Observable<Message>;
2812
2976
  socketMessages: () => SocketSubject<Message>;
@@ -3057,7 +3221,8 @@ export declare enum EventMessageType {
3057
3221
  * @public
3058
3222
  * @param reconnectOptions - {@link SocketReconnectOptions} options
3059
3223
  * @param attempt - number of attempts
3060
- * @returns number of milliseconds that is a power of 2 ^ attempts * baseInterval
3224
+ * @returns a random number of milliseconds between half and all of 2 ^ attempts * baseInterval,
3225
+ * capped at 60 seconds, so clients dropped together do not reconnect together
3061
3226
  */
3062
3227
  export declare const exponentialScheduler: SocketReconnectScheduler;
3063
3228
 
@@ -3558,6 +3723,7 @@ export declare const HttpConnectConfig: InterfaceSymbol<HttpConnectConfig>;
3558
3723
 
3559
3724
  /**
3560
3725
  * An error thrown when an HTTP request fails with a non-2xx status code.
3726
+ * @remarks `DefaultHttp` throws a `ConnectHttpError`, which also carries the response body.
3561
3727
  * @public
3562
3728
  */
3563
3729
  export declare interface HttpError extends Error {
@@ -3630,21 +3796,24 @@ export declare interface HttpTransport {
3630
3796
  * @remarks Used for events, commits, metadata, schema and resources lookups.
3631
3797
  * @param host - The `http(s)://` host to send to.
3632
3798
  * @param message - The message to send.
3799
+ * @param options - Timeout and abort signal for the request.
3633
3800
  */
3634
- post(host: string, message: Message<any>): Promise<Message>;
3801
+ post(host: string, message: Message<any>, options?: ConnectRequestOptions): Promise<Message>;
3635
3802
  /**
3636
3803
  * GETs a message and resolves with the reply.
3637
3804
  * @remarks Used for `DATA_LOGON` polling where the endpoint carries no query string.
3638
3805
  * @param host - The `http(s)://` host to send to.
3639
3806
  * @param message - The message to send.
3807
+ * @param options - Timeout and abort signal for the request.
3640
3808
  */
3641
- get(host: string, message: Message<any>): Promise<Message>;
3809
+ get(host: string, message: Message<any>, options?: ConnectRequestOptions): Promise<Message>;
3642
3810
  /**
3643
3811
  * GETs a `REQUEST_SERVER` message, encoding its `REQUEST`/`DETAILS` params as a query string.
3644
3812
  * @param host - The `http(s)://` host to send to.
3645
3813
  * @param requestMessage - The request message to send.
3814
+ * @param options - Timeout and abort signal for the request.
3646
3815
  */
3647
- requestServer(host: string, requestMessage: Message<any>): Promise<Message>;
3816
+ requestServer(host: string, requestMessage: Message<any>, options?: ConnectRequestOptions): Promise<Message>;
3648
3817
  }
3649
3818
 
3650
3819
  /**
@@ -3668,6 +3837,19 @@ export declare type IndexDetail = {
3668
3837
  */
3669
3838
  export declare function initScdbWasm(wasmBytes?: BufferSource): Promise<ScdbWasm>;
3670
3839
 
3840
+ /**
3841
+ * Whether a request failed for a transient reason, so sending it again may succeed: a closed
3842
+ * connection, a network error, a timeout, an HTTP 408, 429, 500, 502, 503 or 504 without a Genesis
3843
+ * NACK, or a NACK whose errors are all 408, 429, 503 or 504, such as `UNAVAILABLE`.
3844
+ * @remarks
3845
+ * Other NACKs, aborts and other HTTP statuses are not retryable. A NACK without a status on every
3846
+ * error falls back to the HTTP status. Retry only idempotent requests: a commit that timed out may
3847
+ * still have been applied.
3848
+ * @param error - The error a request rejected with.
3849
+ * @public
3850
+ */
3851
+ export declare function isRetryable(error: unknown): boolean;
3852
+
3671
3853
  /**
3672
3854
  * Regular Expression to test valid WebSocket (wss and ws) hosts
3673
3855
  * @public
@@ -4256,9 +4438,25 @@ export declare namespace MessageDetails {
4256
4438
  * @public
4257
4439
  */
4258
4440
  export declare type MessageError = {
4441
+ /**
4442
+ * The error code, such as `VALIDATION_ERROR`, or the HTTP status, such as `'404'`, for errors
4443
+ * the router raises itself.
4444
+ * @remarks The router sends those statuses as numbers; Connect converts them to strings.
4445
+ */
4259
4446
  CODE: MessageCode | string;
4447
+ /** The HTTP status the error maps to, such as `400 Bad Request`. */
4260
4448
  STATUS_CODE?: string;
4261
4449
  TEXT: string;
4450
+ /** The field a validation error refers to. */
4451
+ FIELD?: string;
4452
+ /** The JSON path of the field a validation error refers to. */
4453
+ PATH?: string;
4454
+ /** The table a database error refers to. */
4455
+ TABLE?: string;
4456
+ /** The index a duplicate key error refers to. */
4457
+ KEY?: string;
4458
+ /** The fields of the index a duplicate key error refers to. */
4459
+ KEY_FIELD?: string[];
4262
4460
  };
4263
4461
 
4264
4462
  /**
@@ -4295,7 +4493,8 @@ export declare enum MessageType {
4295
4493
  MSG_NACK = "MSG_NACK",
4296
4494
  LOGOUT_ACK = "LOGOUT_ACK",
4297
4495
  LOGOUT_NACK = "LOGOUT_NACK",
4298
- QUERY_UPDATE = "QUERY_UPDATE"
4496
+ QUERY_UPDATE = "QUERY_UPDATE",
4497
+ INVALID_INDEX_NACK = "INVALID_INDEX_NACK"
4299
4498
  }
4300
4499
 
4301
4500
  /**
@@ -5132,7 +5331,17 @@ export declare interface Socket extends Omit<SocketStatus, 'serialize' | 'onClos
5132
5331
  * Disconnects the socket and clears all subscriptions
5133
5332
  */
5134
5333
  reset(): void;
5135
- send<T>(message: Message<T | any>, needsHandling?: boolean): Promise<Message | any>;
5334
+ /**
5335
+ * Sends a message and resolves with its reply.
5336
+ * @remarks
5337
+ * Rejects with a `ConnectNackError` on a `MSG_NACK`, `LOGON_NACK` or `INVALID_INDEX_NACK`, a
5338
+ * `ConnectTransportError` when the socket is closed or closes before the reply arrives, and a
5339
+ * `ConnectTimeoutError` or `ConnectAbortError` per `options`.
5340
+ * @param message - The message to send.
5341
+ * @param needsHandling - Whether to wait for a reply. Without one the promise never settles. Default: true.
5342
+ * @param options - Timeout and abort signal for the reply.
5343
+ */
5344
+ send<T>(message: Message<T | any>, needsHandling?: boolean, options?: ConnectRequestOptions): Promise<Message | any>;
5136
5345
  sendForStream<T>(message: Message<T | any>, onMessage: Function, onError: Function, onComplete?: Function): Observable<Message>;
5137
5346
  /**
5138
5347
  * Sends a message and returns an observable that emits messages received from the server.
@@ -5212,6 +5421,11 @@ export declare type SocketConnectOptions = {
5212
5421
  * The path to a proxy server to use for the connection.
5213
5422
  */
5214
5423
  proxyPath?: string;
5424
+ /**
5425
+ * Milliseconds to wait for a request/reply message's reply before rejecting with a
5426
+ * `ConnectTimeoutError`. Unset (default) waits until the reply arrives or the socket closes.
5427
+ */
5428
+ requestTimeout?: number;
5215
5429
  /**
5216
5430
  * Opt in to a columnar dataserver payload encoding for all DATA_LOGON subscriptions, negotiated
5217
5431
  * transparently — every consumer (grids, React wrappers, FAST components, custom datasources)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/foundation-comms",
3
3
  "description": "Genesis Foundation UI Comms",
4
- "version": "15.82.0",
4
+ "version": "15.84.0",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -75,12 +75,12 @@
75
75
  }
76
76
  },
77
77
  "devDependencies": {
78
- "@genesislcap/foundation-testing": "15.82.0",
79
- "@genesislcap/genx": "15.82.0",
80
- "@genesislcap/ts-builder": "15.82.0",
81
- "@genesislcap/uvu-playwright-builder": "15.82.0",
82
- "@genesislcap/vite-builder": "15.82.0",
83
- "@genesislcap/webpack-builder": "15.82.0",
78
+ "@genesislcap/foundation-testing": "15.84.0",
79
+ "@genesislcap/genx": "15.84.0",
80
+ "@genesislcap/ts-builder": "15.84.0",
81
+ "@genesislcap/uvu-playwright-builder": "15.84.0",
82
+ "@genesislcap/vite-builder": "15.84.0",
83
+ "@genesislcap/webpack-builder": "15.84.0",
84
84
  "@types/js-cookie": "^3.0.2",
85
85
  "@types/json-schema": "^7.0.11",
86
86
  "@types/webappsec-credential-management": "^0.6.2",
@@ -88,11 +88,11 @@
88
88
  "sinon": "^17.0.1"
89
89
  },
90
90
  "dependencies": {
91
- "@genesislcap/foundation-broadcast-channel": "15.82.0",
92
- "@genesislcap/foundation-logger": "15.82.0",
93
- "@genesislcap/foundation-user": "15.82.0",
94
- "@genesislcap/foundation-utils": "15.82.0",
95
- "@genesislcap/web-core": "15.82.0",
91
+ "@genesislcap/foundation-broadcast-channel": "15.84.0",
92
+ "@genesislcap/foundation-logger": "15.84.0",
93
+ "@genesislcap/foundation-user": "15.84.0",
94
+ "@genesislcap/foundation-utils": "15.84.0",
95
+ "@genesislcap/web-core": "15.84.0",
96
96
  "@microsoft/fast-element": "1.14.0",
97
97
  "@microsoft/fast-foundation": "2.50.0",
98
98
  "bowser": "^2.11.0",