@truenas/api-client 8.0.0 → 9.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 CHANGED
@@ -1,148 +1,152 @@
1
1
  'use strict';
2
2
 
3
- var chunkDIZAGV4B_cjs = require('./chunk-DIZAGV4B.cjs');
3
+ var chunkU6V2Y3AE_cjs = require('./chunk-U6V2Y3AE.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "AppState", {
8
8
  enumerable: true,
9
- get: function () { return chunkDIZAGV4B_cjs.AppState; }
9
+ get: function () { return chunkU6V2Y3AE_cjs.AppState; }
10
10
  });
11
11
  Object.defineProperty(exports, "AuthError", {
12
12
  enumerable: true,
13
- get: function () { return chunkDIZAGV4B_cjs.AuthError; }
13
+ get: function () { return chunkU6V2Y3AE_cjs.AuthError; }
14
14
  });
15
15
  Object.defineProperty(exports, "AuthErrorCode", {
16
16
  enumerable: true,
17
- get: function () { return chunkDIZAGV4B_cjs.AuthErrorCode; }
17
+ get: function () { return chunkU6V2Y3AE_cjs.AuthErrorCode; }
18
18
  });
19
19
  Object.defineProperty(exports, "AuthResponseType", {
20
20
  enumerable: true,
21
- get: function () { return chunkDIZAGV4B_cjs.AuthResponseType; }
21
+ get: function () { return chunkU6V2Y3AE_cjs.AuthResponseType; }
22
22
  });
23
23
  Object.defineProperty(exports, "InvalidVersionResponseError", {
24
24
  enumerable: true,
25
- get: function () { return chunkDIZAGV4B_cjs.InvalidVersionResponseError; }
25
+ get: function () { return chunkU6V2Y3AE_cjs.InvalidVersionResponseError; }
26
26
  });
27
27
  Object.defineProperty(exports, "JobState", {
28
28
  enumerable: true,
29
- get: function () { return chunkDIZAGV4B_cjs.JobState; }
29
+ get: function () { return chunkU6V2Y3AE_cjs.JobState; }
30
30
  });
31
31
  Object.defineProperty(exports, "NoCompatibleVersionsError", {
32
32
  enumerable: true,
33
- get: function () { return chunkDIZAGV4B_cjs.NoCompatibleVersionsError; }
33
+ get: function () { return chunkU6V2Y3AE_cjs.NoCompatibleVersionsError; }
34
34
  });
35
35
  Object.defineProperty(exports, "SUPPORTED_API_VERSIONS", {
36
36
  enumerable: true,
37
- get: function () { return chunkDIZAGV4B_cjs.SUPPORTED_API_VERSIONS; }
37
+ get: function () { return chunkU6V2Y3AE_cjs.SUPPORTED_API_VERSIONS; }
38
38
  });
39
39
  Object.defineProperty(exports, "TrueNasApiClient", {
40
40
  enumerable: true,
41
- get: function () { return chunkDIZAGV4B_cjs.TrueNasApiClient; }
41
+ get: function () { return chunkU6V2Y3AE_cjs.TrueNasApiClient; }
42
42
  });
43
43
  Object.defineProperty(exports, "TrueNasApiClientV2510", {
44
44
  enumerable: true,
45
- get: function () { return chunkDIZAGV4B_cjs.TrueNasApiClientV2510; }
45
+ get: function () { return chunkU6V2Y3AE_cjs.TrueNasApiClientV2510; }
46
46
  });
47
- Object.defineProperty(exports, "TrueNasApiClientV26", {
47
+ Object.defineProperty(exports, "TrueNasApiClientV27", {
48
48
  enumerable: true,
49
- get: function () { return chunkDIZAGV4B_cjs.TrueNasApiClientV26; }
49
+ get: function () { return chunkU6V2Y3AE_cjs.TrueNasApiClientV27; }
50
50
  });
51
- Object.defineProperty(exports, "TrueNasApiClientV27", {
51
+ Object.defineProperty(exports, "TrueNasApiClientV28", {
52
+ enumerable: true,
53
+ get: function () { return chunkU6V2Y3AE_cjs.TrueNasApiClientV28; }
54
+ });
55
+ Object.defineProperty(exports, "TrueNasApiError", {
52
56
  enumerable: true,
53
- get: function () { return chunkDIZAGV4B_cjs.TrueNasApiClientV27; }
57
+ get: function () { return chunkU6V2Y3AE_cjs.TrueNasApiError; }
54
58
  });
55
59
  Object.defineProperty(exports, "TrueNasAuthMechanism", {
56
60
  enumerable: true,
57
- get: function () { return chunkDIZAGV4B_cjs.TrueNasAuthMechanism; }
61
+ get: function () { return chunkU6V2Y3AE_cjs.TrueNasAuthMechanism; }
58
62
  });
59
63
  Object.defineProperty(exports, "UserRole", {
60
64
  enumerable: true,
61
- get: function () { return chunkDIZAGV4B_cjs.UserRole; }
65
+ get: function () { return chunkU6V2Y3AE_cjs.UserRole; }
62
66
  });
63
67
  Object.defineProperty(exports, "VersionCompatibility", {
64
68
  enumerable: true,
65
- get: function () { return chunkDIZAGV4B_cjs.VersionCompatibility; }
69
+ get: function () { return chunkU6V2Y3AE_cjs.VersionCompatibility; }
66
70
  });
67
71
  Object.defineProperty(exports, "VersionDiscovery", {
68
72
  enumerable: true,
69
- get: function () { return chunkDIZAGV4B_cjs.VersionDiscovery; }
73
+ get: function () { return chunkU6V2Y3AE_cjs.VersionDiscovery; }
70
74
  });
71
75
  Object.defineProperty(exports, "VersionDiscoveryError", {
72
76
  enumerable: true,
73
- get: function () { return chunkDIZAGV4B_cjs.VersionDiscoveryError; }
77
+ get: function () { return chunkU6V2Y3AE_cjs.VersionDiscoveryError; }
74
78
  });
75
79
  Object.defineProperty(exports, "VersionDiscoveryNetworkError", {
76
80
  enumerable: true,
77
- get: function () { return chunkDIZAGV4B_cjs.VersionDiscoveryNetworkError; }
81
+ get: function () { return chunkU6V2Y3AE_cjs.VersionDiscoveryNetworkError; }
78
82
  });
79
83
  Object.defineProperty(exports, "VersionDiscoveryTimeoutError", {
80
84
  enumerable: true,
81
- get: function () { return chunkDIZAGV4B_cjs.VersionDiscoveryTimeoutError; }
85
+ get: function () { return chunkU6V2Y3AE_cjs.VersionDiscoveryTimeoutError; }
82
86
  });
83
87
  Object.defineProperty(exports, "VersionEndpointNotFoundError", {
84
88
  enumerable: true,
85
- get: function () { return chunkDIZAGV4B_cjs.VersionEndpointNotFoundError; }
89
+ get: function () { return chunkU6V2Y3AE_cjs.VersionEndpointNotFoundError; }
86
90
  });
87
91
  Object.defineProperty(exports, "VersionTooNewError", {
88
92
  enumerable: true,
89
- get: function () { return chunkDIZAGV4B_cjs.VersionTooNewError; }
93
+ get: function () { return chunkU6V2Y3AE_cjs.VersionTooNewError; }
90
94
  });
91
95
  Object.defineProperty(exports, "VersionTooOldError", {
92
96
  enumerable: true,
93
- get: function () { return chunkDIZAGV4B_cjs.VersionTooOldError; }
97
+ get: function () { return chunkU6V2Y3AE_cjs.VersionTooOldError; }
94
98
  });
95
99
  Object.defineProperty(exports, "consoleLogger", {
96
100
  enumerable: true,
97
- get: function () { return chunkDIZAGV4B_cjs.consoleLogger; }
101
+ get: function () { return chunkU6V2Y3AE_cjs.consoleLogger; }
98
102
  });
99
103
  Object.defineProperty(exports, "createTrueNasClient", {
100
104
  enumerable: true,
101
- get: function () { return chunkDIZAGV4B_cjs.createTrueNasClient; }
105
+ get: function () { return chunkU6V2Y3AE_cjs.createTrueNasClient; }
102
106
  });
103
107
  Object.defineProperty(exports, "getApiErrorMessage", {
104
108
  enumerable: true,
105
- get: function () { return chunkDIZAGV4B_cjs.getApiErrorMessage; }
109
+ get: function () { return chunkU6V2Y3AE_cjs.getApiErrorMessage; }
106
110
  });
107
111
  Object.defineProperty(exports, "isJobFinished", {
108
112
  enumerable: true,
109
- get: function () { return chunkDIZAGV4B_cjs.isJobFinished; }
113
+ get: function () { return chunkU6V2Y3AE_cjs.isJobFinished; }
110
114
  });
111
115
  Object.defineProperty(exports, "noopLogger", {
112
116
  enumerable: true,
113
- get: function () { return chunkDIZAGV4B_cjs.noopLogger; }
117
+ get: function () { return chunkU6V2Y3AE_cjs.noopLogger; }
114
118
  });
115
119
  Object.defineProperty(exports, "v25_10_0", {
116
120
  enumerable: true,
117
- get: function () { return chunkDIZAGV4B_cjs.v25_10_0_exports; }
121
+ get: function () { return chunkU6V2Y3AE_cjs.v25_10_0_exports; }
118
122
  });
119
123
  Object.defineProperty(exports, "v25_10_1", {
120
124
  enumerable: true,
121
- get: function () { return chunkDIZAGV4B_cjs.v25_10_1_exports; }
125
+ get: function () { return chunkU6V2Y3AE_cjs.v25_10_1_exports; }
122
126
  });
123
127
  Object.defineProperty(exports, "v25_10_2", {
124
128
  enumerable: true,
125
- get: function () { return chunkDIZAGV4B_cjs.v25_10_2_exports; }
129
+ get: function () { return chunkU6V2Y3AE_cjs.v25_10_2_exports; }
126
130
  });
127
131
  Object.defineProperty(exports, "v25_10_3", {
128
132
  enumerable: true,
129
- get: function () { return chunkDIZAGV4B_cjs.v25_10_3_exports; }
133
+ get: function () { return chunkU6V2Y3AE_cjs.v25_10_3_exports; }
130
134
  });
131
135
  Object.defineProperty(exports, "v25_10_4", {
132
136
  enumerable: true,
133
- get: function () { return chunkDIZAGV4B_cjs.v25_10_4_exports; }
137
+ get: function () { return chunkU6V2Y3AE_cjs.v25_10_4_exports; }
134
138
  });
135
139
  Object.defineProperty(exports, "v25_10_5", {
136
140
  enumerable: true,
137
- get: function () { return chunkDIZAGV4B_cjs.v25_10_5_exports; }
141
+ get: function () { return chunkU6V2Y3AE_cjs.v25_10_5_exports; }
138
142
  });
139
- Object.defineProperty(exports, "v26_0_0", {
143
+ Object.defineProperty(exports, "v27_0_0", {
140
144
  enumerable: true,
141
- get: function () { return chunkDIZAGV4B_cjs.v26_0_0_exports; }
145
+ get: function () { return chunkU6V2Y3AE_cjs.v27_0_0_exports; }
142
146
  });
143
- Object.defineProperty(exports, "v27_0_0", {
147
+ Object.defineProperty(exports, "v28_0_0", {
144
148
  enumerable: true,
145
- get: function () { return chunkDIZAGV4B_cjs.v27_0_0_exports; }
149
+ get: function () { return chunkU6V2Y3AE_cjs.v28_0_0_exports; }
146
150
  });
147
151
  //# sourceMappingURL=index.cjs.map
148
152
  //# sourceMappingURL=index.cjs.map
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { T as TrueNasApiClient, A as ApiDirectory, O as OperationMappings, a as ApiDirectory$1, b as ApiDirectory$2, L as Logger, c as ApplianceProtocol, d as ApiVersion } from './truenas-auth-mechanism.enum-DUitTxen.cjs';
2
- export { e as ApiCallDirectoryV25_10_0, f as ApiCallDirectoryV25_10_1, g as ApiCallDirectoryV25_10_2, h as ApiCallDirectoryV25_10_3, i as ApiCallDirectoryV25_10_4, j as ApiCallDirectoryV25_10_5, k as ApiCallDirectoryV26_0_0, l as ApiCallDirectoryV27_0_0, m as ApiDirectoryByVersion, n as ApiDirectoryShape, o as ApiDirectoryV25_10_1, p as ApiDirectoryV25_10_2, q as ApiDirectoryV25_10_3, r as ApiDirectoryV25_10_4, s as ApiDirectoryV25_10_5, t as ApiError, u as ApiEventDirectoryV25_10_0, v as ApiEventDirectoryV25_10_1, w as ApiEventDirectoryV25_10_2, x as ApiEventDirectoryV25_10_3, y as ApiEventDirectoryV25_10_4, z as ApiEventDirectoryV25_10_5, B as ApiEventDirectoryV26_0_0, C as ApiEventDirectoryV27_0_0, D as ApiJobDirectoryV25_10_0, E as ApiJobDirectoryV25_10_1, F as ApiJobDirectoryV25_10_2, G as ApiJobDirectoryV25_10_3, H as ApiJobDirectoryV25_10_4, I as ApiJobDirectoryV25_10_5, J as ApiJobDirectoryV26_0_0, K as ApiJobDirectoryV27_0_0, M as ApiKeyCreate, N as ApiVersionResponse, P as AppState, Q as ArgsOf, R as AuthResponse, S as AuthResponseType, U as BaseApiDirectory, V as CallMethod, W as CallParams, X as CallResponse, Y as ConnectionClose, Z as ConnectionEndpoint, _ as Container, $ as CreateClientOptions, a0 as DefaultApiDirectory, a1 as EventKind, a2 as EventName, a3 as EventUnion, a4 as Job, a5 as JobMethod, a6 as JobParams, a7 as JobProgress, a8 as JobResult, a9 as JobState, aa as QueryDirectory, ab as QueryEntity, ac as QueryListOptions, ad as QueryMethod, ae as QuerySingleOptions, af as ReconnectOptions, ag as SUPPORTED_API_VERSIONS, ah as SmbStatusInfoLevel, ai as SmbStatusOptions, aj as SmbStatusRequest, ak as SmbStatusResponse, al as SmbStatusRow, am as SupportedApiVersion, an as TrueNasAuthMechanism, ao as TrueNasDate, ap as TrueNasErrorData, aq as TrueNasErrorFrame, ar as UserRole, as as UserRoleName, at as VersionCompatibility, au as consoleLogger, av as createTrueNasClient, aw as getApiErrorMessage, ax as isJobFinished, ay as noopLogger, az as v25_10_0, aA as v25_10_1, aB as v25_10_2, aC as v25_10_3, aD as v25_10_4, aE as v25_10_5, aF as v26_0_0, aG as v27_0_0 } from './truenas-auth-mechanism.enum-DUitTxen.cjs';
1
+ import { T as TrueNasApiClient, A as ApiDirectory, O as OperationMappings, a as ApiDirectory$1, b as ApiDirectory$2, L as Logger, c as ApplianceProtocol, d as ApiVersion, e as TrueNasErrorFrame, f as TrueNasErrorData } from './truenas-auth-mechanism.enum-Bp2XMMwK.cjs';
2
+ export { g as ApiCallDirectoryV25_10_0, h as ApiCallDirectoryV25_10_1, i as ApiCallDirectoryV25_10_2, j as ApiCallDirectoryV25_10_3, k as ApiCallDirectoryV25_10_4, l as ApiCallDirectoryV25_10_5, m as ApiCallDirectoryV27_0_0, n as ApiCallDirectoryV28_0_0, o as ApiDirectoryByVersion, p as ApiDirectoryShape, q as ApiDirectoryV25_10_1, r as ApiDirectoryV25_10_2, s as ApiDirectoryV25_10_3, t as ApiDirectoryV25_10_4, u as ApiDirectoryV25_10_5, v as ApiError, w as ApiEventDirectoryV25_10_0, x as ApiEventDirectoryV25_10_1, y as ApiEventDirectoryV25_10_2, z as ApiEventDirectoryV25_10_3, B as ApiEventDirectoryV25_10_4, C as ApiEventDirectoryV25_10_5, D as ApiEventDirectoryV27_0_0, E as ApiEventDirectoryV28_0_0, F as ApiJobDirectoryV25_10_0, G as ApiJobDirectoryV25_10_1, H as ApiJobDirectoryV25_10_2, I as ApiJobDirectoryV25_10_3, J as ApiJobDirectoryV25_10_4, K as ApiJobDirectoryV25_10_5, M as ApiJobDirectoryV27_0_0, N as ApiJobDirectoryV28_0_0, P as ApiKeyCreate, Q as ApiVersionResponse, R as AppState, S as ArgsOf, U as AuthResponse, V as AuthResponseType, W as BaseApiDirectory, X as CallMethod, Y as CallParams, Z as CallResponse, _ as ConnectionClose, $ as ConnectionEndpoint, a0 as Container, a1 as CreateClientOptions, a2 as DefaultApiDirectory, a3 as EventKind, a4 as EventName, a5 as EventSourceName, a6 as EventUnion, a7 as Job, a8 as JobMethod, a9 as JobParams, aa as JobProgress, ab as JobResult, ac as JobState, ad as QueryDirectory, ae as QueryEntity, af as QueryListOptions, ag as QueryMethod, ah as QuerySingleOptions, ai as ReconnectOptions, aj as SUPPORTED_API_VERSIONS, ak as SmbStatusInfoLevel, al as SmbStatusOptions, am as SmbStatusRequest, an as SmbStatusResponse, ao as SmbStatusRow, ap as SubscribableEvent, aq as SubscriptionArgs, ar as SubscriptionParams, as as SupportedApiVersion, at as TrueNasAuthMechanism, au as TrueNasDate, av as UserRole, aw as UserRoleName, ax as VersionCompatibility, ay as consoleLogger, az as createTrueNasClient, aA as getApiErrorMessage, aB as isJobFinished, aC as noopLogger, aD as v25_10_0, aE as v25_10_1, aF as v25_10_2, aG as v25_10_3, aH as v25_10_4, aI as v25_10_5, aJ as v27_0_0, aK as v28_0_0 } from './truenas-auth-mechanism.enum-Bp2XMMwK.cjs';
3
3
  import { Observable } from 'rxjs';
4
4
  import 'rxjs/webSocket';
5
5
 
@@ -39,11 +39,12 @@ declare class TrueNasApiClientV2510 extends TrueNasApiClient<ApiDirectory> {
39
39
  }
40
40
 
41
41
  /**
42
- * TrueNAS API Client for v26.X.Y
42
+ * TrueNAS API Client for v27.X.Y
43
43
  *
44
- * Handles all v26 versions (v26.0.0, v26.0.1, v26.1.2, etc.).
45
- * Minor AND patch versions are backward compatible, so one client implementation
46
- * handles all patches within the v26 series.
44
+ * Handles the v27 series: minor and patch versions are backward compatible, so
45
+ * one implementation covers them. Discovery is stricter — it admits only what
46
+ * `SUPPORTED_API_VERSIONS` names, so a v27 patch reaches this client only once
47
+ * the types are regenerated for it.
47
48
  *
48
49
  * To add version-specific behavior, override the factory methods:
49
50
  * - createConnection() - for connection-specific changes
@@ -53,7 +54,7 @@ declare class TrueNasApiClientV2510 extends TrueNasApiClient<ApiDirectory> {
53
54
  */
54
55
 
55
56
  /**
56
- * API client for TrueNAS API v26 (JSON-RPC 2.0 over /api/v26.{minor}.{patch}).
57
+ * API client for TrueNAS API v27 (JSON-RPC 2.0 over /api/v27.{minor}.{patch}).
57
58
  *
58
59
  * - containerQuery → container.query (with response transformation)
59
60
  * - containerStart → container.start (synchronous, emits null)
@@ -62,9 +63,9 @@ declare class TrueNasApiClientV2510 extends TrueNasApiClient<ApiDirectory> {
62
63
  * - containerDelete → container.delete (a job; force/recursive)
63
64
  * - smbStatus → smb.status (public, gated on `SHARING_SMB_READ`)
64
65
  */
65
- declare class TrueNasApiClientV26 extends TrueNasApiClient<ApiDirectory$1> {
66
+ declare class TrueNasApiClientV27 extends TrueNasApiClient<ApiDirectory$1> {
66
67
  /**
67
- * Create v26-specific operation mappings
68
+ * Create v27-specific operation mappings
68
69
  *
69
70
  * Operations return Observable<Job | null>:
70
71
  * - Async operations emit Job updates until complete
@@ -74,28 +75,29 @@ declare class TrueNasApiClientV26 extends TrueNasApiClient<ApiDirectory$1> {
74
75
  }
75
76
 
76
77
  /**
77
- * TrueNAS API Client for v27.X.Y
78
+ * TrueNAS API Client for v28.X.Y
78
79
  *
79
- * Handles the whole v27 series; breaking changes only arrive with v28.
80
+ * Handles the whole v28 series; breaking changes only arrive with v29.
80
81
  *
81
- * Discovery admits less: `MAX_SUPPORTED_VERSION` is compared down to the patch,
82
- * so v27.0.1 and v27.1.0 are reported too new and never reach this client.
82
+ * Discovery admits less: a version has to be one `SUPPORTED_API_VERSIONS`
83
+ * names, so v28.0.1 and v28.1.0 are reported `Unsupported` and never reach this
84
+ * client until the types are regenerated for them.
83
85
  *
84
86
  * To add version-specific behavior, override createConnection(), createApi(),
85
87
  * createAuthenticator() or createOperations().
86
88
  */
87
89
 
88
90
  /**
89
- * API client for TrueNAS API v27 (JSON-RPC 2.0 over /api/v27.{minor}.{patch}).
91
+ * API client for TrueNAS API v28 (JSON-RPC 2.0 over /api/v28.{minor}.{patch}).
90
92
  *
91
- * Operations currently match `TrueNasApiClientV26`'s because v27 inherits every
92
- * entry they use. The spec pins the four container entries to v26's;
93
+ * Operations currently match `TrueNasApiClientV27`'s because v28 inherits every
94
+ * entry they use. The spec pins the four container entries to v27's;
93
95
  * `smb.status` is unpinned, so a widened param or narrowed response would
94
96
  * still compile here. Duplicated rather than shared so the series can diverge.
95
97
  */
96
- declare class TrueNasApiClientV27 extends TrueNasApiClient<ApiDirectory$2> {
98
+ declare class TrueNasApiClientV28 extends TrueNasApiClient<ApiDirectory$2> {
97
99
  /**
98
- * Create v27-specific operation mappings
100
+ * Create v28-specific operation mappings
99
101
  *
100
102
  * Operations return Observable<Job | null>:
101
103
  * - Async operations emit Job updates until complete
@@ -232,17 +234,27 @@ declare class VersionDiscoveryNetworkError extends VersionDiscoveryError {
232
234
  }
233
235
  /**
234
236
  * Thrown when no compatible versions are found in the response
237
+ *
238
+ * The message lists the versions rather than a span. An appliance can offer a
239
+ * version inside `supportedRange` that this package still ships no types for —
240
+ * v26.0.0, which middleware renumbered to v27.0.0 before release — and telling
241
+ * that caller "supported: v25.10.0 to v28.0.0" would describe their version as
242
+ * qualifying while refusing it.
235
243
  */
236
244
  declare class NoCompatibleVersionsError extends VersionDiscoveryError {
237
245
  readonly availableVersions: string[];
246
+ /** The span the range checks use. Retained for callers that render it; it is wider than the `supportedVersions` list. */
238
247
  readonly supportedRange: {
239
248
  min: string;
240
249
  max: string;
241
250
  };
242
- constructor(hostname: string, availableVersions: string[], supportedRange?: {
251
+ readonly supportedVersions: readonly string[];
252
+ constructor(hostname: string, availableVersions: string[],
253
+ /** The span the range checks use. Retained for callers that render it; it is wider than the `supportedVersions` list. */
254
+ supportedRange?: {
243
255
  min: string;
244
256
  max: string;
245
- });
257
+ }, supportedVersions?: readonly string[]);
246
258
  }
247
259
  /**
248
260
  * Thrown when the API response is malformed or invalid
@@ -281,4 +293,39 @@ declare class AuthError extends Error {
281
293
  constructor(code: AuthErrorCode, message: string);
282
294
  }
283
295
 
284
- export { ApiDirectory as ApiDirectoryV25_10_0, ApiDirectory$1 as ApiDirectoryV26_0_0, ApiDirectory$2 as ApiDirectoryV27_0_0, ApiVersion, ApplianceProtocol, AuthError, AuthErrorCode, InvalidVersionResponseError, Logger, NoCompatibleVersionsError, OperationMappings, TrueNasApiClient, TrueNasApiClientV2510, TrueNasApiClientV26, TrueNasApiClientV27, VersionDiscovery, VersionDiscoveryError, VersionDiscoveryNetworkError, VersionDiscoveryTimeoutError, VersionEndpointNotFoundError, VersionTooNewError, VersionTooOldError };
296
+ /**
297
+ * A method call middleware refused, with the whole error it refused it with.
298
+ *
299
+ * `message` is the human-readable reason, as the plain `Error` this replaced
300
+ * carried. What that dropped is the rest of the frame: `errname` is how a
301
+ * caller tells `ENOTAUTHENTICATED` from `EINVAL`, and `extra` is where a
302
+ * validation error names the fields it rejected. Both are on {@link frame}.
303
+ *
304
+ * Thrown by `call`, the query verbs, and a job method refused before it
305
+ * started a job. A job that starts and then fails is not this: it is reported
306
+ * through its own `FAILED` state, with `error` and `exc_info` on the job.
307
+ */
308
+ declare class TrueNasApiError extends Error {
309
+ /** The JSON-RPC error object, as middleware sent it. */
310
+ readonly frame: TrueNasErrorFrame;
311
+ /** The method that was refused. */
312
+ readonly method: string;
313
+ constructor(
314
+ /** The JSON-RPC error object, as middleware sent it. */
315
+ frame: TrueNasErrorFrame,
316
+ /** The method that was refused. */
317
+ method: string);
318
+ /** The JSON-RPC code: `-32001` for a refused call, others for a malformed one. */
319
+ get code(): number;
320
+ /**
321
+ * The TrueNAS payload — `errname`, `reason`, `extra`, `trace`.
322
+ *
323
+ * `undefined` for the codes middleware sends without one, such as
324
+ * `-32601 "Method does not exist"`.
325
+ */
326
+ get data(): TrueNasErrorData | undefined;
327
+ /** `data.errname`, e.g. `EINVAL`, or `undefined` when there is no payload. */
328
+ get errname(): string | undefined;
329
+ }
330
+
331
+ export { ApiDirectory as ApiDirectoryV25_10_0, ApiDirectory$1 as ApiDirectoryV27_0_0, ApiDirectory$2 as ApiDirectoryV28_0_0, ApiVersion, ApplianceProtocol, AuthError, AuthErrorCode, InvalidVersionResponseError, Logger, NoCompatibleVersionsError, OperationMappings, TrueNasApiClient, TrueNasApiClientV2510, TrueNasApiClientV27, TrueNasApiClientV28, TrueNasApiError, TrueNasErrorData, TrueNasErrorFrame, VersionDiscovery, VersionDiscoveryError, VersionDiscoveryNetworkError, VersionDiscoveryTimeoutError, VersionEndpointNotFoundError, VersionTooNewError, VersionTooOldError };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { T as TrueNasApiClient, A as ApiDirectory, O as OperationMappings, a as ApiDirectory$1, b as ApiDirectory$2, L as Logger, c as ApplianceProtocol, d as ApiVersion } from './truenas-auth-mechanism.enum-DUitTxen.js';
2
- export { e as ApiCallDirectoryV25_10_0, f as ApiCallDirectoryV25_10_1, g as ApiCallDirectoryV25_10_2, h as ApiCallDirectoryV25_10_3, i as ApiCallDirectoryV25_10_4, j as ApiCallDirectoryV25_10_5, k as ApiCallDirectoryV26_0_0, l as ApiCallDirectoryV27_0_0, m as ApiDirectoryByVersion, n as ApiDirectoryShape, o as ApiDirectoryV25_10_1, p as ApiDirectoryV25_10_2, q as ApiDirectoryV25_10_3, r as ApiDirectoryV25_10_4, s as ApiDirectoryV25_10_5, t as ApiError, u as ApiEventDirectoryV25_10_0, v as ApiEventDirectoryV25_10_1, w as ApiEventDirectoryV25_10_2, x as ApiEventDirectoryV25_10_3, y as ApiEventDirectoryV25_10_4, z as ApiEventDirectoryV25_10_5, B as ApiEventDirectoryV26_0_0, C as ApiEventDirectoryV27_0_0, D as ApiJobDirectoryV25_10_0, E as ApiJobDirectoryV25_10_1, F as ApiJobDirectoryV25_10_2, G as ApiJobDirectoryV25_10_3, H as ApiJobDirectoryV25_10_4, I as ApiJobDirectoryV25_10_5, J as ApiJobDirectoryV26_0_0, K as ApiJobDirectoryV27_0_0, M as ApiKeyCreate, N as ApiVersionResponse, P as AppState, Q as ArgsOf, R as AuthResponse, S as AuthResponseType, U as BaseApiDirectory, V as CallMethod, W as CallParams, X as CallResponse, Y as ConnectionClose, Z as ConnectionEndpoint, _ as Container, $ as CreateClientOptions, a0 as DefaultApiDirectory, a1 as EventKind, a2 as EventName, a3 as EventUnion, a4 as Job, a5 as JobMethod, a6 as JobParams, a7 as JobProgress, a8 as JobResult, a9 as JobState, aa as QueryDirectory, ab as QueryEntity, ac as QueryListOptions, ad as QueryMethod, ae as QuerySingleOptions, af as ReconnectOptions, ag as SUPPORTED_API_VERSIONS, ah as SmbStatusInfoLevel, ai as SmbStatusOptions, aj as SmbStatusRequest, ak as SmbStatusResponse, al as SmbStatusRow, am as SupportedApiVersion, an as TrueNasAuthMechanism, ao as TrueNasDate, ap as TrueNasErrorData, aq as TrueNasErrorFrame, ar as UserRole, as as UserRoleName, at as VersionCompatibility, au as consoleLogger, av as createTrueNasClient, aw as getApiErrorMessage, ax as isJobFinished, ay as noopLogger, az as v25_10_0, aA as v25_10_1, aB as v25_10_2, aC as v25_10_3, aD as v25_10_4, aE as v25_10_5, aF as v26_0_0, aG as v27_0_0 } from './truenas-auth-mechanism.enum-DUitTxen.js';
1
+ import { T as TrueNasApiClient, A as ApiDirectory, O as OperationMappings, a as ApiDirectory$1, b as ApiDirectory$2, L as Logger, c as ApplianceProtocol, d as ApiVersion, e as TrueNasErrorFrame, f as TrueNasErrorData } from './truenas-auth-mechanism.enum-Bp2XMMwK.js';
2
+ export { g as ApiCallDirectoryV25_10_0, h as ApiCallDirectoryV25_10_1, i as ApiCallDirectoryV25_10_2, j as ApiCallDirectoryV25_10_3, k as ApiCallDirectoryV25_10_4, l as ApiCallDirectoryV25_10_5, m as ApiCallDirectoryV27_0_0, n as ApiCallDirectoryV28_0_0, o as ApiDirectoryByVersion, p as ApiDirectoryShape, q as ApiDirectoryV25_10_1, r as ApiDirectoryV25_10_2, s as ApiDirectoryV25_10_3, t as ApiDirectoryV25_10_4, u as ApiDirectoryV25_10_5, v as ApiError, w as ApiEventDirectoryV25_10_0, x as ApiEventDirectoryV25_10_1, y as ApiEventDirectoryV25_10_2, z as ApiEventDirectoryV25_10_3, B as ApiEventDirectoryV25_10_4, C as ApiEventDirectoryV25_10_5, D as ApiEventDirectoryV27_0_0, E as ApiEventDirectoryV28_0_0, F as ApiJobDirectoryV25_10_0, G as ApiJobDirectoryV25_10_1, H as ApiJobDirectoryV25_10_2, I as ApiJobDirectoryV25_10_3, J as ApiJobDirectoryV25_10_4, K as ApiJobDirectoryV25_10_5, M as ApiJobDirectoryV27_0_0, N as ApiJobDirectoryV28_0_0, P as ApiKeyCreate, Q as ApiVersionResponse, R as AppState, S as ArgsOf, U as AuthResponse, V as AuthResponseType, W as BaseApiDirectory, X as CallMethod, Y as CallParams, Z as CallResponse, _ as ConnectionClose, $ as ConnectionEndpoint, a0 as Container, a1 as CreateClientOptions, a2 as DefaultApiDirectory, a3 as EventKind, a4 as EventName, a5 as EventSourceName, a6 as EventUnion, a7 as Job, a8 as JobMethod, a9 as JobParams, aa as JobProgress, ab as JobResult, ac as JobState, ad as QueryDirectory, ae as QueryEntity, af as QueryListOptions, ag as QueryMethod, ah as QuerySingleOptions, ai as ReconnectOptions, aj as SUPPORTED_API_VERSIONS, ak as SmbStatusInfoLevel, al as SmbStatusOptions, am as SmbStatusRequest, an as SmbStatusResponse, ao as SmbStatusRow, ap as SubscribableEvent, aq as SubscriptionArgs, ar as SubscriptionParams, as as SupportedApiVersion, at as TrueNasAuthMechanism, au as TrueNasDate, av as UserRole, aw as UserRoleName, ax as VersionCompatibility, ay as consoleLogger, az as createTrueNasClient, aA as getApiErrorMessage, aB as isJobFinished, aC as noopLogger, aD as v25_10_0, aE as v25_10_1, aF as v25_10_2, aG as v25_10_3, aH as v25_10_4, aI as v25_10_5, aJ as v27_0_0, aK as v28_0_0 } from './truenas-auth-mechanism.enum-Bp2XMMwK.js';
3
3
  import { Observable } from 'rxjs';
4
4
  import 'rxjs/webSocket';
5
5
 
@@ -39,11 +39,12 @@ declare class TrueNasApiClientV2510 extends TrueNasApiClient<ApiDirectory> {
39
39
  }
40
40
 
41
41
  /**
42
- * TrueNAS API Client for v26.X.Y
42
+ * TrueNAS API Client for v27.X.Y
43
43
  *
44
- * Handles all v26 versions (v26.0.0, v26.0.1, v26.1.2, etc.).
45
- * Minor AND patch versions are backward compatible, so one client implementation
46
- * handles all patches within the v26 series.
44
+ * Handles the v27 series: minor and patch versions are backward compatible, so
45
+ * one implementation covers them. Discovery is stricter — it admits only what
46
+ * `SUPPORTED_API_VERSIONS` names, so a v27 patch reaches this client only once
47
+ * the types are regenerated for it.
47
48
  *
48
49
  * To add version-specific behavior, override the factory methods:
49
50
  * - createConnection() - for connection-specific changes
@@ -53,7 +54,7 @@ declare class TrueNasApiClientV2510 extends TrueNasApiClient<ApiDirectory> {
53
54
  */
54
55
 
55
56
  /**
56
- * API client for TrueNAS API v26 (JSON-RPC 2.0 over /api/v26.{minor}.{patch}).
57
+ * API client for TrueNAS API v27 (JSON-RPC 2.0 over /api/v27.{minor}.{patch}).
57
58
  *
58
59
  * - containerQuery → container.query (with response transformation)
59
60
  * - containerStart → container.start (synchronous, emits null)
@@ -62,9 +63,9 @@ declare class TrueNasApiClientV2510 extends TrueNasApiClient<ApiDirectory> {
62
63
  * - containerDelete → container.delete (a job; force/recursive)
63
64
  * - smbStatus → smb.status (public, gated on `SHARING_SMB_READ`)
64
65
  */
65
- declare class TrueNasApiClientV26 extends TrueNasApiClient<ApiDirectory$1> {
66
+ declare class TrueNasApiClientV27 extends TrueNasApiClient<ApiDirectory$1> {
66
67
  /**
67
- * Create v26-specific operation mappings
68
+ * Create v27-specific operation mappings
68
69
  *
69
70
  * Operations return Observable<Job | null>:
70
71
  * - Async operations emit Job updates until complete
@@ -74,28 +75,29 @@ declare class TrueNasApiClientV26 extends TrueNasApiClient<ApiDirectory$1> {
74
75
  }
75
76
 
76
77
  /**
77
- * TrueNAS API Client for v27.X.Y
78
+ * TrueNAS API Client for v28.X.Y
78
79
  *
79
- * Handles the whole v27 series; breaking changes only arrive with v28.
80
+ * Handles the whole v28 series; breaking changes only arrive with v29.
80
81
  *
81
- * Discovery admits less: `MAX_SUPPORTED_VERSION` is compared down to the patch,
82
- * so v27.0.1 and v27.1.0 are reported too new and never reach this client.
82
+ * Discovery admits less: a version has to be one `SUPPORTED_API_VERSIONS`
83
+ * names, so v28.0.1 and v28.1.0 are reported `Unsupported` and never reach this
84
+ * client until the types are regenerated for them.
83
85
  *
84
86
  * To add version-specific behavior, override createConnection(), createApi(),
85
87
  * createAuthenticator() or createOperations().
86
88
  */
87
89
 
88
90
  /**
89
- * API client for TrueNAS API v27 (JSON-RPC 2.0 over /api/v27.{minor}.{patch}).
91
+ * API client for TrueNAS API v28 (JSON-RPC 2.0 over /api/v28.{minor}.{patch}).
90
92
  *
91
- * Operations currently match `TrueNasApiClientV26`'s because v27 inherits every
92
- * entry they use. The spec pins the four container entries to v26's;
93
+ * Operations currently match `TrueNasApiClientV27`'s because v28 inherits every
94
+ * entry they use. The spec pins the four container entries to v27's;
93
95
  * `smb.status` is unpinned, so a widened param or narrowed response would
94
96
  * still compile here. Duplicated rather than shared so the series can diverge.
95
97
  */
96
- declare class TrueNasApiClientV27 extends TrueNasApiClient<ApiDirectory$2> {
98
+ declare class TrueNasApiClientV28 extends TrueNasApiClient<ApiDirectory$2> {
97
99
  /**
98
- * Create v27-specific operation mappings
100
+ * Create v28-specific operation mappings
99
101
  *
100
102
  * Operations return Observable<Job | null>:
101
103
  * - Async operations emit Job updates until complete
@@ -232,17 +234,27 @@ declare class VersionDiscoveryNetworkError extends VersionDiscoveryError {
232
234
  }
233
235
  /**
234
236
  * Thrown when no compatible versions are found in the response
237
+ *
238
+ * The message lists the versions rather than a span. An appliance can offer a
239
+ * version inside `supportedRange` that this package still ships no types for —
240
+ * v26.0.0, which middleware renumbered to v27.0.0 before release — and telling
241
+ * that caller "supported: v25.10.0 to v28.0.0" would describe their version as
242
+ * qualifying while refusing it.
235
243
  */
236
244
  declare class NoCompatibleVersionsError extends VersionDiscoveryError {
237
245
  readonly availableVersions: string[];
246
+ /** The span the range checks use. Retained for callers that render it; it is wider than the `supportedVersions` list. */
238
247
  readonly supportedRange: {
239
248
  min: string;
240
249
  max: string;
241
250
  };
242
- constructor(hostname: string, availableVersions: string[], supportedRange?: {
251
+ readonly supportedVersions: readonly string[];
252
+ constructor(hostname: string, availableVersions: string[],
253
+ /** The span the range checks use. Retained for callers that render it; it is wider than the `supportedVersions` list. */
254
+ supportedRange?: {
243
255
  min: string;
244
256
  max: string;
245
- });
257
+ }, supportedVersions?: readonly string[]);
246
258
  }
247
259
  /**
248
260
  * Thrown when the API response is malformed or invalid
@@ -281,4 +293,39 @@ declare class AuthError extends Error {
281
293
  constructor(code: AuthErrorCode, message: string);
282
294
  }
283
295
 
284
- export { ApiDirectory as ApiDirectoryV25_10_0, ApiDirectory$1 as ApiDirectoryV26_0_0, ApiDirectory$2 as ApiDirectoryV27_0_0, ApiVersion, ApplianceProtocol, AuthError, AuthErrorCode, InvalidVersionResponseError, Logger, NoCompatibleVersionsError, OperationMappings, TrueNasApiClient, TrueNasApiClientV2510, TrueNasApiClientV26, TrueNasApiClientV27, VersionDiscovery, VersionDiscoveryError, VersionDiscoveryNetworkError, VersionDiscoveryTimeoutError, VersionEndpointNotFoundError, VersionTooNewError, VersionTooOldError };
296
+ /**
297
+ * A method call middleware refused, with the whole error it refused it with.
298
+ *
299
+ * `message` is the human-readable reason, as the plain `Error` this replaced
300
+ * carried. What that dropped is the rest of the frame: `errname` is how a
301
+ * caller tells `ENOTAUTHENTICATED` from `EINVAL`, and `extra` is where a
302
+ * validation error names the fields it rejected. Both are on {@link frame}.
303
+ *
304
+ * Thrown by `call`, the query verbs, and a job method refused before it
305
+ * started a job. A job that starts and then fails is not this: it is reported
306
+ * through its own `FAILED` state, with `error` and `exc_info` on the job.
307
+ */
308
+ declare class TrueNasApiError extends Error {
309
+ /** The JSON-RPC error object, as middleware sent it. */
310
+ readonly frame: TrueNasErrorFrame;
311
+ /** The method that was refused. */
312
+ readonly method: string;
313
+ constructor(
314
+ /** The JSON-RPC error object, as middleware sent it. */
315
+ frame: TrueNasErrorFrame,
316
+ /** The method that was refused. */
317
+ method: string);
318
+ /** The JSON-RPC code: `-32001` for a refused call, others for a malformed one. */
319
+ get code(): number;
320
+ /**
321
+ * The TrueNAS payload — `errname`, `reason`, `extra`, `trace`.
322
+ *
323
+ * `undefined` for the codes middleware sends without one, such as
324
+ * `-32601 "Method does not exist"`.
325
+ */
326
+ get data(): TrueNasErrorData | undefined;
327
+ /** `data.errname`, e.g. `EINVAL`, or `undefined` when there is no payload. */
328
+ get errname(): string | undefined;
329
+ }
330
+
331
+ export { ApiDirectory as ApiDirectoryV25_10_0, ApiDirectory$1 as ApiDirectoryV27_0_0, ApiDirectory$2 as ApiDirectoryV28_0_0, ApiVersion, ApplianceProtocol, AuthError, AuthErrorCode, InvalidVersionResponseError, Logger, NoCompatibleVersionsError, OperationMappings, TrueNasApiClient, TrueNasApiClientV2510, TrueNasApiClientV27, TrueNasApiClientV28, TrueNasApiError, TrueNasErrorData, TrueNasErrorFrame, VersionDiscovery, VersionDiscoveryError, VersionDiscoveryNetworkError, VersionDiscoveryTimeoutError, VersionEndpointNotFoundError, VersionTooNewError, VersionTooOldError };
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export { AppState, AuthError, AuthErrorCode, AuthResponseType, InvalidVersionResponseError, JobState, NoCompatibleVersionsError, SUPPORTED_API_VERSIONS, TrueNasApiClient, TrueNasApiClientV2510, TrueNasApiClientV26, TrueNasApiClientV27, TrueNasAuthMechanism, UserRole, 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 } from './chunk-RH7UXULE.js';
1
+ export { AppState, AuthError, AuthErrorCode, AuthResponseType, InvalidVersionResponseError, JobState, NoCompatibleVersionsError, SUPPORTED_API_VERSIONS, TrueNasApiClient, TrueNasApiClientV2510, TrueNasApiClientV27, TrueNasApiClientV28, TrueNasApiError, TrueNasAuthMechanism, UserRole, 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, v27_0_0_exports as v27_0_0, v28_0_0_exports as v28_0_0 } from './chunk-K7BL6J3Z.js';
2
2
  //# sourceMappingURL=index.js.map
3
3
  //# sourceMappingURL=index.js.map