@truenas/api-client 6.0.0 → 6.0.2

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.js CHANGED
@@ -1,4326 +1,3 @@
1
- import { map, toArray, switchMap, concat, from, defer, throwError, firstValueFrom, BehaviorSubject, Subject, distinctUntilChanged, catchError as catchError$1, of, filter, take, retry, startWith, shareReplay as shareReplay$1, takeUntil, EMPTY, combineLatest, interval, Observable, timeout, timer, race, tap, share, finalize, merge, takeWhile } from 'rxjs';
2
- import { webSocket } from 'rxjs/webSocket';
3
- import { map as map$1, catchError, shareReplay } from 'rxjs/operators';
4
-
5
- var __defProp = Object.defineProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
-
11
- // src/types/api-error.type.ts
12
- function isJsonRpcError(error) {
13
- return typeof error === "object" && error !== null && "message" in error && typeof error.message === "string";
14
- }
15
- function isTrueNasError(error) {
16
- return typeof error === "object" && error !== null && "reason" in error && typeof error.reason === "string";
17
- }
18
- function getApiErrorMessage(error, fallback = "API call failed") {
19
- if (isJsonRpcError(error) && error.data && isTrueNasError(error.data)) {
20
- return error.data.reason;
21
- }
22
- if (isTrueNasError(error)) {
23
- return error.reason;
24
- }
25
- if (isJsonRpcError(error)) {
26
- return error.message;
27
- }
28
- return fallback;
29
- }
30
-
31
- // src/types/job.type.ts
32
- var JobState = /* @__PURE__ */ ((JobState2) => {
33
- JobState2["Pending"] = "PENDING";
34
- JobState2["Running"] = "RUNNING";
35
- JobState2["Hold"] = "HOLD";
36
- JobState2["Error"] = "ERROR";
37
- JobState2["Failed"] = "FAILED";
38
- JobState2["Aborted"] = "ABORTED";
39
- JobState2["Success"] = "SUCCESS";
40
- JobState2["Finished"] = "FINISHED";
41
- JobState2["Locked"] = "LOCKED";
42
- JobState2["Waiting"] = "WAITING";
43
- return JobState2;
44
- })(JobState || {});
45
- var terminalStates = [
46
- "SUCCESS" /* Success */,
47
- "FAILED" /* Failed */,
48
- "ABORTED" /* Aborted */,
49
- "ERROR" /* Error */,
50
- "FINISHED" /* Finished */
51
- ];
52
- function isJobFinished(job) {
53
- return terminalStates.includes(job.state);
54
- }
55
- var withId = (id) => filter((msg) => msg.id === id);
56
- function randomUUID() {
57
- if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
58
- return crypto.randomUUID();
59
- }
60
- if (typeof crypto === "undefined" || typeof crypto.getRandomValues !== "function") {
61
- throw new Error("Web Crypto API unavailable: cannot generate a UUID");
62
- }
63
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
64
- const r = crypto.getRandomValues(new Uint8Array(1))[0] % 16 | 0;
65
- const v = c === "x" ? r : r & 3 | 8;
66
- return v.toString(16);
67
- });
68
- }
69
-
70
- // src/utils/jsonrpc.utils.ts
71
- function createJsonRpcMessage(method, params) {
72
- return {
73
- jsonrpc: "2.0",
74
- id: randomUUID(),
75
- method,
76
- params: params ?? []
77
- };
78
- }
79
-
80
- // src/api/truenas-api.ts
81
- var EVENT_KINDS = ["added", "changed", "removed"];
82
- var TrueNasApi = class {
83
- constructor(authenticated, connection) {
84
- this.authenticated = authenticated;
85
- this.connection = connection;
86
- /**
87
- * Stream of job events from websocket.
88
- * JSON-RPC 2.0 events have structure: { method: 'collection_update', params: { collection, fields, ... } }
89
- */
90
- this.jobEvents = this.connection.messages().pipe(
91
- filter(
92
- (res) => res.method === "collection_update" && res.params?.collection === "core.get_jobs"
93
- ),
94
- map((event) => event.params.fields),
95
- filter((job) => !!job?.id),
96
- share()
97
- );
98
- /**
99
- * One shared stream per subscribed event name — see {@link events}.
100
- * Keyed by name rather than by caller, because the subscription it stands
101
- * for lives on the server and is per socket, not per caller.
102
- */
103
- this.eventStreams = /* @__PURE__ */ new Map();
104
- this.initializeJobEventsSubscription();
105
- }
106
- /**
107
- * Send a request to a method of the surface this instance is typed against,
108
- * and emit its result.
109
- *
110
- * ```typescript
111
- * api.call('system.info') // SystemInfo
112
- * api.call('pool.dataset.delete', ['tank/ds', { recursive: true }])
113
- * ```
114
- *
115
- * `params` is required exactly when the method takes them — the directory
116
- * says which — so a method that needs an id cannot be called without one.
117
- *
118
- * The polymorphic `.query` methods are reachable here too, but their
119
- * `response` is the five-way union the server may return, which is
120
- * {@link query} / {@link queryOne} / {@link queryCount}'s job to resolve.
121
- * Reach for a verb instead.
122
- */
123
- call(method, ...params) {
124
- return this.dispatch(method, params[0]);
125
- }
126
- /**
127
- * Send a JSON-RPC request and emit its result.
128
- *
129
- * Shared by {@link call} and the query verbs, which read the same directory
130
- * but resolve different things from it: `call` takes the entry's `response`
131
- * verbatim, the verbs narrow its polymorphic union by the verb chosen.
132
- *
133
- * Also the way the class reaches methods on its own behalf — `core.get_jobs`,
134
- * `auth.generate_token`. Inside the class body `D` is a type parameter, so
135
- * the checker cannot know those are among its methods; they are, since both
136
- * are in the shared base every surface extends.
137
- */
138
- dispatch(method, params) {
139
- return defer(() => {
140
- const message = createJsonRpcMessage(method, params);
141
- const messageId = message.id ?? "";
142
- const reply = this.connection.messages().pipe(
143
- withId(messageId),
144
- map((msg) => {
145
- if (msg.error) {
146
- const errorMessage = getApiErrorMessage(
147
- msg.error,
148
- "API call failed"
149
- );
150
- throw new Error(errorMessage);
151
- }
152
- return msg.result;
153
- }),
154
- take(1)
155
- );
156
- const sending = this.connection.send(message);
157
- return reply.pipe(finalize(() => sending.unsubscribe()));
158
- });
159
- }
160
- /**
161
- * Query a collection and emit the matching entries.
162
- *
163
- * ```typescript
164
- * api.query('user.query') // UserEntry[]
165
- * api.query('user.query', [['uid', '>', 1000]]) // UserEntry[]
166
- * api.query('user.query', [], { select: ['id', 'username'] })
167
- * // Pick<UserEntry, 'id' | 'username'>[]
168
- * ```
169
- *
170
- * The precise result type comes from reading the options *literal*. Options
171
- * annotated as `QueryListOptions<E>` lose that, and the result degrades to
172
- * `Partial<E>[]` — not only when a `select` is present, but whenever the
173
- * annotation merely permits one:
174
- *
175
- * ```typescript
176
- * const opts: QueryListOptions<UserEntry> = { limit: 10 };
177
- * api.query('user.query', [], opts); // Partial<UserEntry>[]
178
- *
179
- * const opts = { limit: 10 } satisfies QueryListOptions<UserEntry>;
180
- * api.query('user.query', [], opts); // UserEntry[]
181
- * ```
182
- *
183
- * That is imprecise, never unsound: `Partial<E>` is a supertype of `E`, so a
184
- * field is only ever reported as *possibly* missing, never as present when it
185
- * is not. Reach for `satisfies` over an annotation to keep the precision —
186
- * the checking is the same, the inferred type is narrower.
187
- *
188
- * `count` and `get` are rejected: they would change the shape of the
189
- * response, which is {@link queryCount} and {@link queryOne}'s job.
190
- */
191
- query(method, filters, options) {
192
- return this.dispatch(method, [filters ?? [], options ?? {}]);
193
- }
194
- /**
195
- * Query a collection and emit the single matching entry.
196
- *
197
- * Middleware errors unless exactly one entry matches, so this rejects
198
- * `limit` and `offset` as well as the shape switches.
199
- */
200
- queryOne(method, filters, options) {
201
- return this.dispatch(method, [filters ?? [], { ...options, get: true }]);
202
- }
203
- /**
204
- * Emit the number of entries matching the filters.
205
- *
206
- * Takes no options: `select` and `order_by` cannot affect a count, and
207
- * `limit` / `offset` would silently cap it.
208
- */
209
- queryCount(method, filters) {
210
- return this.dispatch(method, [filters ?? [], { count: true }]);
211
- }
212
- /**
213
- * Start a job and emit its id.
214
- *
215
- * Keyed off the surface's *job* directory rather than its call directory —
216
- * a disjoint key space, so `callAndGetJobId('app.query')` is rejected and
217
- * `call('app.start')` is too. Which one a method belongs to is a fact about
218
- * the method, and the generated directories are where that fact lives.
219
- *
220
- * The id comes from the first job event whose `message_ids` carries this
221
- * request's id, not from the response: what a job method returns on the wire
222
- * differs by version (v25.10 answers with the id, v26 with `null`), while
223
- * the event correlation holds for both.
224
- *
225
- * @returns Observable that emits the job ID when received from websocket events
226
- */
227
- callAndGetJobId(method, ...params) {
228
- return defer(() => {
229
- const message = createJsonRpcMessage(method, params[0]);
230
- const seen = this.jobEvents.pipe(
231
- filter((job) => job.message_ids?.includes(message.id ?? "") ?? false),
232
- map((job) => job.id),
233
- take(1)
234
- );
235
- const sending = this.connection.send(message);
236
- return seen.pipe(finalize(() => sending.unsubscribe()));
237
- });
238
- }
239
- /**
240
- * Start a job and follow it to completion.
241
- *
242
- * Emits the job's state as it progresses and completes when the job reaches
243
- * a terminal state, so `last()` gives the finished job and the intermediate
244
- * emissions drive a progress indicator.
245
- *
246
- * ```typescript
247
- * api.job('pool.dataset.unlock', ['tank/enc', { … }])
248
- * .subscribe(job => bar.set(job.progress.percent ?? 0));
249
- * ```
250
- *
251
- * The result is typed from the job directory, which is the whole reason to
252
- * prefer this over {@link callAndGetJobId} plus {@link trackJob}: those two
253
- * lose the connection between the method and its result, and the job comes
254
- * back with `result: unknown`. It is `R | null` either way — a job that has
255
- * not finished has no result, and neither does one that failed.
256
- */
257
- job(method, ...params) {
258
- return this.callAndGetJobId(method, ...params).pipe(
259
- switchMap((jobId) => this.trackJob(jobId))
260
- );
261
- }
262
- /**
263
- * Subscribe to a collection and emit its changes.
264
- *
265
- * Emits the change itself rather than the transport frame, as a union
266
- * discriminated on `msg`:
267
- *
268
- * ```typescript
269
- * api.events('app.query').subscribe(event => {
270
- * if (event.msg === 'removed') return drop(event.id);
271
- * render(event.fields); // only reachable once narrowed
272
- * });
273
- * ```
274
- *
275
- * The narrowing is load-bearing, not decoration: a `removed` event carries
276
- * an `id` and no `fields` in 55 of the 56 collections that declare one, so
277
- * reaching `fields` unconditionally is wrong for almost all of them.
278
- *
279
- * Event *sources* — the entries taking subscribe-time arguments — are not
280
- * reachable here; see {@link EventName}.
281
- */
282
- events(event) {
283
- const existing = this.eventStreams.get(event);
284
- if (existing) return existing;
285
- const stream = defer(() => {
286
- const resubscribe = this.authenticated.pipe(distinctUntilChanged(), filter(Boolean)).subscribe(() => {
287
- this.connection.send(createJsonRpcMessage("core.subscribe", [event]));
288
- });
289
- return this.connection.messages().pipe(
290
- filter((res) => res.method === "collection_update"),
291
- map((res) => res.params),
292
- filter(
293
- (params) => params?.collection === event && EVENT_KINDS.includes(params.msg)
294
- ),
295
- // `collection` is the subscription the caller already named; what is
296
- // left is exactly the payload the directory declares, plus its tag.
297
- map(({ collection, ...change }) => change),
298
- finalize(() => resubscribe.unsubscribe())
299
- );
300
- }).pipe(share({ resetOnRefCountZero: false, resetOnComplete: false }));
301
- this.eventStreams.set(event, stream);
302
- return stream;
303
- }
304
- /**
305
- * Convenience wrapper for auth.generate_token API call.
306
- *
307
- * Goes through {@link dispatch} rather than {@link call}: inside the class
308
- * body `D` is still a type parameter, so TypeScript cannot know that
309
- * `auth.generate_token` is one of its methods. It is — the method is in the
310
- * shared base, so every surface has it — but proving that to the checker
311
- * would mean constraining `D` on the class, which would push the constraint
312
- * onto every caller. The signature below is the guarantee instead.
313
- */
314
- generateToken(ttl = 600, matchOrigin = false, singleUse = true) {
315
- return this.dispatch("auth.generate_token", [
316
- ttl,
317
- {},
318
- matchOrigin,
319
- singleUse
320
- ]);
321
- }
322
- /**
323
- * Follow an already-started job to completion.
324
- *
325
- * @typeParam R - what the job resolves to. An id carries no evidence of
326
- * which method produced it, so nothing here can infer this and the default
327
- * is `unknown`; naming it is the caller's assertion. {@link job} knows the
328
- * method and fills it in from the directory, which is the reason to prefer
329
- * it whenever you are the one starting the job.
330
- */
331
- trackJob(jobId) {
332
- const updates$ = this.jobEvents.pipe(
333
- filter((job) => job.id === jobId),
334
- map((job) => job)
335
- );
336
- const read$ = this.dispatch("core.get_jobs", [
337
- [["id", "=", jobId]]
338
- ]).pipe(
339
- map((jobs) => jobs[0]),
340
- share()
341
- );
342
- const missing$ = read$.pipe(
343
- filter((job) => job === void 0),
344
- takeUntil(updates$)
345
- );
346
- const snapshot$ = read$.pipe(
347
- filter((job) => job !== void 0),
348
- takeUntil(updates$)
349
- );
350
- return merge(snapshot$, updates$).pipe(
351
- takeWhile((job) => !isJobFinished(job), true),
352
- // Include the final state
353
- takeUntil(missing$)
354
- );
355
- }
356
- /**
357
- * Ask the server for job events, and keep asking after every reconnect —
358
- * `authenticated$` returns to `false` when the socket drops, and a `take(1)`
359
- * here left job tracking permanently deaf once that happened.
360
- */
361
- initializeJobEventsSubscription() {
362
- this.authenticated.pipe(distinctUntilChanged(), filter(Boolean)).subscribe(() => {
363
- this.connection.send(
364
- createJsonRpcMessage("core.subscribe", ["core.get_jobs"])
365
- );
366
- });
367
- }
368
- };
369
-
370
- // src/generated/v25_10_0/index.ts
371
- var v25_10_0_exports = {};
372
- __export(v25_10_0_exports, {
373
- ACLTemplateEntryAcltypeInput: () => ACLTemplateEntryAcltypeInput,
374
- Aclmode: () => Aclmode,
375
- Acltype: () => Acltype,
376
- Action: () => Action,
377
- Advpowermgmt: () => Advpowermgmt,
378
- Algorithm: () => Algorithm,
379
- AppContainerDetailsStateInput: () => AppContainerDetailsStateInput,
380
- Atime: () => Atime,
381
- AuthMeSource: () => AuthMeSource,
382
- Authenticator: () => Authenticator,
383
- Authmethod: () => Authmethod,
384
- Autotrim: () => Autotrim,
385
- Basic: () => Basic,
386
- Blocksize: () => Blocksize,
387
- Bootloader: () => Bootloader,
388
- Casesensitivity: () => Casesensitivity,
389
- CloudBackupSnapshotItemType: () => CloudBackupSnapshotItemType,
390
- CloudSyncCreateDirection: () => CloudSyncCreateDirection,
391
- CloudSyncCreateDirectionInput: () => CloudSyncCreateDirectionInput,
392
- CloudTaskAttributesEncryption: () => CloudTaskAttributesEncryption,
393
- CloudTaskAttributesEncryptionInput: () => CloudTaskAttributesEncryptionInput,
394
- Code: () => Code,
395
- Compression: () => Compression,
396
- CorePingRemoteTypeInput: () => CorePingRemoteTypeInput,
397
- Credentials: () => Credentials,
398
- DeviceGetInfoOtherTypeInput: () => DeviceGetInfoOtherTypeInput,
399
- DiskDetailsTypeInput: () => DiskDetailsTypeInput,
400
- DiskWipeModeInput: () => DiskWipeModeInput,
401
- DockerStatusInfoStatusInput: () => DockerStatusInfoStatusInput,
402
- Enclosure2SetSlotStatusStatusInput: () => Enclosure2SetSlotStatusStatusInput,
403
- Endpoint: () => Endpoint,
404
- Exec: () => Exec,
405
- Feature: () => Feature,
406
- FilesystemDirEntryType: () => FilesystemDirEntryType,
407
- Function: () => Function,
408
- GetDisplayDeviceType: () => GetDisplayDeviceType,
409
- Hddstandby: () => Hddstandby,
410
- InitShutdownScriptCreateType: () => InitShutdownScriptCreateType,
411
- InitShutdownScriptCreateTypeInput: () => InitShutdownScriptCreateTypeInput,
412
- InterfaceCreateAliasTypeInput: () => InterfaceCreateAliasTypeInput,
413
- InterfaceCreateTypeInput: () => InterfaceCreateTypeInput,
414
- Iotype: () => Iotype,
415
- IpmiChassisIdentifyVerb: () => IpmiChassisIdentifyVerb,
416
- IscsiExtentCreateType: () => IscsiExtentCreateType,
417
- IscsiExtentCreateTypeInput: () => IscsiExtentCreateTypeInput,
418
- IscsiTargetCreateMode: () => IscsiTargetCreateMode,
419
- IscsiTargetCreateModeInput: () => IscsiTargetCreateModeInput,
420
- KeychainCredentialEntryType: () => KeychainCredentialEntryType,
421
- KeychainCredentialEntryTypeInput: () => KeychainCredentialEntryTypeInput,
422
- Level: () => Level,
423
- NFS4ACEType: () => NFS4ACEType,
424
- NFS4ACETypeInput: () => NFS4ACETypeInput,
425
- Name: () => Name,
426
- Policy: () => Policy,
427
- PoolCreateChecksum: () => PoolCreateChecksum,
428
- PoolCreateDeduplication: () => PoolCreateDeduplication,
429
- PoolCreateTopologyDataVdevDRAIDTypeInput: () => PoolCreateTopologyDataVdevDRAIDTypeInput,
430
- PoolDatasetCreateFilesystemAcltypeInput: () => PoolDatasetCreateFilesystemAcltypeInput,
431
- PoolDatasetCreateFilesystemChecksum: () => PoolDatasetCreateFilesystemChecksum,
432
- PoolDatasetCreateFilesystemDeduplication: () => PoolDatasetCreateFilesystemDeduplication,
433
- PoolDatasetCreateFilesystemReadonlyInput: () => PoolDatasetCreateFilesystemReadonlyInput,
434
- PoolDatasetDeleteResult: () => PoolDatasetDeleteResult,
435
- PoolScanStateInput: () => PoolScanStateInput,
436
- PoolSnapshotEntryPropertyFieldsSource: () => PoolSnapshotEntryPropertyFieldsSource,
437
- Protocol: () => Protocol,
438
- Purpose: () => Purpose,
439
- Readonly: () => Readonly,
440
- ReplicationCountEligibleManualSnapshotsTransport: () => ReplicationCountEligibleManualSnapshotsTransport,
441
- ReplicationCountEligibleManualSnapshotsTransportInput: () => ReplicationCountEligibleManualSnapshotsTransportInput,
442
- ReplicationCreateReadonlyInput: () => ReplicationCreateReadonlyInput,
443
- Resolution: () => Resolution,
444
- Rpm: () => Rpm,
445
- RsyncTaskCreateDirection: () => RsyncTaskCreateDirection,
446
- RsyncTaskCreateDirectionInput: () => RsyncTaskCreateDirectionInput,
447
- RsyncTaskCreateMode: () => RsyncTaskCreateMode,
448
- RsyncTaskCreateModeInput: () => RsyncTaskCreateModeInput,
449
- SMBEntryEncryption: () => SMBEntryEncryption,
450
- SMBEntryEncryptionInput: () => SMBEntryEncryptionInput,
451
- STIGType: () => STIGType,
452
- Schema: () => Schema,
453
- Security: () => Security,
454
- Serialspeed: () => Serialspeed,
455
- Service: () => Service,
456
- ServiceControlVerb: () => ServiceControlVerb,
457
- SharingSMBEntryPurposeInput: () => SharingSMBEntryPurposeInput,
458
- SharingSMBEntryPurposeInput2: () => SharingSMBEntryPurposeInput2,
459
- Shutdown: () => Shutdown,
460
- Snapdev: () => Snapdev,
461
- Snapdir: () => Snapdir,
462
- SourceInput: () => SourceInput,
463
- SourceValueType: () => SourceValueType,
464
- State: () => State,
465
- Status: () => Status,
466
- SupportNewTicketCommunityTypeInput: () => SupportNewTicketCommunityTypeInput,
467
- Sync: () => Sync,
468
- SyslogServerTransport: () => SyslogServerTransport,
469
- SyslogServerTransportInput: () => SyslogServerTransportInput,
470
- Sysloglevel: () => Sysloglevel,
471
- SystemProductTypeResult: () => SystemProductTypeResult,
472
- SystemStateResult: () => SystemStateResult,
473
- Tag: () => Tag,
474
- Target: () => Target,
475
- Time: () => Time,
476
- TruecommandConfigChangedEventFieldsStatus: () => TruecommandConfigChangedEventFieldsStatus,
477
- TruecommandConfigChangedEventFieldsStatusInput: () => TruecommandConfigChangedEventFieldsStatusInput,
478
- TunableCreateType: () => TunableCreateType,
479
- TunableCreateTypeInput: () => TunableCreateTypeInput,
480
- UPSEntryMode: () => UPSEntryMode,
481
- UPSEntryModeInput: () => UPSEntryModeInput,
482
- Unixcharset: () => Unixcharset,
483
- Username: () => Username,
484
- VMDiskDeviceType: () => VMDiskDeviceType,
485
- VMDiskDeviceTypeInput: () => VMDiskDeviceTypeInput,
486
- VMWareEntryStateStateInput: () => VMWareEntryStateStateInput,
487
- VMWareMatchDatastoresWithDatasetsResultFilesystemType: () => VMWareMatchDatastoresWithDatasetsResultFilesystemType,
488
- Vendor: () => Vendor,
489
- Volblocksize: () => Volblocksize,
490
- When: () => When,
491
- ZfsTierRewriteJobEntryStatusInput: () => ZfsTierRewriteJobEntryStatusInput
492
- });
493
-
494
- // src/generated/v25_10_0/api-types.ts
495
- var Aclmode = {
496
- Passthrough: "PASSTHROUGH",
497
- Restricted: "RESTRICTED",
498
- Discard: "DISCARD",
499
- Inherit: "INHERIT"
500
- };
501
- var ACLTemplateEntryAcltypeInput = {
502
- Nfs4: "NFS4",
503
- Posix1e: "POSIX1E"
504
- };
505
- var Acltype = {
506
- Nfs4: "NFS4",
507
- Posix1e: "POSIX1E"
508
- };
509
- var Action = {
510
- Start: "START",
511
- Stop: "STOP",
512
- Pause: "PAUSE"
513
- };
514
- var Advpowermgmt = {
515
- Disabled: "DISABLED",
516
- "1": "1",
517
- "64": "64",
518
- "127": "127",
519
- "128": "128",
520
- "192": "192",
521
- "254": "254"
522
- };
523
- var Algorithm = {
524
- Aes128Ccm: "AES-128-CCM",
525
- Aes192Ccm: "AES-192-CCM",
526
- Aes256Ccm: "AES-256-CCM",
527
- Aes128Gcm: "AES-128-GCM",
528
- Aes192Gcm: "AES-192-GCM",
529
- Aes256Gcm: "AES-256-GCM"
530
- };
531
- var AppContainerDetailsStateInput = {
532
- Crashed: "crashed",
533
- Created: "created",
534
- Exited: "exited",
535
- Running: "running",
536
- Starting: "starting"
537
- };
538
- var Atime = {
539
- On: "ON",
540
- Off: "OFF",
541
- Inherit: "INHERIT"
542
- };
543
- var Authenticator = {
544
- Level1: "LEVEL_1",
545
- Level2: "LEVEL_2"
546
- };
547
- var AuthMeSource = {
548
- Local: "LOCAL",
549
- Activedirectory: "ACTIVEDIRECTORY",
550
- Ldap: "LDAP"
551
- };
552
- var Authmethod = {
553
- None: "NONE",
554
- Chap: "CHAP",
555
- ChapMutual: "CHAP_MUTUAL"
556
- };
557
- var Autotrim = {
558
- On: "ON",
559
- Off: "OFF"
560
- };
561
- var Basic = {
562
- Inherit: "INHERIT",
563
- Noinherit: "NOINHERIT"
564
- };
565
- var Blocksize = {
566
- "512": 512,
567
- "1024": 1024,
568
- "2048": 2048,
569
- "4096": 4096
570
- };
571
- var Bootloader = {
572
- UefiCsm: "UEFI_CSM",
573
- Uefi: "UEFI"
574
- };
575
- var Casesensitivity = {
576
- Sensitive: "SENSITIVE",
577
- Insensitive: "INSENSITIVE",
578
- Inherit: "INHERIT"
579
- };
580
- var CloudBackupSnapshotItemType = {
581
- Dir: "dir",
582
- File: "file"
583
- };
584
- var CloudSyncCreateDirection = {
585
- Push: "PUSH",
586
- Pull: "PULL"
587
- };
588
- var CloudSyncCreateDirectionInput = {
589
- Push: "PUSH",
590
- Pull: "PULL"
591
- };
592
- var CloudTaskAttributesEncryption = {
593
- Null: null,
594
- Aes256: "AES256"
595
- };
596
- var CloudTaskAttributesEncryptionInput = {
597
- Null: null,
598
- Aes256: "AES256"
599
- };
600
- var Code = {
601
- Normal: "NORMAL",
602
- Error: "ERROR"
603
- };
604
- var Compression = {
605
- On: "ON",
606
- Off: "OFF",
607
- Lz4: "LZ4",
608
- Gzip: "GZIP",
609
- Gzip1: "GZIP-1",
610
- Gzip9: "GZIP-9",
611
- Zstd: "ZSTD",
612
- ZstdFast: "ZSTD-FAST",
613
- Zle: "ZLE",
614
- Lzjb: "LZJB",
615
- Zstd1: "ZSTD-1",
616
- Zstd2: "ZSTD-2",
617
- Zstd3: "ZSTD-3",
618
- Zstd4: "ZSTD-4",
619
- Zstd5: "ZSTD-5",
620
- Zstd6: "ZSTD-6",
621
- Zstd7: "ZSTD-7",
622
- Zstd8: "ZSTD-8",
623
- Zstd9: "ZSTD-9",
624
- Zstd10: "ZSTD-10",
625
- Zstd11: "ZSTD-11",
626
- Zstd12: "ZSTD-12",
627
- Zstd13: "ZSTD-13",
628
- Zstd14: "ZSTD-14",
629
- Zstd15: "ZSTD-15",
630
- Zstd16: "ZSTD-16",
631
- Zstd17: "ZSTD-17",
632
- Zstd18: "ZSTD-18",
633
- Zstd19: "ZSTD-19",
634
- ZstdFast1: "ZSTD-FAST-1",
635
- ZstdFast2: "ZSTD-FAST-2",
636
- ZstdFast3: "ZSTD-FAST-3",
637
- ZstdFast4: "ZSTD-FAST-4",
638
- ZstdFast5: "ZSTD-FAST-5",
639
- ZstdFast6: "ZSTD-FAST-6",
640
- ZstdFast7: "ZSTD-FAST-7",
641
- ZstdFast8: "ZSTD-FAST-8",
642
- ZstdFast9: "ZSTD-FAST-9",
643
- ZstdFast10: "ZSTD-FAST-10",
644
- ZstdFast20: "ZSTD-FAST-20",
645
- ZstdFast30: "ZSTD-FAST-30",
646
- ZstdFast40: "ZSTD-FAST-40",
647
- ZstdFast50: "ZSTD-FAST-50",
648
- ZstdFast60: "ZSTD-FAST-60",
649
- ZstdFast70: "ZSTD-FAST-70",
650
- ZstdFast80: "ZSTD-FAST-80",
651
- ZstdFast90: "ZSTD-FAST-90",
652
- ZstdFast100: "ZSTD-FAST-100",
653
- ZstdFast500: "ZSTD-FAST-500",
654
- ZstdFast1000: "ZSTD-FAST-1000",
655
- Inherit: "INHERIT"
656
- };
657
- var CorePingRemoteTypeInput = {
658
- Icmp: "ICMP",
659
- Icmpv4: "ICMPV4",
660
- Icmpv6: "ICMPV6"
661
- };
662
- var Credentials = {
663
- UnixSocket: "UNIX_SOCKET",
664
- LoginPassword: "LOGIN_PASSWORD",
665
- LoginTwofactor: "LOGIN_TWOFACTOR",
666
- LoginOnetimePassword: "LOGIN_ONETIME_PASSWORD",
667
- ApiKey: "API_KEY",
668
- Token: "TOKEN",
669
- TruenasNode: "TRUENAS_NODE"
670
- };
671
- var DeviceGetInfoOtherTypeInput = {
672
- Serial: "SERIAL",
673
- Gpu: "GPU"
674
- };
675
- var DiskDetailsTypeInput = {
676
- Used: "USED",
677
- Unused: "UNUSED",
678
- Both: "BOTH"
679
- };
680
- var DiskWipeModeInput = {
681
- Quick: "QUICK",
682
- Full: "FULL",
683
- FullRandom: "FULL_RANDOM"
684
- };
685
- var DockerStatusInfoStatusInput = {
686
- Pending: "PENDING",
687
- Running: "RUNNING",
688
- Stopped: "STOPPED",
689
- Initializing: "INITIALIZING",
690
- Stopping: "STOPPING",
691
- Unconfigured: "UNCONFIGURED",
692
- Failed: "FAILED",
693
- Migrating: "MIGRATING",
694
- MigrationFailed: "MIGRATION_FAILED"
695
- };
696
- var Enclosure2SetSlotStatusStatusInput = {
697
- Clear: "CLEAR",
698
- On: "ON",
699
- Off: "OFF"
700
- };
701
- var Endpoint = {
702
- OvhEu: "ovh-eu",
703
- OvhCa: "ovh-ca",
704
- OvhUs: "ovh-us",
705
- KimsufiEu: "kimsufi-eu",
706
- KimsufiCa: "kimsufi-ca",
707
- SoyoustartEu: "soyoustart-eu",
708
- SoyoustartCa: "soyoustart-ca"
709
- };
710
- var Exec = {
711
- On: "ON",
712
- Off: "OFF",
713
- Inherit: "INHERIT"
714
- };
715
- var Feature = {
716
- Dedup: "DEDUP",
717
- Fibrechannel: "FIBRECHANNEL",
718
- Vm: "VM"
719
- };
720
- var FilesystemDirEntryType = {
721
- Directory: "DIRECTORY",
722
- File: "FILE",
723
- Symlink: "SYMLINK",
724
- Other: "OTHER"
725
- };
726
- var Function = {
727
- Resilver: "RESILVER",
728
- Scrub: "SCRUB"
729
- };
730
- var GetDisplayDeviceType = {
731
- Spice: "SPICE",
732
- Vnc: "VNC"
733
- };
734
- var Hddstandby = {
735
- AlwaysOn: "ALWAYS ON",
736
- "5": "5",
737
- "10": "10",
738
- "20": "20",
739
- "30": "30",
740
- "60": "60",
741
- "120": "120",
742
- "180": "180",
743
- "240": "240",
744
- "300": "300",
745
- "330": "330"
746
- };
747
- var InitShutdownScriptCreateType = {
748
- Command: "COMMAND",
749
- Script: "SCRIPT"
750
- };
751
- var InitShutdownScriptCreateTypeInput = {
752
- Command: "COMMAND",
753
- Script: "SCRIPT"
754
- };
755
- var InterfaceCreateAliasTypeInput = {
756
- Inet: "INET",
757
- Inet6: "INET6"
758
- };
759
- var InterfaceCreateTypeInput = {
760
- Bridge: "BRIDGE",
761
- LinkAggregation: "LINK_AGGREGATION",
762
- Vlan: "VLAN"
763
- };
764
- var Iotype = {
765
- Native: "NATIVE",
766
- Threads: "THREADS",
767
- IoUring: "IO_URING"
768
- };
769
- var IpmiChassisIdentifyVerb = {
770
- On: "ON",
771
- Off: "OFF"
772
- };
773
- var IscsiExtentCreateType = {
774
- Disk: "DISK",
775
- File: "FILE"
776
- };
777
- var IscsiExtentCreateTypeInput = {
778
- Disk: "DISK",
779
- File: "FILE"
780
- };
781
- var IscsiTargetCreateMode = {
782
- Iscsi: "ISCSI",
783
- Fc: "FC",
784
- Both: "BOTH"
785
- };
786
- var IscsiTargetCreateModeInput = {
787
- Iscsi: "ISCSI",
788
- Fc: "FC",
789
- Both: "BOTH"
790
- };
791
- var KeychainCredentialEntryType = {
792
- SshKeyPair: "SSH_KEY_PAIR",
793
- SshCredentials: "SSH_CREDENTIALS"
794
- };
795
- var KeychainCredentialEntryTypeInput = {
796
- SshKeyPair: "SSH_KEY_PAIR",
797
- SshCredentials: "SSH_CREDENTIALS"
798
- };
799
- var Level = {
800
- Info: "INFO",
801
- Notice: "NOTICE",
802
- Warning: "WARNING",
803
- Error: "ERROR",
804
- Critical: "CRITICAL",
805
- Alert: "ALERT",
806
- Emergency: "EMERGENCY"
807
- };
808
- var Name = {
809
- Cpu: "cpu",
810
- Cputemp: "cputemp",
811
- Disk: "disk",
812
- Interface: "interface",
813
- Load: "load",
814
- Processes: "processes",
815
- Memory: "memory",
816
- Uptime: "uptime",
817
- Arcactualrate: "arcactualrate",
818
- Arcrate: "arcrate",
819
- Arcsize: "arcsize",
820
- Arcresult: "arcresult",
821
- Disktemp: "disktemp",
822
- Upscharge: "upscharge",
823
- Upsruntime: "upsruntime",
824
- Upsvoltage: "upsvoltage",
825
- Upscurrent: "upscurrent",
826
- Upsfrequency: "upsfrequency",
827
- Upsload: "upsload",
828
- Upstemperature: "upstemperature"
829
- };
830
- var NFS4ACEType = {
831
- Allow: "ALLOW",
832
- Deny: "DENY"
833
- };
834
- var NFS4ACETypeInput = {
835
- Allow: "ALLOW",
836
- Deny: "DENY"
837
- };
838
- var Policy = {
839
- Immediately: "IMMEDIATELY",
840
- Hourly: "HOURLY",
841
- Daily: "DAILY",
842
- Never: "NEVER"
843
- };
844
- var PoolCreateChecksum = {
845
- On: "ON",
846
- Off: "OFF",
847
- Fletcher2: "FLETCHER2",
848
- Fletcher4: "FLETCHER4",
849
- Sha256: "SHA256",
850
- Sha512: "SHA512",
851
- Skein: "SKEIN",
852
- Edonr: "EDONR",
853
- Blake3: "BLAKE3",
854
- Null: null
855
- };
856
- var PoolCreateDeduplication = {
857
- On: "ON",
858
- Verify: "VERIFY",
859
- Off: "OFF",
860
- Null: null
861
- };
862
- var PoolCreateTopologyDataVdevDRAIDTypeInput = {
863
- Draid1: "DRAID1",
864
- Draid2: "DRAID2",
865
- Draid3: "DRAID3"
866
- };
867
- var PoolDatasetCreateFilesystemAcltypeInput = {
868
- Off: "OFF",
869
- Nfsv4: "NFSV4",
870
- Posix: "POSIX",
871
- Inherit: "INHERIT"
872
- };
873
- var PoolDatasetCreateFilesystemChecksum = {
874
- On: "ON",
875
- Off: "OFF",
876
- Fletcher2: "FLETCHER2",
877
- Fletcher4: "FLETCHER4",
878
- Sha256: "SHA256",
879
- Sha512: "SHA512",
880
- Skein: "SKEIN",
881
- Edonr: "EDONR",
882
- Blake3: "BLAKE3",
883
- Inherit: "INHERIT"
884
- };
885
- var PoolDatasetCreateFilesystemDeduplication = {
886
- On: "ON",
887
- Verify: "VERIFY",
888
- Off: "OFF",
889
- Inherit: "INHERIT"
890
- };
891
- var PoolDatasetCreateFilesystemReadonlyInput = {
892
- On: "ON",
893
- Off: "OFF",
894
- Inherit: "INHERIT"
895
- };
896
- var PoolDatasetDeleteResult = {
897
- Null: null,
898
- True: true
899
- };
900
- var PoolScanStateInput = {
901
- Scanning: "SCANNING",
902
- Finished: "FINISHED",
903
- Canceled: "CANCELED"
904
- };
905
- var PoolSnapshotEntryPropertyFieldsSource = {
906
- None: "NONE",
907
- Default: "DEFAULT",
908
- Local: "LOCAL",
909
- Temporary: "TEMPORARY",
910
- Inherited: "INHERITED",
911
- Received: "RECEIVED"
912
- };
913
- var Protocol = {
914
- Http: "HTTP",
915
- Https: "HTTPS"
916
- };
917
- var Purpose = {
918
- DefaultShare: "DEFAULT_SHARE",
919
- LegacyShare: "LEGACY_SHARE",
920
- TimemachineShare: "TIMEMACHINE_SHARE",
921
- MultiprotocolShare: "MULTIPROTOCOL_SHARE",
922
- TimeLockedShare: "TIME_LOCKED_SHARE",
923
- PrivateDatasetsShare: "PRIVATE_DATASETS_SHARE",
924
- ExternalShare: "EXTERNAL_SHARE",
925
- VeeamRepositoryShare: "VEEAM_REPOSITORY_SHARE"
926
- };
927
- var Readonly = {
928
- Set: "SET",
929
- Require: "REQUIRE",
930
- Ignore: "IGNORE"
931
- };
932
- var ReplicationCountEligibleManualSnapshotsTransport = {
933
- Ssh: "SSH",
934
- SshNetcat: "SSH+NETCAT",
935
- Local: "LOCAL"
936
- };
937
- var ReplicationCountEligibleManualSnapshotsTransportInput = {
938
- Ssh: "SSH",
939
- SshNetcat: "SSH+NETCAT",
940
- Local: "LOCAL"
941
- };
942
- var ReplicationCreateReadonlyInput = {
943
- Set: "SET",
944
- Require: "REQUIRE",
945
- Ignore: "IGNORE"
946
- };
947
- var Resolution = {
948
- "1920x1200": "1920x1200",
949
- "1920x1080": "1920x1080",
950
- "1600x1200": "1600x1200",
951
- "1600x900": "1600x900",
952
- "1400x1050": "1400x1050",
953
- "1280x1024": "1280x1024",
954
- "1280x720": "1280x720",
955
- "1024x768": "1024x768",
956
- "800x600": "800x600",
957
- "640x480": "640x480"
958
- };
959
- var Rpm = {
960
- Unknown: "UNKNOWN",
961
- Ssd: "SSD",
962
- "5400": "5400",
963
- "7200": "7200",
964
- "10000": "10000",
965
- "15000": "15000"
966
- };
967
- var RsyncTaskCreateDirection = {
968
- Pull: "PULL",
969
- Push: "PUSH"
970
- };
971
- var RsyncTaskCreateDirectionInput = {
972
- Pull: "PULL",
973
- Push: "PUSH"
974
- };
975
- var RsyncTaskCreateMode = {
976
- Module: "MODULE",
977
- Ssh: "SSH"
978
- };
979
- var RsyncTaskCreateModeInput = {
980
- Module: "MODULE",
981
- Ssh: "SSH"
982
- };
983
- var Schema = {
984
- Rfc2307: "RFC2307",
985
- Rfc2307bis: "RFC2307BIS"
986
- };
987
- var Security = {
988
- Plain: "PLAIN",
989
- Ssl: "SSL",
990
- Tls: "TLS"
991
- };
992
- var Serialspeed = {
993
- "9600": "9600",
994
- "19200": "19200",
995
- "38400": "38400",
996
- "57600": "57600",
997
- "115200": "115200"
998
- };
999
- var Service = {
1000
- Middleware: "MIDDLEWARE",
1001
- Smb: "SMB",
1002
- Sudo: "SUDO",
1003
- System: "SYSTEM"
1004
- };
1005
- var ServiceControlVerb = {
1006
- Start: "START",
1007
- Stop: "STOP",
1008
- Restart: "RESTART",
1009
- Reload: "RELOAD"
1010
- };
1011
- var SharingSMBEntryPurposeInput = {
1012
- DefaultShare: "DEFAULT_SHARE",
1013
- LegacyShare: "LEGACY_SHARE",
1014
- TimemachineShare: "TIMEMACHINE_SHARE",
1015
- MultiprotocolShare: "MULTIPROTOCOL_SHARE",
1016
- TimeLockedShare: "TIME_LOCKED_SHARE",
1017
- PrivateDatasetsShare: "PRIVATE_DATASETS_SHARE",
1018
- ExternalShare: "EXTERNAL_SHARE",
1019
- VeeamRepositoryShare: "VEEAM_REPOSITORY_SHARE",
1020
- FcpShare: "FCP_SHARE"
1021
- };
1022
- var SharingSMBEntryPurposeInput2 = {
1023
- DefaultShare: "DEFAULT_SHARE",
1024
- LegacyShare: "LEGACY_SHARE",
1025
- TimemachineShare: "TIMEMACHINE_SHARE",
1026
- MultiprotocolShare: "MULTIPROTOCOL_SHARE",
1027
- TimeLockedShare: "TIME_LOCKED_SHARE",
1028
- PrivateDatasetsShare: "PRIVATE_DATASETS_SHARE",
1029
- ExternalShare: "EXTERNAL_SHARE",
1030
- VeeamRepositoryShare: "VEEAM_REPOSITORY_SHARE"
1031
- };
1032
- var Shutdown = {
1033
- Lowbatt: "LOWBATT",
1034
- Batt: "BATT"
1035
- };
1036
- var SMBEntryEncryption = {
1037
- Default: "DEFAULT",
1038
- Negotiate: "NEGOTIATE",
1039
- Desired: "DESIRED",
1040
- Required: "REQUIRED"
1041
- };
1042
- var SMBEntryEncryptionInput = {
1043
- Default: "DEFAULT",
1044
- Negotiate: "NEGOTIATE",
1045
- Desired: "DESIRED",
1046
- Required: "REQUIRED"
1047
- };
1048
- var Snapdev = {
1049
- Hidden: "HIDDEN",
1050
- Visible: "VISIBLE",
1051
- Inherit: "INHERIT"
1052
- };
1053
- var Snapdir = {
1054
- Disabled: "DISABLED",
1055
- Visible: "VISIBLE",
1056
- Hidden: "HIDDEN",
1057
- Inherit: "INHERIT"
1058
- };
1059
- var SourceInput = {
1060
- None: "NONE",
1061
- Default: "DEFAULT",
1062
- Local: "LOCAL",
1063
- Temporary: "TEMPORARY",
1064
- Inherited: "INHERITED",
1065
- Received: "RECEIVED"
1066
- };
1067
- var SourceValueType = {
1068
- None: "NONE",
1069
- Default: "DEFAULT",
1070
- Temporary: "TEMPORARY",
1071
- Local: "LOCAL",
1072
- Inherited: "INHERITED",
1073
- Received: "RECEIVED"
1074
- };
1075
- var State = {
1076
- Crashed: "crashed",
1077
- Created: "created",
1078
- Exited: "exited",
1079
- Running: "running",
1080
- Starting: "starting"
1081
- };
1082
- var Status = {
1083
- Pending: "PENDING",
1084
- Running: "RUNNING",
1085
- Stopped: "STOPPED",
1086
- Initializing: "INITIALIZING",
1087
- Stopping: "STOPPING",
1088
- Unconfigured: "UNCONFIGURED",
1089
- Failed: "FAILED"
1090
- };
1091
- var STIGType = {
1092
- "0": 0,
1093
- "1": 1
1094
- };
1095
- var SupportNewTicketCommunityTypeInput = {
1096
- Bug: "BUG",
1097
- Feature: "FEATURE"
1098
- };
1099
- var Sync = {
1100
- Standard: "STANDARD",
1101
- Always: "ALWAYS",
1102
- Disabled: "DISABLED",
1103
- Inherit: "INHERIT"
1104
- };
1105
- var Sysloglevel = {
1106
- FEmerg: "F_EMERG",
1107
- FAlert: "F_ALERT",
1108
- FCrit: "F_CRIT",
1109
- FErr: "F_ERR",
1110
- FWarning: "F_WARNING",
1111
- FNotice: "F_NOTICE",
1112
- FInfo: "F_INFO",
1113
- FDebug: "F_DEBUG"
1114
- };
1115
- var SyslogServerTransport = {
1116
- Udp: "UDP",
1117
- Tcp: "TCP",
1118
- Tls: "TLS"
1119
- };
1120
- var SyslogServerTransportInput = {
1121
- Udp: "UDP",
1122
- Tcp: "TCP",
1123
- Tls: "TLS"
1124
- };
1125
- var SystemProductTypeResult = {
1126
- CommunityEdition: "COMMUNITY_EDITION",
1127
- Enterprise: "ENTERPRISE"
1128
- };
1129
- var SystemStateResult = {
1130
- Booting: "BOOTING",
1131
- Ready: "READY",
1132
- ShuttingDown: "SHUTTING_DOWN"
1133
- };
1134
- var Tag = {
1135
- Owner: "owner@",
1136
- Group: "group@",
1137
- Everyone: "everyone@",
1138
- User: "USER",
1139
- "GROUP": "GROUP"
1140
- };
1141
- var Target = {
1142
- Ws: "WS",
1143
- Cli: "CLI",
1144
- Rest: "REST"
1145
- };
1146
- var Time = {
1147
- Local: "LOCAL",
1148
- Utc: "UTC"
1149
- };
1150
- var TruecommandConfigChangedEventFieldsStatus = {
1151
- Connected: "CONNECTED",
1152
- Connecting: "CONNECTING",
1153
- Disabled: "DISABLED",
1154
- Failed: "FAILED"
1155
- };
1156
- var TruecommandConfigChangedEventFieldsStatusInput = {
1157
- Connected: "CONNECTED",
1158
- Connecting: "CONNECTING",
1159
- Disabled: "DISABLED",
1160
- Failed: "FAILED"
1161
- };
1162
- var TunableCreateType = {
1163
- Sysctl: "SYSCTL",
1164
- Udev: "UDEV",
1165
- Zfs: "ZFS"
1166
- };
1167
- var TunableCreateTypeInput = {
1168
- Sysctl: "SYSCTL",
1169
- Udev: "UDEV",
1170
- Zfs: "ZFS"
1171
- };
1172
- var Unixcharset = {
1173
- Utf8: "UTF-8",
1174
- Gb2312: "GB2312",
1175
- HzGb2312: "HZ-GB-2312",
1176
- Cp1361: "CP1361",
1177
- Big5: "BIG5",
1178
- Big5hkscs: "BIG5HKSCS",
1179
- Cp037: "CP037",
1180
- Cp273: "CP273",
1181
- Cp424: "CP424",
1182
- Cp437: "CP437",
1183
- Cp500: "CP500",
1184
- Cp775: "CP775",
1185
- Cp850: "CP850",
1186
- Cp852: "CP852",
1187
- Cp855: "CP855",
1188
- Cp857: "CP857",
1189
- Cp858: "CP858",
1190
- Cp860: "CP860",
1191
- Cp861: "CP861",
1192
- Cp862: "CP862",
1193
- Cp863: "CP863",
1194
- Cp864: "CP864",
1195
- Cp865: "CP865",
1196
- Cp866: "CP866",
1197
- Cp869: "CP869",
1198
- Cp932: "CP932",
1199
- Cp949: "CP949",
1200
- Cp950: "CP950",
1201
- Cp1026: "CP1026",
1202
- Cp1125: "CP1125",
1203
- Cp1140: "CP1140",
1204
- Cp1250: "CP1250",
1205
- Cp1251: "CP1251",
1206
- Cp1252: "CP1252",
1207
- Cp1253: "CP1253",
1208
- Cp1254: "CP1254",
1209
- Cp1255: "CP1255",
1210
- Cp1256: "CP1256",
1211
- Cp1257: "CP1257",
1212
- Cp1258: "CP1258",
1213
- EucJis2004: "EUC_JIS_2004",
1214
- EucJisx0213: "EUC_JISX0213",
1215
- EucJp: "EUC_JP",
1216
- EucKr: "EUC_KR",
1217
- Gb18030: "GB18030",
1218
- Gbk: "GBK",
1219
- Hz: "HZ",
1220
- Iso2022Jp: "ISO2022_JP",
1221
- Iso2022Jp1: "ISO2022_JP_1",
1222
- Iso2022Jp2: "ISO2022_JP_2",
1223
- Iso2022Jp2004: "ISO2022_JP_2004",
1224
- Iso2022Jp3: "ISO2022_JP_3",
1225
- Iso2022JpExt: "ISO2022_JP_EXT",
1226
- Iso2022Kr: "ISO2022_KR",
1227
- Iso88591: "ISO8859_1",
1228
- Iso88592: "ISO8859_2",
1229
- Iso88593: "ISO8859_3",
1230
- Iso88594: "ISO8859_4",
1231
- Iso88595: "ISO8859_5",
1232
- Iso88596: "ISO8859_6",
1233
- Iso88597: "ISO8859_7",
1234
- Iso88598: "ISO8859_8",
1235
- Iso88599: "ISO8859_9",
1236
- Iso885910: "ISO8859_10",
1237
- Iso885911: "ISO8859_11",
1238
- Iso885913: "ISO8859_13",
1239
- Iso885914: "ISO8859_14",
1240
- Iso885915: "ISO8859_15",
1241
- Iso885916: "ISO8859_16",
1242
- Johab: "JOHAB",
1243
- Koi8R: "KOI8_R",
1244
- Kz1048: "KZ1048",
1245
- Latin1: "LATIN_1",
1246
- MacCyrillic: "MAC_CYRILLIC",
1247
- MacGreek: "MAC_GREEK",
1248
- MacIceland: "MAC_ICELAND",
1249
- MacLatin2: "MAC_LATIN2",
1250
- MacRoman: "MAC_ROMAN",
1251
- MacTurkish: "MAC_TURKISH",
1252
- Ptcp154: "PTCP154",
1253
- ShiftJis: "SHIFT_JIS",
1254
- ShiftJis2004: "SHIFT_JIS_2004",
1255
- ShiftJisx0213: "SHIFT_JISX0213",
1256
- Tis620: "TIS_620",
1257
- Utf16: "UTF_16",
1258
- Utf16Be: "UTF_16_BE",
1259
- Utf16Le: "UTF_16_LE"
1260
- };
1261
- var UPSEntryMode = {
1262
- Master: "MASTER",
1263
- Slave: "SLAVE"
1264
- };
1265
- var UPSEntryModeInput = {
1266
- Master: "MASTER",
1267
- Slave: "SLAVE"
1268
- };
1269
- var Username = {
1270
- Root: "root",
1271
- TruenasAdmin: "truenas_admin"
1272
- };
1273
- var Vendor = {
1274
- Nextcloud: "NEXTCLOUD",
1275
- Owncloud: "OWNCLOUD",
1276
- Sharepoint: "SHAREPOINT",
1277
- Other: "OTHER"
1278
- };
1279
- var VMDiskDeviceType = {
1280
- Ahci: "AHCI",
1281
- Virtio: "VIRTIO"
1282
- };
1283
- var VMDiskDeviceTypeInput = {
1284
- Ahci: "AHCI",
1285
- Virtio: "VIRTIO"
1286
- };
1287
- var VMWareEntryStateStateInput = {
1288
- Pending: "PENDING",
1289
- Success: "SUCCESS",
1290
- Error: "ERROR",
1291
- Blocked: "BLOCKED"
1292
- };
1293
- var VMWareMatchDatastoresWithDatasetsResultFilesystemType = {
1294
- Filesystem: "FILESYSTEM",
1295
- Volume: "VOLUME"
1296
- };
1297
- var Volblocksize = {
1298
- "512": "512",
1299
- "512B": "512B",
1300
- "1K": "1K",
1301
- "2K": "2K",
1302
- "4K": "4K",
1303
- "8K": "8K",
1304
- "16K": "16K",
1305
- "32K": "32K",
1306
- "64K": "64K",
1307
- "128K": "128K"
1308
- };
1309
- var When = {
1310
- Preinit: "PREINIT",
1311
- Postinit: "POSTINIT",
1312
- Shutdown: "SHUTDOWN"
1313
- };
1314
- var ZfsTierRewriteJobEntryStatusInput = {
1315
- Complete: "COMPLETE",
1316
- Running: "RUNNING",
1317
- Queued: "QUEUED",
1318
- Cancelled: "CANCELLED",
1319
- Stopped: "STOPPED",
1320
- Error: "ERROR"
1321
- };
1322
-
1323
- // src/generated/v25_10_1/index.ts
1324
- var v25_10_1_exports = {};
1325
- __export(v25_10_1_exports, {
1326
- ACLTemplateEntryAcltypeInput: () => ACLTemplateEntryAcltypeInput,
1327
- Aclmode: () => Aclmode,
1328
- Acltype: () => Acltype,
1329
- Action: () => Action,
1330
- Advpowermgmt: () => Advpowermgmt,
1331
- Algorithm: () => Algorithm,
1332
- AppContainerDetailsStateInput: () => AppContainerDetailsStateInput,
1333
- Atime: () => Atime,
1334
- AuthMeSource: () => AuthMeSource,
1335
- Authenticator: () => Authenticator,
1336
- Authmethod: () => Authmethod,
1337
- Autotrim: () => Autotrim,
1338
- Basic: () => Basic,
1339
- Blocksize: () => Blocksize,
1340
- Bootloader: () => Bootloader,
1341
- Casesensitivity: () => Casesensitivity,
1342
- CloudBackupSnapshotItemType: () => CloudBackupSnapshotItemType,
1343
- CloudSyncCreateDirection: () => CloudSyncCreateDirection,
1344
- CloudSyncCreateDirectionInput: () => CloudSyncCreateDirectionInput,
1345
- CloudTaskAttributesEncryption: () => CloudTaskAttributesEncryption,
1346
- CloudTaskAttributesEncryptionInput: () => CloudTaskAttributesEncryptionInput,
1347
- Code: () => Code,
1348
- Compression: () => Compression,
1349
- CorePingRemoteTypeInput: () => CorePingRemoteTypeInput,
1350
- Credentials: () => Credentials,
1351
- DeviceGetInfoOtherTypeInput: () => DeviceGetInfoOtherTypeInput,
1352
- DiskDetailsTypeInput: () => DiskDetailsTypeInput,
1353
- DiskWipeModeInput: () => DiskWipeModeInput,
1354
- DockerStatusInfoStatus: () => DockerStatusInfoStatus,
1355
- DockerStatusInfoStatusInput: () => DockerStatusInfoStatusInput,
1356
- Enclosure2SetSlotStatusStatusInput: () => Enclosure2SetSlotStatusStatusInput,
1357
- Endpoint: () => Endpoint,
1358
- Exec: () => Exec,
1359
- Feature: () => Feature,
1360
- FilesystemDirEntryType: () => FilesystemDirEntryType,
1361
- Function: () => Function,
1362
- GetDisplayDeviceType: () => GetDisplayDeviceType,
1363
- Hddstandby: () => Hddstandby,
1364
- InitShutdownScriptCreateType: () => InitShutdownScriptCreateType,
1365
- InitShutdownScriptCreateTypeInput: () => InitShutdownScriptCreateTypeInput,
1366
- InterfaceCreateAliasTypeInput: () => InterfaceCreateAliasTypeInput,
1367
- InterfaceCreateTypeInput: () => InterfaceCreateTypeInput,
1368
- Iotype: () => Iotype,
1369
- IpmiChassisIdentifyVerb: () => IpmiChassisIdentifyVerb,
1370
- IscsiExtentCreateType: () => IscsiExtentCreateType,
1371
- IscsiExtentCreateTypeInput: () => IscsiExtentCreateTypeInput,
1372
- IscsiTargetCreateMode: () => IscsiTargetCreateMode,
1373
- IscsiTargetCreateModeInput: () => IscsiTargetCreateModeInput,
1374
- KeychainCredentialEntryType: () => KeychainCredentialEntryType,
1375
- KeychainCredentialEntryTypeInput: () => KeychainCredentialEntryTypeInput,
1376
- Level: () => Level,
1377
- NFS4ACEType: () => NFS4ACEType,
1378
- NFS4ACETypeInput: () => NFS4ACETypeInput,
1379
- Name: () => Name,
1380
- Policy: () => Policy,
1381
- PoolCreateChecksum: () => PoolCreateChecksum,
1382
- PoolCreateDeduplication: () => PoolCreateDeduplication,
1383
- PoolCreateTopologyDataVdevDRAIDTypeInput: () => PoolCreateTopologyDataVdevDRAIDTypeInput,
1384
- PoolDatasetCreateFilesystemAcltypeInput: () => PoolDatasetCreateFilesystemAcltypeInput,
1385
- PoolDatasetCreateFilesystemChecksum: () => PoolDatasetCreateFilesystemChecksum,
1386
- PoolDatasetCreateFilesystemDeduplication: () => PoolDatasetCreateFilesystemDeduplication,
1387
- PoolDatasetCreateFilesystemReadonlyInput: () => PoolDatasetCreateFilesystemReadonlyInput,
1388
- PoolDatasetDeleteResult: () => PoolDatasetDeleteResult,
1389
- PoolScanStateInput: () => PoolScanStateInput,
1390
- PoolSnapshotEntryPropertyFieldsSource: () => PoolSnapshotEntryPropertyFieldsSource,
1391
- Protocol: () => Protocol,
1392
- Purpose: () => Purpose2,
1393
- Readonly: () => Readonly,
1394
- ReplicationCountEligibleManualSnapshotsTransport: () => ReplicationCountEligibleManualSnapshotsTransport,
1395
- ReplicationCountEligibleManualSnapshotsTransportInput: () => ReplicationCountEligibleManualSnapshotsTransportInput,
1396
- ReplicationCreateReadonlyInput: () => ReplicationCreateReadonlyInput,
1397
- Resolution: () => Resolution,
1398
- Rpm: () => Rpm,
1399
- RsyncTaskCreateDirection: () => RsyncTaskCreateDirection,
1400
- RsyncTaskCreateDirectionInput: () => RsyncTaskCreateDirectionInput,
1401
- RsyncTaskCreateMode: () => RsyncTaskCreateMode,
1402
- RsyncTaskCreateModeInput: () => RsyncTaskCreateModeInput,
1403
- SMBEntryEncryption: () => SMBEntryEncryption,
1404
- SMBEntryEncryptionInput: () => SMBEntryEncryptionInput,
1405
- STIGType: () => STIGType,
1406
- Schema: () => Schema,
1407
- Security: () => Security,
1408
- Serialspeed: () => Serialspeed,
1409
- Service: () => Service,
1410
- ServiceControlVerb: () => ServiceControlVerb,
1411
- Shutdown: () => Shutdown,
1412
- Snapdev: () => Snapdev,
1413
- Snapdir: () => Snapdir,
1414
- SourceInput: () => SourceInput,
1415
- SourceValueType: () => SourceValueType,
1416
- State: () => State,
1417
- SupportNewTicketCommunityTypeInput: () => SupportNewTicketCommunityTypeInput,
1418
- Sync: () => Sync,
1419
- SyslogServerTransport: () => SyslogServerTransport,
1420
- SyslogServerTransportInput: () => SyslogServerTransportInput,
1421
- Sysloglevel: () => Sysloglevel,
1422
- SystemProductTypeResult: () => SystemProductTypeResult,
1423
- SystemStateResult: () => SystemStateResult,
1424
- Tag: () => Tag,
1425
- Target: () => Target,
1426
- Time: () => Time,
1427
- TruecommandConfigChangedEventFieldsStatus: () => TruecommandConfigChangedEventFieldsStatus,
1428
- TruecommandConfigChangedEventFieldsStatusInput: () => TruecommandConfigChangedEventFieldsStatusInput,
1429
- TunableCreateType: () => TunableCreateType,
1430
- TunableCreateTypeInput: () => TunableCreateTypeInput,
1431
- UPSEntryMode: () => UPSEntryMode,
1432
- UPSEntryModeInput: () => UPSEntryModeInput,
1433
- Unixcharset: () => Unixcharset,
1434
- Username: () => Username,
1435
- VMDiskDeviceType: () => VMDiskDeviceType,
1436
- VMDiskDeviceTypeInput: () => VMDiskDeviceTypeInput,
1437
- VMWareEntryStateStateInput: () => VMWareEntryStateStateInput,
1438
- VMWareMatchDatastoresWithDatasetsResultFilesystemType: () => VMWareMatchDatastoresWithDatasetsResultFilesystemType,
1439
- Vendor: () => Vendor,
1440
- Volblocksize: () => Volblocksize,
1441
- When: () => When,
1442
- ZfsTierRewriteJobEntryStatusInput: () => ZfsTierRewriteJobEntryStatusInput
1443
- });
1444
-
1445
- // src/generated/v25_10_1/api-types.ts
1446
- var DockerStatusInfoStatus = {
1447
- Pending: "PENDING",
1448
- Running: "RUNNING",
1449
- Stopped: "STOPPED",
1450
- Initializing: "INITIALIZING",
1451
- Stopping: "STOPPING",
1452
- Unconfigured: "UNCONFIGURED",
1453
- Failed: "FAILED",
1454
- Migrating: "MIGRATING",
1455
- MigrationFailed: "MIGRATION_FAILED"
1456
- };
1457
- var Purpose2 = {
1458
- DefaultShare: "DEFAULT_SHARE",
1459
- LegacyShare: "LEGACY_SHARE",
1460
- TimemachineShare: "TIMEMACHINE_SHARE",
1461
- MultiprotocolShare: "MULTIPROTOCOL_SHARE",
1462
- TimeLockedShare: "TIME_LOCKED_SHARE",
1463
- PrivateDatasetsShare: "PRIVATE_DATASETS_SHARE",
1464
- ExternalShare: "EXTERNAL_SHARE",
1465
- VeeamRepositoryShare: "VEEAM_REPOSITORY_SHARE",
1466
- FcpShare: "FCP_SHARE"
1467
- };
1468
-
1469
- // src/generated/v25_10_2/index.ts
1470
- var v25_10_2_exports = {};
1471
- __export(v25_10_2_exports, {
1472
- ACLTemplateEntryAcltypeInput: () => ACLTemplateEntryAcltypeInput,
1473
- Aclmode: () => Aclmode,
1474
- Acltype: () => Acltype,
1475
- Action: () => Action,
1476
- Advpowermgmt: () => Advpowermgmt,
1477
- Algorithm: () => Algorithm,
1478
- AppContainerDetailsStateInput: () => AppContainerDetailsStateInput,
1479
- Atime: () => Atime,
1480
- AuthMeSource: () => AuthMeSource,
1481
- Authenticator: () => Authenticator,
1482
- Authmethod: () => Authmethod,
1483
- Autotrim: () => Autotrim,
1484
- Basic: () => Basic,
1485
- Blocksize: () => Blocksize,
1486
- Bootloader: () => Bootloader,
1487
- Casesensitivity: () => Casesensitivity,
1488
- CloudBackupSnapshotItemType: () => CloudBackupSnapshotItemType,
1489
- CloudSyncCreateDirection: () => CloudSyncCreateDirection,
1490
- CloudSyncCreateDirectionInput: () => CloudSyncCreateDirectionInput,
1491
- CloudTaskAttributesEncryption: () => CloudTaskAttributesEncryption,
1492
- CloudTaskAttributesEncryptionInput: () => CloudTaskAttributesEncryptionInput,
1493
- Code: () => Code,
1494
- Compression: () => Compression,
1495
- CorePingRemoteTypeInput: () => CorePingRemoteTypeInput,
1496
- Credentials: () => Credentials,
1497
- DeviceGetInfoOtherTypeInput: () => DeviceGetInfoOtherTypeInput,
1498
- DiskDetailsTypeInput: () => DiskDetailsTypeInput,
1499
- DiskWipeModeInput: () => DiskWipeModeInput,
1500
- DockerStatusInfoStatus: () => DockerStatusInfoStatus,
1501
- DockerStatusInfoStatusInput: () => DockerStatusInfoStatusInput,
1502
- Enclosure2SetSlotStatusStatusInput: () => Enclosure2SetSlotStatusStatusInput,
1503
- Endpoint: () => Endpoint,
1504
- Exec: () => Exec,
1505
- Feature: () => Feature,
1506
- FilesystemDirEntryType: () => FilesystemDirEntryType,
1507
- Function: () => Function,
1508
- GetDisplayDeviceType: () => GetDisplayDeviceType,
1509
- Hddstandby: () => Hddstandby,
1510
- InitShutdownScriptCreateType: () => InitShutdownScriptCreateType,
1511
- InitShutdownScriptCreateTypeInput: () => InitShutdownScriptCreateTypeInput,
1512
- InterfaceCreateAliasTypeInput: () => InterfaceCreateAliasTypeInput,
1513
- InterfaceCreateTypeInput: () => InterfaceCreateTypeInput,
1514
- Iotype: () => Iotype,
1515
- IpmiChassisIdentifyRequestVerb: () => IpmiChassisIdentifyRequestVerb,
1516
- IscsiExtentCreateType: () => IscsiExtentCreateType,
1517
- IscsiExtentCreateTypeInput: () => IscsiExtentCreateTypeInput,
1518
- IscsiTargetCreateMode: () => IscsiTargetCreateMode,
1519
- IscsiTargetCreateModeInput: () => IscsiTargetCreateModeInput,
1520
- KeychainCredentialEntryType: () => KeychainCredentialEntryType,
1521
- KeychainCredentialEntryTypeInput: () => KeychainCredentialEntryTypeInput,
1522
- Level: () => Level,
1523
- NFS4ACEType: () => NFS4ACEType,
1524
- NFS4ACETypeInput: () => NFS4ACETypeInput,
1525
- Name: () => Name,
1526
- Policy: () => Policy,
1527
- PoolCreateChecksum: () => PoolCreateChecksum,
1528
- PoolCreateDeduplication: () => PoolCreateDeduplication,
1529
- PoolCreateTopologyDataVdevDRAIDTypeInput: () => PoolCreateTopologyDataVdevDRAIDTypeInput,
1530
- PoolDatasetCreateFilesystemAcltypeInput: () => PoolDatasetCreateFilesystemAcltypeInput,
1531
- PoolDatasetCreateFilesystemChecksum: () => PoolDatasetCreateFilesystemChecksum,
1532
- PoolDatasetCreateFilesystemDeduplication: () => PoolDatasetCreateFilesystemDeduplication,
1533
- PoolDatasetCreateFilesystemReadonlyInput: () => PoolDatasetCreateFilesystemReadonlyInput,
1534
- PoolDatasetDeleteResult: () => PoolDatasetDeleteResult,
1535
- PoolScanStateInput: () => PoolScanStateInput,
1536
- PoolSnapshotEntryPropertyFieldsSource: () => PoolSnapshotEntryPropertyFieldsSource,
1537
- Protocol: () => Protocol,
1538
- Purpose: () => Purpose2,
1539
- Readonly: () => Readonly,
1540
- ReplicationCountEligibleManualSnapshotsTransport: () => ReplicationCountEligibleManualSnapshotsTransport,
1541
- ReplicationCountEligibleManualSnapshotsTransportInput: () => ReplicationCountEligibleManualSnapshotsTransportInput,
1542
- ReplicationCreateReadonlyInput: () => ReplicationCreateReadonlyInput,
1543
- Resolution: () => Resolution,
1544
- Rpm: () => Rpm,
1545
- RsyncTaskCreateDirection: () => RsyncTaskCreateDirection,
1546
- RsyncTaskCreateDirectionInput: () => RsyncTaskCreateDirectionInput,
1547
- RsyncTaskCreateMode: () => RsyncTaskCreateMode,
1548
- RsyncTaskCreateModeInput: () => RsyncTaskCreateModeInput,
1549
- SMBEntryEncryption: () => SMBEntryEncryption,
1550
- SMBEntryEncryptionInput: () => SMBEntryEncryptionInput,
1551
- STIGType: () => STIGType,
1552
- Schema: () => Schema,
1553
- Security: () => Security,
1554
- Serialspeed: () => Serialspeed,
1555
- Service: () => Service,
1556
- ServiceControlVerb: () => ServiceControlVerb,
1557
- Shutdown: () => Shutdown,
1558
- Snapdev: () => Snapdev,
1559
- Snapdir: () => Snapdir,
1560
- SourceInput: () => SourceInput,
1561
- SourceValueType: () => SourceValueType,
1562
- State: () => State,
1563
- SupportNewTicketCommunityTypeInput: () => SupportNewTicketCommunityTypeInput,
1564
- Sync: () => Sync,
1565
- SyslogServerTransport: () => SyslogServerTransport,
1566
- SyslogServerTransportInput: () => SyslogServerTransportInput,
1567
- Sysloglevel: () => Sysloglevel,
1568
- SystemProductTypeResult: () => SystemProductTypeResult,
1569
- SystemStateResult: () => SystemStateResult,
1570
- Tag: () => Tag,
1571
- Target: () => Target,
1572
- Time: () => Time,
1573
- TruecommandConfigChangedEventFieldsStatus: () => TruecommandConfigChangedEventFieldsStatus,
1574
- TruecommandConfigChangedEventFieldsStatusInput: () => TruecommandConfigChangedEventFieldsStatusInput,
1575
- TunableCreateType: () => TunableCreateType,
1576
- TunableCreateTypeInput: () => TunableCreateTypeInput,
1577
- UPSEntryMode: () => UPSEntryMode,
1578
- UPSEntryModeInput: () => UPSEntryModeInput,
1579
- Unixcharset: () => Unixcharset,
1580
- Username: () => Username,
1581
- VMDiskDeviceType: () => VMDiskDeviceType,
1582
- VMDiskDeviceTypeInput: () => VMDiskDeviceTypeInput,
1583
- VMWareEntryStateStateInput: () => VMWareEntryStateStateInput,
1584
- VMWareMatchDatastoresWithDatasetsResultFilesystemType: () => VMWareMatchDatastoresWithDatasetsResultFilesystemType,
1585
- Vendor: () => Vendor,
1586
- Volblocksize: () => Volblocksize,
1587
- When: () => When,
1588
- ZfsTierRewriteJobEntryStatusInput: () => ZfsTierRewriteJobEntryStatusInput
1589
- });
1590
-
1591
- // src/generated/v25_10_2/api-types.ts
1592
- var IpmiChassisIdentifyRequestVerb = {
1593
- On: "ON",
1594
- Off: "OFF"
1595
- };
1596
-
1597
- // src/generated/v25_10_3/index.ts
1598
- var v25_10_3_exports = {};
1599
- __export(v25_10_3_exports, {
1600
- ACLTemplateEntryAcltypeInput: () => ACLTemplateEntryAcltypeInput,
1601
- Aclmode: () => Aclmode,
1602
- Acltype: () => Acltype,
1603
- Action: () => Action,
1604
- Advpowermgmt: () => Advpowermgmt,
1605
- Algorithm: () => Algorithm,
1606
- AppContainerDetailsStateInput: () => AppContainerDetailsStateInput,
1607
- Atime: () => Atime,
1608
- AuthMeSource: () => AuthMeSource,
1609
- Authenticator: () => Authenticator,
1610
- Authmethod: () => Authmethod,
1611
- Autotrim: () => Autotrim,
1612
- Basic: () => Basic,
1613
- Blocksize: () => Blocksize,
1614
- Bootloader: () => Bootloader,
1615
- Casesensitivity: () => Casesensitivity,
1616
- CloudBackupSnapshotItemType: () => CloudBackupSnapshotItemType,
1617
- CloudSyncCreateDirection: () => CloudSyncCreateDirection,
1618
- CloudSyncCreateDirectionInput: () => CloudSyncCreateDirectionInput,
1619
- CloudTaskAttributesEncryption: () => CloudTaskAttributesEncryption,
1620
- CloudTaskAttributesEncryptionInput: () => CloudTaskAttributesEncryptionInput,
1621
- Code: () => Code,
1622
- Compression: () => Compression,
1623
- CorePingRemoteTypeInput: () => CorePingRemoteTypeInput,
1624
- Credentials: () => Credentials,
1625
- DeviceGetInfoOtherTypeInput: () => DeviceGetInfoOtherTypeInput,
1626
- DiskDetailsTypeInput: () => DiskDetailsTypeInput,
1627
- DiskWipeModeInput: () => DiskWipeModeInput,
1628
- DockerStatusInfoStatus: () => DockerStatusInfoStatus,
1629
- DockerStatusInfoStatusInput: () => DockerStatusInfoStatusInput,
1630
- Enclosure2SetSlotStatusStatusInput: () => Enclosure2SetSlotStatusStatusInput,
1631
- Endpoint: () => Endpoint,
1632
- Exec: () => Exec,
1633
- Feature: () => Feature,
1634
- FilesystemDirEntryType: () => FilesystemDirEntryType,
1635
- Function: () => Function,
1636
- GetDisplayDeviceType: () => GetDisplayDeviceType,
1637
- Hddstandby: () => Hddstandby,
1638
- InitShutdownScriptCreateType: () => InitShutdownScriptCreateType,
1639
- InitShutdownScriptCreateTypeInput: () => InitShutdownScriptCreateTypeInput,
1640
- InterfaceCreateAliasTypeInput: () => InterfaceCreateAliasTypeInput,
1641
- InterfaceCreateTypeInput: () => InterfaceCreateTypeInput,
1642
- Iotype: () => Iotype,
1643
- IpmiChassisIdentifyRequestVerb: () => IpmiChassisIdentifyRequestVerb,
1644
- IscsiExtentCreateType: () => IscsiExtentCreateType,
1645
- IscsiExtentCreateTypeInput: () => IscsiExtentCreateTypeInput,
1646
- IscsiTargetCreateMode: () => IscsiTargetCreateMode,
1647
- IscsiTargetCreateModeInput: () => IscsiTargetCreateModeInput,
1648
- KeychainCredentialEntryType: () => KeychainCredentialEntryType,
1649
- KeychainCredentialEntryTypeInput: () => KeychainCredentialEntryTypeInput,
1650
- Level: () => Level,
1651
- NFS4ACEType: () => NFS4ACEType,
1652
- NFS4ACETypeInput: () => NFS4ACETypeInput,
1653
- Name: () => Name,
1654
- Policy: () => Policy,
1655
- PoolCreateChecksum: () => PoolCreateChecksum,
1656
- PoolCreateDeduplication: () => PoolCreateDeduplication,
1657
- PoolCreateTopologyDataVdevDRAIDTypeInput: () => PoolCreateTopologyDataVdevDRAIDTypeInput,
1658
- PoolDatasetCreateFilesystemAcltypeInput: () => PoolDatasetCreateFilesystemAcltypeInput,
1659
- PoolDatasetCreateFilesystemChecksum: () => PoolDatasetCreateFilesystemChecksum,
1660
- PoolDatasetCreateFilesystemDeduplication: () => PoolDatasetCreateFilesystemDeduplication,
1661
- PoolDatasetCreateFilesystemReadonlyInput: () => PoolDatasetCreateFilesystemReadonlyInput,
1662
- PoolDatasetDeleteResult: () => PoolDatasetDeleteResult,
1663
- PoolScanStateInput: () => PoolScanStateInput,
1664
- PoolSnapshotEntryPropertyFieldsSource: () => PoolSnapshotEntryPropertyFieldsSource,
1665
- Protocol: () => Protocol,
1666
- Purpose: () => Purpose2,
1667
- Readonly: () => Readonly,
1668
- ReplicationCountEligibleManualSnapshotsTransport: () => ReplicationCountEligibleManualSnapshotsTransport,
1669
- ReplicationCountEligibleManualSnapshotsTransportInput: () => ReplicationCountEligibleManualSnapshotsTransportInput,
1670
- ReplicationCreateReadonlyInput: () => ReplicationCreateReadonlyInput,
1671
- Resolution: () => Resolution,
1672
- Rpm: () => Rpm,
1673
- RsyncTaskCreateDirection: () => RsyncTaskCreateDirection,
1674
- RsyncTaskCreateDirectionInput: () => RsyncTaskCreateDirectionInput,
1675
- RsyncTaskCreateMode: () => RsyncTaskCreateMode,
1676
- RsyncTaskCreateModeInput: () => RsyncTaskCreateModeInput,
1677
- SMBEntryEncryption: () => SMBEntryEncryption,
1678
- SMBEntryEncryptionInput: () => SMBEntryEncryptionInput,
1679
- STIGType: () => STIGType,
1680
- Schema: () => Schema,
1681
- Security: () => Security,
1682
- Serialspeed: () => Serialspeed,
1683
- Service: () => Service,
1684
- ServiceControlVerb: () => ServiceControlVerb,
1685
- Shutdown: () => Shutdown,
1686
- Snapdev: () => Snapdev,
1687
- Snapdir: () => Snapdir,
1688
- SourceInput: () => SourceInput,
1689
- SourceValueType: () => SourceValueType,
1690
- State: () => State,
1691
- SupportNewTicketCommunityTypeInput: () => SupportNewTicketCommunityTypeInput,
1692
- Sync: () => Sync,
1693
- SyslogServerTransport: () => SyslogServerTransport,
1694
- SyslogServerTransportInput: () => SyslogServerTransportInput,
1695
- Sysloglevel: () => Sysloglevel,
1696
- SystemProductTypeResult: () => SystemProductTypeResult,
1697
- SystemStateResult: () => SystemStateResult,
1698
- Tag: () => Tag,
1699
- Target: () => Target,
1700
- Time: () => Time,
1701
- TruecommandConfigChangedEventFieldsStatus: () => TruecommandConfigChangedEventFieldsStatus,
1702
- TruecommandConfigChangedEventFieldsStatusInput: () => TruecommandConfigChangedEventFieldsStatusInput,
1703
- TunableCreateType: () => TunableCreateType,
1704
- TunableCreateTypeInput: () => TunableCreateTypeInput,
1705
- UPSEntryMode: () => UPSEntryMode,
1706
- UPSEntryModeInput: () => UPSEntryModeInput,
1707
- Unixcharset: () => Unixcharset,
1708
- Username: () => Username,
1709
- VMDiskDeviceType: () => VMDiskDeviceType,
1710
- VMDiskDeviceTypeInput: () => VMDiskDeviceTypeInput,
1711
- VMWareEntryStateStateInput: () => VMWareEntryStateStateInput,
1712
- VMWareMatchDatastoresWithDatasetsResultFilesystemType: () => VMWareMatchDatastoresWithDatasetsResultFilesystemType,
1713
- Vendor: () => Vendor,
1714
- Volblocksize: () => Volblocksize,
1715
- When: () => When,
1716
- ZfsTierRewriteJobEntryStatusInput: () => ZfsTierRewriteJobEntryStatusInput
1717
- });
1718
-
1719
- // src/generated/v25_10_4/index.ts
1720
- var v25_10_4_exports = {};
1721
- __export(v25_10_4_exports, {
1722
- ACLTemplateEntryAcltypeInput: () => ACLTemplateEntryAcltypeInput,
1723
- Aclmode: () => Aclmode,
1724
- Acltype: () => Acltype,
1725
- Action: () => Action,
1726
- Advpowermgmt: () => Advpowermgmt,
1727
- Algorithm: () => Algorithm,
1728
- AppContainerDetailsStateInput: () => AppContainerDetailsStateInput,
1729
- Atime: () => Atime,
1730
- AuthMeSource: () => AuthMeSource,
1731
- Authenticator: () => Authenticator,
1732
- Authmethod: () => Authmethod,
1733
- Autotrim: () => Autotrim,
1734
- Basic: () => Basic,
1735
- Blocksize: () => Blocksize,
1736
- Bootloader: () => Bootloader,
1737
- Casesensitivity: () => Casesensitivity,
1738
- CloudBackupSnapshotItemType: () => CloudBackupSnapshotItemType,
1739
- CloudSyncCreateDirection: () => CloudSyncCreateDirection,
1740
- CloudSyncCreateDirectionInput: () => CloudSyncCreateDirectionInput,
1741
- CloudTaskAttributesEncryption: () => CloudTaskAttributesEncryption,
1742
- CloudTaskAttributesEncryptionInput: () => CloudTaskAttributesEncryptionInput,
1743
- Code: () => Code,
1744
- Compression: () => Compression,
1745
- CorePingRemoteTypeInput: () => CorePingRemoteTypeInput,
1746
- Credentials: () => Credentials,
1747
- DeviceGetInfoOtherTypeInput: () => DeviceGetInfoOtherTypeInput,
1748
- DiskDetailsTypeInput: () => DiskDetailsTypeInput,
1749
- DiskWipeModeInput: () => DiskWipeModeInput,
1750
- DockerStatusInfoStatus: () => DockerStatusInfoStatus,
1751
- DockerStatusInfoStatusInput: () => DockerStatusInfoStatusInput,
1752
- Enclosure2SetSlotStatusStatusInput: () => Enclosure2SetSlotStatusStatusInput,
1753
- Endpoint: () => Endpoint,
1754
- Exec: () => Exec,
1755
- Feature: () => Feature,
1756
- FilesystemDirEntryType: () => FilesystemDirEntryType,
1757
- Function: () => Function,
1758
- GetDisplayDeviceType: () => GetDisplayDeviceType,
1759
- Hddstandby: () => Hddstandby,
1760
- InitShutdownScriptCreateType: () => InitShutdownScriptCreateType,
1761
- InitShutdownScriptCreateTypeInput: () => InitShutdownScriptCreateTypeInput,
1762
- InterfaceCreateAliasTypeInput: () => InterfaceCreateAliasTypeInput,
1763
- InterfaceCreateTypeInput: () => InterfaceCreateTypeInput,
1764
- Iotype: () => Iotype,
1765
- IpmiChassisIdentifyRequestVerb: () => IpmiChassisIdentifyRequestVerb,
1766
- IscsiExtentCreateType: () => IscsiExtentCreateType,
1767
- IscsiExtentCreateTypeInput: () => IscsiExtentCreateTypeInput,
1768
- IscsiTargetCreateMode: () => IscsiTargetCreateMode,
1769
- IscsiTargetCreateModeInput: () => IscsiTargetCreateModeInput,
1770
- KeychainCredentialEntryType: () => KeychainCredentialEntryType,
1771
- KeychainCredentialEntryTypeInput: () => KeychainCredentialEntryTypeInput,
1772
- Level: () => Level,
1773
- NFS4ACEType: () => NFS4ACEType,
1774
- NFS4ACETypeInput: () => NFS4ACETypeInput,
1775
- Name: () => Name,
1776
- Policy: () => Policy,
1777
- PoolCreateChecksum: () => PoolCreateChecksum,
1778
- PoolCreateDeduplication: () => PoolCreateDeduplication,
1779
- PoolCreateTopologyDataVdevDRAIDTypeInput: () => PoolCreateTopologyDataVdevDRAIDTypeInput,
1780
- PoolDatasetCreateFilesystemAcltypeInput: () => PoolDatasetCreateFilesystemAcltypeInput,
1781
- PoolDatasetCreateFilesystemChecksum: () => PoolDatasetCreateFilesystemChecksum,
1782
- PoolDatasetCreateFilesystemDeduplication: () => PoolDatasetCreateFilesystemDeduplication,
1783
- PoolDatasetCreateFilesystemReadonlyInput: () => PoolDatasetCreateFilesystemReadonlyInput,
1784
- PoolDatasetDeleteResult: () => PoolDatasetDeleteResult,
1785
- PoolScanStateInput: () => PoolScanStateInput,
1786
- PoolSnapshotEntryPropertyFieldsSource: () => PoolSnapshotEntryPropertyFieldsSource,
1787
- Protocol: () => Protocol,
1788
- Purpose: () => Purpose2,
1789
- Readonly: () => Readonly,
1790
- ReplicationCountEligibleManualSnapshotsTransport: () => ReplicationCountEligibleManualSnapshotsTransport,
1791
- ReplicationCountEligibleManualSnapshotsTransportInput: () => ReplicationCountEligibleManualSnapshotsTransportInput,
1792
- ReplicationCreateReadonlyInput: () => ReplicationCreateReadonlyInput,
1793
- Resolution: () => Resolution,
1794
- Rpm: () => Rpm,
1795
- RsyncTaskCreateDirection: () => RsyncTaskCreateDirection,
1796
- RsyncTaskCreateDirectionInput: () => RsyncTaskCreateDirectionInput,
1797
- RsyncTaskCreateMode: () => RsyncTaskCreateMode,
1798
- RsyncTaskCreateModeInput: () => RsyncTaskCreateModeInput,
1799
- SMBEntryEncryption: () => SMBEntryEncryption,
1800
- SMBEntryEncryptionInput: () => SMBEntryEncryptionInput,
1801
- STIGType: () => STIGType,
1802
- Schema: () => Schema,
1803
- Security: () => Security,
1804
- Serialspeed: () => Serialspeed,
1805
- Service: () => Service,
1806
- ServiceControlVerb: () => ServiceControlVerb,
1807
- Shutdown: () => Shutdown,
1808
- Snapdev: () => Snapdev,
1809
- Snapdir: () => Snapdir,
1810
- SourceInput: () => SourceInput,
1811
- SourceValueType: () => SourceValueType,
1812
- State: () => State,
1813
- SupportNewTicketCommunityTypeInput: () => SupportNewTicketCommunityTypeInput,
1814
- Sync: () => Sync,
1815
- SyslogServerTransport: () => SyslogServerTransport,
1816
- SyslogServerTransportInput: () => SyslogServerTransportInput,
1817
- Sysloglevel: () => Sysloglevel,
1818
- SystemProductTypeResult: () => SystemProductTypeResult,
1819
- SystemStateResult: () => SystemStateResult,
1820
- Tag: () => Tag,
1821
- Target: () => Target,
1822
- Time: () => Time,
1823
- TruecommandConfigChangedEventFieldsStatus: () => TruecommandConfigChangedEventFieldsStatus,
1824
- TruecommandConfigChangedEventFieldsStatusInput: () => TruecommandConfigChangedEventFieldsStatusInput,
1825
- TunableCreateType: () => TunableCreateType,
1826
- TunableCreateTypeInput: () => TunableCreateTypeInput,
1827
- UPSEntryMode: () => UPSEntryMode,
1828
- UPSEntryModeInput: () => UPSEntryModeInput,
1829
- Unixcharset: () => Unixcharset,
1830
- Username: () => Username,
1831
- VMDiskDeviceType: () => VMDiskDeviceType,
1832
- VMDiskDeviceTypeInput: () => VMDiskDeviceTypeInput,
1833
- VMWareEntryStateStateInput: () => VMWareEntryStateStateInput,
1834
- VMWareMatchDatastoresWithDatasetsResultFilesystemType: () => VMWareMatchDatastoresWithDatasetsResultFilesystemType,
1835
- Vendor: () => Vendor,
1836
- Volblocksize: () => Volblocksize,
1837
- When: () => When,
1838
- ZfsTierRewriteJobEntryStatusInput: () => ZfsTierRewriteJobEntryStatusInput
1839
- });
1840
-
1841
- // src/generated/v25_10_5/index.ts
1842
- var v25_10_5_exports = {};
1843
- __export(v25_10_5_exports, {
1844
- ACLTemplateEntryAcltypeInput: () => ACLTemplateEntryAcltypeInput,
1845
- Aclmode: () => Aclmode,
1846
- Acltype: () => Acltype,
1847
- Action: () => Action,
1848
- Advpowermgmt: () => Advpowermgmt,
1849
- Algorithm: () => Algorithm,
1850
- AppContainerDetailsStateInput: () => AppContainerDetailsStateInput,
1851
- Atime: () => Atime,
1852
- AuthMeSource: () => AuthMeSource,
1853
- Authenticator: () => Authenticator,
1854
- Authmethod: () => Authmethod,
1855
- Autotrim: () => Autotrim,
1856
- Basic: () => Basic,
1857
- Blocksize: () => Blocksize,
1858
- Bootloader: () => Bootloader,
1859
- Casesensitivity: () => Casesensitivity,
1860
- CloudBackupSnapshotItemType: () => CloudBackupSnapshotItemType,
1861
- CloudSyncCreateDirection: () => CloudSyncCreateDirection,
1862
- CloudSyncCreateDirectionInput: () => CloudSyncCreateDirectionInput,
1863
- CloudTaskAttributesEncryption: () => CloudTaskAttributesEncryption,
1864
- CloudTaskAttributesEncryptionInput: () => CloudTaskAttributesEncryptionInput,
1865
- Code: () => Code,
1866
- Compression: () => Compression,
1867
- CorePingRemoteTypeInput: () => CorePingRemoteTypeInput,
1868
- Credentials: () => Credentials,
1869
- DeviceGetInfoOtherTypeInput: () => DeviceGetInfoOtherTypeInput,
1870
- DiskDetailsTypeInput: () => DiskDetailsTypeInput,
1871
- DiskWipeModeInput: () => DiskWipeModeInput,
1872
- DockerStatusInfoStatus: () => DockerStatusInfoStatus,
1873
- DockerStatusInfoStatusInput: () => DockerStatusInfoStatusInput,
1874
- Enclosure2SetSlotStatusStatusInput: () => Enclosure2SetSlotStatusStatusInput,
1875
- Endpoint: () => Endpoint,
1876
- Exec: () => Exec,
1877
- Feature: () => Feature,
1878
- FilesystemDirEntryType: () => FilesystemDirEntryType,
1879
- Function: () => Function,
1880
- GetDisplayDeviceType: () => GetDisplayDeviceType,
1881
- Hddstandby: () => Hddstandby,
1882
- InitShutdownScriptCreateType: () => InitShutdownScriptCreateType,
1883
- InitShutdownScriptCreateTypeInput: () => InitShutdownScriptCreateTypeInput,
1884
- InterfaceCreateAliasTypeInput: () => InterfaceCreateAliasTypeInput,
1885
- InterfaceCreateTypeInput: () => InterfaceCreateTypeInput,
1886
- Iotype: () => Iotype,
1887
- IpmiChassisIdentifyRequestVerb: () => IpmiChassisIdentifyRequestVerb,
1888
- IscsiExtentCreateType: () => IscsiExtentCreateType,
1889
- IscsiExtentCreateTypeInput: () => IscsiExtentCreateTypeInput,
1890
- IscsiTargetCreateMode: () => IscsiTargetCreateMode,
1891
- IscsiTargetCreateModeInput: () => IscsiTargetCreateModeInput,
1892
- KeychainCredentialEntryType: () => KeychainCredentialEntryType,
1893
- KeychainCredentialEntryTypeInput: () => KeychainCredentialEntryTypeInput,
1894
- Level: () => Level,
1895
- NFS4ACEType: () => NFS4ACEType,
1896
- NFS4ACETypeInput: () => NFS4ACETypeInput,
1897
- Name: () => Name,
1898
- Policy: () => Policy,
1899
- PoolCreateChecksum: () => PoolCreateChecksum,
1900
- PoolCreateDeduplication: () => PoolCreateDeduplication,
1901
- PoolCreateTopologyDataVdevDRAIDTypeInput: () => PoolCreateTopologyDataVdevDRAIDTypeInput,
1902
- PoolDatasetCreateFilesystemAcltypeInput: () => PoolDatasetCreateFilesystemAcltypeInput,
1903
- PoolDatasetCreateFilesystemChecksum: () => PoolDatasetCreateFilesystemChecksum,
1904
- PoolDatasetCreateFilesystemDeduplication: () => PoolDatasetCreateFilesystemDeduplication,
1905
- PoolDatasetCreateFilesystemReadonlyInput: () => PoolDatasetCreateFilesystemReadonlyInput,
1906
- PoolDatasetDeleteResult: () => PoolDatasetDeleteResult,
1907
- PoolScanStateInput: () => PoolScanStateInput,
1908
- PoolSnapshotEntryPropertyFieldsSource: () => PoolSnapshotEntryPropertyFieldsSource,
1909
- Protocol: () => Protocol,
1910
- Purpose: () => Purpose2,
1911
- Readonly: () => Readonly,
1912
- ReplicationCountEligibleManualSnapshotsTransport: () => ReplicationCountEligibleManualSnapshotsTransport,
1913
- ReplicationCountEligibleManualSnapshotsTransportInput: () => ReplicationCountEligibleManualSnapshotsTransportInput,
1914
- ReplicationCreateReadonlyInput: () => ReplicationCreateReadonlyInput,
1915
- Resolution: () => Resolution,
1916
- Rpm: () => Rpm,
1917
- RsyncTaskCreateDirection: () => RsyncTaskCreateDirection,
1918
- RsyncTaskCreateDirectionInput: () => RsyncTaskCreateDirectionInput,
1919
- RsyncTaskCreateMode: () => RsyncTaskCreateMode,
1920
- RsyncTaskCreateModeInput: () => RsyncTaskCreateModeInput,
1921
- SMBEntryEncryption: () => SMBEntryEncryption,
1922
- SMBEntryEncryptionInput: () => SMBEntryEncryptionInput,
1923
- STIGType: () => STIGType,
1924
- Schema: () => Schema,
1925
- Security: () => Security,
1926
- Serialspeed: () => Serialspeed,
1927
- Service: () => Service,
1928
- ServiceControlVerb: () => ServiceControlVerb,
1929
- Shutdown: () => Shutdown,
1930
- Snapdev: () => Snapdev,
1931
- Snapdir: () => Snapdir,
1932
- SourceInput: () => SourceInput,
1933
- SourceValueType: () => SourceValueType,
1934
- State: () => State,
1935
- SupportNewTicketCommunityTypeInput: () => SupportNewTicketCommunityTypeInput,
1936
- Sync: () => Sync,
1937
- SyslogServerTransport: () => SyslogServerTransport,
1938
- SyslogServerTransportInput: () => SyslogServerTransportInput,
1939
- Sysloglevel: () => Sysloglevel,
1940
- SystemProductTypeResult: () => SystemProductTypeResult,
1941
- SystemStateResult: () => SystemStateResult,
1942
- Tag: () => Tag,
1943
- Target: () => Target,
1944
- Time: () => Time,
1945
- TruecommandConfigChangedEventFieldsStatus: () => TruecommandConfigChangedEventFieldsStatus,
1946
- TruecommandConfigChangedEventFieldsStatusInput: () => TruecommandConfigChangedEventFieldsStatusInput,
1947
- TunableCreateType: () => TunableCreateType,
1948
- TunableCreateTypeInput: () => TunableCreateTypeInput,
1949
- UPSEntryMode: () => UPSEntryMode,
1950
- UPSEntryModeInput: () => UPSEntryModeInput,
1951
- Unixcharset: () => Unixcharset,
1952
- Username: () => Username,
1953
- VMDiskDeviceType: () => VMDiskDeviceType,
1954
- VMDiskDeviceTypeInput: () => VMDiskDeviceTypeInput,
1955
- VMWareEntryStateStateInput: () => VMWareEntryStateStateInput,
1956
- VMWareMatchDatastoresWithDatasetsResultFilesystemType: () => VMWareMatchDatastoresWithDatasetsResultFilesystemType,
1957
- Vendor: () => Vendor,
1958
- Volblocksize: () => Volblocksize,
1959
- When: () => When,
1960
- ZfsTierRewriteJobEntryStatusInput: () => ZfsTierRewriteJobEntryStatusInput
1961
- });
1962
-
1963
- // src/generated/v26_0_0/index.ts
1964
- var v26_0_0_exports = {};
1965
- __export(v26_0_0_exports, {
1966
- ACLTemplateEntryAcltypeInput: () => ACLTemplateEntryAcltypeInput,
1967
- Access: () => Access,
1968
- Aclmode: () => Aclmode,
1969
- Acltype: () => Acltype,
1970
- Advpowermgmt: () => Advpowermgmt,
1971
- AppContainerDetailsState: () => AppContainerDetailsState,
1972
- AppContainerDetailsStateInput: () => AppContainerDetailsStateInput,
1973
- Atime: () => Atime,
1974
- AuthMeSource: () => AuthMeSource,
1975
- Authenticator: () => Authenticator,
1976
- Authmethod: () => Authmethod,
1977
- Autotrim: () => Autotrim,
1978
- Basic: () => Basic,
1979
- Blocksize: () => Blocksize,
1980
- Bootloader: () => Bootloader,
1981
- Casesensitivity: () => Casesensitivity,
1982
- CloudBackupSnapshotItemType: () => CloudBackupSnapshotItemType,
1983
- CloudSyncCreateDirection: () => CloudSyncCreateDirection,
1984
- CloudSyncCreateDirectionInput: () => CloudSyncCreateDirectionInput,
1985
- CloudTaskAttributesEncryption: () => CloudTaskAttributesEncryption,
1986
- CloudTaskAttributesEncryptionInput: () => CloudTaskAttributesEncryptionInput,
1987
- Code: () => Code,
1988
- Compression: () => Compression,
1989
- ContainerNICDeviceType: () => ContainerNICDeviceType,
1990
- ContainerNICDeviceTypeInput: () => ContainerNICDeviceTypeInput,
1991
- ContainerStatusState: () => ContainerStatusState,
1992
- ContainerStatusStateInput: () => ContainerStatusStateInput,
1993
- CorePingRemoteTypeInput: () => CorePingRemoteTypeInput,
1994
- Credentials: () => Credentials,
1995
- DeviceGetInfoOtherTypeInput: () => DeviceGetInfoOtherTypeInput,
1996
- DiskDetailsTypeInput: () => DiskDetailsTypeInput,
1997
- DiskWipeModeInput: () => DiskWipeModeInput,
1998
- DockerStatusInfoStatus: () => DockerStatusInfoStatus,
1999
- DockerStatusInfoStatusInput: () => DockerStatusInfoStatusInput,
2000
- Enclosure2SetSlotStatusStatusInput: () => Enclosure2SetSlotStatusStatusInput,
2001
- Endpoint: () => Endpoint,
2002
- Exec: () => Exec,
2003
- FilesystemDirEntryType: () => FilesystemDirEntryType,
2004
- Function: () => Function,
2005
- GetDisplayDeviceType: () => GetDisplayDeviceType,
2006
- Hddstandby: () => Hddstandby,
2007
- InitShutdownScriptCreateType: () => InitShutdownScriptCreateType,
2008
- InitShutdownScriptCreateTypeInput: () => InitShutdownScriptCreateTypeInput,
2009
- InterfaceCreateAliasTypeInput: () => InterfaceCreateAliasTypeInput,
2010
- InterfaceCreateTypeInput: () => InterfaceCreateTypeInput,
2011
- Interval: () => Interval,
2012
- Iotype: () => Iotype,
2013
- IpmiChassisIdentifyRequestVerb: () => IpmiChassisIdentifyRequestVerb,
2014
- IscsiExtentCreateType: () => IscsiExtentCreateType,
2015
- IscsiExtentCreateTypeInput: () => IscsiExtentCreateTypeInput,
2016
- IscsiTargetCreateMode: () => IscsiTargetCreateMode,
2017
- IscsiTargetCreateModeInput: () => IscsiTargetCreateModeInput,
2018
- KeychainCredentialEntryType: () => KeychainCredentialEntryType,
2019
- KeychainCredentialEntryTypeInput: () => KeychainCredentialEntryTypeInput,
2020
- Level: () => Level,
2021
- NFS4ACEType: () => NFS4ACEType,
2022
- NFS4ACETypeInput: () => NFS4ACETypeInput,
2023
- Name: () => Name2,
2024
- Passkey: () => Passkey,
2025
- Policy: () => Policy,
2026
- PoolCreateChecksum: () => PoolCreateChecksum,
2027
- PoolCreateDeduplication: () => PoolCreateDeduplication,
2028
- PoolCreateTopologyDedupVdevTypeInput: () => PoolCreateTopologyDedupVdevTypeInput,
2029
- PoolDatasetCreateFilesystemAcltypeInput: () => PoolDatasetCreateFilesystemAcltypeInput,
2030
- PoolDatasetCreateFilesystemChecksum: () => PoolDatasetCreateFilesystemChecksum,
2031
- PoolDatasetCreateFilesystemDeduplication: () => PoolDatasetCreateFilesystemDeduplication,
2032
- PoolDatasetCreateFilesystemReadonlyInput: () => PoolDatasetCreateFilesystemReadonlyInput,
2033
- PoolDatasetDeleteResult: () => PoolDatasetDeleteResult,
2034
- PoolScanState: () => PoolScanState,
2035
- PoolScanStateInput: () => PoolScanStateInput,
2036
- PoolScrubAction: () => PoolScrubAction,
2037
- PoolSnapshotEntryPropertyFieldsSource: () => PoolSnapshotEntryPropertyFieldsSource,
2038
- Protocol: () => Protocol,
2039
- Purpose: () => Purpose2,
2040
- Readonly: () => Readonly,
2041
- Reason: () => Reason,
2042
- ReplicationCountEligibleManualSnapshotsTransport: () => ReplicationCountEligibleManualSnapshotsTransport,
2043
- ReplicationCountEligibleManualSnapshotsTransportInput: () => ReplicationCountEligibleManualSnapshotsTransportInput,
2044
- ReplicationCreateReadonlyInput: () => ReplicationCreateReadonlyInput,
2045
- Resolution: () => Resolution,
2046
- Rpm: () => Rpm,
2047
- RsyncTaskCreateDirection: () => RsyncTaskCreateDirection,
2048
- RsyncTaskCreateDirectionInput: () => RsyncTaskCreateDirectionInput,
2049
- RsyncTaskCreateMode: () => RsyncTaskCreateMode,
2050
- RsyncTaskCreateModeInput: () => RsyncTaskCreateModeInput,
2051
- S3AccesskeyEntryStatus: () => S3AccesskeyEntryStatus,
2052
- S3AccesskeyEntryStatusInput: () => S3AccesskeyEntryStatusInput,
2053
- SMBEntryEncryption: () => SMBEntryEncryption,
2054
- SMBEntryEncryptionInput: () => SMBEntryEncryptionInput,
2055
- STIGType: () => STIGType,
2056
- Schema: () => Schema,
2057
- Security: () => Security,
2058
- Serialspeed: () => Serialspeed,
2059
- Service: () => Service,
2060
- ServiceControlVerb: () => ServiceControlVerb,
2061
- Shutdown: () => Shutdown,
2062
- Snapdev: () => Snapdev,
2063
- Snapdir: () => Snapdir,
2064
- SourceInput: () => SourceInput,
2065
- SourceValueType: () => SourceValueType,
2066
- SupportNewTicketCommunityTypeInput: () => SupportNewTicketCommunityTypeInput,
2067
- Sync: () => Sync,
2068
- SyslogServerTransport: () => SyslogServerTransport,
2069
- SyslogServerTransportInput: () => SyslogServerTransportInput,
2070
- Sysloglevel: () => Sysloglevel,
2071
- SystemProductTypeResult: () => SystemProductTypeResult,
2072
- SystemStateResult: () => SystemStateResult,
2073
- Tag: () => Tag,
2074
- Target: () => Target,
2075
- Time: () => Time,
2076
- TruecommandConfigChangedEventFieldsStatus: () => TruecommandConfigChangedEventFieldsStatus,
2077
- TruecommandConfigChangedEventFieldsStatusInput: () => TruecommandConfigChangedEventFieldsStatusInput,
2078
- TunableCreateType: () => TunableCreateType,
2079
- TunableCreateTypeInput: () => TunableCreateTypeInput,
2080
- UPSEntryMode: () => UPSEntryMode,
2081
- UPSEntryModeInput: () => UPSEntryModeInput,
2082
- Unixcharset: () => Unixcharset,
2083
- Username: () => Username,
2084
- VMDiskDeviceType: () => VMDiskDeviceType,
2085
- VMDiskDeviceTypeInput: () => VMDiskDeviceTypeInput,
2086
- VMWareEntryStateState: () => VMWareEntryStateState,
2087
- VMWareEntryStateStateInput: () => VMWareEntryStateStateInput,
2088
- VMWareMatchDatastoresWithDatasetsResultFilesystemType: () => VMWareMatchDatastoresWithDatasetsResultFilesystemType,
2089
- Vendor: () => Vendor,
2090
- Versioning: () => Versioning,
2091
- Volblocksize: () => Volblocksize,
2092
- When: () => When,
2093
- ZfsTierRewriteJobEntryStatus: () => ZfsTierRewriteJobEntryStatus,
2094
- ZfsTierRewriteJobEntryStatusInput: () => ZfsTierRewriteJobEntryStatusInput,
2095
- ZpoolScrubRunAction: () => ZpoolScrubRunAction
2096
- });
2097
-
2098
- // src/generated/v26_0_0/api-types.ts
2099
- var Access = {
2100
- Readonly: "READONLY",
2101
- Writeonly: "WRITEONLY",
2102
- Readwrite: "READWRITE",
2103
- Deny: "DENY"
2104
- };
2105
- var AppContainerDetailsState = {
2106
- Crashed: "crashed",
2107
- Created: "created",
2108
- Exited: "exited",
2109
- Running: "running",
2110
- Starting: "starting"
2111
- };
2112
- var ContainerNICDeviceType = {
2113
- E1000: "E1000",
2114
- Virtio: "VIRTIO"
2115
- };
2116
- var ContainerNICDeviceTypeInput = {
2117
- E1000: "E1000",
2118
- Virtio: "VIRTIO"
2119
- };
2120
- var ContainerStatusState = {
2121
- Running: "RUNNING",
2122
- Stopped: "STOPPED",
2123
- Suspended: "SUSPENDED"
2124
- };
2125
- var ContainerStatusStateInput = {
2126
- Running: "RUNNING",
2127
- Stopped: "STOPPED",
2128
- Suspended: "SUSPENDED"
2129
- };
2130
- var Interval = {
2131
- "30": 30,
2132
- "60": 60
2133
- };
2134
- var Name2 = {
2135
- Cpu: "cpu",
2136
- Cputemp: "cputemp",
2137
- Disk: "disk",
2138
- Interface: "interface",
2139
- Load: "load",
2140
- Processes: "processes",
2141
- Memory: "memory",
2142
- Uptime: "uptime",
2143
- Arcsize: "arcsize",
2144
- Disktemp: "disktemp",
2145
- Upscharge: "upscharge",
2146
- Upsruntime: "upsruntime",
2147
- Upsvoltage: "upsvoltage",
2148
- Upscurrent: "upscurrent",
2149
- Upsfrequency: "upsfrequency",
2150
- Upsload: "upsload",
2151
- Upstemperature: "upstemperature"
2152
- };
2153
- var Passkey = {
2154
- Enabled: "ENABLED",
2155
- Disabled: "DISABLED",
2156
- Required: "REQUIRED"
2157
- };
2158
- var PoolCreateTopologyDedupVdevTypeInput = {
2159
- Mirror: "MIRROR",
2160
- Stripe: "STRIPE"
2161
- };
2162
- var PoolScanState = {
2163
- Scanning: "SCANNING",
2164
- Finished: "FINISHED",
2165
- Canceled: "CANCELED"
2166
- };
2167
- var PoolScrubAction = {
2168
- Start: "START",
2169
- Stop: "STOP",
2170
- Pause: "PAUSE"
2171
- };
2172
- var Reason = {
2173
- Entitled: "ENTITLED",
2174
- NoLicense: "NO_LICENSE",
2175
- KeyMissing: "KEY_MISSING",
2176
- WrongHardware: "WRONG_HARDWARE",
2177
- TierInsufficient: "TIER_INSUFFICIENT",
2178
- WrongLicenseType: "WRONG_LICENSE_TYPE",
2179
- NotGated: "NOT_GATED"
2180
- };
2181
- var S3AccesskeyEntryStatus = {
2182
- Enabled: "ENABLED",
2183
- Disabled: "DISABLED",
2184
- Expired: "EXPIRED",
2185
- UserMissing: "USER_MISSING",
2186
- SecretLost: "SECRET_LOST"
2187
- };
2188
- var S3AccesskeyEntryStatusInput = {
2189
- Enabled: "ENABLED",
2190
- Disabled: "DISABLED",
2191
- Expired: "EXPIRED",
2192
- UserMissing: "USER_MISSING",
2193
- SecretLost: "SECRET_LOST"
2194
- };
2195
- var Versioning = {
2196
- Off: "OFF",
2197
- Enabled: "ENABLED",
2198
- Suspended: "SUSPENDED"
2199
- };
2200
- var VMWareEntryStateState = {
2201
- Pending: "PENDING",
2202
- Success: "SUCCESS",
2203
- Error: "ERROR",
2204
- Blocked: "BLOCKED"
2205
- };
2206
- var ZfsTierRewriteJobEntryStatus = {
2207
- Complete: "COMPLETE",
2208
- Running: "RUNNING",
2209
- Queued: "QUEUED",
2210
- Cancelled: "CANCELLED",
2211
- Stopped: "STOPPED",
2212
- Error: "ERROR"
2213
- };
2214
- var ZpoolScrubRunAction = {
2215
- Start: "START",
2216
- Pause: "PAUSE",
2217
- Cancel: "CANCEL"
2218
- };
2219
-
2220
- // src/generated/v27_0_0/index.ts
2221
- var v27_0_0_exports = {};
2222
- __export(v27_0_0_exports, {
2223
- ACLTemplateEntryAcltypeInput: () => ACLTemplateEntryAcltypeInput,
2224
- Access: () => Access,
2225
- Aclmode: () => Aclmode,
2226
- Acltype: () => Acltype,
2227
- Advpowermgmt: () => Advpowermgmt,
2228
- AppContainerDetailsState: () => AppContainerDetailsState,
2229
- AppContainerDetailsStateInput: () => AppContainerDetailsStateInput,
2230
- Atime: () => Atime,
2231
- AuthMeSource: () => AuthMeSource,
2232
- Authenticator: () => Authenticator,
2233
- Authmethod: () => Authmethod,
2234
- Autotrim: () => Autotrim,
2235
- Basic: () => Basic,
2236
- Blocksize: () => Blocksize,
2237
- Bootloader: () => Bootloader,
2238
- Casesensitivity: () => Casesensitivity,
2239
- CloudBackupSnapshotItemType: () => CloudBackupSnapshotItemType,
2240
- CloudSyncCreateDirection: () => CloudSyncCreateDirection,
2241
- CloudSyncCreateDirectionInput: () => CloudSyncCreateDirectionInput,
2242
- CloudTaskAttributesEncryption: () => CloudTaskAttributesEncryption,
2243
- CloudTaskAttributesEncryptionInput: () => CloudTaskAttributesEncryptionInput,
2244
- Code: () => Code,
2245
- Compression: () => Compression,
2246
- ContainerNICDeviceType: () => ContainerNICDeviceType,
2247
- ContainerNICDeviceTypeInput: () => ContainerNICDeviceTypeInput,
2248
- ContainerStatusState: () => ContainerStatusState,
2249
- ContainerStatusStateInput: () => ContainerStatusStateInput,
2250
- CorePingRemoteTypeInput: () => CorePingRemoteTypeInput,
2251
- Credentials: () => Credentials,
2252
- DeviceGetInfoOtherTypeInput: () => DeviceGetInfoOtherTypeInput,
2253
- DiskDetailsTypeInput: () => DiskDetailsTypeInput,
2254
- DiskWipeModeInput: () => DiskWipeModeInput,
2255
- DockerStatusInfoStatus: () => DockerStatusInfoStatus,
2256
- DockerStatusInfoStatusInput: () => DockerStatusInfoStatusInput,
2257
- Enclosure2SetSlotStatusStatusInput: () => Enclosure2SetSlotStatusStatusInput,
2258
- Endpoint: () => Endpoint,
2259
- Exec: () => Exec,
2260
- FilesystemDirEntryType: () => FilesystemDirEntryType,
2261
- Function: () => Function,
2262
- GetDisplayDeviceType: () => GetDisplayDeviceType,
2263
- Hddstandby: () => Hddstandby,
2264
- InitShutdownScriptCreateType: () => InitShutdownScriptCreateType,
2265
- InitShutdownScriptCreateTypeInput: () => InitShutdownScriptCreateTypeInput,
2266
- InterfaceCreateAliasTypeInput: () => InterfaceCreateAliasTypeInput,
2267
- InterfaceCreateTypeInput: () => InterfaceCreateTypeInput,
2268
- Interval: () => Interval,
2269
- Iotype: () => Iotype,
2270
- IpmiChassisIdentifyRequestVerb: () => IpmiChassisIdentifyRequestVerb,
2271
- IscsiExtentCreateType: () => IscsiExtentCreateType,
2272
- IscsiExtentCreateTypeInput: () => IscsiExtentCreateTypeInput,
2273
- IscsiTargetCreateMode: () => IscsiTargetCreateMode,
2274
- IscsiTargetCreateModeInput: () => IscsiTargetCreateModeInput,
2275
- KeychainCredentialEntryType: () => KeychainCredentialEntryType,
2276
- KeychainCredentialEntryTypeInput: () => KeychainCredentialEntryTypeInput,
2277
- Level: () => Level,
2278
- NFS4ACEType: () => NFS4ACEType,
2279
- NFS4ACETypeInput: () => NFS4ACETypeInput,
2280
- Name: () => Name2,
2281
- Passkey: () => Passkey,
2282
- Policy: () => Policy,
2283
- PoolCreateChecksum: () => PoolCreateChecksum,
2284
- PoolCreateDeduplication: () => PoolCreateDeduplication,
2285
- PoolCreateTopologyDedupVdevTypeInput: () => PoolCreateTopologyDedupVdevTypeInput,
2286
- PoolDatasetCreateFilesystemAcltypeInput: () => PoolDatasetCreateFilesystemAcltypeInput,
2287
- PoolDatasetCreateFilesystemChecksum: () => PoolDatasetCreateFilesystemChecksum,
2288
- PoolDatasetCreateFilesystemDeduplication: () => PoolDatasetCreateFilesystemDeduplication,
2289
- PoolDatasetCreateFilesystemReadonlyInput: () => PoolDatasetCreateFilesystemReadonlyInput,
2290
- PoolDatasetDeleteResult: () => PoolDatasetDeleteResult,
2291
- PoolScanState: () => PoolScanState,
2292
- PoolScanStateInput: () => PoolScanStateInput,
2293
- PoolScrubAction: () => PoolScrubAction,
2294
- PoolSnapshotEntryPropertyFieldsSource: () => PoolSnapshotEntryPropertyFieldsSource,
2295
- Protocol: () => Protocol,
2296
- Purpose: () => Purpose2,
2297
- Readonly: () => Readonly,
2298
- Reason: () => Reason,
2299
- ReplicationCountEligibleManualSnapshotsTransport: () => ReplicationCountEligibleManualSnapshotsTransport,
2300
- ReplicationCountEligibleManualSnapshotsTransportInput: () => ReplicationCountEligibleManualSnapshotsTransportInput,
2301
- ReplicationCreateReadonlyInput: () => ReplicationCreateReadonlyInput,
2302
- Resolution: () => Resolution,
2303
- Rpm: () => Rpm,
2304
- RsyncTaskCreateDirection: () => RsyncTaskCreateDirection,
2305
- RsyncTaskCreateDirectionInput: () => RsyncTaskCreateDirectionInput,
2306
- RsyncTaskCreateMode: () => RsyncTaskCreateMode,
2307
- RsyncTaskCreateModeInput: () => RsyncTaskCreateModeInput,
2308
- S3AccesskeyEntryStatus: () => S3AccesskeyEntryStatus,
2309
- S3AccesskeyEntryStatusInput: () => S3AccesskeyEntryStatusInput,
2310
- SMBEntryEncryption: () => SMBEntryEncryption,
2311
- SMBEntryEncryptionInput: () => SMBEntryEncryptionInput,
2312
- STIGType: () => STIGType,
2313
- Schema: () => Schema,
2314
- Security: () => Security,
2315
- Serialspeed: () => Serialspeed,
2316
- Service: () => Service2,
2317
- ServiceControlVerb: () => ServiceControlVerb,
2318
- Shutdown: () => Shutdown,
2319
- Snapdev: () => Snapdev,
2320
- Snapdir: () => Snapdir,
2321
- SourceInput: () => SourceInput,
2322
- SourceValueType: () => SourceValueType,
2323
- SupportNewTicketCommunityTypeInput: () => SupportNewTicketCommunityTypeInput,
2324
- Sync: () => Sync,
2325
- SyslogServerTransport: () => SyslogServerTransport,
2326
- SyslogServerTransportInput: () => SyslogServerTransportInput,
2327
- Sysloglevel: () => Sysloglevel,
2328
- SystemProductTypeResult: () => SystemProductTypeResult,
2329
- SystemStateResult: () => SystemStateResult,
2330
- Tag: () => Tag,
2331
- Target: () => Target,
2332
- Time: () => Time,
2333
- TruecommandConfigChangedEventFieldsStatus: () => TruecommandConfigChangedEventFieldsStatus,
2334
- TruecommandConfigChangedEventFieldsStatusInput: () => TruecommandConfigChangedEventFieldsStatusInput,
2335
- TunableCreateType: () => TunableCreateType,
2336
- TunableCreateTypeInput: () => TunableCreateTypeInput,
2337
- UPSEntryMode: () => UPSEntryMode,
2338
- UPSEntryModeInput: () => UPSEntryModeInput,
2339
- Unixcharset: () => Unixcharset,
2340
- Username: () => Username,
2341
- VMDiskDeviceType: () => VMDiskDeviceType,
2342
- VMDiskDeviceTypeInput: () => VMDiskDeviceTypeInput,
2343
- VMWareEntryStateState: () => VMWareEntryStateState,
2344
- VMWareEntryStateStateInput: () => VMWareEntryStateStateInput,
2345
- VMWareMatchDatastoresWithDatasetsResultFilesystemType: () => VMWareMatchDatastoresWithDatasetsResultFilesystemType,
2346
- VMWareMatchDatastoresWithDatasetsResultFilesystemTypeInput: () => VMWareMatchDatastoresWithDatasetsResultFilesystemTypeInput,
2347
- Vendor: () => Vendor,
2348
- Versioning: () => Versioning,
2349
- Volblocksize: () => Volblocksize,
2350
- When: () => When,
2351
- ZfsTierRewriteJobEntryStatus: () => ZfsTierRewriteJobEntryStatus,
2352
- ZfsTierRewriteJobEntryStatusInput: () => ZfsTierRewriteJobEntryStatusInput,
2353
- ZpoolScrubRunAction: () => ZpoolScrubRunAction
2354
- });
2355
-
2356
- // src/generated/v27_0_0/api-types.ts
2357
- var Service2 = {
2358
- Middleware: "MIDDLEWARE",
2359
- S3: "S3",
2360
- Smb: "SMB",
2361
- Sudo: "SUDO",
2362
- System: "SYSTEM"
2363
- };
2364
- var VMWareMatchDatastoresWithDatasetsResultFilesystemTypeInput = {
2365
- Filesystem: "FILESYSTEM",
2366
- Volume: "VOLUME"
2367
- };
2368
-
2369
- // src/generated/index.ts
2370
- var SUPPORTED_API_VERSIONS = [
2371
- "v25.10.0",
2372
- "v25.10.1",
2373
- "v25.10.2",
2374
- "v25.10.3",
2375
- "v25.10.4",
2376
- "v25.10.5",
2377
- "v26.0.0",
2378
- "v27.0.0"
2379
- ];
2380
-
2381
- // src/config/api-version.config.ts
2382
- var apiVersionConfig = {
2383
- /**
2384
- * Minimum supported API version. Systems below it are rejected.
2385
- *
2386
- * DERIVED, not declared. The client supports exactly the versions it ships
2387
- * types for, so the oldest generated version *is* the minimum — there is no
2388
- * second decision to make, and therefore nothing to keep in sync.
2389
- *
2390
- * To move the floor, change `--min-version` in the `generate:api` script in
2391
- * package.json and regenerate; this follows on its own. Written as a literal
2392
- * it would duplicate that value with nothing enforcing agreement, so raising
2393
- * one and forgetting the other would silently keep generating types for
2394
- * versions the client rejects.
2395
- */
2396
- MIN_SUPPORTED_VERSION: SUPPORTED_API_VERSIONS[0],
2397
- /**
2398
- * Maximum supported API version. Systems above it are rejected.
2399
- *
2400
- * NOT derived, deliberately — and for a different reason than it used to
2401
- * lag. It sat at v26.0.0 while types for v27 already shipped, because
2402
- * `CLIENT_BY_VERSION_KEY` had no `27` and a v27 system would have passed the
2403
- * range check only to throw on client selection. `TrueNasApiClientV27` now
2404
- * exists, so this moves up with it.
2405
- *
2406
- * What it must not become is `SUPPORTED_API_VERSIONS[length - 1]`, the mirror
2407
- * of how MIN is derived. MIN is safe to derive because the oldest generated
2408
- * version always has a client — it is the floor the clients were built from.
2409
- * The ceiling is not symmetric: generating types for v28 does not write a v28
2410
- * client, so deriving this would re-create the exact gap described above on
2411
- * the next regeneration, silently. The real invariant is "the newest version
2412
- * a client can be built for", which lives in `CLIENT_BY_VERSION_KEY`; a
2413
- * factory test asserts the two agree, which is the check that keeps this
2414
- * literal honest without importing the factory here.
2415
- */
2416
- MAX_SUPPORTED_VERSION: "v27.0.0",
2417
- /**
2418
- * Fallback version to use when version discovery fails due to CORS/network errors.
2419
- * When /api/versions returns HTTP status 0 (CORS block, network down, etc.),
2420
- * the system will attempt to connect using this version as a best-effort fallback.
2421
- *
2422
- * WARNING: Status 0 errors have multiple causes:
2423
- * - CORS policy blocking the request
2424
- * - Network disconnected
2425
- * - DNS lookup failure
2426
- * - Server unreachable
2427
- *
2428
- * Which is why it is no longer reached on all of them. A discovery failure is
2429
- * now put to a reachability probe and a second attempt first, and only an
2430
- * appliance that answers the probe and still will not serve `/api/versions`
2431
- * is assumed to be this version. One that answers nothing is reported as
2432
- * unreachable rather than pinned to a version nobody confirmed.
2433
- */
2434
- FALLBACK_VERSION: "v25.10.0"
2435
- };
2436
-
2437
- // src/types/api-version.type.ts
2438
- var VersionCompatibility = /* @__PURE__ */ ((VersionCompatibility2) => {
2439
- VersionCompatibility2["Compatible"] = "compatible";
2440
- VersionCompatibility2["TooOld"] = "too-old";
2441
- VersionCompatibility2["TooNew"] = "too-new";
2442
- VersionCompatibility2["Invalid"] = "invalid";
2443
- return VersionCompatibility2;
2444
- })(VersionCompatibility || {});
2445
-
2446
- // src/utils/api-version.utils.ts
2447
- var legacyCutoffYear = 25;
2448
- function parseApiVersion(versionString) {
2449
- const regex = /^v(\d{2})\.(\d+)\.(\d+)$/;
2450
- const match = versionString.match(regex);
2451
- if (!match) {
2452
- return null;
2453
- }
2454
- const [, yearStr, minorStr, patchStr] = match;
2455
- const year = parseInt(yearStr, 10);
2456
- const minor = parseInt(minorStr, 10);
2457
- const patch = parseInt(patchStr, 10);
2458
- if (year <= legacyCutoffYear) {
2459
- if (minor < 1 || minor > 12) {
2460
- return null;
2461
- }
2462
- } else if (year >= 26) {
2463
- if (minor < 0 || minor > 99) {
2464
- return null;
2465
- }
2466
- }
2467
- return {
2468
- version: versionString,
2469
- year,
2470
- minor,
2471
- patch,
2472
- websocketPath: `/api/${versionString}`
2473
- };
2474
- }
2475
- function compareVersions(a, b) {
2476
- if (a.year !== b.year) {
2477
- return a.year - b.year;
2478
- }
2479
- if (a.minor !== b.minor) {
2480
- return a.minor - b.minor;
2481
- }
2482
- return a.patch - b.patch;
2483
- }
2484
- function checkVersionCompatibility(version) {
2485
- const minVersion = parseApiVersion(apiVersionConfig.MIN_SUPPORTED_VERSION);
2486
- const maxVersion = parseApiVersion(apiVersionConfig.MAX_SUPPORTED_VERSION);
2487
- if (!minVersion || !maxVersion) {
2488
- return "invalid" /* Invalid */;
2489
- }
2490
- if (compareVersions(version, minVersion) < 0) {
2491
- return "too-old" /* TooOld */;
2492
- }
2493
- if (compareVersions(version, maxVersion) > 0) {
2494
- return "too-new" /* TooNew */;
2495
- }
2496
- return "compatible" /* Compatible */;
2497
- }
2498
- function isVersionSupported(version) {
2499
- return checkVersionCompatibility(version) === "compatible" /* Compatible */;
2500
- }
2501
- function filterCompatibleVersions(versions) {
2502
- return versions.filter(isVersionSupported);
2503
- }
2504
- function getWebSocketPath(version) {
2505
- return version.websocketPath;
2506
- }
2507
-
2508
- // src/enums/truenas-auth-mechanism.enum.ts
2509
- var TrueNasAuthMechanism = /* @__PURE__ */ ((TrueNasAuthMechanism2) => {
2510
- TrueNasAuthMechanism2["ApiKey"] = "API_KEY_PLAIN";
2511
- TrueNasAuthMechanism2["Password"] = "PASSWORD_PLAIN";
2512
- TrueNasAuthMechanism2["Otp"] = "OTP_TOKEN";
2513
- TrueNasAuthMechanism2["Token"] = "TOKEN_PLAIN";
2514
- return TrueNasAuthMechanism2;
2515
- })(TrueNasAuthMechanism || {});
2516
-
2517
- // src/errors/auth.errors.ts
2518
- var AuthErrorCode = /* @__PURE__ */ ((AuthErrorCode2) => {
2519
- AuthErrorCode2["PasswordAuthFailed"] = "PASSWORD_AUTH_FAILED";
2520
- AuthErrorCode2["OtpAuthFailed"] = "OTP_AUTH_FAILED";
2521
- AuthErrorCode2["ApiKeyAuthFailed"] = "API_KEY_AUTH_FAILED";
2522
- AuthErrorCode2["TokenAuthFailed"] = "TOKEN_AUTH_FAILED";
2523
- AuthErrorCode2["LoginSuperseded"] = "LOGIN_SUPERSEDED";
2524
- AuthErrorCode2["FullAdminRequired"] = "FULL_ADMIN_REQUIRED";
2525
- return AuthErrorCode2;
2526
- })(AuthErrorCode || {});
2527
- var AuthError = class _AuthError extends Error {
2528
- constructor(code, message) {
2529
- super(message);
2530
- this.code = code;
2531
- this.name = "AuthError";
2532
- Object.setPrototypeOf(this, _AuthError.prototype);
2533
- }
2534
- };
2535
-
2536
- // src/auth/truenas-authenticator.ts
2537
- var throwOnAuthenticationFailure = (code, message) => switchMap((response) => {
2538
- if (response.response_type === "AUTH_ERR" /* AuthErr */) {
2539
- return throwError(() => new AuthError(code, message));
2540
- }
2541
- return of(response);
2542
- });
2543
- var TrueNasAuthenticator = class _TrueNasAuthenticator {
2544
- constructor(connection, version) {
2545
- this.connection = connection;
2546
- this.version = version;
2547
- // in seconds (5 minutes)
2548
- /**
2549
- * whether or not the system is currently authenticated and accessible.
2550
- * this is a `BehaviorSubject` instead of a signal, since we use its `getValue` method
2551
- * throughout a lot of the codebase.
2552
- */
2553
- this.authenticated$ = new BehaviorSubject(false);
2554
- /**
2555
- * `true` when the system is currently being authenticated to, and `false` otherwise.
2556
- * does not indicate whatsoever if authentication is successful or not, just whether the process
2557
- * is ongoing.
2558
- */
2559
- this.authenticating$ = new BehaviorSubject(false);
2560
- this.credentials = { username: "", password: "", key: "" };
2561
- this.sessionLifetime = _TrueNasAuthenticator.DefaultSessionLifetime;
2562
- /**
2563
- * Claimed by each login when it sends and checked when its answer lands: a
2564
- * difference means another login or a logout was issued in between, so this
2565
- * answer is stale and must not write session state. Responses on one socket
2566
- * are not ordered, which is why arrival is not enough to make an answer
2567
- * current.
2568
- *
2569
- * `logout()` bumps it without claiming one. It has no answer to guard —
2570
- * it settles its own state at the call — and bumping is what invalidates the
2571
- * logins already on the wire that a logout is meant to override.
2572
- */
2573
- this.authEpoch = 0;
2574
- /**
2575
- * Caller-issued logins still awaiting an answer, keyed by the epoch each
2576
- * claimed. The value is whether its frame has been written to a socket yet.
2577
- *
2578
- * The auto-relogin below defers while any entry exists. It is this class
2579
- * retrying a cached credential, not a request anyone made, so it must never
2580
- * outrank an explicit login — and it would: `TrueNasConnection.send` holds a
2581
- * frame through an outage rather than dropping it, so a login submitted while
2582
- * the socket is down is still pending when `opened` fires, and a relogin
2583
- * claiming the newer epoch has that login answered `LoginSuperseded` while the
2584
- * client authenticates as the previously cached account.
2585
- *
2586
- * Keyed rather than counted, because a count cannot say *which* login a
2587
- * removal belongs to: a login torn down by its caller would retire a slot
2588
- * belonging to a different login that is still waiting, and the retry would
2589
- * overtake it again. Identity also makes a double-subscribed login harmless.
2590
- */
2591
- this.liveCallerLogins = /* @__PURE__ */ new Map();
2592
- /** True only while the constructor's relogin is being constructed. */
2593
- this.reloginInProgress = false;
2594
- this.connection.opened.subscribe((isOpen) => {
2595
- if (!isOpen) return;
2596
- for (const epoch of this.liveCallerLogins.keys()) {
2597
- this.liveCallerLogins.set(epoch, true);
2598
- }
2599
- });
2600
- this.connection.opened.pipe(
2601
- filter(
2602
- (isOpen) => !!(isOpen && this.credentials?.username && (this.credentials.password || this.credentials.key) && // An explicit login already on the wire outranks this retry.
2603
- this.liveCallerLogins.size === 0)
2604
- ),
2605
- switchMap(() => {
2606
- this.reloginInProgress = true;
2607
- let relogin;
2608
- try {
2609
- relogin = this.credentials.password ? this.loginWithUserPass(
2610
- this.credentials.username,
2611
- this.credentials.password
2612
- ) : this.loginWithApiKey({
2613
- username: this.credentials.username,
2614
- key: this.credentials.key
2615
- });
2616
- } finally {
2617
- this.reloginInProgress = false;
2618
- }
2619
- return relogin.pipe(catchError$1(() => EMPTY));
2620
- })
2621
- ).subscribe();
2622
- connection.closed.subscribe(() => {
2623
- for (const [epoch, flushed] of this.liveCallerLogins) {
2624
- if (flushed) this.liveCallerLogins.delete(epoch);
2625
- }
2626
- this.sessionLifetime = _TrueNasAuthenticator.DefaultSessionLifetime;
2627
- this.authenticated$.next(false);
2628
- });
2629
- }
2630
- static {
2631
- this.DefaultSessionLifetime = 300;
2632
- }
2633
- /**
2634
- * `login_options` asking for a reconnect token, when the server understands it.
2635
- *
2636
- * Omitted below v26. `AuthCommonOptions` is `additionalProperties: false`
2637
- * there and has only `user_info`, so sending the member is a validation
2638
- * error, not an ignored field — it would fail login outright on the oldest
2639
- * version this client supports.
2640
- */
2641
- /**
2642
- * Two things this does not do, both deliberate and both worth knowing.
2643
- *
2644
- * There is no way for a consumer to decline: every v26+ password login now
2645
- * mints a single-use credential carrying that session's roles, whether or not
2646
- * the caller wants one. And the auto-relogin in the constructor subscribes
2647
- * with no observer, so the token it mints is dropped — a caller reconnecting
2648
- * repeatedly holds an ageing token while the appliance mints fresh ones
2649
- * nobody reads. Tokens are single-use with a 600s TTL, so that is the
2650
- * reconnect case the feature is named for.
2651
- */
2652
- reconnectTokenOption() {
2653
- if (!this.version || this.version.year <= legacyCutoffYear) return void 0;
2654
- return { login_options: { reconnect_token: true } };
2655
- }
2656
- /**
2657
- * Throws when another login or a logout was issued after this one was sent,
2658
- * so a stale answer cannot be reported to its caller as a successful login.
2659
- */
2660
- assertNotSuperseded(sentDuring) {
2661
- if (this.authEpoch === sentDuring) return;
2662
- throw new AuthError(
2663
- "LOGIN_SUPERSEDED" /* LoginSuperseded */,
2664
- "Login was superseded by a later logout or login and was discarded."
2665
- );
2666
- }
2667
- /** Claim the next epoch for a login, and record it if a caller asked for it. */
2668
- beginLogin() {
2669
- const callerInitiated = !this.reloginInProgress;
2670
- const sentDuring = ++this.authEpoch;
2671
- if (callerInitiated) {
2672
- this.liveCallerLogins.set(sentDuring, this.connection.opened.value);
2673
- }
2674
- return { sentDuring, callerInitiated };
2675
- }
2676
- endLogin(sentDuring, callerInitiated, answered) {
2677
- const flushed = this.liveCallerLogins.get(sentDuring);
2678
- if (callerInitiated && (answered || flushed)) {
2679
- this.liveCallerLogins.delete(sentDuring);
2680
- }
2681
- this.authenticating$.next(false);
2682
- }
2683
- loginWithUserPass(username, password) {
2684
- const { sentDuring, callerInitiated } = this.beginLogin();
2685
- let answered = false;
2686
- const message = createJsonRpcMessage("auth.login_ex", [
2687
- {
2688
- mechanism: "PASSWORD_PLAIN" /* Password */,
2689
- username,
2690
- password,
2691
- ...this.reconnectTokenOption()
2692
- }
2693
- ]);
2694
- this.authenticating$.next(true);
2695
- this.connection.send(message);
2696
- const messageId = message.id ?? "";
2697
- return this.connection.messages().pipe(
2698
- withId(messageId),
2699
- tap(() => {
2700
- answered = true;
2701
- }),
2702
- map((msg) => {
2703
- if (msg.error) {
2704
- const errorMessage = getApiErrorMessage(
2705
- msg.error,
2706
- "Authentication failed"
2707
- );
2708
- throw new Error(errorMessage);
2709
- }
2710
- return msg.result;
2711
- }),
2712
- throwOnAuthenticationFailure(
2713
- "PASSWORD_AUTH_FAILED" /* PasswordAuthFailed */,
2714
- "TrueNAS authentication failed. Please verify your TrueNAS user credentials and try again."
2715
- ),
2716
- tap((res) => {
2717
- if (res.response_type === "SUCCESS" /* Success */) {
2718
- this.assertNotSuperseded(sentDuring);
2719
- this.credentials = { username, password, key: "" };
2720
- this.sessionLifetime = res.user_info?.attributes?.preferences?.lifetime ?? _TrueNasAuthenticator.DefaultSessionLifetime;
2721
- this.authenticated$.next(true);
2722
- }
2723
- }),
2724
- finalize(() => {
2725
- this.endLogin(sentDuring, callerInitiated, answered);
2726
- }),
2727
- take(1)
2728
- );
2729
- }
2730
- loginWithOtp(code) {
2731
- const { sentDuring, callerInitiated } = this.beginLogin();
2732
- let answered = false;
2733
- const message = createJsonRpcMessage("auth.login_ex", [
2734
- {
2735
- mechanism: "OTP_TOKEN" /* Otp */,
2736
- otp_token: code
2737
- }
2738
- ]);
2739
- this.authenticating$.next(true);
2740
- this.connection.send(message);
2741
- const messageId = message.id ?? "";
2742
- return this.connection.messages().pipe(
2743
- withId(messageId),
2744
- tap(() => {
2745
- answered = true;
2746
- }),
2747
- map((msg) => {
2748
- if (msg.error) {
2749
- const errorMessage = getApiErrorMessage(
2750
- msg.error,
2751
- "Authentication failed"
2752
- );
2753
- throw new Error(errorMessage);
2754
- }
2755
- return msg.result;
2756
- }),
2757
- tap((res) => {
2758
- if (res?.response_type === "SUCCESS" /* Success */) {
2759
- this.assertNotSuperseded(sentDuring);
2760
- this.sessionLifetime = res.user_info?.attributes?.preferences?.lifetime ?? _TrueNasAuthenticator.DefaultSessionLifetime;
2761
- this.authenticated$.next(true);
2762
- }
2763
- }),
2764
- throwOnAuthenticationFailure(
2765
- "OTP_AUTH_FAILED" /* OtpAuthFailed */,
2766
- "TrueNAS authentication failed. Please verify your one-time passcode and try again."
2767
- ),
2768
- finalize(() => {
2769
- this.endLogin(sentDuring, callerInitiated, answered);
2770
- }),
2771
- take(1)
2772
- );
2773
- }
2774
- /**
2775
- * Re-authenticate with a token from a previous login's `reconnect_token`.
2776
- *
2777
- * This is what lets a second connection to the same appliance authenticate
2778
- * without asking the user for a password again — middleware sessions are
2779
- * per-connection, so a second socket has its own to establish.
2780
- *
2781
- * The token is single-use and short-lived. On v26+ a successful login mints
2782
- * another on the response, so a caller keeping a session alive across
2783
- * reconnects stores the newest each time; below v26 nothing is minted and
2784
- * there is no chain to keep.
2785
- *
2786
- * Re-login is the caller's to drive. A token session is not covered by the
2787
- * automatic reconnect this class does for password and api-key sessions,
2788
- * which is deliberate — the token is single-use — but it means a dropped
2789
- * socket needs the stored token spending explicitly. Middleware holds tokens
2790
- * in memory, so a `middlewared` restart voids them, and that is a common
2791
- * reason the socket dropped in the first place.
2792
- */
2793
- loginWithToken(token) {
2794
- const { sentDuring, callerInitiated } = this.beginLogin();
2795
- let answered = false;
2796
- const message = createJsonRpcMessage("auth.login_ex", [
2797
- {
2798
- mechanism: "TOKEN_PLAIN" /* Token */,
2799
- token,
2800
- ...this.reconnectTokenOption()
2801
- }
2802
- ]);
2803
- this.authenticating$.next(true);
2804
- this.connection.send(message);
2805
- const messageId = message.id ?? "";
2806
- return this.connection.messages().pipe(
2807
- withId(messageId),
2808
- tap(() => {
2809
- answered = true;
2810
- }),
2811
- map((msg) => {
2812
- if (msg.error) {
2813
- const errorMessage = getApiErrorMessage(
2814
- msg.error,
2815
- "Authentication failed"
2816
- );
2817
- throw new Error(errorMessage);
2818
- }
2819
- return msg.result;
2820
- }),
2821
- // Password login lets non-`AUTH_ERR` answers through because it has to
2822
- // hand `OTP_REQUIRED` back to the caller. Token login has no such case:
2823
- // middleware answers `EXPIRED` for an account locked or expired between
2824
- // minting and spending, and `DENIED` for a permission refusal, so letting
2825
- // those reach `next` would report a failed login as a successful one.
2826
- map((res) => {
2827
- if (res.response_type !== "SUCCESS" /* Success */) {
2828
- throw new AuthError(
2829
- "TOKEN_AUTH_FAILED" /* TokenAuthFailed */,
2830
- `TrueNAS token authentication failed (${res.response_type}). The token may have expired or been used, or the account may no longer be permitted to log in.`
2831
- );
2832
- }
2833
- return res;
2834
- }),
2835
- tap((res) => {
2836
- if (res.response_type === "SUCCESS" /* Success */) {
2837
- this.assertNotSuperseded(sentDuring);
2838
- this.sessionLifetime = res.user_info?.attributes?.preferences?.lifetime ?? _TrueNasAuthenticator.DefaultSessionLifetime;
2839
- this.authenticated$.next(true);
2840
- }
2841
- }),
2842
- finalize(() => {
2843
- this.endLogin(sentDuring, callerInitiated, answered);
2844
- }),
2845
- take(1)
2846
- );
2847
- }
2848
- /**
2849
- * No reconnect token is requested here, though v26+ would mint one: an
2850
- * api-key session already reconnects without a prompt, since the key is held
2851
- * and replayed. The token exists for the credential that cannot be.
2852
- */
2853
- loginWithApiKey(credentials) {
2854
- const { sentDuring, callerInitiated } = this.beginLogin();
2855
- let answered = false;
2856
- const { username, key } = credentials;
2857
- const message = createJsonRpcMessage("auth.login_ex", [
2858
- {
2859
- mechanism: "API_KEY_PLAIN" /* ApiKey */,
2860
- username,
2861
- api_key: key
2862
- }
2863
- ]);
2864
- this.authenticating$.next(true);
2865
- this.connection.send(message);
2866
- const messageId = message.id ?? "";
2867
- return this.connection.messages().pipe(
2868
- withId(messageId),
2869
- tap(() => {
2870
- answered = true;
2871
- }),
2872
- map((msg) => {
2873
- if (msg.error) {
2874
- const errorMessage = getApiErrorMessage(
2875
- msg.error,
2876
- "Authentication failed"
2877
- );
2878
- throw new Error(errorMessage);
2879
- }
2880
- return msg.result;
2881
- }),
2882
- throwOnAuthenticationFailure(
2883
- "API_KEY_AUTH_FAILED" /* ApiKeyAuthFailed */,
2884
- "TrueNAS authentication failed. Has the TrueNAS Connect API key been removed from your TrueNAS server?"
2885
- ),
2886
- tap((res) => {
2887
- this.assertNotSuperseded(sentDuring);
2888
- this.credentials = { username, password: "", key };
2889
- this.sessionLifetime = res.user_info?.attributes?.preferences?.lifetime ?? _TrueNasAuthenticator.DefaultSessionLifetime;
2890
- this.authenticated$.next(true);
2891
- }),
2892
- finalize(() => {
2893
- this.endLogin(sentDuring, callerInitiated, answered);
2894
- }),
2895
- take(1)
2896
- );
2897
- }
2898
- newApiKey(username) {
2899
- const message = createJsonRpcMessage("api_key.create", [
2900
- { name: `tnc-${randomUUID()}`, username }
2901
- ]);
2902
- this.connection.send(message);
2903
- const messageId = message.id ?? "";
2904
- return this.connection.messages().pipe(
2905
- withId(messageId),
2906
- map((msg) => {
2907
- if (msg.error) {
2908
- const errorMessage = getApiErrorMessage(
2909
- msg.error,
2910
- "Failed to create API key"
2911
- );
2912
- throw new Error(errorMessage);
2913
- }
2914
- return msg.result;
2915
- }),
2916
- take(1)
2917
- );
2918
- }
2919
- logout() {
2920
- this.credentials = { username: "", password: "", key: "" };
2921
- this.sessionLifetime = _TrueNasAuthenticator.DefaultSessionLifetime;
2922
- this.authEpoch += 1;
2923
- this.authenticated$.next(false);
2924
- const message = createJsonRpcMessage("auth.logout");
2925
- this.connection.send(message);
2926
- const messageId = message.id ?? "";
2927
- return this.connection.messages().pipe(
2928
- withId(messageId),
2929
- map((msg) => {
2930
- if (msg.error) {
2931
- return false;
2932
- }
2933
- return msg.result;
2934
- }),
2935
- take(1)
2936
- );
2937
- }
2938
- };
2939
-
2940
- // src/logger.ts
2941
- var consoleLogger = {
2942
- trace: (message, ...args) => console.trace(message, ...args),
2943
- debug: (message, ...args) => console.debug(message, ...args),
2944
- info: (message, ...args) => console.info(message, ...args),
2945
- warn: (message, ...args) => console.warn(message, ...args),
2946
- error: (message, ...args) => console.error(message, ...args)
2947
- };
2948
- var noop = () => void 0;
2949
- var noopLogger = {
2950
- trace: noop,
2951
- debug: noop,
2952
- info: noop,
2953
- warn: noop,
2954
- error: noop
2955
- };
2956
-
2957
- // src/utils/truenas-connection.utils.ts
2958
- var policyViolationCloseCode = 1008;
2959
- function isHttpStatusError(reason) {
2960
- return ["404", "502", "503"].some((code) => reason.includes(code));
2961
- }
2962
- function getHttpError(reason) {
2963
- if (reason.includes("404")) {
2964
- return "API endpoint not found - System may not support versioned API";
2965
- }
2966
- if (reason.includes("502")) {
2967
- return "Bad Gateway - System may be starting up";
2968
- }
2969
- if (reason.includes("503")) {
2970
- return "Service Unavailable - System may be overloaded";
2971
- }
2972
- return "";
2973
- }
2974
- function getWebSocketError(code) {
2975
- switch (code) {
2976
- case 1e3:
2977
- return "Connection closed normally";
2978
- case 1001:
2979
- return "Server is shutting down or restarting";
2980
- case 1002:
2981
- return "Protocol error - Invalid WebSocket communication";
2982
- case 1003:
2983
- return "Unsupported data format received";
2984
- case 1006:
2985
- return "Connection lost unexpectedly - Check network connectivity";
2986
- case 1007:
2987
- return "Invalid data received from server";
2988
- case 1008:
2989
- return "Connection terminated due to policy violation";
2990
- case 1009:
2991
- return "Message size exceeded server limits";
2992
- case 1011:
2993
- return "Server encountered an internal error";
2994
- case 1012:
2995
- return "Service is restarting";
2996
- case 1013:
2997
- return "Server temporarily overloaded - Try again later";
2998
- case 1015:
2999
- return "TLS/Certificate error - Certificate may be expired";
3000
- default:
3001
- return "Network connection failed - Check IP address and connectivity";
3002
- }
3003
- }
3004
- var TrueNasSocket = class {
3005
- constructor(config) {
3006
- this.config = config;
3007
- this.socket = webSocket(this.config);
3008
- }
3009
- messages() {
3010
- return this.socket;
3011
- }
3012
- next(msg) {
3013
- this.socket.next(msg);
3014
- }
3015
- complete() {
3016
- this.socket.complete();
3017
- }
3018
- };
3019
-
3020
- // src/types/transport.type.ts
3021
- function httpScheme(protocol) {
3022
- return protocol === "http:" ? "http:" : "https:";
3023
- }
3024
- function socketScheme(protocol) {
3025
- return protocol === "http:" ? "ws:" : "wss:";
3026
- }
3027
-
3028
- // src/connection/truenas-connection.ts
3029
- var tenSeconds = 10 * 1e3;
3030
- var twentySeconds = 20 * 1e3;
3031
- var TrueNasConnection = class {
3032
- constructor(initialEnabled, hostnames, systemUuid, websocketPath, systemName, retryDelay = tenSeconds, maxRetry = 3, logger = noopLogger, protocol = "https:") {
3033
- this.hostnames = hostnames;
3034
- this.systemUuid = systemUuid;
3035
- this.websocketPath = websocketPath;
3036
- this.systemName = systemName;
3037
- this.retryDelay = retryDelay;
3038
- this.maxRetry = maxRetry;
3039
- this.logger = logger;
3040
- this.protocol = protocol;
3041
- // compatibility properties
3042
- this.opened = new BehaviorSubject(false);
3043
- this.closed = new Subject();
3044
- this.hostname = new BehaviorSubject("");
3045
- this.connectionAttempts = new BehaviorSubject(0);
3046
- this.lastErrorMessage = new BehaviorSubject(null);
3047
- /**
3048
- * emits when the connection is manually closed.
3049
- */
3050
- this.closeConnection = new Subject();
3051
- /**
3052
- * the connection only establishes a socket while this gate is `true`. consumers
3053
- * flip it via `setEnabled()` (the app maps `SystemState.Active -> true`).
3054
- */
3055
- this.enabled$ = new BehaviorSubject(false);
3056
- /**
3057
- * observable which emits the current gate value and only emits again when it changes.
3058
- */
3059
- this.enabledChange$ = this.enabled$.pipe(distinctUntilChanged());
3060
- /**
3061
- * observable that handles the entire connection lifecycle.
3062
- */
3063
- this.connection$ = this.enabledChange$.pipe(
3064
- switchMap((enabled) => {
3065
- if (enabled) {
3066
- return this.connect().pipe(
3067
- map((conn) => makeActiveConnection(conn.ws, conn.hostname)),
3068
- // A refusal becomes a value here rather than an error, so it never
3069
- // reaches the `retry` below and nothing reconnects on its own.
3070
- //
3071
- // Handled at this depth on purpose: letting it out completes the
3072
- // pipeline and unsubscribes `enabledChange$`, and `setEnabled` is the
3073
- // documented way an app asks for another attempt once the network
3074
- // changes. Not retrying is a statement about what this client does on
3075
- // its own; it is not a reason to refuse the caller asking again.
3076
- catchError$1(
3077
- (err) => isTerminalClose(err) ? of(
3078
- makeConnectionError(
3079
- err.message,
3080
- err.hostname,
3081
- err.closeCode,
3082
- err.closeReason
3083
- )
3084
- ) : throwError(() => err)
3085
- )
3086
- );
3087
- }
3088
- return of(closedConnection);
3089
- }),
3090
- switchMap((connection) => {
3091
- if (connection.state !== "active") {
3092
- return of(connection);
3093
- }
3094
- const initMessage = createJsonRpcMessage("core.set_options", [
3095
- { legacy_jobs: false }
3096
- ]);
3097
- connection.ws.next(initMessage);
3098
- return connection.ws.messages().pipe(
3099
- filter((msg) => msg.id === initMessage.id),
3100
- take(1),
3101
- map(() => connection)
3102
- );
3103
- }),
3104
- // in the event of an error, do two things:
3105
- // 1. emit an errored connection downstream to inform consumers that
3106
- // the connection is dead.
3107
- // 2. re-throw an error so the downstream `retry` will re-subscribe.
3108
- catchError$1((err) => {
3109
- this.logger.error("All connections failed - retrying", { message: err?.message, hostname: err?.hostname });
3110
- return concat(
3111
- of(
3112
- makeConnectionError(
3113
- err.message,
3114
- err.hostname,
3115
- err.closeCode,
3116
- err.closeReason
3117
- )
3118
- ),
3119
- // since this error will immediately get caught by `retry` there's no reason to build a real error.
3120
- throwError(() => null)
3121
- );
3122
- }),
3123
- retry(),
3124
- // start with a closed connection.
3125
- startWith(closedConnection),
3126
- // prevent multiple subscriptions from re-evaluating the entire pipeline.
3127
- shareReplay$1({ bufferSize: 1, refCount: false }),
3128
- takeUntil(this.closeConnection)
3129
- );
3130
- /**
3131
- * observable which is either an instance of the current `TrueNasSocket` used for the connection
3132
- * or `null` if the connection is closed or errored for any reason.
3133
- */
3134
- this.ws$ = this.connection$.pipe(
3135
- map((conn) => conn.state === "active" ? conn.ws : null)
3136
- );
3137
- /**
3138
- * current hostname we used to build the URL for this connection.
3139
- */
3140
- this.hostname$ = this.connection$.pipe(
3141
- map((conn) => conn.state === "active" ? conn.hostname : null)
3142
- );
3143
- /**
3144
- * emits error messages from the connection pipeline. this is used to derive the
3145
- * corresponding compatibility property.
3146
- */
3147
- this.lastErrorMessage$ = this.connection$.pipe(
3148
- map((conn) => conn.state === "error" ? conn.message : null)
3149
- );
3150
- /**
3151
- * emits when the connection state *changes*, so it'll never emit `true` twice
3152
- * in a row nor `false` twice in a row.
3153
- */
3154
- this.opened$ = this.connection$.pipe(
3155
- map((conn) => conn.state),
3156
- distinctUntilChanged(),
3157
- map((state) => state === "active")
3158
- );
3159
- /**
3160
- * emits when the connection state goes from open to closed.
3161
- */
3162
- this.closed$ = this.connection$.pipe(
3163
- map((conn) => conn.state),
3164
- distinctUntilChanged(),
3165
- filter((state) => state === "closed" || state === "error"),
3166
- map(() => {
3167
- })
3168
- );
3169
- /**
3170
- * whether to display a connection error to the user — the **live** signal.
3171
- *
3172
- * `true` only while `connection$` is currently a `ConnectionError`, meaning the entire race +
3173
- * retry cycle has been exhausted for all hostnames right now; it flips back to `false` once a
3174
- * connection is re-established. individual socket losses during a race are expected and not surfaced.
3175
- *
3176
- * NOTE: this is NOT the same as the `hasExhaustedRetries()` method, which is a **cumulative**
3177
- * snapshot (see there). The two can disagree — prefer this observable for "is the connection
3178
- * errored right now?".
3179
- */
3180
- this.hasConnectionError$ = this.connection$.pipe(
3181
- map((conn) => conn.state === "error"),
3182
- takeUntil(this.closeConnection)
3183
- );
3184
- /**
3185
- * observable which always emits messages from the current socket.
3186
- */
3187
- this.messages$ = this.ws$.pipe(
3188
- filter((ws) => ws !== null),
3189
- switchMap((ws) => ws.messages().pipe(
3190
- catchError$1(() => EMPTY)
3191
- ))
3192
- );
3193
- combineLatest([
3194
- interval(twentySeconds),
3195
- this.ws$
3196
- ]).pipe(
3197
- takeUntil(this.closeConnection)
3198
- ).subscribe(([, ws]) => {
3199
- if (ws) {
3200
- const pingMessage = createJsonRpcMessage("core.ping");
3201
- ws.next(pingMessage);
3202
- }
3203
- });
3204
- this.opened$.subscribe((val) => this.opened.next(val));
3205
- this.closed$.subscribe(() => this.closed.next());
3206
- this.hostname$.pipe(filter(Boolean)).subscribe((name) => this.hostname.next(name));
3207
- this.ws$.pipe(filter(Boolean)).subscribe((ws) => this.ws = ws);
3208
- this.lastErrorMessage$.subscribe((msg) => this.lastErrorMessage.next(msg));
3209
- this.enabled$.next(initialEnabled);
3210
- }
3211
- /**
3212
- * whether the connection has exhausted its retries — the **cumulative** snapshot, read
3213
- * synchronously. (Formerly `hasConnectionError()`; renamed to disambiguate it from the
3214
- * live `hasConnectionError$` observable, with which it can disagree.)
3215
- *
3216
- * `true` when the lifetime `connectionAttempts` count exceeds `hostnames.length * maxRetry`,
3217
- * OR when an error message is currently set. Ported from the source (tncui) behavior.
3218
- */
3219
- hasExhaustedRetries() {
3220
- const attemptsExhausted = this.connectionAttempts.value > this.hostnames.length * this.maxRetry;
3221
- const hasErrorMessage = this.lastErrorMessage.value !== null;
3222
- return attemptsExhausted || hasErrorMessage;
3223
- }
3224
- /**
3225
- * enables or disables the connection gate. the app calls this when its `SystemState`
3226
- * changes (mapping `SystemState.Active -> true`, everything else -> `false`).
3227
- *
3228
- * This is also how a caller asks for another attempt after the appliance has
3229
- * refused the client — nothing reconnects on its own from there. The gate is
3230
- * `distinctUntilChanged`, so re-asserting `true` while it is already `true`
3231
- * does nothing: the round trip through `false` is what asks again.
3232
- */
3233
- setEnabled(enabled) {
3234
- this.enabled$.next(enabled);
3235
- }
3236
- /**
3237
- * compatibility method which just returns the public `messages$` observable.
3238
- * this is used in a few places in the codebase that relied upon the old implementation.
3239
- */
3240
- messages() {
3241
- return this.messages$;
3242
- }
3243
- /**
3244
- * sends a message over the current websocket OR queues it to send once
3245
- * the next websocket is opened. messages sent via `send` will not be lost until after
3246
- * the next `closed$` emission.
3247
- */
3248
- send(message) {
3249
- return this.ws$.pipe(
3250
- filter((ws) => ws !== null),
3251
- take(1)
3252
- ).subscribe((ws) => ws.next(message));
3253
- }
3254
- /**
3255
- * manually closes this connection and prevents it from retrying/opening any more.
3256
- */
3257
- close() {
3258
- this.closeConnection.next();
3259
- this.closeConnection.complete();
3260
- }
3261
- /**
3262
- * helper method which creates an `Observable` which emits an `ActiveConnection`
3263
- * after it establishes a connection to the given hostname. the observable will emit an
3264
- * error if the connection is never established and will not complete until unsubscribed from or closed.
3265
- */
3266
- createSocket(hostname) {
3267
- const url = `${socketScheme(this.protocol)}//${hostname}${this.websocketPath}`;
3268
- let hasOpened = false;
3269
- return new Observable((subscriber) => {
3270
- const ws = new TrueNasSocket({
3271
- url,
3272
- openObserver: {
3273
- next: () => {
3274
- hasOpened = true;
3275
- this.connectionAttempts.next(0);
3276
- subscriber.next({ ws, hostname });
3277
- }
3278
- },
3279
- closeObserver: {
3280
- next: (event) => {
3281
- const reason = event.reason || "";
3282
- let errorMessage;
3283
- if (isHttpStatusError(reason)) {
3284
- errorMessage = getHttpError(reason);
3285
- } else {
3286
- errorMessage = getWebSocketError(event.code);
3287
- }
3288
- this.connectionAttempts.next(this.connectionAttempts.value + 1);
3289
- subscriber.error(
3290
- makeConnectionError(errorMessage, hostname, event.code, reason)
3291
- );
3292
- }
3293
- }
3294
- });
3295
- const startupSub = ws.socket.subscribe({
3296
- error: () => {
3297
- }
3298
- });
3299
- return () => {
3300
- startupSub.unsubscribe();
3301
- ws.complete();
3302
- };
3303
- }).pipe(
3304
- // retry logic:
3305
- // * if a connection is not established in 10 seconds, consider that an error
3306
- timeout({ first: tenSeconds }),
3307
- retry({
3308
- // * while still *establishing*: wait `retryDelay` before trying again, giving up
3309
- // after `maxRetry` retries.
3310
- count: this.maxRetry,
3311
- // * we use a custom `delay` function here to ensure no retries are performed
3312
- // once a socket is *opened*.
3313
- // basically: a later death must propagate out rather than being retried
3314
- // so it can be handled by the `connection$` observable.
3315
- delay: (error) => {
3316
- if (hasOpened) {
3317
- return throwError(() => error);
3318
- }
3319
- return timer(this.retryDelay);
3320
- }
3321
- })
3322
- );
3323
- }
3324
- /**
3325
- * helper function which actually performs the parallel connection `race`.
3326
- */
3327
- connect() {
3328
- return race(
3329
- this.hostnames.map(this.createSocket.bind(this))
3330
- ).pipe(
3331
- tap((conn) => this.logger.debug(`TrueNas socket opened to ${conn.hostname}.`)),
3332
- takeUntil(this.closeConnection)
3333
- );
3334
- }
3335
- };
3336
- var makeActiveConnection = (ws, hostname) => ({
3337
- ws,
3338
- hostname,
3339
- state: "active"
3340
- });
3341
- var makeConnectionError = (message, hostname, closeCode, closeReason) => ({
3342
- name: "ConnectionError",
3343
- message,
3344
- hostname,
3345
- closeCode,
3346
- closeReason,
3347
- state: "error"
3348
- });
3349
- var isTerminalClose = (err) => err?.closeCode === policyViolationCloseCode;
3350
- var closedConnection = { state: "closed" };
3351
-
3352
- // src/client/truenas-api-client.ts
3353
- var TrueNasApiClient = class {
3354
- constructor(uuid, hostnames, version, enabled, systemName, logger = noopLogger, protocol = "https:") {
3355
- this.uuid = uuid;
3356
- this.hostnames = hostnames;
3357
- this.version = version;
3358
- this.enabled = enabled;
3359
- this.systemName = systemName;
3360
- this.logger = logger;
3361
- this.protocol = protocol;
3362
- this.connection = this.createConnection();
3363
- this.authenticator = this.createAuthenticator();
3364
- this.api = this.createApi();
3365
- this.ops = this.createOperations();
3366
- }
3367
- /**
3368
- * Get current connection status.
3369
- * @returns true if WebSocket is connected
3370
- */
3371
- get connected() {
3372
- return this.connection.opened.getValue();
3373
- }
3374
- /**
3375
- * Get current authentication status.
3376
- * @returns true if authenticated with the system
3377
- */
3378
- get authenticated() {
3379
- return this.authenticator.authenticated$.getValue();
3380
- }
3381
- /**
3382
- * Close the WebSocket connection.
3383
- * Connection will automatically retry if retry is enabled.
3384
- */
3385
- close() {
3386
- this.connection.close();
3387
- }
3388
- /**
3389
- * Factory method to create the WebSocket connection.
3390
- * Override in subclasses to provide version-specific connection handling.
3391
- */
3392
- createConnection() {
3393
- const websocketPath = getWebSocketPath(this.version);
3394
- return new TrueNasConnection(
3395
- this.enabled,
3396
- this.hostnames,
3397
- this.uuid,
3398
- websocketPath,
3399
- this.systemName,
3400
- void 0,
3401
- // retryDelay (use default)
3402
- void 0,
3403
- // maxRetry (use default)
3404
- this.logger,
3405
- this.protocol
3406
- );
3407
- }
3408
- /**
3409
- * Factory method to create the API handler.
3410
- * Override in subclasses to provide version-specific API implementations.
3411
- */
3412
- createApi() {
3413
- return new TrueNasApi(this.authenticator.authenticated$, this.connection);
3414
- }
3415
- /**
3416
- * Factory method to create the authenticator.
3417
- * Override in subclasses to provide version-specific authentication.
3418
- */
3419
- createAuthenticator() {
3420
- return new TrueNasAuthenticator(this.connection, this.version);
3421
- }
3422
- };
3423
-
3424
- // src/types/app-query.type.ts
3425
- var AppState = /* @__PURE__ */ ((AppState2) => {
3426
- AppState2["Running"] = "RUNNING";
3427
- AppState2["Stopped"] = "STOPPED";
3428
- AppState2["Stopping"] = "STOPPING";
3429
- AppState2["Deploying"] = "DEPLOYING";
3430
- AppState2["Suspended"] = "SUSPENDED";
3431
- AppState2["Suspending"] = "SUSPENDING";
3432
- AppState2["Error"] = "ERROR";
3433
- AppState2["Unknown"] = "UNKNOWN";
3434
- return AppState2;
3435
- })(AppState || {});
3436
-
3437
- // src/utils/app-state.utils.ts
3438
- function toAppState(state) {
3439
- switch (state.toUpperCase()) {
3440
- case "RUNNING":
3441
- return "RUNNING" /* Running */;
3442
- case "STOPPED":
3443
- return "STOPPED" /* Stopped */;
3444
- // `ABORTING` is v25.10 only: the instance is being forced down, which ends
3445
- // at `STOPPED` and is what `Stopping` already means.
3446
- case "STOPPING":
3447
- case "ABORTING":
3448
- return "STOPPING" /* Stopping */;
3449
- // `STARTING` is v25.10 `virt.instance` only, and folding it into `Stopped`
3450
- // told callers a container that is coming up is at rest — enough for a UI
3451
- // to offer a Start button for it, or for a poll loop to give up. `Deploying`
3452
- // is the only in-progress state `AppState` has.
3453
- case "STARTING":
3454
- case "DEPLOYING":
3455
- return "DEPLOYING" /* Deploying */;
3456
- // v25.10's freezer states are the same idea as v26's `SUSPENDED`: the
3457
- // processes are paused, not exited. `FROZEN` is that pause completed, so it
3458
- // and `SUSPENDED` are the same answer.
3459
- case "SUSPENDED":
3460
- case "FROZEN":
3461
- return "SUSPENDED" /* Suspended */;
3462
- // `FREEZING` is on the way there and not there yet. It used to answer
3463
- // `Suspended`, defended by analogy with `STARTING` — but `STARTING` maps to
3464
- // `Deploying`, which is itself an in-progress word, so the analogy ran the
3465
- // wrong way. Answering `Suspended` tells a caller polling for "the memory
3466
- // is quiesced" that it is, one poll before it is true: the same false
3467
- // claim this mapping was rewritten to stop making, one state along.
3468
- // `ABORTING` had `Stopping` to land on; the freeze path needed its own.
3469
- case "FREEZING":
3470
- return "SUSPENDING" /* Suspending */;
3471
- // `THAWED` is the freezer lifted: the processes are scheduled again, so
3472
- // this is `RUNNING` reported through the transition rather than a state a
3473
- // caller should act on differently.
3474
- case "THAWED":
3475
- return "RUNNING" /* Running */;
3476
- case "ERROR":
3477
- return "ERROR" /* Error */;
3478
- // `UNKNOWN` is middleware's own word for it, and anything unrecognised is
3479
- // the same situation: a state this mapping has no word for. Neither is
3480
- // evidence the container is stopped.
3481
- case "UNKNOWN":
3482
- return "UNKNOWN" /* Unknown */;
3483
- default:
3484
- return "UNKNOWN" /* Unknown */;
3485
- }
3486
- }
3487
-
3488
- // src/utils/smb-status.utils.ts
3489
- function toSmbStatusParams(request = {}) {
3490
- return [
3491
- request.infoLevel ?? "ALL",
3492
- request.filters ?? [],
3493
- request.options ?? {},
3494
- request.statusOptions ?? {}
3495
- ];
3496
- }
3497
-
3498
- // src/client/truenas-api-client-v25-10.ts
3499
- var TrueNasApiClientV2510 = class extends TrueNasApiClient {
3500
- /**
3501
- * Create v25.10-specific operation mappings
3502
- *
3503
- * virt.instance.* APIs return boolean (true) but emit job events via websocket.
3504
- * We use callAndGetJobId to capture the job ID, then track the job.
3505
- * All operations emit Job updates until the operation completes.
3506
- */
3507
- createOperations() {
3508
- return {
3509
- // A polymorphic `.query`, so it goes through the verb rather than
3510
- // `call`: the directory types the raw method's response as the five-way
3511
- // union the server may return, and the verb is what fixes it to a list.
3512
- containerQuery: () => this.api.query("virt.instance.query", [["type", "=", "CONTAINER"]]).pipe(map((instances) => instances.map(toContainer))),
3513
- containerStart: (id) => this.api.job("virt.instance.start", [id]),
3514
- containerStop: (id, options) => this.api.job("virt.instance.stop", [id, options]),
3515
- containerRestart: (id, options) => this.api.job("virt.instance.restart", [id, options]),
3516
- // Already a job here — `virt.instance.delete` has been one since
3517
- // v25.10.0 — so this needs no synthesis, only the id. It takes nothing
3518
- // else: there is no `force` and no `recursive` on this version.
3519
- //
3520
- // Unsupported options are reported rather than dropped. `recursive`
3521
- // destroys child datasets, snapshots and clones irrecoverably, so a
3522
- // caller who asked for it and silently did not get it has been told
3523
- // something false about what just happened to their data. Reporting is
3524
- // all this layer can do — refusing outright would make `ops.containerDelete`
3525
- // unusable on v25.10 for the ordinary case, which is the case that works.
3526
- containerDelete: (id, options) => {
3527
- const unsupported = ["force", "recursive"].filter(
3528
- (key) => options?.[key]
3529
- );
3530
- if (unsupported.length > 0) {
3531
- this.logger.warn(
3532
- "containerDelete: v25.10 has no counterpart for these options and will delete without them",
3533
- { ignored: unsupported, id, method: "virt.instance.delete" }
3534
- );
3535
- }
3536
- return this.api.job("virt.instance.delete", [id]);
3537
- },
3538
- // The private leg. See `PrivateSmbStatusCall` for why this is a cast and
3539
- // not a directory lookup.
3540
- //
3541
- // v25.10 answers rather than refusing, for a caller with the authority.
3542
- // Being private does not stop the method running: `ws_handler/rpc.py`
3543
- // logs a warning for a private call over websocket and dispatches it
3544
- // anyway — the `# FIXME: Eventually, prohibit this` above that branch is
3545
- // still unresolved on master.
3546
- //
3547
- // It does decide who may run it. `smb.status` carries no `roles=` here,
3548
- // and middleware role-registers a method only `if roles:`, so it is in no
3549
- // role's allowlist and only the non-STIG full-admin wildcard reaches it.
3550
- // That is documented on `OperationMappings.smbStatus`; this leg does not
3551
- // pre-empt it. A caller without the authority gets middleware's `EACCES`,
3552
- // which is the honest answer and the server's to give.
3553
- //
3554
- // The server-side warning is per dispatch, and a client count is exactly
3555
- // the sort of thing a caller polls. Reported at debug rather than warn,
3556
- // because nothing here is degraded or unhonoured — the request is served
3557
- // in full — and left to the caller to weigh.
3558
- //
3559
- // Future tense, and for the same reason as `containerDelete` above: this
3560
- // runs when the operation is built, and `api.call` is cold, so no request
3561
- // has gone out yet and may never. One built observable subscribed twice
3562
- // dispatches twice; this line is what will happen, not a record that it
3563
- // did.
3564
- smbStatus: (request) => {
3565
- this.logger.debug(
3566
- "smbStatus: smb.status is private on v25.10; each dispatch will log a warning server-side and needs a non-STIG full-admin session",
3567
- { method: "smb.status", infoLevel: request?.infoLevel ?? "ALL" }
3568
- );
3569
- return this.api.call(
3570
- "smb.status",
3571
- toSmbStatusParams(request)
3572
- );
3573
- }
3574
- };
3575
- }
3576
- };
3577
- function toContainer(instance) {
3578
- return {
3579
- id: instance.id,
3580
- name: instance.name,
3581
- status: toAppState(instance.status),
3582
- autostart: instance.autostart,
3583
- cpu: instance.cpu ?? void 0,
3584
- memory: instance.memory ?? void 0,
3585
- // The whole image object, not just its description: `Container.image`
3586
- // declares only `description`, but the API returns `architecture`, `os`,
3587
- // `release` and more, and callers were already receiving them. Narrowing
3588
- // to the declared field would take data away to match a type that was
3589
- // always an under-declaration — the same call as the v26 `description`
3590
- // widening, decided the same way.
3591
- image: instance.image.description === null ? void 0 : { ...instance.image, description: instance.image.description }
3592
- };
3593
- }
3594
- var TrueNasApiClientV26 = class extends TrueNasApiClient {
3595
- /**
3596
- * Create v26-specific operation mappings
3597
- *
3598
- * Operations return Observable<Job | null>:
3599
- * - Async operations emit Job updates until complete
3600
- * - Sync operations emit null once
3601
- */
3602
- createOperations() {
3603
- return {
3604
- // A polymorphic `.query`, so it goes through the verb rather than
3605
- // `call`: the directory types the raw method's response as the five-way
3606
- // union the server may return, and the verb is what fixes it to a list.
3607
- containerQuery: () => this.api.query("container.query").pipe(
3608
- map((containers) => containers.map(toContainer2))
3609
- ),
3610
- // container.start is synchronous in v26.0.0 - emit null
3611
- containerStart: (id) => this.api.call("container.start", [parseInt(id, 10)]).pipe(map(() => null)),
3612
- // container.stop emits job updates
3613
- containerStop: (id, options) => this.api.job("container.stop", [
3614
- parseInt(id, 10),
3615
- {
3616
- force: options.force,
3617
- force_after_timeout: options.force
3618
- }
3619
- ]),
3620
- // v26.0.0 doesn't have container.restart - chain stop + start
3621
- // Emits Job updates during stop, then null when start completes
3622
- containerRestart: (id, options) => {
3623
- const numericId = parseInt(id, 10);
3624
- return this.api.job("container.stop", [
3625
- numericId,
3626
- {
3627
- force: options.force,
3628
- force_after_timeout: options.force
3629
- }
3630
- ]).pipe(
3631
- // Collect all job updates to ensure stop fully completes
3632
- toArray(),
3633
- // Re-emit job updates, then call start after stop is done
3634
- switchMap(
3635
- (jobUpdates) => concat(
3636
- from(jobUpdates),
3637
- this.api.call("container.start", [numericId]).pipe(map(() => null))
3638
- )
3639
- )
3640
- );
3641
- },
3642
- // A job since v26.0.0 — middleware made deletion long-running (it stops
3643
- // the container when asked, tears down the libvirt domain and destroys
3644
- // the dataset), and the generated directory moved it out of `call`
3645
- // accordingly. `api.job` is what tracks it; `api.call` would not compile.
3646
- //
3647
- // Options pass straight through when given: the unified
3648
- // `ContainerDeleteOptions` is `force`/`recursive`, exactly what the
3649
- // generated params take.
3650
- //
3651
- // When they are not given the argument is *omitted* rather than passed as
3652
- // `undefined`. `JSON.stringify` renders a trailing `undefined` array
3653
- // element as `null`, and middleware declares `options: ContainerDeleteOptions`
3654
- // with a model default and no `| None` — so `[id, null]` is a validation
3655
- // error rather than "use the defaults", which is the one thing a caller
3656
- // passing nothing is asking for.
3657
- containerDelete: (id, options) => this.api.job(
3658
- "container.delete",
3659
- options ? [parseInt(id, 10), options] : [parseInt(id, 10)]
3660
- ),
3661
- // `smb.status` is public here and gated on `SHARING_SMB_READ`, so it is
3662
- // an ordinary `call` read straight out of the generated directory — the
3663
- // one leg of this operation that needs no assertion about the server.
3664
- //
3665
- // Not a query verb: middleware returns the same `list | dict | int`
3666
- // polymorphism a `.query` does, but the generator did not mark the entry
3667
- // with an `entity`, so `api.query` does not accept it and the union is
3668
- // handed to the caller to narrow.
3669
- smbStatus: (request) => this.api.call("smb.status", toSmbStatusParams(request))
3670
- };
3671
- }
3672
- };
3673
- function toContainer2(container) {
3674
- const { description } = container;
3675
- return {
3676
- id: container.id.toString(),
3677
- name: container.name,
3678
- status: toAppState(container.status.state),
3679
- // Optional in the generated entry, required by `Container`.
3680
- autostart: container.autostart ?? false,
3681
- description
3682
- };
3683
- }
3684
- var TrueNasApiClientV27 = class extends TrueNasApiClient {
3685
- /**
3686
- * Create v27-specific operation mappings
3687
- *
3688
- * Operations return Observable<Job | null>:
3689
- * - Async operations emit Job updates until complete
3690
- * - Sync operations emit null once
3691
- */
3692
- createOperations() {
3693
- return {
3694
- // A polymorphic `.query`, so it goes through the verb rather than
3695
- // `call`: the directory types the raw method's response as the five-way
3696
- // union the server may return, and the verb is what fixes it to a list.
3697
- containerQuery: () => this.api.query("container.query").pipe(
3698
- map((containers) => containers.map(toContainer3))
3699
- ),
3700
- // container.start is synchronous in v27 - emit null
3701
- containerStart: (id) => this.api.call("container.start", [parseInt(id, 10)]).pipe(map(() => null)),
3702
- // container.stop emits job updates
3703
- containerStop: (id, options) => this.api.job("container.stop", [
3704
- parseInt(id, 10),
3705
- {
3706
- force: options.force,
3707
- force_after_timeout: options.force
3708
- }
3709
- ]),
3710
- // v27 still has no container.restart - chain stop + start.
3711
- // Emits Job updates during stop, then null when start completes.
3712
- containerRestart: (id, options) => {
3713
- const numericId = parseInt(id, 10);
3714
- return this.api.job("container.stop", [
3715
- numericId,
3716
- {
3717
- force: options.force,
3718
- force_after_timeout: options.force
3719
- }
3720
- ]).pipe(
3721
- // Collect all job updates to ensure stop fully completes
3722
- toArray(),
3723
- // Re-emit job updates, then call start after stop is done
3724
- switchMap(
3725
- (jobUpdates) => concat(
3726
- from(jobUpdates),
3727
- this.api.call("container.start", [numericId]).pipe(map(() => null))
3728
- )
3729
- )
3730
- );
3731
- },
3732
- // A job since v26.0.0 — middleware made deletion long-running (it stops
3733
- // the container when asked, tears down the libvirt domain and destroys
3734
- // the dataset), and the generated directory moved it out of `call`
3735
- // accordingly. `api.job` is what tracks it; `api.call` would not compile.
3736
- //
3737
- // Options pass straight through when given: the unified
3738
- // `ContainerDeleteOptions` is `force`/`recursive`, exactly what the
3739
- // generated params take.
3740
- //
3741
- // When they are not given the argument is *omitted* rather than passed as
3742
- // `undefined`. `JSON.stringify` renders a trailing `undefined` array
3743
- // element as `null`, and middleware declares `options: ContainerDeleteOptions`
3744
- // with a model default and no `| None` — so `[id, null]` is a validation
3745
- // error rather than "use the defaults", which is the one thing a caller
3746
- // passing nothing is asking for.
3747
- containerDelete: (id, options) => this.api.job(
3748
- "container.delete",
3749
- options ? [parseInt(id, 10), options] : [parseInt(id, 10)]
3750
- ),
3751
- // `smb.status` is public here and gated on `SHARING_SMB_READ`, so it is
3752
- // an ordinary `call` read straight out of the generated directory — the
3753
- // one leg of this operation that needs no assertion about the server.
3754
- //
3755
- // Not a query verb: middleware returns the same `list | dict | int`
3756
- // polymorphism a `.query` does, but the generator did not mark the entry
3757
- // with an `entity`, so `api.query` does not accept it and the union is
3758
- // handed to the caller to narrow.
3759
- smbStatus: (request) => this.api.call("smb.status", toSmbStatusParams(request))
3760
- };
3761
- }
3762
- };
3763
- function toContainer3(container) {
3764
- const { description } = container;
3765
- return {
3766
- id: container.id.toString(),
3767
- name: container.name,
3768
- status: toAppState(container.status.state),
3769
- // Optional in the generated entry, required by `Container`.
3770
- autostart: container.autostart ?? false,
3771
- description
3772
- };
3773
- }
3774
-
3775
- // src/errors/version-discovery.errors.ts
3776
- var VersionDiscoveryError = class extends Error {
3777
- constructor(message, hostname) {
3778
- super(message);
3779
- this.hostname = hostname;
3780
- this.name = this.constructor.name;
3781
- Object.setPrototypeOf(this, new.target.prototype);
3782
- }
3783
- };
3784
- var VersionTooOldError = class extends VersionDiscoveryError {
3785
- constructor(hostname, availableVersions, minRequired = apiVersionConfig.MIN_SUPPORTED_VERSION) {
3786
- super(
3787
- `System API version is too old. Minimum supported: ${minRequired}. Available versions: ${availableVersions.join(
3788
- ", "
3789
- )}`,
3790
- hostname
3791
- );
3792
- this.availableVersions = availableVersions;
3793
- this.minRequired = minRequired;
3794
- }
3795
- };
3796
- var VersionTooNewError = class extends VersionDiscoveryError {
3797
- constructor(hostname, availableVersions, maxSupported = apiVersionConfig.MAX_SUPPORTED_VERSION) {
3798
- super(
3799
- `System API version is too new. Maximum supported: ${maxSupported}. Available versions: ${availableVersions.join(
3800
- ", "
3801
- )}`,
3802
- hostname
3803
- );
3804
- this.availableVersions = availableVersions;
3805
- this.maxSupported = maxSupported;
3806
- }
3807
- };
3808
- var VersionEndpointNotFoundError = class extends VersionDiscoveryError {
3809
- constructor(hostname, statusCode = 404) {
3810
- super(
3811
- `Version discovery endpoint not found: ${hostname} (HTTP ${String(
3812
- statusCode
3813
- )})`,
3814
- hostname
3815
- );
3816
- this.statusCode = statusCode;
3817
- }
3818
- };
3819
- var VersionDiscoveryTimeoutError = class extends VersionDiscoveryError {
3820
- constructor(hostname, timeoutMs = 5e3) {
3821
- super(
3822
- `Cannot connect to system (timeout after ${String(
3823
- timeoutMs
3824
- )}ms): ${hostname}`,
3825
- hostname
3826
- );
3827
- this.timeoutMs = timeoutMs;
3828
- }
3829
- };
3830
- var VersionDiscoveryNetworkError = class extends VersionDiscoveryError {
3831
- constructor(hostname, originalError) {
3832
- super(
3833
- `Network error connecting to ${hostname}: ${originalError.message}`,
3834
- hostname
3835
- );
3836
- this.originalError = originalError;
3837
- }
3838
- };
3839
- var NoCompatibleVersionsError = class extends VersionDiscoveryError {
3840
- constructor(hostname, availableVersions, supportedRange = {
3841
- min: apiVersionConfig.MIN_SUPPORTED_VERSION,
3842
- max: apiVersionConfig.MAX_SUPPORTED_VERSION
3843
- }) {
3844
- super(
3845
- `No compatible API versions available. Supported: ${supportedRange.min} to ${supportedRange.max}. Available: ${availableVersions.join(", ")}`,
3846
- hostname
3847
- );
3848
- this.availableVersions = availableVersions;
3849
- this.supportedRange = supportedRange;
3850
- }
3851
- };
3852
- var InvalidVersionResponseError = class extends VersionDiscoveryError {
3853
- constructor(hostname, reason) {
3854
- super(`Invalid API response format from ${hostname}: ${reason}`, hostname);
3855
- this.reason = reason;
3856
- }
3857
- };
3858
- var discoveryTimeoutMs = 5e3;
3859
- var probeTimeoutMs = 5e3;
3860
- function corsIsEnforced() {
3861
- const hasDocument = typeof window !== "undefined" && typeof window.document !== "undefined";
3862
- const inWorker = typeof globalThis.WorkerGlobalScope !== "undefined";
3863
- return hasDocument || inWorker;
3864
- }
3865
- function hasErrorName(error, expected) {
3866
- return typeof error === "object" && error !== null && "name" in error && error.name === expected;
3867
- }
3868
- var VersionDiscovery = class {
3869
- constructor(logger = noopLogger, protocol = "https:") {
3870
- this.logger = logger;
3871
- this.protocol = protocol;
3872
- this.versionCache = /* @__PURE__ */ new Map();
3873
- }
3874
- versionsUrl(hostname) {
3875
- return `${httpScheme(this.protocol)}//${hostname}/api/versions`;
3876
- }
3877
- /**
3878
- * Whether the appliance answers at all, asked in a way CORS cannot block.
3879
- *
3880
- * A `no-cors` request yields a response the page may not read, but its
3881
- * *arrival* is the whole answer here: something served it. That separates the
3882
- * two failures `fetch` reports identically — a box that refused to share its
3883
- * versions with this origin, and a box that is not there.
3884
- *
3885
- * `cannot-ask` where CORS is not enforced: nothing is blocking anything, so a
3886
- * failed fetch already means unreachable and a probe would only repeat what
3887
- * discovery just found. It is not a quieter way of saying "no".
3888
- */
3889
- async probeReachable(hostname) {
3890
- if (!corsIsEnforced()) return "cannot-ask";
3891
- const url = this.versionsUrl(hostname);
3892
- const controller = new AbortController();
3893
- const timer2 = setTimeout(() => controller.abort(), probeTimeoutMs);
3894
- try {
3895
- await fetch(url, {
3896
- mode: "no-cors",
3897
- cache: "no-store",
3898
- signal: controller.signal
3899
- });
3900
- this.logger.info("Reachability probe answered", { hostname, url });
3901
- return "reachable";
3902
- } catch (error) {
3903
- this.logger.warn("Reachability probe got no answer", {
3904
- hostname,
3905
- url,
3906
- error
3907
- });
3908
- return "silent";
3909
- } finally {
3910
- clearTimeout(timer2);
3911
- }
3912
- }
3913
- /**
3914
- * Discovers the API version for a given hostname.
3915
- *
3916
- * Makes a GET request to `{protocol}//{hostname}/api/versions` and returns the latest
3917
- * compatible version. Results are cached per hostname; the cache entry is removed
3918
- * on failure so the next call retries.
3919
- *
3920
- * @param hostname - The TrueNAS system hostname (e.g., "truenas.local")
3921
- * @returns Observable that emits the selected ApiVersion
3922
- * @throws VersionDiscoveryError subclasses for specific failure scenarios
3923
- */
3924
- discoverVersion(hostname) {
3925
- const cached = this.versionCache.get(hostname);
3926
- if (cached) {
3927
- this.logger.info("Version discovery cache hit", { hostname });
3928
- return cached;
3929
- }
3930
- this.logger.info("Starting version discovery", {
3931
- hostname,
3932
- url: this.versionsUrl(hostname)
3933
- });
3934
- const discovery$ = defer(() => from(this.fetchVersions(hostname))).pipe(
3935
- map$1((versionStrings) => this.selectVersion(hostname, versionStrings)),
3936
- catchError((error) => {
3937
- this.versionCache.delete(hostname);
3938
- this.logger.warn("Version discovery failed", { hostname, error });
3939
- return throwError(() => this.classify(error, hostname));
3940
- }),
3941
- shareReplay(1)
3942
- );
3943
- this.versionCache.set(hostname, discovery$);
3944
- return discovery$;
3945
- }
3946
- /**
3947
- * Clears the version cache for a specific hostname or all hostnames.
3948
- *
3949
- * @param hostname - Optional hostname to clear. If omitted, clears all cached versions.
3950
- */
3951
- clearCache(hostname) {
3952
- if (hostname) {
3953
- this.versionCache.delete(hostname);
3954
- } else {
3955
- this.versionCache.clear();
3956
- }
3957
- }
3958
- /**
3959
- * Performs the `fetch` with a 5-second `AbortController` timeout and inspects the
3960
- * *resolved* Response (fetch does not reject on non-2xx). Throws
3961
- * `VersionEndpointNotFoundError` on 404 and `InvalidVersionResponseError` on any
3962
- * other non-2xx or a body that is not an array of strings; lets `TypeError`
3963
- * (network) and `AbortError` (timeout) bubble to `classify`.
3964
- *
3965
- * The element-type check matters: a reachable server returning an array of
3966
- * non-strings (e.g. `[1, 2, 3]`) would otherwise reach `parseApiVersion`, whose
3967
- * `.match()` throws a `TypeError` on a non-string — which `classify` would then
3968
- * misfile as a network error. Validating here keeps it an `InvalidVersionResponseError`.
3969
- */
3970
- async fetchVersions(hostname) {
3971
- const url = this.versionsUrl(hostname);
3972
- const controller = new AbortController();
3973
- const timer2 = setTimeout(() => controller.abort(), discoveryTimeoutMs);
3974
- try {
3975
- const response = await fetch(url, { signal: controller.signal });
3976
- if (response.status === 404) {
3977
- throw new VersionEndpointNotFoundError(hostname);
3978
- }
3979
- if (!response.ok) {
3980
- throw new InvalidVersionResponseError(
3981
- hostname,
3982
- `HTTP ${String(response.status)}`
3983
- );
3984
- }
3985
- const body = await response.json();
3986
- if (!Array.isArray(body) || !body.every((v) => typeof v === "string")) {
3987
- throw new InvalidVersionResponseError(
3988
- hostname,
3989
- "Response was not an array of version strings"
3990
- );
3991
- }
3992
- return body;
3993
- } finally {
3994
- clearTimeout(timer2);
3995
- }
3996
- }
3997
- /**
3998
- * Parses, filters, and selects the latest compatible version from the raw response
3999
- * array. Throws the appropriate typed error when no valid/compatible version exists.
4000
- */
4001
- selectVersion(hostname, versionStrings) {
4002
- this.logger.info("Version discovery response received", {
4003
- hostname,
4004
- versionCount: versionStrings.length,
4005
- versions: versionStrings
4006
- });
4007
- const parsedVersions = versionStrings.map(parseApiVersion).filter((v) => v !== null);
4008
- if (parsedVersions.length === 0) {
4009
- this.logger.warn("No valid versions in response", {
4010
- hostname,
4011
- versionStrings
4012
- });
4013
- throw new InvalidVersionResponseError(
4014
- hostname,
4015
- "No valid API versions found in response"
4016
- );
4017
- }
4018
- const compatibleVersions = filterCompatibleVersions(parsedVersions);
4019
- this.logger.info("Version compatibility check", {
4020
- hostname,
4021
- total: parsedVersions.length,
4022
- compatible: compatibleVersions.length,
4023
- supportedRange: {
4024
- min: apiVersionConfig.MIN_SUPPORTED_VERSION,
4025
- max: apiVersionConfig.MAX_SUPPORTED_VERSION
4026
- }
4027
- });
4028
- if (compatibleVersions.length === 0) {
4029
- const allTooOld = parsedVersions.every(
4030
- (v) => checkVersionCompatibility(v) === "too-old" /* TooOld */
4031
- );
4032
- const allTooNew = parsedVersions.every(
4033
- (v) => checkVersionCompatibility(v) === "too-new" /* TooNew */
4034
- );
4035
- const availableVersions = parsedVersions.map((v) => v.version);
4036
- if (allTooOld) {
4037
- this.logger.warn("All available versions too old", {
4038
- hostname,
4039
- availableVersions
4040
- });
4041
- throw new VersionTooOldError(hostname, availableVersions);
4042
- } else if (allTooNew) {
4043
- this.logger.warn("All available versions too new", {
4044
- hostname,
4045
- availableVersions
4046
- });
4047
- throw new VersionTooNewError(hostname, availableVersions);
4048
- } else {
4049
- this.logger.warn("No compatible versions found", {
4050
- hostname,
4051
- availableVersions
4052
- });
4053
- throw new NoCompatibleVersionsError(hostname, availableVersions);
4054
- }
4055
- }
4056
- const sortedVersions = compatibleVersions.sort(
4057
- (a, b) => compareVersions(b, a)
4058
- );
4059
- const selectedVersion = sortedVersions[0];
4060
- this.logger.info("Version selected", {
4061
- hostname,
4062
- selected: selectedVersion.version,
4063
- websocketPath: selectedVersion.websocketPath
4064
- });
4065
- return selectedVersion;
4066
- }
4067
- /**
4068
- * Maps a raw failure to a typed {@link VersionDiscoveryError}. Errors thrown by
4069
- * `fetchVersions`/`selectVersion` are already typed and pass through unchanged; a
4070
- * `fetch` `TypeError` becomes {@link VersionDiscoveryNetworkError} (the CORS/network
4071
- * sentinel), an `AbortError` becomes {@link VersionDiscoveryTimeoutError}, and any
4072
- * other failure (e.g. an unparseable body's `SyntaxError`) becomes
4073
- * {@link InvalidVersionResponseError}.
4074
- */
4075
- classify(error, hostname) {
4076
- if (error instanceof VersionDiscoveryError) {
4077
- return error;
4078
- }
4079
- if (hasErrorName(error, "AbortError")) {
4080
- this.logger.warn("Version discovery timeout", { hostname });
4081
- return new VersionDiscoveryTimeoutError(hostname);
4082
- }
4083
- if (error instanceof TypeError) {
4084
- this.logger.warn("Version discovery network error", {
4085
- hostname,
4086
- message: error.message
4087
- });
4088
- return new VersionDiscoveryNetworkError(hostname, error);
4089
- }
4090
- const reason = error instanceof Error ? error.message : "Unknown error";
4091
- this.logger.warn("Version discovery failed with unknown error", {
4092
- hostname,
4093
- reason
4094
- });
4095
- return new InvalidVersionResponseError(
4096
- hostname,
4097
- `Versioned API not available. This system may be running an older TrueNAS version (requires v25.10.0+). ${reason}`
4098
- );
4099
- }
4100
- };
4101
-
4102
- // src/factory.ts
4103
- async function createTrueNasClient(opts) {
4104
- const { uuid, hostnames, systemName } = opts;
4105
- const logger = opts.logger ?? noopLogger;
4106
- if (!hostnames || hostnames.length === 0) {
4107
- throw new Error(
4108
- `Cannot create client for system ${uuid}: hostnames array is empty`
4109
- );
4110
- }
4111
- logger.info("Creating versioned API client", {
4112
- uuid: uuid.slice(0, 8),
4113
- hostnames: hostnames.join(", "),
4114
- systemName
4115
- });
4116
- if (opts.version !== void 0) {
4117
- if (!SUPPORTED_API_VERSIONS.includes(opts.version)) {
4118
- throw new Error(
4119
- `Cannot create client for system ${uuid}: '${opts.version}' is not a version this package ships types for. Supported: ${SUPPORTED_API_VERSIONS.join(", ")}.`
4120
- );
4121
- }
4122
- const known = parseApiVersion(opts.version);
4123
- if (!known) {
4124
- throw new Error(
4125
- `Cannot create client for system ${uuid}: supported version '${opts.version}' failed to parse.`
4126
- );
4127
- }
4128
- const compatibility = checkVersionCompatibility(known);
4129
- if (compatibility === "too-new" /* TooNew */) {
4130
- throw new VersionTooNewError(hostnames[0], [known.version]);
4131
- }
4132
- if (compatibility !== "compatible" /* Compatible */) {
4133
- throw new Error(
4134
- `Cannot create client for system ${uuid}: the supported version range is not usable (${apiVersionConfig.MIN_SUPPORTED_VERSION}..${apiVersionConfig.MAX_SUPPORTED_VERSION}).`
4135
- );
4136
- }
4137
- logger.info("API version supplied by the caller, skipping discovery", {
4138
- uuid: uuid.slice(0, 8),
4139
- version: known.version,
4140
- websocketPath: known.websocketPath
4141
- });
4142
- return instantiateClientForVersion(known, opts, logger);
4143
- }
4144
- const versionDiscovery = new VersionDiscovery(logger, opts.protocol);
4145
- let version;
4146
- try {
4147
- const winner = await discoverVersionFromAnyHostname(
4148
- hostnames,
4149
- versionDiscovery
4150
- );
4151
- version = winner.version;
4152
- logger.info("API version discovered, instantiating client", {
4153
- uuid: uuid.slice(0, 8),
4154
- // Which hostname answered is log context only. The client is built with
4155
- // the full hostname list regardless — the websocket connection races all
4156
- // of them anyway.
4157
- hostname: winner.hostname,
4158
- version: version.version,
4159
- websocketPath: version.websocketPath
4160
- });
4161
- } catch (error) {
4162
- const errorMessage = errorMessageOrDefault(error, "Unknown error");
4163
- if (!(error instanceof VersionDiscoveryNetworkError)) {
4164
- logger.error("Version discovery failed on every hostname", {
4165
- uuid: uuid.slice(0, 8),
4166
- hostnames: hostnames.join(", "),
4167
- error: errorMessage,
4168
- errorType: error instanceof Error ? error.constructor.name : typeof error
4169
- });
4170
- throw error;
4171
- }
4172
- const reachable = await probeAnyHostname(hostnames, versionDiscovery);
4173
- if (reachable === "silent") {
4174
- await sleep(unreachableRetryDelayMs);
4175
- }
4176
- try {
4177
- const retryWinner = await discoverVersionFromAnyHostname(
4178
- hostnames,
4179
- versionDiscovery
4180
- );
4181
- logger.info("Version discovery succeeded on retry", {
4182
- uuid: uuid.slice(0, 8),
4183
- hostname: retryWinner.hostname,
4184
- version: retryWinner.version.version,
4185
- firstError: errorMessage
4186
- });
4187
- version = retryWinner.version;
4188
- } catch (retryError) {
4189
- if (!(retryError instanceof VersionDiscoveryNetworkError)) {
4190
- throw retryError;
4191
- }
4192
- if (reachable !== "reachable") {
4193
- logger.error(
4194
- "Version discovery failed and the appliance did not answer a reachability probe; not assuming a version",
4195
- {
4196
- uuid: uuid.slice(0, 8),
4197
- hostnames: hostnames.join(", "),
4198
- probe: reachable === "silent" ? "no answer" : "not applicable",
4199
- error: errorMessageOrDefault(retryError, "Unknown error")
4200
- }
4201
- );
4202
- throw retryError;
4203
- }
4204
- const fallbackVersionString = apiVersionConfig.FALLBACK_VERSION;
4205
- const fallbackVersion = parseApiVersion(fallbackVersionString);
4206
- if (!fallbackVersion) {
4207
- logger.error("Invalid fallback version configuration", {
4208
- uuid: uuid.slice(0, 8),
4209
- hostnames: hostnames.join(", "),
4210
- fallbackVersion: fallbackVersionString
4211
- });
4212
- throw retryError;
4213
- }
4214
- logger.warn(
4215
- "Appliance is reachable but version discovery is still blocked; falling back to assumed version",
4216
- {
4217
- uuid: uuid.slice(0, 8),
4218
- hostnames: hostnames.join(", "),
4219
- fallbackVersion: fallbackVersionString,
4220
- originalError: errorMessage,
4221
- warning: "The appliance answered a probe but not /api/versions, which is what v25.10.0 looks like from a browser. If it is newer than that, this client is now pinned to the wrong surface."
4222
- }
4223
- );
4224
- version = fallbackVersion;
4225
- }
4226
- }
4227
- return instantiateClientForVersion(version, opts, logger);
4228
- }
4229
- var unreachableRetryDelayMs = 2500;
4230
- var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
4231
- async function probeAnyHostname(hostnames, versionDiscovery) {
4232
- const probes = hostnames.map(
4233
- (hostname) => versionDiscovery.probeReachable(hostname)
4234
- );
4235
- const remaining = new Set(probes);
4236
- let sawSilence = false;
4237
- while (remaining.size > 0) {
4238
- const settled = await Promise.race(
4239
- [...remaining].map((probe) => probe.then((result) => ({ probe, result })))
4240
- );
4241
- if (settled.result === "reachable") return "reachable";
4242
- if (settled.result === "silent") sawSilence = true;
4243
- remaining.delete(settled.probe);
4244
- }
4245
- return sawSilence ? "silent" : "cannot-ask";
4246
- }
4247
- async function discoverVersionFromAnyHostname(hostnames, versionDiscovery) {
4248
- const attempts = hostnames.map(
4249
- (hostname) => firstValueFrom(versionDiscovery.discoverVersion(hostname)).then(
4250
- (version) => ({ hostname, version })
4251
- )
4252
- );
4253
- try {
4254
- return await Promise.any(attempts);
4255
- } catch (error) {
4256
- const failures = error instanceof AggregateError ? error.errors : [error];
4257
- throw selectRepresentativeFailure(failures);
4258
- }
4259
- }
4260
- function selectRepresentativeFailure(failures) {
4261
- const isVersionError = (error) => (
4262
- // cases: valid response, but the given versions won't work for us
4263
- error instanceof VersionTooOldError || error instanceof VersionTooNewError || error instanceof NoCompatibleVersionsError || error instanceof VersionEndpointNotFoundError
4264
- );
4265
- const isNetworkError = (error) => error instanceof VersionDiscoveryNetworkError;
4266
- return failures.find(isVersionError) ?? failures.find(isNetworkError) ?? failures[0];
4267
- }
4268
- var CLIENT_BY_VERSION_KEY = {
4269
- "25.10": TrueNasApiClientV2510,
4270
- "26": TrueNasApiClientV26,
4271
- "27": TrueNasApiClientV27
4272
- };
4273
- function clientVersionKey(version) {
4274
- if (version.year <= legacyCutoffYear) {
4275
- return `${version.year.toString()}.${version.minor.toString().padStart(2, "0")}`;
4276
- }
4277
- return version.year.toString();
4278
- }
4279
- function instantiateClientForVersion(version, opts, logger) {
4280
- const { uuid, hostnames, enabled, systemName } = opts;
4281
- const versionKey = clientVersionKey(version);
4282
- const Client = CLIENT_BY_VERSION_KEY[versionKey];
4283
- if (!Client) {
4284
- logger.error("No client implementation for version", {
4285
- uuid: uuid.slice(0, 8),
4286
- version: version.version,
4287
- versionKey
4288
- });
4289
- throw new Error(
4290
- `No client implementation for API version ${version.version}. Version keys with a client: ${Object.keys(CLIENT_BY_VERSION_KEY).join(", ")}. Version key: ${versionKey}`
4291
- );
4292
- }
4293
- logger.info(`Instantiating ${Client.name}`, {
4294
- uuid: uuid.slice(0, 8),
4295
- version: version.version,
4296
- versionKey
4297
- });
4298
- return new Client(
4299
- uuid,
4300
- hostnames,
4301
- version,
4302
- enabled,
4303
- systemName,
4304
- logger,
4305
- opts.protocol
4306
- );
4307
- }
4308
- function errorMessageOrDefault(error, fallback) {
4309
- if (error instanceof Error) {
4310
- return error.message;
4311
- }
4312
- if (typeof error === "object" && error !== null && "message" in error && typeof error.message === "string") {
4313
- return error.message;
4314
- }
4315
- return fallback;
4316
- }
4317
-
4318
- // src/enums/user-role.enum.ts
4319
- var UserRole = /* @__PURE__ */ ((UserRole2) => {
4320
- UserRole2["FullAdmin"] = "FULL_ADMIN";
4321
- return UserRole2;
4322
- })(UserRole || {});
4323
-
4324
- export { AppState, AuthError, AuthErrorCode, 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 };
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-7QVRLQIZ.js';
4325
2
  //# sourceMappingURL=index.js.map
4326
3
  //# sourceMappingURL=index.js.map