@truenas/api-client 3.0.0 → 3.0.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/index.cjs +81 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +63 -2
- package/dist/index.d.ts +63 -2
- package/dist/index.js +81 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -27540,7 +27540,7 @@ interface CreateClientOptions {
|
|
|
27540
27540
|
* 1. Discovers the API version (`GET /api/versions`), asking every hostname in
|
|
27541
27541
|
* parallel. The first usable answer wins.
|
|
27542
27542
|
* 2. Selects the matching client implementation (`v25.10.x` -> `TrueNasApiClientV2510`,
|
|
27543
|
-
* `v26.x.y` -> `TrueNasApiClientV26`).
|
|
27543
|
+
* `v26.x.y` -> `TrueNasApiClientV26`, `v27.x.y` -> `TrueNasApiClientV27`).
|
|
27544
27544
|
* 3. Instantiates and returns it.
|
|
27545
27545
|
*
|
|
27546
27546
|
* Resolves exactly once with a single client instance — dispose of it with
|
|
@@ -27657,6 +27657,67 @@ declare class TrueNasApiClientV26 extends TrueNasApiClient<ApiDirectory$1> {
|
|
|
27657
27657
|
protected createOperations(): OperationMappings;
|
|
27658
27658
|
}
|
|
27659
27659
|
|
|
27660
|
+
/**
|
|
27661
|
+
* TrueNAS API Client for v27.X.Y
|
|
27662
|
+
*
|
|
27663
|
+
* Handles all v27 versions (v27.0.0, v27.0.1, v27.1.2, etc.). Minor and patch
|
|
27664
|
+
* releases within a year are backward compatible, so one implementation covers
|
|
27665
|
+
* the series; breaking changes only arrive with the next year.
|
|
27666
|
+
*
|
|
27667
|
+
* That is what this class supports. What version *discovery* currently admits
|
|
27668
|
+
* is narrower: `MAX_SUPPORTED_VERSION` is a concrete version and the range check
|
|
27669
|
+
* compares patches, so today only `v27.0.0` clears it — `v27.0.1` and `v27.1.0`
|
|
27670
|
+
* are reported too-new and never reach this client. The effect always falls on
|
|
27671
|
+
* the newest series and nothing below it, which is why it has gone unnoticed:
|
|
27672
|
+
* raising the ceiling to v27.0.0 is what made v26.0.1 admissible in the first
|
|
27673
|
+
* place. Closing it means deciding how the ceiling should treat a series rather
|
|
27674
|
+
* than a version, which is a change to the compatibility model and not this
|
|
27675
|
+
* client's to make.
|
|
27676
|
+
*
|
|
27677
|
+
* To add version-specific behavior, override the factory methods:
|
|
27678
|
+
* - createConnection() - for connection-specific changes
|
|
27679
|
+
* - createApi() - for API method changes
|
|
27680
|
+
* - createAuthenticator() - for authentication changes
|
|
27681
|
+
* - createOperations() - for version-specific operation mappings
|
|
27682
|
+
*/
|
|
27683
|
+
|
|
27684
|
+
/**
|
|
27685
|
+
* API client for TrueNAS API v27
|
|
27686
|
+
*
|
|
27687
|
+
* Protocol: JSON-RPC 2.0
|
|
27688
|
+
* WebSocket Path: /api/v27.{minor}.{patch}
|
|
27689
|
+
*
|
|
27690
|
+
* Container operations use the native container.* APIs, as v26 does:
|
|
27691
|
+
* - containerQuery → container.query (with response transformation)
|
|
27692
|
+
* - containerStart → container.start (synchronous, emits null)
|
|
27693
|
+
* - containerStop → container.stop (emits Job updates)
|
|
27694
|
+
* - containerRestart → container.stop + container.start (emits Job, then null)
|
|
27695
|
+
*
|
|
27696
|
+
* Those four are currently identical to v26's, because v27 inherits all three
|
|
27697
|
+
* container entries the facade touches rather than re-declaring them. Asserted
|
|
27698
|
+
* rather than assumed, and re-runnable: the spec pins all three against v26's,
|
|
27699
|
+
* so the day they diverge is a failure there.
|
|
27700
|
+
*
|
|
27701
|
+
* They are written out here rather than shared with v26 because that is what
|
|
27702
|
+
* this repo's one-client-per-series design is for: the two are the same today
|
|
27703
|
+
* and are expected to diverge — middleware has no `container.restart` yet, and
|
|
27704
|
+
* the chained stop+start below is the workaround for its absence. Factoring the
|
|
27705
|
+
* bodies into a common base would couple two versions that exist in order to
|
|
27706
|
+
* evolve apart, and the coupling would have to be undone by whichever release
|
|
27707
|
+
* diverges first. The `@/generated` types are the guard against them drifting
|
|
27708
|
+
* silently: an entry that changes at v27 stops compiling here.
|
|
27709
|
+
*/
|
|
27710
|
+
declare class TrueNasApiClientV27 extends TrueNasApiClient<ApiDirectory> {
|
|
27711
|
+
/**
|
|
27712
|
+
* Create v27-specific operation mappings
|
|
27713
|
+
*
|
|
27714
|
+
* Operations return Observable<Job | null>:
|
|
27715
|
+
* - Async operations emit Job updates until complete
|
|
27716
|
+
* - Sync operations emit null once
|
|
27717
|
+
*/
|
|
27718
|
+
protected createOperations(): OperationMappings;
|
|
27719
|
+
}
|
|
27720
|
+
|
|
27660
27721
|
/**
|
|
27661
27722
|
* Discovers available API versions from TrueNAS systems.
|
|
27662
27723
|
*
|
|
@@ -27860,4 +27921,4 @@ type ApiError = JsonRpcError | TrueNasError;
|
|
|
27860
27921
|
*/
|
|
27861
27922
|
declare function getApiErrorMessage(error: unknown, fallback?: string): string;
|
|
27862
27923
|
|
|
27863
|
-
export { type ApiCallDirectory$7 as ApiCallDirectoryV25_10_0, type ApiCallDirectory$6 as ApiCallDirectoryV25_10_1, type ApiCallDirectory$5 as ApiCallDirectoryV25_10_2, type ApiCallDirectory$4 as ApiCallDirectoryV25_10_3, type ApiCallDirectory$3 as ApiCallDirectoryV25_10_4, type ApiCallDirectory$2 as ApiCallDirectoryV25_10_5, type ApiCallDirectory$1 as ApiCallDirectoryV26_0_0, type ApiCallDirectory as ApiCallDirectoryV27_0_0, type ApiDirectoryByVersion, type ApiDirectoryShape, type ApiDirectory$7 as ApiDirectoryV25_10_0, type ApiDirectory$6 as ApiDirectoryV25_10_1, type ApiDirectory$5 as ApiDirectoryV25_10_2, type ApiDirectory$4 as ApiDirectoryV25_10_3, type ApiDirectory$3 as ApiDirectoryV25_10_4, type ApiDirectory$2 as ApiDirectoryV25_10_5, type ApiDirectory$1 as ApiDirectoryV26_0_0, type ApiDirectory as ApiDirectoryV27_0_0, type ApiError, type ApiEventDirectory$7 as ApiEventDirectoryV25_10_0, type ApiEventDirectory$6 as ApiEventDirectoryV25_10_1, type ApiEventDirectory$5 as ApiEventDirectoryV25_10_2, type ApiEventDirectory$4 as ApiEventDirectoryV25_10_3, type ApiEventDirectory$3 as ApiEventDirectoryV25_10_4, type ApiEventDirectory$2 as ApiEventDirectoryV25_10_5, type ApiEventDirectory$1 as ApiEventDirectoryV26_0_0, type ApiEventDirectory as ApiEventDirectoryV27_0_0, type ApiJobDirectory$7 as ApiJobDirectoryV25_10_0, type ApiJobDirectory$6 as ApiJobDirectoryV25_10_1, type ApiJobDirectory$5 as ApiJobDirectoryV25_10_2, type ApiJobDirectory$4 as ApiJobDirectoryV25_10_3, type ApiJobDirectory$3 as ApiJobDirectoryV25_10_4, type ApiJobDirectory$2 as ApiJobDirectoryV25_10_5, type ApiJobDirectory$1 as ApiJobDirectoryV26_0_0, type ApiJobDirectory as ApiJobDirectoryV27_0_0, type ApiKeyCreate, type ApiVersion, type ApiVersionResponse, AppState, type ArgsOf, AuthError, AuthErrorCode, type AuthResponse, type BaseApiDirectory, type CallMethod, type CallParams, type CallResponse, type Container, type CreateClientOptions, type DefaultApiDirectory, type EventKind, type EventName, type EventUnion, InvalidVersionResponseError, type Job, type JobMethod, type JobParams, type JobProgress, type JobResult, JobState, type Logger, NoCompatibleVersionsError, type OperationMappings, type QueryDirectory, type QueryEntity, type QueryListOptions, type QueryMethod, type QuerySingleOptions, SUPPORTED_API_VERSIONS, type SupportedApiVersion, TrueNasApiClient, TrueNasApiClientV2510, TrueNasApiClientV26, TrueNasAuthMechanism, type TrueNasDate, VersionCompatibility, VersionDiscovery, VersionDiscoveryError, VersionDiscoveryNetworkError, VersionDiscoveryTimeoutError, VersionEndpointNotFoundError, VersionTooNewError, VersionTooOldError, consoleLogger, createTrueNasClient, getApiErrorMessage, isJobFinished, noopLogger, index$7 as v25_10_0, index$6 as v25_10_1, index$5 as v25_10_2, index$4 as v25_10_3, index$3 as v25_10_4, index$2 as v25_10_5, index$1 as v26_0_0, index as v27_0_0 };
|
|
27924
|
+
export { type ApiCallDirectory$7 as ApiCallDirectoryV25_10_0, type ApiCallDirectory$6 as ApiCallDirectoryV25_10_1, type ApiCallDirectory$5 as ApiCallDirectoryV25_10_2, type ApiCallDirectory$4 as ApiCallDirectoryV25_10_3, type ApiCallDirectory$3 as ApiCallDirectoryV25_10_4, type ApiCallDirectory$2 as ApiCallDirectoryV25_10_5, type ApiCallDirectory$1 as ApiCallDirectoryV26_0_0, type ApiCallDirectory as ApiCallDirectoryV27_0_0, type ApiDirectoryByVersion, type ApiDirectoryShape, type ApiDirectory$7 as ApiDirectoryV25_10_0, type ApiDirectory$6 as ApiDirectoryV25_10_1, type ApiDirectory$5 as ApiDirectoryV25_10_2, type ApiDirectory$4 as ApiDirectoryV25_10_3, type ApiDirectory$3 as ApiDirectoryV25_10_4, type ApiDirectory$2 as ApiDirectoryV25_10_5, type ApiDirectory$1 as ApiDirectoryV26_0_0, type ApiDirectory as ApiDirectoryV27_0_0, type ApiError, type ApiEventDirectory$7 as ApiEventDirectoryV25_10_0, type ApiEventDirectory$6 as ApiEventDirectoryV25_10_1, type ApiEventDirectory$5 as ApiEventDirectoryV25_10_2, type ApiEventDirectory$4 as ApiEventDirectoryV25_10_3, type ApiEventDirectory$3 as ApiEventDirectoryV25_10_4, type ApiEventDirectory$2 as ApiEventDirectoryV25_10_5, type ApiEventDirectory$1 as ApiEventDirectoryV26_0_0, type ApiEventDirectory as ApiEventDirectoryV27_0_0, type ApiJobDirectory$7 as ApiJobDirectoryV25_10_0, type ApiJobDirectory$6 as ApiJobDirectoryV25_10_1, type ApiJobDirectory$5 as ApiJobDirectoryV25_10_2, type ApiJobDirectory$4 as ApiJobDirectoryV25_10_3, type ApiJobDirectory$3 as ApiJobDirectoryV25_10_4, type ApiJobDirectory$2 as ApiJobDirectoryV25_10_5, type ApiJobDirectory$1 as ApiJobDirectoryV26_0_0, type ApiJobDirectory as ApiJobDirectoryV27_0_0, type ApiKeyCreate, type ApiVersion, type ApiVersionResponse, AppState, type ArgsOf, AuthError, AuthErrorCode, type AuthResponse, type BaseApiDirectory, type CallMethod, type CallParams, type CallResponse, type Container, type CreateClientOptions, type DefaultApiDirectory, type EventKind, type EventName, type EventUnion, InvalidVersionResponseError, type Job, type JobMethod, type JobParams, type JobProgress, type JobResult, JobState, type Logger, NoCompatibleVersionsError, type OperationMappings, type QueryDirectory, type QueryEntity, type QueryListOptions, type QueryMethod, type QuerySingleOptions, SUPPORTED_API_VERSIONS, type SupportedApiVersion, TrueNasApiClient, TrueNasApiClientV2510, TrueNasApiClientV26, TrueNasApiClientV27, TrueNasAuthMechanism, type TrueNasDate, VersionCompatibility, VersionDiscovery, VersionDiscoveryError, VersionDiscoveryNetworkError, VersionDiscoveryTimeoutError, VersionEndpointNotFoundError, VersionTooNewError, VersionTooOldError, consoleLogger, createTrueNasClient, getApiErrorMessage, isJobFinished, noopLogger, index$7 as v25_10_0, index$6 as v25_10_1, index$5 as v25_10_2, index$4 as v25_10_3, index$3 as v25_10_4, index$2 as v25_10_5, index$1 as v26_0_0, index as v27_0_0 };
|
package/dist/index.d.ts
CHANGED
|
@@ -27540,7 +27540,7 @@ interface CreateClientOptions {
|
|
|
27540
27540
|
* 1. Discovers the API version (`GET /api/versions`), asking every hostname in
|
|
27541
27541
|
* parallel. The first usable answer wins.
|
|
27542
27542
|
* 2. Selects the matching client implementation (`v25.10.x` -> `TrueNasApiClientV2510`,
|
|
27543
|
-
* `v26.x.y` -> `TrueNasApiClientV26`).
|
|
27543
|
+
* `v26.x.y` -> `TrueNasApiClientV26`, `v27.x.y` -> `TrueNasApiClientV27`).
|
|
27544
27544
|
* 3. Instantiates and returns it.
|
|
27545
27545
|
*
|
|
27546
27546
|
* Resolves exactly once with a single client instance — dispose of it with
|
|
@@ -27657,6 +27657,67 @@ declare class TrueNasApiClientV26 extends TrueNasApiClient<ApiDirectory$1> {
|
|
|
27657
27657
|
protected createOperations(): OperationMappings;
|
|
27658
27658
|
}
|
|
27659
27659
|
|
|
27660
|
+
/**
|
|
27661
|
+
* TrueNAS API Client for v27.X.Y
|
|
27662
|
+
*
|
|
27663
|
+
* Handles all v27 versions (v27.0.0, v27.0.1, v27.1.2, etc.). Minor and patch
|
|
27664
|
+
* releases within a year are backward compatible, so one implementation covers
|
|
27665
|
+
* the series; breaking changes only arrive with the next year.
|
|
27666
|
+
*
|
|
27667
|
+
* That is what this class supports. What version *discovery* currently admits
|
|
27668
|
+
* is narrower: `MAX_SUPPORTED_VERSION` is a concrete version and the range check
|
|
27669
|
+
* compares patches, so today only `v27.0.0` clears it — `v27.0.1` and `v27.1.0`
|
|
27670
|
+
* are reported too-new and never reach this client. The effect always falls on
|
|
27671
|
+
* the newest series and nothing below it, which is why it has gone unnoticed:
|
|
27672
|
+
* raising the ceiling to v27.0.0 is what made v26.0.1 admissible in the first
|
|
27673
|
+
* place. Closing it means deciding how the ceiling should treat a series rather
|
|
27674
|
+
* than a version, which is a change to the compatibility model and not this
|
|
27675
|
+
* client's to make.
|
|
27676
|
+
*
|
|
27677
|
+
* To add version-specific behavior, override the factory methods:
|
|
27678
|
+
* - createConnection() - for connection-specific changes
|
|
27679
|
+
* - createApi() - for API method changes
|
|
27680
|
+
* - createAuthenticator() - for authentication changes
|
|
27681
|
+
* - createOperations() - for version-specific operation mappings
|
|
27682
|
+
*/
|
|
27683
|
+
|
|
27684
|
+
/**
|
|
27685
|
+
* API client for TrueNAS API v27
|
|
27686
|
+
*
|
|
27687
|
+
* Protocol: JSON-RPC 2.0
|
|
27688
|
+
* WebSocket Path: /api/v27.{minor}.{patch}
|
|
27689
|
+
*
|
|
27690
|
+
* Container operations use the native container.* APIs, as v26 does:
|
|
27691
|
+
* - containerQuery → container.query (with response transformation)
|
|
27692
|
+
* - containerStart → container.start (synchronous, emits null)
|
|
27693
|
+
* - containerStop → container.stop (emits Job updates)
|
|
27694
|
+
* - containerRestart → container.stop + container.start (emits Job, then null)
|
|
27695
|
+
*
|
|
27696
|
+
* Those four are currently identical to v26's, because v27 inherits all three
|
|
27697
|
+
* container entries the facade touches rather than re-declaring them. Asserted
|
|
27698
|
+
* rather than assumed, and re-runnable: the spec pins all three against v26's,
|
|
27699
|
+
* so the day they diverge is a failure there.
|
|
27700
|
+
*
|
|
27701
|
+
* They are written out here rather than shared with v26 because that is what
|
|
27702
|
+
* this repo's one-client-per-series design is for: the two are the same today
|
|
27703
|
+
* and are expected to diverge — middleware has no `container.restart` yet, and
|
|
27704
|
+
* the chained stop+start below is the workaround for its absence. Factoring the
|
|
27705
|
+
* bodies into a common base would couple two versions that exist in order to
|
|
27706
|
+
* evolve apart, and the coupling would have to be undone by whichever release
|
|
27707
|
+
* diverges first. The `@/generated` types are the guard against them drifting
|
|
27708
|
+
* silently: an entry that changes at v27 stops compiling here.
|
|
27709
|
+
*/
|
|
27710
|
+
declare class TrueNasApiClientV27 extends TrueNasApiClient<ApiDirectory> {
|
|
27711
|
+
/**
|
|
27712
|
+
* Create v27-specific operation mappings
|
|
27713
|
+
*
|
|
27714
|
+
* Operations return Observable<Job | null>:
|
|
27715
|
+
* - Async operations emit Job updates until complete
|
|
27716
|
+
* - Sync operations emit null once
|
|
27717
|
+
*/
|
|
27718
|
+
protected createOperations(): OperationMappings;
|
|
27719
|
+
}
|
|
27720
|
+
|
|
27660
27721
|
/**
|
|
27661
27722
|
* Discovers available API versions from TrueNAS systems.
|
|
27662
27723
|
*
|
|
@@ -27860,4 +27921,4 @@ type ApiError = JsonRpcError | TrueNasError;
|
|
|
27860
27921
|
*/
|
|
27861
27922
|
declare function getApiErrorMessage(error: unknown, fallback?: string): string;
|
|
27862
27923
|
|
|
27863
|
-
export { type ApiCallDirectory$7 as ApiCallDirectoryV25_10_0, type ApiCallDirectory$6 as ApiCallDirectoryV25_10_1, type ApiCallDirectory$5 as ApiCallDirectoryV25_10_2, type ApiCallDirectory$4 as ApiCallDirectoryV25_10_3, type ApiCallDirectory$3 as ApiCallDirectoryV25_10_4, type ApiCallDirectory$2 as ApiCallDirectoryV25_10_5, type ApiCallDirectory$1 as ApiCallDirectoryV26_0_0, type ApiCallDirectory as ApiCallDirectoryV27_0_0, type ApiDirectoryByVersion, type ApiDirectoryShape, type ApiDirectory$7 as ApiDirectoryV25_10_0, type ApiDirectory$6 as ApiDirectoryV25_10_1, type ApiDirectory$5 as ApiDirectoryV25_10_2, type ApiDirectory$4 as ApiDirectoryV25_10_3, type ApiDirectory$3 as ApiDirectoryV25_10_4, type ApiDirectory$2 as ApiDirectoryV25_10_5, type ApiDirectory$1 as ApiDirectoryV26_0_0, type ApiDirectory as ApiDirectoryV27_0_0, type ApiError, type ApiEventDirectory$7 as ApiEventDirectoryV25_10_0, type ApiEventDirectory$6 as ApiEventDirectoryV25_10_1, type ApiEventDirectory$5 as ApiEventDirectoryV25_10_2, type ApiEventDirectory$4 as ApiEventDirectoryV25_10_3, type ApiEventDirectory$3 as ApiEventDirectoryV25_10_4, type ApiEventDirectory$2 as ApiEventDirectoryV25_10_5, type ApiEventDirectory$1 as ApiEventDirectoryV26_0_0, type ApiEventDirectory as ApiEventDirectoryV27_0_0, type ApiJobDirectory$7 as ApiJobDirectoryV25_10_0, type ApiJobDirectory$6 as ApiJobDirectoryV25_10_1, type ApiJobDirectory$5 as ApiJobDirectoryV25_10_2, type ApiJobDirectory$4 as ApiJobDirectoryV25_10_3, type ApiJobDirectory$3 as ApiJobDirectoryV25_10_4, type ApiJobDirectory$2 as ApiJobDirectoryV25_10_5, type ApiJobDirectory$1 as ApiJobDirectoryV26_0_0, type ApiJobDirectory as ApiJobDirectoryV27_0_0, type ApiKeyCreate, type ApiVersion, type ApiVersionResponse, AppState, type ArgsOf, AuthError, AuthErrorCode, type AuthResponse, type BaseApiDirectory, type CallMethod, type CallParams, type CallResponse, type Container, type CreateClientOptions, type DefaultApiDirectory, type EventKind, type EventName, type EventUnion, InvalidVersionResponseError, type Job, type JobMethod, type JobParams, type JobProgress, type JobResult, JobState, type Logger, NoCompatibleVersionsError, type OperationMappings, type QueryDirectory, type QueryEntity, type QueryListOptions, type QueryMethod, type QuerySingleOptions, SUPPORTED_API_VERSIONS, type SupportedApiVersion, TrueNasApiClient, TrueNasApiClientV2510, TrueNasApiClientV26, TrueNasAuthMechanism, type TrueNasDate, VersionCompatibility, VersionDiscovery, VersionDiscoveryError, VersionDiscoveryNetworkError, VersionDiscoveryTimeoutError, VersionEndpointNotFoundError, VersionTooNewError, VersionTooOldError, consoleLogger, createTrueNasClient, getApiErrorMessage, isJobFinished, noopLogger, index$7 as v25_10_0, index$6 as v25_10_1, index$5 as v25_10_2, index$4 as v25_10_3, index$3 as v25_10_4, index$2 as v25_10_5, index$1 as v26_0_0, index as v27_0_0 };
|
|
27924
|
+
export { type ApiCallDirectory$7 as ApiCallDirectoryV25_10_0, type ApiCallDirectory$6 as ApiCallDirectoryV25_10_1, type ApiCallDirectory$5 as ApiCallDirectoryV25_10_2, type ApiCallDirectory$4 as ApiCallDirectoryV25_10_3, type ApiCallDirectory$3 as ApiCallDirectoryV25_10_4, type ApiCallDirectory$2 as ApiCallDirectoryV25_10_5, type ApiCallDirectory$1 as ApiCallDirectoryV26_0_0, type ApiCallDirectory as ApiCallDirectoryV27_0_0, type ApiDirectoryByVersion, type ApiDirectoryShape, type ApiDirectory$7 as ApiDirectoryV25_10_0, type ApiDirectory$6 as ApiDirectoryV25_10_1, type ApiDirectory$5 as ApiDirectoryV25_10_2, type ApiDirectory$4 as ApiDirectoryV25_10_3, type ApiDirectory$3 as ApiDirectoryV25_10_4, type ApiDirectory$2 as ApiDirectoryV25_10_5, type ApiDirectory$1 as ApiDirectoryV26_0_0, type ApiDirectory as ApiDirectoryV27_0_0, type ApiError, type ApiEventDirectory$7 as ApiEventDirectoryV25_10_0, type ApiEventDirectory$6 as ApiEventDirectoryV25_10_1, type ApiEventDirectory$5 as ApiEventDirectoryV25_10_2, type ApiEventDirectory$4 as ApiEventDirectoryV25_10_3, type ApiEventDirectory$3 as ApiEventDirectoryV25_10_4, type ApiEventDirectory$2 as ApiEventDirectoryV25_10_5, type ApiEventDirectory$1 as ApiEventDirectoryV26_0_0, type ApiEventDirectory as ApiEventDirectoryV27_0_0, type ApiJobDirectory$7 as ApiJobDirectoryV25_10_0, type ApiJobDirectory$6 as ApiJobDirectoryV25_10_1, type ApiJobDirectory$5 as ApiJobDirectoryV25_10_2, type ApiJobDirectory$4 as ApiJobDirectoryV25_10_3, type ApiJobDirectory$3 as ApiJobDirectoryV25_10_4, type ApiJobDirectory$2 as ApiJobDirectoryV25_10_5, type ApiJobDirectory$1 as ApiJobDirectoryV26_0_0, type ApiJobDirectory as ApiJobDirectoryV27_0_0, type ApiKeyCreate, type ApiVersion, type ApiVersionResponse, AppState, type ArgsOf, AuthError, AuthErrorCode, type AuthResponse, type BaseApiDirectory, type CallMethod, type CallParams, type CallResponse, type Container, type CreateClientOptions, type DefaultApiDirectory, type EventKind, type EventName, type EventUnion, InvalidVersionResponseError, type Job, type JobMethod, type JobParams, type JobProgress, type JobResult, JobState, type Logger, NoCompatibleVersionsError, type OperationMappings, type QueryDirectory, type QueryEntity, type QueryListOptions, type QueryMethod, type QuerySingleOptions, SUPPORTED_API_VERSIONS, type SupportedApiVersion, TrueNasApiClient, TrueNasApiClientV2510, TrueNasApiClientV26, TrueNasApiClientV27, TrueNasAuthMechanism, type TrueNasDate, VersionCompatibility, VersionDiscovery, VersionDiscoveryError, VersionDiscoveryNetworkError, VersionDiscoveryTimeoutError, VersionEndpointNotFoundError, VersionTooNewError, VersionTooOldError, consoleLogger, createTrueNasClient, getApiErrorMessage, isJobFinished, noopLogger, index$7 as v25_10_0, index$6 as v25_10_1, index$5 as v25_10_2, index$4 as v25_10_3, index$3 as v25_10_4, index$2 as v25_10_5, index$1 as v26_0_0, index as v27_0_0 };
|
package/dist/index.js
CHANGED
|
@@ -2892,14 +2892,23 @@ var apiVersionConfig = {
|
|
|
2892
2892
|
/**
|
|
2893
2893
|
* Maximum supported API version. Systems above it are rejected.
|
|
2894
2894
|
*
|
|
2895
|
-
* NOT derived, deliberately
|
|
2896
|
-
*
|
|
2897
|
-
* `
|
|
2898
|
-
*
|
|
2899
|
-
*
|
|
2900
|
-
*
|
|
2895
|
+
* NOT derived, deliberately — and for a different reason than it used to
|
|
2896
|
+
* lag. It sat at v26.0.0 while types for v27 already shipped, because
|
|
2897
|
+
* `CLIENT_BY_VERSION_KEY` had no `27` and a v27 system would have passed the
|
|
2898
|
+
* range check only to throw on client selection. `TrueNasApiClientV27` now
|
|
2899
|
+
* exists, so this moves up with it.
|
|
2900
|
+
*
|
|
2901
|
+
* What it must not become is `SUPPORTED_API_VERSIONS[length - 1]`, the mirror
|
|
2902
|
+
* of how MIN is derived. MIN is safe to derive because the oldest generated
|
|
2903
|
+
* version always has a client — it is the floor the clients were built from.
|
|
2904
|
+
* The ceiling is not symmetric: generating types for v28 does not write a v28
|
|
2905
|
+
* client, so deriving this would re-create the exact gap described above on
|
|
2906
|
+
* the next regeneration, silently. The real invariant is "the newest version
|
|
2907
|
+
* a client can be built for", which lives in `CLIENT_BY_VERSION_KEY`; a
|
|
2908
|
+
* factory test asserts the two agree, which is the check that keeps this
|
|
2909
|
+
* literal honest without importing the factory here.
|
|
2901
2910
|
*/
|
|
2902
|
-
MAX_SUPPORTED_VERSION: "
|
|
2911
|
+
MAX_SUPPORTED_VERSION: "v27.0.0",
|
|
2903
2912
|
/**
|
|
2904
2913
|
* Fallback version to use when version discovery fails due to CORS/network errors.
|
|
2905
2914
|
* When /api/versions returns HTTP status 0 (CORS block, network down, etc.),
|
|
@@ -3222,6 +3231,68 @@ function toContainer2(container) {
|
|
|
3222
3231
|
description
|
|
3223
3232
|
};
|
|
3224
3233
|
}
|
|
3234
|
+
var TrueNasApiClientV27 = class extends TrueNasApiClient {
|
|
3235
|
+
/**
|
|
3236
|
+
* Create v27-specific operation mappings
|
|
3237
|
+
*
|
|
3238
|
+
* Operations return Observable<Job | null>:
|
|
3239
|
+
* - Async operations emit Job updates until complete
|
|
3240
|
+
* - Sync operations emit null once
|
|
3241
|
+
*/
|
|
3242
|
+
createOperations() {
|
|
3243
|
+
return {
|
|
3244
|
+
// A polymorphic `.query`, so it goes through the verb rather than
|
|
3245
|
+
// `call`: the directory types the raw method's response as the five-way
|
|
3246
|
+
// union the server may return, and the verb is what fixes it to a list.
|
|
3247
|
+
containerQuery: () => this.api.query("container.query").pipe(
|
|
3248
|
+
map((containers) => containers.map(toContainer3))
|
|
3249
|
+
),
|
|
3250
|
+
// container.start is synchronous in v27 - emit null
|
|
3251
|
+
containerStart: (id) => this.api.call("container.start", [parseInt(id, 10)]).pipe(map(() => null)),
|
|
3252
|
+
// container.stop emits job updates
|
|
3253
|
+
containerStop: (id, options) => this.api.job("container.stop", [
|
|
3254
|
+
parseInt(id, 10),
|
|
3255
|
+
{
|
|
3256
|
+
force: options.force,
|
|
3257
|
+
force_after_timeout: options.force
|
|
3258
|
+
}
|
|
3259
|
+
]),
|
|
3260
|
+
// v27 still has no container.restart - chain stop + start.
|
|
3261
|
+
// Emits Job updates during stop, then null when start completes.
|
|
3262
|
+
containerRestart: (id, options) => {
|
|
3263
|
+
const numericId = parseInt(id, 10);
|
|
3264
|
+
return this.api.job("container.stop", [
|
|
3265
|
+
numericId,
|
|
3266
|
+
{
|
|
3267
|
+
force: options.force,
|
|
3268
|
+
force_after_timeout: options.force
|
|
3269
|
+
}
|
|
3270
|
+
]).pipe(
|
|
3271
|
+
// Collect all job updates to ensure stop fully completes
|
|
3272
|
+
toArray(),
|
|
3273
|
+
// Re-emit job updates, then call start after stop is done
|
|
3274
|
+
switchMap(
|
|
3275
|
+
(jobUpdates) => concat(
|
|
3276
|
+
from(jobUpdates),
|
|
3277
|
+
this.api.call("container.start", [numericId]).pipe(map(() => null))
|
|
3278
|
+
)
|
|
3279
|
+
)
|
|
3280
|
+
);
|
|
3281
|
+
}
|
|
3282
|
+
};
|
|
3283
|
+
}
|
|
3284
|
+
};
|
|
3285
|
+
function toContainer3(container) {
|
|
3286
|
+
const { description } = container;
|
|
3287
|
+
return {
|
|
3288
|
+
id: container.id.toString(),
|
|
3289
|
+
name: container.name,
|
|
3290
|
+
status: toAppState(container.status.state),
|
|
3291
|
+
// Optional in the generated entry, required by `Container`.
|
|
3292
|
+
autostart: container.autostart ?? false,
|
|
3293
|
+
description
|
|
3294
|
+
};
|
|
3295
|
+
}
|
|
3225
3296
|
|
|
3226
3297
|
// src/errors/version-discovery.errors.ts
|
|
3227
3298
|
var VersionDiscoveryError = class extends Error {
|
|
@@ -3591,7 +3662,8 @@ function selectRepresentativeFailure(failures) {
|
|
|
3591
3662
|
}
|
|
3592
3663
|
var CLIENT_BY_VERSION_KEY = {
|
|
3593
3664
|
"25.10": TrueNasApiClientV2510,
|
|
3594
|
-
"26": TrueNasApiClientV26
|
|
3665
|
+
"26": TrueNasApiClientV26,
|
|
3666
|
+
"27": TrueNasApiClientV27
|
|
3595
3667
|
};
|
|
3596
3668
|
function clientVersionKey(version) {
|
|
3597
3669
|
if (version.year <= legacyCutoffYear) {
|
|
@@ -3637,6 +3709,6 @@ function errorMessageOrDefault(error, fallback) {
|
|
|
3637
3709
|
return fallback;
|
|
3638
3710
|
}
|
|
3639
3711
|
|
|
3640
|
-
export { AppState, AuthError, AuthErrorCode, InvalidVersionResponseError, JobState, NoCompatibleVersionsError, SUPPORTED_API_VERSIONS, TrueNasApiClient, TrueNasApiClientV2510, TrueNasApiClientV26, TrueNasAuthMechanism, VersionCompatibility, VersionDiscovery, VersionDiscoveryError, VersionDiscoveryNetworkError, VersionDiscoveryTimeoutError, VersionEndpointNotFoundError, VersionTooNewError, VersionTooOldError, consoleLogger, createTrueNasClient, getApiErrorMessage, isJobFinished, noopLogger, v25_10_0_exports as v25_10_0, v25_10_1_exports as v25_10_1, v25_10_2_exports as v25_10_2, v25_10_3_exports as v25_10_3, v25_10_4_exports as v25_10_4, v25_10_5_exports as v25_10_5, v26_0_0_exports as v26_0_0, v27_0_0_exports as v27_0_0 };
|
|
3712
|
+
export { AppState, AuthError, AuthErrorCode, InvalidVersionResponseError, JobState, NoCompatibleVersionsError, SUPPORTED_API_VERSIONS, TrueNasApiClient, TrueNasApiClientV2510, TrueNasApiClientV26, TrueNasApiClientV27, TrueNasAuthMechanism, VersionCompatibility, VersionDiscovery, VersionDiscoveryError, VersionDiscoveryNetworkError, VersionDiscoveryTimeoutError, VersionEndpointNotFoundError, VersionTooNewError, VersionTooOldError, consoleLogger, createTrueNasClient, getApiErrorMessage, isJobFinished, noopLogger, v25_10_0_exports as v25_10_0, v25_10_1_exports as v25_10_1, v25_10_2_exports as v25_10_2, v25_10_3_exports as v25_10_3, v25_10_4_exports as v25_10_4, v25_10_5_exports as v25_10_5, v26_0_0_exports as v26_0_0, v27_0_0_exports as v27_0_0 };
|
|
3641
3713
|
//# sourceMappingURL=index.js.map
|
|
3642
3714
|
//# sourceMappingURL=index.js.map
|