@truenas/api-client 9.0.4 → 9.0.6
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/README.md +15 -0
- package/dist/{chunk-PEOXWWBS.js → chunk-R4VP3HBB.js} +243 -6
- package/dist/chunk-R4VP3HBB.js.map +1 -0
- package/dist/{chunk-WAVCPALL.cjs → chunk-UOTSHE2J.cjs} +243 -6
- package/dist/chunk-UOTSHE2J.cjs.map +1 -0
- package/dist/index.cjs +37 -37
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/testing/index.cjs +13 -13
- package/dist/testing/index.d.cts +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.js +2 -2
- package/dist/{truenas-auth-mechanism.enum-Djr9ulY7.d.cts → truenas-auth-mechanism.enum-CtU2b15s.d.cts} +71 -18
- package/dist/{truenas-auth-mechanism.enum-Djr9ulY7.d.ts → truenas-auth-mechanism.enum-CtU2b15s.d.ts} +71 -18
- package/package.json +1 -1
- package/dist/chunk-PEOXWWBS.js.map +0 -1
- package/dist/chunk-WAVCPALL.cjs.map +0 -1
package/dist/{truenas-auth-mechanism.enum-Djr9ulY7.d.ts → truenas-auth-mechanism.enum-CtU2b15s.d.ts}
RENAMED
|
@@ -2538,7 +2538,7 @@ interface DropboxCredentialsModel {
|
|
|
2538
2538
|
interface FTPCredentialsModel {
|
|
2539
2539
|
type: "FTP";
|
|
2540
2540
|
host: string;
|
|
2541
|
-
port?: number
|
|
2541
|
+
port?: number;
|
|
2542
2542
|
user: string;
|
|
2543
2543
|
pass: string;
|
|
2544
2544
|
}
|
|
@@ -2593,9 +2593,9 @@ interface CloudBackupS3CredentialsModelInput {
|
|
|
2593
2593
|
secret_access_key: string;
|
|
2594
2594
|
endpoint?: "" | string;
|
|
2595
2595
|
region?: string;
|
|
2596
|
-
skip_region?: boolean
|
|
2597
|
-
signatures_v2?: boolean
|
|
2598
|
-
max_upload_parts?: number
|
|
2596
|
+
skip_region?: boolean;
|
|
2597
|
+
signatures_v2?: boolean;
|
|
2598
|
+
max_upload_parts?: number;
|
|
2599
2599
|
provider?: string;
|
|
2600
2600
|
force_path_style?: boolean;
|
|
2601
2601
|
sign_accept_encoding?: boolean;
|
|
@@ -2603,7 +2603,7 @@ interface CloudBackupS3CredentialsModelInput {
|
|
|
2603
2603
|
interface SFTPCredentialsModel {
|
|
2604
2604
|
type: "SFTP";
|
|
2605
2605
|
host: string;
|
|
2606
|
-
port?: number
|
|
2606
|
+
port?: number;
|
|
2607
2607
|
user: string;
|
|
2608
2608
|
pass?: string | null;
|
|
2609
2609
|
private_key?: number | null;
|
|
@@ -2724,9 +2724,9 @@ interface S3CredentialsModel$1 {
|
|
|
2724
2724
|
secret_access_key: string;
|
|
2725
2725
|
endpoint?: "" | string;
|
|
2726
2726
|
region?: string;
|
|
2727
|
-
skip_region?: boolean
|
|
2728
|
-
signatures_v2?: boolean
|
|
2729
|
-
max_upload_parts?: number
|
|
2727
|
+
skip_region?: boolean;
|
|
2728
|
+
signatures_v2?: boolean;
|
|
2729
|
+
max_upload_parts?: number;
|
|
2730
2730
|
}
|
|
2731
2731
|
interface StorjIxCredentialsModel {
|
|
2732
2732
|
type: "STORJ_IX";
|
|
@@ -2784,9 +2784,9 @@ interface CloudBackupS3CredentialsModelInput2 {
|
|
|
2784
2784
|
secret_access_key: string;
|
|
2785
2785
|
endpoint?: "" | string;
|
|
2786
2786
|
region?: string;
|
|
2787
|
-
skip_region?: boolean
|
|
2788
|
-
signatures_v2?: boolean
|
|
2789
|
-
max_upload_parts?: number
|
|
2787
|
+
skip_region?: boolean;
|
|
2788
|
+
signatures_v2?: boolean;
|
|
2789
|
+
max_upload_parts?: number;
|
|
2790
2790
|
}
|
|
2791
2791
|
interface CloudBackupSnapshot {
|
|
2792
2792
|
id: string;
|
|
@@ -21860,9 +21860,9 @@ interface S3CredentialsModel {
|
|
|
21860
21860
|
secret_access_key: string;
|
|
21861
21861
|
endpoint?: "" | string;
|
|
21862
21862
|
region?: string;
|
|
21863
|
-
skip_region?: boolean
|
|
21864
|
-
signatures_v2?: boolean
|
|
21865
|
-
max_upload_parts?: number
|
|
21863
|
+
skip_region?: boolean;
|
|
21864
|
+
signatures_v2?: boolean;
|
|
21865
|
+
max_upload_parts?: number;
|
|
21866
21866
|
provider?: string;
|
|
21867
21867
|
force_path_style?: boolean;
|
|
21868
21868
|
sign_accept_encoding?: boolean;
|
|
@@ -31575,6 +31575,16 @@ interface ConnectionInterceptor {
|
|
|
31575
31575
|
interface ConnectionOptions extends ReconnectOptions {
|
|
31576
31576
|
/** See {@link ConnectionInterceptor}. Unset (the default), nothing is intercepted. */
|
|
31577
31577
|
interceptor?: ConnectionInterceptor;
|
|
31578
|
+
/**
|
|
31579
|
+
* How many requests may await an answer at once; beyond it they wait, in
|
|
31580
|
+
* order, for an answer to make room. Unset (the default), nothing waits.
|
|
31581
|
+
* Middleware refuses calls past 20 per connection on current releases, so an
|
|
31582
|
+
* app that bursts past that sets 20. Every frame the client writes counts, its
|
|
31583
|
+
* `core.ping` included (skipped, not queued, while every place is taken).
|
|
31584
|
+
* Calls waiting when a socket is lost are held until the session is
|
|
31585
|
+
* authenticated again; `connection.refuseHeldCalls()` ends them instead.
|
|
31586
|
+
*/
|
|
31587
|
+
maxConcurrentCalls?: number;
|
|
31578
31588
|
}
|
|
31579
31589
|
/** One socket closing, as `connection.closes$` reports it. */
|
|
31580
31590
|
interface ConnectionClose {
|
|
@@ -31629,6 +31639,11 @@ declare class TrueNasConnection {
|
|
|
31629
31639
|
readonly logger: Logger;
|
|
31630
31640
|
/** Sees every frame in and out, and can answer in the appliance's place. */
|
|
31631
31641
|
private readonly interceptor?;
|
|
31642
|
+
/**
|
|
31643
|
+
* How many requests may await an answer at once; the rest wait their turn.
|
|
31644
|
+
* Unset, nothing is held back. See `ConnectionOptions.maxConcurrentCalls`.
|
|
31645
|
+
*/
|
|
31646
|
+
readonly maxConcurrentCalls?: number | undefined;
|
|
31632
31647
|
opened: BehaviorSubject<boolean>;
|
|
31633
31648
|
closed: Subject<void>;
|
|
31634
31649
|
hostname: BehaviorSubject<string>;
|
|
@@ -31702,14 +31717,24 @@ declare class TrueNasConnection {
|
|
|
31702
31717
|
hasConnectionError$: Observable<boolean>;
|
|
31703
31718
|
/** What the appliance sends, on whichever socket is current. */
|
|
31704
31719
|
private readonly socketMessages$;
|
|
31720
|
+
/** Answers given here, to calls ended without being sent. See `refuseHeldCalls()`. */
|
|
31721
|
+
private readonly refusals$;
|
|
31705
31722
|
/**
|
|
31706
|
-
* observable which always emits messages from the current socket,
|
|
31707
|
-
*
|
|
31723
|
+
* observable which always emits messages from the current socket, the
|
|
31724
|
+
* refusals `refuseHeldCalls()` gives, and the frames an `interceptor`
|
|
31725
|
+
* injects. Assigned in the constructor, which has it.
|
|
31708
31726
|
*/
|
|
31709
31727
|
messages$: Observable<TrueNasMessage>;
|
|
31728
|
+
/** Set when `maxConcurrentCalls` is; see there. */
|
|
31729
|
+
private readonly limiter;
|
|
31710
31730
|
constructor(initialEnabled: boolean, hostnames: string[], systemUuid: string, websocketPath: string, systemName?: string | undefined, retryDelay?: number, maxRetry?: number, logger?: Logger, protocol?: ApplianceProtocol,
|
|
31711
31731
|
/** Sees every frame in and out, and can answer in the appliance's place. */
|
|
31712
|
-
interceptor?: ConnectionInterceptor | undefined
|
|
31732
|
+
interceptor?: ConnectionInterceptor | undefined,
|
|
31733
|
+
/**
|
|
31734
|
+
* How many requests may await an answer at once; the rest wait their turn.
|
|
31735
|
+
* Unset, nothing is held back. See `ConnectionOptions.maxConcurrentCalls`.
|
|
31736
|
+
*/
|
|
31737
|
+
maxConcurrentCalls?: number | undefined);
|
|
31713
31738
|
/** The hostnames and protocol the connection currently points at. */
|
|
31714
31739
|
get endpoint(): ResolvedEndpoint;
|
|
31715
31740
|
/** The appliance's scheme; changed through `setEndpoint()`. */
|
|
@@ -31749,8 +31774,35 @@ declare class TrueNasConnection {
|
|
|
31749
31774
|
* sends a message over the current websocket OR queues it to send once
|
|
31750
31775
|
* the next websocket is opened. messages sent via `send` will not be lost until after
|
|
31751
31776
|
* the next `closed$` emission.
|
|
31777
|
+
*
|
|
31778
|
+
* With `maxConcurrentCalls` set, a request beyond the limit waits for an
|
|
31779
|
+
* answer to make room. Unsubscribing the returned handle takes back a frame
|
|
31780
|
+
* not written yet, waiting or queued.
|
|
31752
31781
|
*/
|
|
31753
31782
|
send(message: TrueNasMessage): Subscription;
|
|
31783
|
+
/**
|
|
31784
|
+
* Lets calls held from a lost socket go out again. The client calls this
|
|
31785
|
+
* whenever the session is authenticated, so a consumer does not need to;
|
|
31786
|
+
* a no-op without `maxConcurrentCalls`, or with nothing held.
|
|
31787
|
+
*
|
|
31788
|
+
* Calls waiting for a place when a socket is lost are held, not sent on the
|
|
31789
|
+
* next one: a new socket starts signed out, so middleware would refuse them
|
|
31790
|
+
* with `ENOTAUTHENTICATED`.
|
|
31791
|
+
*/
|
|
31792
|
+
releaseHeldCalls(): void;
|
|
31793
|
+
/**
|
|
31794
|
+
* Ends every call held from a lost socket without sending it, answering each
|
|
31795
|
+
* on `messages()` with the refusal middleware would have given it on a socket
|
|
31796
|
+
* that is not signed in: `ENOTAUTHENTICATED`. Returns how many it ended.
|
|
31797
|
+
*
|
|
31798
|
+
* For an app whose next sign-in may be a different user than the one who made
|
|
31799
|
+
* those calls, e.g. a password prompt after the session was lost. Call it
|
|
31800
|
+
* before that sign-in; otherwise the calls go out once it succeeds. A no-op
|
|
31801
|
+
* while nothing is held, so a healthy session's waiting calls are not touched.
|
|
31802
|
+
*/
|
|
31803
|
+
refuseHeldCalls(): number;
|
|
31804
|
+
/** Writes to the current socket, or to the next one once it opens. */
|
|
31805
|
+
private writeToNextSocket;
|
|
31754
31806
|
/**
|
|
31755
31807
|
* manually closes this connection and prevents it from retrying/opening any more.
|
|
31756
31808
|
*/
|
|
@@ -32513,7 +32565,7 @@ declare abstract class TrueNasApiClient<D extends ApiDirectoryShape = BaseApiDir
|
|
|
32513
32565
|
/** Logger forwarded to the connection (defaults to a no-op). */
|
|
32514
32566
|
protected readonly logger: Logger;
|
|
32515
32567
|
protected readonly protocol: ApplianceProtocol;
|
|
32516
|
-
/** Retry pacing and the interceptor, forwarded to the connection; unset fields take its defaults. */
|
|
32568
|
+
/** Retry pacing, call pacing and the interceptor, forwarded to the connection; unset fields take its defaults. */
|
|
32517
32569
|
protected readonly reconnect: ConnectionOptions;
|
|
32518
32570
|
constructor(uuid: string, hostnames: string[], version: ApiVersion, enabled: boolean, systemName?: string, logger?: Logger, protocol?: ApplianceProtocol, reconnect?: ConnectionOptions);
|
|
32519
32571
|
/**
|
|
@@ -32586,6 +32638,7 @@ type DerivedDirectory<V extends SupportedApiVersion> = SupportedApiVersion exten
|
|
|
32586
32638
|
* Options for {@link createTrueNasClient}. `retryDelay` and `maxRetry` pace
|
|
32587
32639
|
* reconnection, which never stops on its own; see {@link ReconnectOptions}.
|
|
32588
32640
|
* `interceptor` sees the traffic; see {@link ConnectionInterceptor}.
|
|
32641
|
+
* `maxConcurrentCalls` paces requests; see {@link ConnectionOptions}.
|
|
32589
32642
|
*/
|
|
32590
32643
|
interface CreateClientOptions extends ConnectionOptions {
|
|
32591
32644
|
/** System UUID. */
|