@genesislcap/foundation-comms 15.83.0 → 15.84.1
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/dts/connect/connect.d.ts +22 -10
- package/dist/dts/connect/connect.d.ts.map +1 -1
- package/dist/dts/connect/connect.errors.d.ts +120 -0
- package/dist/dts/connect/connect.errors.d.ts.map +1 -0
- package/dist/dts/connect/connect.types.d.ts +27 -0
- package/dist/dts/connect/connect.types.d.ts.map +1 -1
- package/dist/dts/connect/errorCodes.d.ts +6 -0
- package/dist/dts/connect/errorCodes.d.ts.map +1 -0
- package/dist/dts/connect/http.connect.d.ts +14 -5
- package/dist/dts/connect/http.connect.d.ts.map +1 -1
- package/dist/dts/connect/http.d.ts +1 -0
- package/dist/dts/connect/http.d.ts.map +1 -1
- package/dist/dts/connect/httpTransport.d.ts +12 -6
- package/dist/dts/connect/httpTransport.d.ts.map +1 -1
- package/dist/dts/connect/index.d.ts +1 -0
- package/dist/dts/connect/index.d.ts.map +1 -1
- package/dist/dts/connect/message.d.ts +18 -1
- package/dist/dts/connect/message.d.ts.map +1 -1
- package/dist/dts/connect/networkFailure.d.ts +7 -0
- package/dist/dts/connect/networkFailure.d.ts.map +1 -0
- package/dist/dts/connect/reconnectStrategy.d.ts +2 -1
- package/dist/dts/connect/reconnectStrategy.d.ts.map +1 -1
- package/dist/dts/connect/requestLifecycle.d.ts +23 -0
- package/dist/dts/connect/requestLifecycle.d.ts.map +1 -0
- package/dist/dts/connect/socket.d.ts +14 -3
- package/dist/dts/connect/socket.d.ts.map +1 -1
- package/dist/dts/connect/socket.types.d.ts +5 -0
- package/dist/dts/connect/socket.types.d.ts.map +1 -1
- package/dist/dts/datasource/datasource.d.ts +6 -0
- package/dist/dts/datasource/datasource.d.ts.map +1 -1
- package/dist/dts/utils/error-code.d.ts +2 -1
- package/dist/dts/utils/error-code.d.ts.map +1 -1
- package/dist/esm/connect/connect.errors.js +192 -0
- package/dist/esm/connect/connect.js +56 -28
- package/dist/esm/connect/errorCodes.js +20 -0
- package/dist/esm/connect/http.connect.js +166 -74
- package/dist/esm/connect/http.js +22 -9
- package/dist/esm/connect/httpTransport.js +35 -12
- package/dist/esm/connect/index.js +1 -0
- package/dist/esm/connect/message.js +6 -1
- package/dist/esm/connect/networkFailure.js +12 -0
- package/dist/esm/connect/reconnectStrategy.js +4 -3
- package/dist/esm/connect/requestLifecycle.js +96 -0
- package/dist/esm/connect/socket.js +74 -37
- package/dist/esm/datasource/datasource.js +75 -22
- package/dist/esm/utils/error-code.js +6 -2
- package/dist/foundation-comms.api.json +1573 -35
- package/dist/foundation-comms.d.ts +244 -24
- 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...
|
|
@@ -1072,6 +1217,8 @@ export declare interface Datasource extends DatasourceMetadata {
|
|
|
1072
1217
|
* @param fetchMeta - Optional flag to fetch metadata for the datasource. Defaults to true.
|
|
1073
1218
|
* @param startStream - Optional flag to start the data stream. Defaults to true.
|
|
1074
1219
|
* @returns A promise that resolves with a boolean indicating whether the initialization was successful.
|
|
1220
|
+
* When another `init()` or `destroy()` is called before it finishes, it sends nothing more and resolves with the
|
|
1221
|
+
* result of the latest `init()`, or false when `destroy()` was called last, even if one of its requests then fails.
|
|
1075
1222
|
*/
|
|
1076
1223
|
init(options: DatasourceOptions, fetchMeta?: boolean, startStream?: boolean): Promise<boolean>;
|
|
1077
1224
|
/**
|
|
@@ -1993,7 +2140,7 @@ export declare class DefaultConnect implements Connect {
|
|
|
1993
2140
|
* @deprecated - Please reference `User` from `@genesislcap/foundation-user` instead.
|
|
1994
2141
|
*/
|
|
1995
2142
|
setValidSession(valid: boolean): void;
|
|
1996
|
-
send<T>(message: Message<any>, needsHandling?: boolean): Promise<any>;
|
|
2143
|
+
send<T>(message: Message<any>, needsHandling?: boolean, options?: ConnectRequestOptions): Promise<any>;
|
|
1997
2144
|
connect(host?: string): Promise<boolean>;
|
|
1998
2145
|
disconnect(): void;
|
|
1999
2146
|
snapshot(resourceName: string, params?: DataserverParams): Promise<Message>;
|
|
@@ -2003,12 +2150,20 @@ export declare class DefaultConnect implements Connect {
|
|
|
2003
2150
|
getMoreRows(sourceRef: string, viewNumber?: number): Promise<Message>;
|
|
2004
2151
|
getMoreColumns(sourceRef: string): Promise<Message>;
|
|
2005
2152
|
dataLogoff(streamSourceRef: string): Promise<Message>;
|
|
2006
|
-
|
|
2153
|
+
private readonly inFlightMetadata;
|
|
2154
|
+
getMetadata(resourceName: string, useCache?: boolean, options?: ConnectRequestOptions): Promise<Metadata>;
|
|
2155
|
+
private fetchMetadata;
|
|
2007
2156
|
getJSONSchema(resourceName: string, useCache?: boolean): Promise<SchemaResponse>;
|
|
2008
|
-
private inFlightRequests;
|
|
2009
|
-
|
|
2157
|
+
private readonly inFlightRequests;
|
|
2158
|
+
/**
|
|
2159
|
+
* How long one caller of a shared request waits: its own timeout, else `requestTimeout` on the
|
|
2160
|
+
* socket. The shared send itself has no timeout.
|
|
2161
|
+
*/
|
|
2162
|
+
private callerOptions;
|
|
2163
|
+
request(resourceName: string, params?: RequestParams, useCache?: boolean, options?: ConnectRequestOptions): Promise<Message>;
|
|
2164
|
+
private sendRequest;
|
|
2010
2165
|
getAvailableResources(params?: RequestParams, useCache?: boolean): Promise<ResourcesMessage>;
|
|
2011
|
-
commitEvent(eventName: string, params?: CommitParams): Promise<Message>;
|
|
2166
|
+
commitEvent(eventName: string, params?: CommitParams, options?: CommitEventOptions): Promise<Message>;
|
|
2012
2167
|
}
|
|
2013
2168
|
|
|
2014
2169
|
/**
|
|
@@ -2146,6 +2301,8 @@ export declare class DefaultDatasource implements Datasource {
|
|
|
2146
2301
|
resourceType: ResourceType;
|
|
2147
2302
|
stream: SocketObservable<FilteredDataServerResult | RequestServerResult>;
|
|
2148
2303
|
private _allParams;
|
|
2304
|
+
private generation;
|
|
2305
|
+
private latestInit?;
|
|
2149
2306
|
constructor(connect: Connect, auth: Auth, resources: GenesisResources, config: DatasourceConfig, connectEvents: ConnectEvents);
|
|
2150
2307
|
private pollTrigger$;
|
|
2151
2308
|
private commitResponseUnsubscribe?;
|
|
@@ -2155,6 +2312,7 @@ export declare class DefaultDatasource implements Datasource {
|
|
|
2155
2312
|
*/
|
|
2156
2313
|
validResourceName(resourceName: string): boolean;
|
|
2157
2314
|
init(options: DatasourceOptions, fetchMeta?: boolean, startStream?: boolean): Promise<boolean>;
|
|
2315
|
+
private initialise;
|
|
2158
2316
|
startStream(): Promise<void>;
|
|
2159
2317
|
/** {@inheritDoc Datasource.destroy} */
|
|
2160
2318
|
destroy(): void;
|
|
@@ -2195,6 +2353,7 @@ export declare class DefaultDatasource implements Datasource {
|
|
|
2195
2353
|
*/
|
|
2196
2354
|
protected normaliseStatus(status: Partial<DatasourceStatus>): DatasourceStatus;
|
|
2197
2355
|
private invalidateCache;
|
|
2356
|
+
private interruptedInit;
|
|
2198
2357
|
}
|
|
2199
2358
|
|
|
2200
2359
|
/**
|
|
@@ -2333,7 +2492,8 @@ export declare class DefaultHttpConnect implements Connect {
|
|
|
2333
2492
|
* @internal
|
|
2334
2493
|
*/
|
|
2335
2494
|
private streams;
|
|
2336
|
-
private inFlightRequests;
|
|
2495
|
+
private readonly inFlightRequests;
|
|
2496
|
+
private readonly inFlightMetadata;
|
|
2337
2497
|
private readonly scdbDecoder;
|
|
2338
2498
|
/** Guards the one-time warning when a columnar encoding is stripped from a dataserver HTTP call. */
|
|
2339
2499
|
private dataserverEncodingStrippedWarned;
|
|
@@ -2342,6 +2502,7 @@ export declare class DefaultHttpConnect implements Connect {
|
|
|
2342
2502
|
* @internal
|
|
2343
2503
|
*/
|
|
2344
2504
|
private ongoingRefresh;
|
|
2505
|
+
private sessionGeneration;
|
|
2345
2506
|
constructor(http: Http, messageBuilder: MessageBuilder, session: Session, metaCache: MetaCache, serializer: JSONSerializer, config: HttpConnectConfig, transport: HttpTransport);
|
|
2346
2507
|
/**
|
|
2347
2508
|
* Attempts to refresh the session when a 401 Unauthorized error is received.
|
|
@@ -2358,7 +2519,10 @@ export declare class DefaultHttpConnect implements Connect {
|
|
|
2358
2519
|
* @returns A Promise that resolves to `true` if the host is available, and `false` otherwise.
|
|
2359
2520
|
*/
|
|
2360
2521
|
private checkHost;
|
|
2361
|
-
send<T>(message: Message<any>, needsHandling?: boolean): Promise<any>;
|
|
2522
|
+
send<T>(message: Message<any>, needsHandling?: boolean, options?: ConnectRequestOptions): Promise<any>;
|
|
2523
|
+
private withinDeadline;
|
|
2524
|
+
private waitForOngoingRefresh;
|
|
2525
|
+
private retryAfterSessionRefresh;
|
|
2362
2526
|
httpMode(): boolean;
|
|
2363
2527
|
/**
|
|
2364
2528
|
* @deprecated - Please reference `User` from `@genesislcap/foundation-user` instead.
|
|
@@ -2368,15 +2532,18 @@ export declare class DefaultHttpConnect implements Connect {
|
|
|
2368
2532
|
disconnect(): void;
|
|
2369
2533
|
snapshot(resourceName: string, params?: any): Promise<Message>;
|
|
2370
2534
|
stream(resourceName: string, onMessage: Function, onError: Function, params?: any): SocketObservable<Message>;
|
|
2535
|
+
private pollRetryDelay;
|
|
2371
2536
|
streamState(resourceName: string, onMessage?: Function, onError?: Function, params?: any, initialState?: any[]): Observable<any[]>;
|
|
2372
2537
|
streamWithoutAutoTeardown(resourceName: string, onMessage: Function, onError: Function, params?: any): SocketObservable<Message<any>>;
|
|
2373
2538
|
private getMessage;
|
|
2374
2539
|
getMoreRows(sourceRef: string): Promise<Message>;
|
|
2375
2540
|
getMoreColumns(sourceRef: string): Promise<Message>;
|
|
2376
2541
|
dataLogoff(streamSourceRef: string): Promise<Message>;
|
|
2377
|
-
getMetadata(resourceName: string, useCache?: boolean): Promise<Metadata>;
|
|
2542
|
+
getMetadata(resourceName: string, useCache?: boolean, options?: ConnectRequestOptions): Promise<Metadata>;
|
|
2543
|
+
private fetchMetadata;
|
|
2378
2544
|
getJSONSchema(resourceName: string): Promise<SchemaResponse>;
|
|
2379
|
-
request(resourceName: string, params?: RequestParams, useCache?: boolean): Promise<Message>;
|
|
2545
|
+
request(resourceName: string, params?: RequestParams, useCache?: boolean, options?: ConnectRequestOptions): Promise<Message>;
|
|
2546
|
+
private sendRequest;
|
|
2380
2547
|
/**
|
|
2381
2548
|
* Removes a negotiated columnar `ENCODING` from a dataserver HTTP message. Dataserver columnar
|
|
2382
2549
|
* encodings batch updates across a streamed connection in a way the HTTP poll/snapshot model
|
|
@@ -2385,7 +2552,7 @@ export declare class DefaultHttpConnect implements Connect {
|
|
|
2385
2552
|
*/
|
|
2386
2553
|
private stripDataserverColumnarEncoding;
|
|
2387
2554
|
getAvailableResources(params?: any, useCache?: boolean): Promise<ResourcesMessage>;
|
|
2388
|
-
commitEvent(eventName: string, params?: CommitParams): Promise<Message>;
|
|
2555
|
+
commitEvent(eventName: string, params?: CommitParams, options?: CommitEventOptions): Promise<Message>;
|
|
2389
2556
|
private maybeTurbo;
|
|
2390
2557
|
private updateIntervals;
|
|
2391
2558
|
private handlePollingIntervalMapUpdate;
|
|
@@ -2406,9 +2573,11 @@ export declare class DefaultHttpTransport implements HttpTransport {
|
|
|
2406
2573
|
private messageBuilder;
|
|
2407
2574
|
constructor(http: Http, messageBuilder: MessageBuilder);
|
|
2408
2575
|
toHttpHost(host?: string): string;
|
|
2409
|
-
post(host: string, message: Message<any
|
|
2410
|
-
get(host: string, message: Message<any
|
|
2411
|
-
requestServer(host: string, requestMessage: Message<any
|
|
2576
|
+
post(host: string, message: Message<any>, options?: ConnectRequestOptions): Promise<Message>;
|
|
2577
|
+
get(host: string, message: Message<any>, options?: ConnectRequestOptions): Promise<Message>;
|
|
2578
|
+
requestServer(host: string, requestMessage: Message<any>, options?: ConnectRequestOptions): Promise<Message>;
|
|
2579
|
+
private call;
|
|
2580
|
+
private static asConnectError;
|
|
2412
2581
|
private static getBody;
|
|
2413
2582
|
private static getUrl;
|
|
2414
2583
|
}
|
|
@@ -2806,7 +2975,8 @@ export declare class DefaultSocket implements Socket {
|
|
|
2806
2975
|
private reloadPage;
|
|
2807
2976
|
reset(): void;
|
|
2808
2977
|
private cleanMessages;
|
|
2809
|
-
|
|
2978
|
+
private rejectPendingRequests;
|
|
2979
|
+
send<T>(message: Message<T | any>, needsHandling?: boolean, options?: ConnectRequestOptions): Promise<Message | any>;
|
|
2810
2980
|
sendForStream<T>(message: Message<T | any>, onMessage: Function, onError: Function, onComplete?: Function): Observable<Message>;
|
|
2811
2981
|
sendForStreamWithoutTeardown<T>(message: Message<T | any>, onMessage: Function, onError: Function): Observable<Message>;
|
|
2812
2982
|
socketMessages: () => SocketSubject<Message>;
|
|
@@ -3057,7 +3227,8 @@ export declare enum EventMessageType {
|
|
|
3057
3227
|
* @public
|
|
3058
3228
|
* @param reconnectOptions - {@link SocketReconnectOptions} options
|
|
3059
3229
|
* @param attempt - number of attempts
|
|
3060
|
-
* @returns number of milliseconds
|
|
3230
|
+
* @returns a random number of milliseconds between half and all of 2 ^ attempts * baseInterval,
|
|
3231
|
+
* capped at 60 seconds, so clients dropped together do not reconnect together
|
|
3061
3232
|
*/
|
|
3062
3233
|
export declare const exponentialScheduler: SocketReconnectScheduler;
|
|
3063
3234
|
|
|
@@ -3558,6 +3729,7 @@ export declare const HttpConnectConfig: InterfaceSymbol<HttpConnectConfig>;
|
|
|
3558
3729
|
|
|
3559
3730
|
/**
|
|
3560
3731
|
* An error thrown when an HTTP request fails with a non-2xx status code.
|
|
3732
|
+
* @remarks `DefaultHttp` throws a `ConnectHttpError`, which also carries the response body.
|
|
3561
3733
|
* @public
|
|
3562
3734
|
*/
|
|
3563
3735
|
export declare interface HttpError extends Error {
|
|
@@ -3630,21 +3802,24 @@ export declare interface HttpTransport {
|
|
|
3630
3802
|
* @remarks Used for events, commits, metadata, schema and resources lookups.
|
|
3631
3803
|
* @param host - The `http(s)://` host to send to.
|
|
3632
3804
|
* @param message - The message to send.
|
|
3805
|
+
* @param options - Timeout and abort signal for the request.
|
|
3633
3806
|
*/
|
|
3634
|
-
post(host: string, message: Message<any
|
|
3807
|
+
post(host: string, message: Message<any>, options?: ConnectRequestOptions): Promise<Message>;
|
|
3635
3808
|
/**
|
|
3636
3809
|
* GETs a message and resolves with the reply.
|
|
3637
3810
|
* @remarks Used for `DATA_LOGON` polling where the endpoint carries no query string.
|
|
3638
3811
|
* @param host - The `http(s)://` host to send to.
|
|
3639
3812
|
* @param message - The message to send.
|
|
3813
|
+
* @param options - Timeout and abort signal for the request.
|
|
3640
3814
|
*/
|
|
3641
|
-
get(host: string, message: Message<any
|
|
3815
|
+
get(host: string, message: Message<any>, options?: ConnectRequestOptions): Promise<Message>;
|
|
3642
3816
|
/**
|
|
3643
3817
|
* GETs a `REQUEST_SERVER` message, encoding its `REQUEST`/`DETAILS` params as a query string.
|
|
3644
3818
|
* @param host - The `http(s)://` host to send to.
|
|
3645
3819
|
* @param requestMessage - The request message to send.
|
|
3820
|
+
* @param options - Timeout and abort signal for the request.
|
|
3646
3821
|
*/
|
|
3647
|
-
requestServer(host: string, requestMessage: Message<any
|
|
3822
|
+
requestServer(host: string, requestMessage: Message<any>, options?: ConnectRequestOptions): Promise<Message>;
|
|
3648
3823
|
}
|
|
3649
3824
|
|
|
3650
3825
|
/**
|
|
@@ -3668,6 +3843,19 @@ export declare type IndexDetail = {
|
|
|
3668
3843
|
*/
|
|
3669
3844
|
export declare function initScdbWasm(wasmBytes?: BufferSource): Promise<ScdbWasm>;
|
|
3670
3845
|
|
|
3846
|
+
/**
|
|
3847
|
+
* Whether a request failed for a transient reason, so sending it again may succeed: a closed
|
|
3848
|
+
* connection, a network error, a timeout, an HTTP 408, 429, 500, 502, 503 or 504 without a Genesis
|
|
3849
|
+
* NACK, or a NACK whose errors are all 408, 429, 503 or 504, such as `UNAVAILABLE`.
|
|
3850
|
+
* @remarks
|
|
3851
|
+
* Other NACKs, aborts and other HTTP statuses are not retryable. A NACK without a status on every
|
|
3852
|
+
* error falls back to the HTTP status. Retry only idempotent requests: a commit that timed out may
|
|
3853
|
+
* still have been applied.
|
|
3854
|
+
* @param error - The error a request rejected with.
|
|
3855
|
+
* @public
|
|
3856
|
+
*/
|
|
3857
|
+
export declare function isRetryable(error: unknown): boolean;
|
|
3858
|
+
|
|
3671
3859
|
/**
|
|
3672
3860
|
* Regular Expression to test valid WebSocket (wss and ws) hosts
|
|
3673
3861
|
* @public
|
|
@@ -4256,9 +4444,25 @@ export declare namespace MessageDetails {
|
|
|
4256
4444
|
* @public
|
|
4257
4445
|
*/
|
|
4258
4446
|
export declare type MessageError = {
|
|
4447
|
+
/**
|
|
4448
|
+
* The error code, such as `VALIDATION_ERROR`, or the HTTP status, such as `'404'`, for errors
|
|
4449
|
+
* the router raises itself.
|
|
4450
|
+
* @remarks The router sends those statuses as numbers; Connect converts them to strings.
|
|
4451
|
+
*/
|
|
4259
4452
|
CODE: MessageCode | string;
|
|
4453
|
+
/** The HTTP status the error maps to, such as `400 Bad Request`. */
|
|
4260
4454
|
STATUS_CODE?: string;
|
|
4261
4455
|
TEXT: string;
|
|
4456
|
+
/** The field a validation error refers to. */
|
|
4457
|
+
FIELD?: string;
|
|
4458
|
+
/** The JSON path of the field a validation error refers to. */
|
|
4459
|
+
PATH?: string;
|
|
4460
|
+
/** The table a database error refers to. */
|
|
4461
|
+
TABLE?: string;
|
|
4462
|
+
/** The index a duplicate key error refers to. */
|
|
4463
|
+
KEY?: string;
|
|
4464
|
+
/** The fields of the index a duplicate key error refers to. */
|
|
4465
|
+
KEY_FIELD?: string[];
|
|
4262
4466
|
};
|
|
4263
4467
|
|
|
4264
4468
|
/**
|
|
@@ -4295,7 +4499,8 @@ export declare enum MessageType {
|
|
|
4295
4499
|
MSG_NACK = "MSG_NACK",
|
|
4296
4500
|
LOGOUT_ACK = "LOGOUT_ACK",
|
|
4297
4501
|
LOGOUT_NACK = "LOGOUT_NACK",
|
|
4298
|
-
QUERY_UPDATE = "QUERY_UPDATE"
|
|
4502
|
+
QUERY_UPDATE = "QUERY_UPDATE",
|
|
4503
|
+
INVALID_INDEX_NACK = "INVALID_INDEX_NACK"
|
|
4299
4504
|
}
|
|
4300
4505
|
|
|
4301
4506
|
/**
|
|
@@ -5132,7 +5337,17 @@ export declare interface Socket extends Omit<SocketStatus, 'serialize' | 'onClos
|
|
|
5132
5337
|
* Disconnects the socket and clears all subscriptions
|
|
5133
5338
|
*/
|
|
5134
5339
|
reset(): void;
|
|
5135
|
-
|
|
5340
|
+
/**
|
|
5341
|
+
* Sends a message and resolves with its reply.
|
|
5342
|
+
* @remarks
|
|
5343
|
+
* Rejects with a `ConnectNackError` on a `MSG_NACK`, `LOGON_NACK` or `INVALID_INDEX_NACK`, a
|
|
5344
|
+
* `ConnectTransportError` when the socket is closed or closes before the reply arrives, and a
|
|
5345
|
+
* `ConnectTimeoutError` or `ConnectAbortError` per `options`.
|
|
5346
|
+
* @param message - The message to send.
|
|
5347
|
+
* @param needsHandling - Whether to wait for a reply. Without one the promise never settles. Default: true.
|
|
5348
|
+
* @param options - Timeout and abort signal for the reply.
|
|
5349
|
+
*/
|
|
5350
|
+
send<T>(message: Message<T | any>, needsHandling?: boolean, options?: ConnectRequestOptions): Promise<Message | any>;
|
|
5136
5351
|
sendForStream<T>(message: Message<T | any>, onMessage: Function, onError: Function, onComplete?: Function): Observable<Message>;
|
|
5137
5352
|
/**
|
|
5138
5353
|
* Sends a message and returns an observable that emits messages received from the server.
|
|
@@ -5212,6 +5427,11 @@ export declare type SocketConnectOptions = {
|
|
|
5212
5427
|
* The path to a proxy server to use for the connection.
|
|
5213
5428
|
*/
|
|
5214
5429
|
proxyPath?: string;
|
|
5430
|
+
/**
|
|
5431
|
+
* Milliseconds to wait for a request/reply message's reply before rejecting with a
|
|
5432
|
+
* `ConnectTimeoutError`. Unset (default) waits until the reply arrives or the socket closes.
|
|
5433
|
+
*/
|
|
5434
|
+
requestTimeout?: number;
|
|
5215
5435
|
/**
|
|
5216
5436
|
* Opt in to a columnar dataserver payload encoding for all DATA_LOGON subscriptions, negotiated
|
|
5217
5437
|
* 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.
|
|
4
|
+
"version": "15.84.1",
|
|
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.
|
|
79
|
-
"@genesislcap/genx": "15.
|
|
80
|
-
"@genesislcap/ts-builder": "15.
|
|
81
|
-
"@genesislcap/uvu-playwright-builder": "15.
|
|
82
|
-
"@genesislcap/vite-builder": "15.
|
|
83
|
-
"@genesislcap/webpack-builder": "15.
|
|
78
|
+
"@genesislcap/foundation-testing": "15.84.1",
|
|
79
|
+
"@genesislcap/genx": "15.84.1",
|
|
80
|
+
"@genesislcap/ts-builder": "15.84.1",
|
|
81
|
+
"@genesislcap/uvu-playwright-builder": "15.84.1",
|
|
82
|
+
"@genesislcap/vite-builder": "15.84.1",
|
|
83
|
+
"@genesislcap/webpack-builder": "15.84.1",
|
|
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.
|
|
92
|
-
"@genesislcap/foundation-logger": "15.
|
|
93
|
-
"@genesislcap/foundation-user": "15.
|
|
94
|
-
"@genesislcap/foundation-utils": "15.
|
|
95
|
-
"@genesislcap/web-core": "15.
|
|
91
|
+
"@genesislcap/foundation-broadcast-channel": "15.84.1",
|
|
92
|
+
"@genesislcap/foundation-logger": "15.84.1",
|
|
93
|
+
"@genesislcap/foundation-user": "15.84.1",
|
|
94
|
+
"@genesislcap/foundation-utils": "15.84.1",
|
|
95
|
+
"@genesislcap/web-core": "15.84.1",
|
|
96
96
|
"@microsoft/fast-element": "1.14.0",
|
|
97
97
|
"@microsoft/fast-foundation": "2.50.0",
|
|
98
98
|
"bowser": "^2.11.0",
|