@truenas/api-client 6.0.1 → 6.0.3

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