@truenas/api-client 9.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 chunkTSO2EHF3_cjs = require('./chunk-TSO2EHF3.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 chunkTSO2EHF3_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 chunkTSO2EHF3_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 chunkTSO2EHF3_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 chunkTSO2EHF3_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 chunkTSO2EHF3_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 chunkTSO2EHF3_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 chunkTSO2EHF3_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 chunkTSO2EHF3_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 chunkTSO2EHF3_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 chunkTSO2EHF3_cjs.TrueNasApiClientV2510; }
45
+ get: function () { return chunkU6V2Y3AE_cjs.TrueNasApiClientV2510; }
46
46
  });
47
47
  Object.defineProperty(exports, "TrueNasApiClientV27", {
48
48
  enumerable: true,
49
- get: function () { return chunkTSO2EHF3_cjs.TrueNasApiClientV27; }
49
+ get: function () { return chunkU6V2Y3AE_cjs.TrueNasApiClientV27; }
50
50
  });
51
51
  Object.defineProperty(exports, "TrueNasApiClientV28", {
52
52
  enumerable: true,
53
- get: function () { return chunkTSO2EHF3_cjs.TrueNasApiClientV28; }
53
+ get: function () { return chunkU6V2Y3AE_cjs.TrueNasApiClientV28; }
54
+ });
55
+ Object.defineProperty(exports, "TrueNasApiError", {
56
+ enumerable: true,
57
+ get: function () { return chunkU6V2Y3AE_cjs.TrueNasApiError; }
54
58
  });
55
59
  Object.defineProperty(exports, "TrueNasAuthMechanism", {
56
60
  enumerable: true,
57
- get: function () { return chunkTSO2EHF3_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 chunkTSO2EHF3_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 chunkTSO2EHF3_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 chunkTSO2EHF3_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 chunkTSO2EHF3_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 chunkTSO2EHF3_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 chunkTSO2EHF3_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 chunkTSO2EHF3_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 chunkTSO2EHF3_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 chunkTSO2EHF3_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 chunkTSO2EHF3_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 chunkTSO2EHF3_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 chunkTSO2EHF3_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 chunkTSO2EHF3_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 chunkTSO2EHF3_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 chunkTSO2EHF3_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 chunkTSO2EHF3_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 chunkTSO2EHF3_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 chunkTSO2EHF3_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 chunkTSO2EHF3_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 chunkTSO2EHF3_cjs.v25_10_5_exports; }
141
+ get: function () { return chunkU6V2Y3AE_cjs.v25_10_5_exports; }
138
142
  });
139
143
  Object.defineProperty(exports, "v27_0_0", {
140
144
  enumerable: true,
141
- get: function () { return chunkTSO2EHF3_cjs.v27_0_0_exports; }
145
+ get: function () { return chunkU6V2Y3AE_cjs.v27_0_0_exports; }
142
146
  });
143
147
  Object.defineProperty(exports, "v28_0_0", {
144
148
  enumerable: true,
145
- get: function () { return chunkTSO2EHF3_cjs.v28_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-CW5Wwz1s.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 ApiCallDirectoryV27_0_0, l as ApiCallDirectoryV28_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 ApiEventDirectoryV27_0_0, C as ApiEventDirectoryV28_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 ApiJobDirectoryV27_0_0, K as ApiJobDirectoryV28_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 v27_0_0, aG as v28_0_0 } from './truenas-auth-mechanism.enum-CW5Wwz1s.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
 
@@ -243,14 +243,14 @@ declare class VersionDiscoveryNetworkError extends VersionDiscoveryError {
243
243
  */
244
244
  declare class NoCompatibleVersionsError extends VersionDiscoveryError {
245
245
  readonly availableVersions: string[];
246
- /** The span the range checks use. Retained for callers that render it; it is wider than {@link supportedVersions}. */
246
+ /** The span the range checks use. Retained for callers that render it; it is wider than the `supportedVersions` list. */
247
247
  readonly supportedRange: {
248
248
  min: string;
249
249
  max: string;
250
250
  };
251
251
  readonly supportedVersions: readonly string[];
252
252
  constructor(hostname: string, availableVersions: string[],
253
- /** The span the range checks use. Retained for callers that render it; it is wider than {@link supportedVersions}. */
253
+ /** The span the range checks use. Retained for callers that render it; it is wider than the `supportedVersions` list. */
254
254
  supportedRange?: {
255
255
  min: string;
256
256
  max: string;
@@ -293,4 +293,39 @@ declare class AuthError extends Error {
293
293
  constructor(code: AuthErrorCode, message: string);
294
294
  }
295
295
 
296
- 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, 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-CW5Wwz1s.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 ApiCallDirectoryV27_0_0, l as ApiCallDirectoryV28_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 ApiEventDirectoryV27_0_0, C as ApiEventDirectoryV28_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 ApiJobDirectoryV27_0_0, K as ApiJobDirectoryV28_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 v27_0_0, aG as v28_0_0 } from './truenas-auth-mechanism.enum-CW5Wwz1s.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
 
@@ -243,14 +243,14 @@ declare class VersionDiscoveryNetworkError extends VersionDiscoveryError {
243
243
  */
244
244
  declare class NoCompatibleVersionsError extends VersionDiscoveryError {
245
245
  readonly availableVersions: string[];
246
- /** The span the range checks use. Retained for callers that render it; it is wider than {@link supportedVersions}. */
246
+ /** The span the range checks use. Retained for callers that render it; it is wider than the `supportedVersions` list. */
247
247
  readonly supportedRange: {
248
248
  min: string;
249
249
  max: string;
250
250
  };
251
251
  readonly supportedVersions: readonly string[];
252
252
  constructor(hostname: string, availableVersions: string[],
253
- /** The span the range checks use. Retained for callers that render it; it is wider than {@link supportedVersions}. */
253
+ /** The span the range checks use. Retained for callers that render it; it is wider than the `supportedVersions` list. */
254
254
  supportedRange?: {
255
255
  min: string;
256
256
  max: string;
@@ -293,4 +293,39 @@ declare class AuthError extends Error {
293
293
  constructor(code: AuthErrorCode, message: string);
294
294
  }
295
295
 
296
- 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, 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, TrueNasApiClientV27, TrueNasApiClientV28, 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-LFNAVARU.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
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkTSO2EHF3_cjs = require('../chunk-TSO2EHF3.cjs');
3
+ var chunkU6V2Y3AE_cjs = require('../chunk-U6V2Y3AE.cjs');
4
4
  var rxjs = require('rxjs');
5
5
 
6
6
  // src/testing/unmocked-call-error.ts
@@ -16,8 +16,8 @@ var UnmockedCallError = class extends Error {
16
16
  };
17
17
 
18
18
  // src/testing/fake-connection.ts
19
- var CLIENT_HOUSEKEEPING = /* @__PURE__ */ new Set(["core.subscribe"]);
20
- var FakeConnection = class extends chunkTSO2EHF3_cjs.TrueNasConnection {
19
+ var CLIENT_HOUSEKEEPING = /* @__PURE__ */ new Set(["core.subscribe", "core.unsubscribe"]);
20
+ var FakeConnection = class extends chunkU6V2Y3AE_cjs.TrueNasConnection {
21
21
  constructor(options = {}) {
22
22
  super(
23
23
  // Disabled: `connection$` derives from this, so no socket is ever built
@@ -29,7 +29,7 @@ var FakeConnection = class extends chunkTSO2EHF3_cjs.TrueNasConnection {
29
29
  void 0,
30
30
  0,
31
31
  0,
32
- chunkTSO2EHF3_cjs.noopLogger
32
+ chunkU6V2Y3AE_cjs.noopLogger
33
33
  );
34
34
  this.incoming = new rxjs.Subject();
35
35
  this.frames = [];
@@ -117,10 +117,22 @@ var FakeConnection = class extends chunkTSO2EHF3_cjs.TrueNasConnection {
117
117
  }
118
118
  write(message) {
119
119
  this.frames.push(message);
120
- const answer = this.autoReplies.get(String(message.method));
120
+ const answer = this.autoReplies.get(String(message.method)) ?? (CLIENT_HOUSEKEEPING.has(String(message.method)) ? (frame) => this.answerHousekeeping(frame) : void 0);
121
121
  if (!answer) return;
122
122
  queueMicrotask(() => answer(message));
123
123
  }
124
+ /**
125
+ * Answers the client's own housekeeping as middleware does: `core.subscribe`
126
+ * with an id, so a release shows as a `core.unsubscribe` carrying it, and
127
+ * `core.unsubscribe` with `null`. Not modelled: the `notify_unsubscribed`
128
+ * middleware sends before that `null` when the release was of an event
129
+ * source. A spec that wants it, or any other answer, registers an `autoReply`.
130
+ */
131
+ answerHousekeeping(frame) {
132
+ const count = this.frames.filter((f) => f.method === "core.subscribe").length;
133
+ const result = frame.method === "core.subscribe" ? `subscription-${count}` : null;
134
+ this.receive({ jsonrpc: "2.0", id: frame.id, result });
135
+ }
124
136
  /** Deliver a message as if middleware had sent it. */
125
137
  receive(message) {
126
138
  this.incoming.next(message);
@@ -180,10 +192,10 @@ var FakeConnection = class extends chunkTSO2EHF3_cjs.TrueNasConnection {
180
192
  this.closesSubject.next({
181
193
  code,
182
194
  reason,
183
- message: chunkTSO2EHF3_cjs.getCloseMessage(code, reason),
195
+ message: chunkU6V2Y3AE_cjs.getCloseMessage(code, reason),
184
196
  hostname: this.endpoint.hostnames[0] ?? "",
185
197
  wasOpen: true,
186
- refused: code === chunkTSO2EHF3_cjs.policyViolationCloseCode
198
+ refused: code === chunkU6V2Y3AE_cjs.policyViolationCloseCode
187
199
  });
188
200
  }
189
201
  /**
@@ -212,7 +224,7 @@ var FakeConnection = class extends chunkTSO2EHF3_cjs.TrueNasConnection {
212
224
  };
213
225
 
214
226
  // src/testing/fake-authenticator.ts
215
- var FakeAuthenticator = class extends chunkTSO2EHF3_cjs.TrueNasAuthenticator {
227
+ var FakeAuthenticator = class extends chunkU6V2Y3AE_cjs.TrueNasAuthenticator {
216
228
  constructor(fakeConnection, version) {
217
229
  super(fakeConnection, version);
218
230
  this.fakeConnection = fakeConnection;
@@ -535,11 +547,11 @@ function createMockAnswers(connection) {
535
547
  });
536
548
  return id;
537
549
  },
538
- emit(event, change) {
550
+ emit(event, change, params) {
539
551
  connection.receive({
540
552
  jsonrpc: "2.0",
541
553
  method: "collection_update",
542
- params: { collection: event, ...change }
554
+ params: { collection: chunkU6V2Y3AE_cjs.subscriptionName(event, params), ...change }
543
555
  });
544
556
  }
545
557
  };
@@ -562,12 +574,12 @@ function withFakeCollaborators(Base, options) {
562
574
  };
563
575
  }
564
576
  function createFakeClient(options = {}) {
565
- const versionString = options.version ?? chunkTSO2EHF3_cjs.SUPPORTED_API_VERSIONS[0];
566
- const version = chunkTSO2EHF3_cjs.parseApiVersion(versionString);
577
+ const versionString = options.version ?? chunkU6V2Y3AE_cjs.SUPPORTED_API_VERSIONS[0];
578
+ const version = chunkU6V2Y3AE_cjs.parseApiVersion(versionString);
567
579
  if (!version) {
568
580
  throw new Error(`'${versionString}' is not a version this package parses.`);
569
581
  }
570
- const Base = chunkTSO2EHF3_cjs.clientClassFor(version);
582
+ const Base = chunkU6V2Y3AE_cjs.clientClassFor(version);
571
583
  if (!Base) {
572
584
  throw new Error(
573
585
  `No client implementation for '${versionString}'. The real factory would have refused it too.`
@@ -653,8 +665,8 @@ function withSpies(client, spy) {
653
665
  }
654
666
 
655
667
  // src/testing/fake-api-version.ts
656
- function fakeApiVersion(version = chunkTSO2EHF3_cjs.SUPPORTED_API_VERSIONS[0], overrides = {}) {
657
- const parsed = chunkTSO2EHF3_cjs.parseApiVersion(version);
668
+ function fakeApiVersion(version = chunkU6V2Y3AE_cjs.SUPPORTED_API_VERSIONS[0], overrides = {}) {
669
+ const parsed = chunkU6V2Y3AE_cjs.parseApiVersion(version);
658
670
  if (!parsed) {
659
671
  throw new Error(
660
672
  `fakeApiVersion('${version}'): not a version this package parses. Expected vYY.MINOR.PATCH \u2014 v25.10.0, v27.0.0. For a version the parser rejects, pass one it accepts and override its fields.`
@@ -723,7 +735,7 @@ function fakeAuthResponse(overrides = {}) {
723
735
 
724
736
  Object.defineProperty(exports, "AuthResponseType", {
725
737
  enumerable: true,
726
- get: function () { return chunkTSO2EHF3_cjs.AuthResponseType; }
738
+ get: function () { return chunkU6V2Y3AE_cjs.AuthResponseType; }
727
739
  });
728
740
  exports.FakeAuthenticator = FakeAuthenticator;
729
741
  exports.FakeConnection = FakeConnection;