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