@truenas/api-client 8.0.0 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -17,7 +17,7 @@ const users = await firstValueFrom(
17
17
  for every supported release. A misspelled method, a missing parameter or a
18
18
  filter on a field that doesn't exist fails the build, not the user.
19
19
  - **Version-aware.** The client asks the appliance which API it speaks and
20
- builds the matching implementation. API versions v25.10.0 through v27.0.0
20
+ builds the matching implementation. API versions v25.10.0 through v28.0.0
21
21
  are supported side by side.
22
22
  - **One call across releases.** `client.ops` keeps working when middleware
23
23
  renames or reshapes an endpoint between versions.
@@ -137,12 +137,12 @@ Without a hint, the client is typed as the oldest supported version, since that
137
137
  is a safe floor against any appliance. Reach newer methods one of two ways:
138
138
 
139
139
  ```typescript
140
- // Discover the version, and write against v26:
141
- const client = await createTrueNasClient<ApiDirectoryV26_0_0>(options);
140
+ // Discover the version, and write against v27:
141
+ const client = await createTrueNasClient<ApiDirectoryV27_0_0>(options);
142
142
  client.api.query('container.query');
143
143
 
144
144
  // Or skip discovery, and let the types follow the version:
145
- const pinned = await createTrueNasClient({ ...options, version: 'v27.0.0' });
145
+ const pinned = await createTrueNasClient({ ...options, version: 'v28.0.0' });
146
146
  pinned.api.query('container.query');
147
147
  ```
148
148
 
@@ -1646,9 +1646,9 @@ __export(v25_10_5_exports, {
1646
1646
  ZfsTierRewriteJobEntryStatusInput: () => ZfsTierRewriteJobEntryStatusInput
1647
1647
  });
1648
1648
 
1649
- // src/generated/v26_0_0/index.ts
1650
- var v26_0_0_exports = {};
1651
- __export(v26_0_0_exports, {
1649
+ // src/generated/v27_0_0/index.ts
1650
+ var v27_0_0_exports = {};
1651
+ __export(v27_0_0_exports, {
1652
1652
  ACLTemplateEntryAcltypeInput: () => ACLTemplateEntryAcltypeInput,
1653
1653
  Access: () => Access,
1654
1654
  Aclmode: () => Aclmode,
@@ -1781,7 +1781,7 @@ __export(v26_0_0_exports, {
1781
1781
  ZpoolScrubRunAction: () => ZpoolScrubRunAction
1782
1782
  });
1783
1783
 
1784
- // src/generated/v26_0_0/api-types.ts
1784
+ // src/generated/v27_0_0/api-types.ts
1785
1785
  var Access = {
1786
1786
  Readonly: "READONLY",
1787
1787
  Writeonly: "WRITEONLY",
@@ -1903,9 +1903,9 @@ var ZpoolScrubRunAction = {
1903
1903
  Cancel: "CANCEL"
1904
1904
  };
1905
1905
 
1906
- // src/generated/v27_0_0/index.ts
1907
- var v27_0_0_exports = {};
1908
- __export(v27_0_0_exports, {
1906
+ // src/generated/v28_0_0/index.ts
1907
+ var v28_0_0_exports = {};
1908
+ __export(v28_0_0_exports, {
1909
1909
  ACLTemplateEntryAcltypeInput: () => ACLTemplateEntryAcltypeInput,
1910
1910
  Access: () => Access,
1911
1911
  Aclmode: () => Aclmode,
@@ -1928,7 +1928,7 @@ __export(v27_0_0_exports, {
1928
1928
  CloudTaskAttributesEncryption: () => CloudTaskAttributesEncryption,
1929
1929
  CloudTaskAttributesEncryptionInput: () => CloudTaskAttributesEncryptionInput,
1930
1930
  Code: () => Code,
1931
- Compression: () => Compression,
1931
+ Compression: () => Compression2,
1932
1932
  ContainerNICDeviceType: () => ContainerNICDeviceType,
1933
1933
  ContainerNICDeviceTypeInput: () => ContainerNICDeviceTypeInput,
1934
1934
  ContainerStatusState: () => ContainerStatusState,
@@ -2006,6 +2006,7 @@ __export(v27_0_0_exports, {
2006
2006
  Snapdir: () => Snapdir,
2007
2007
  SourceInput: () => SourceInput,
2008
2008
  SourceValueType: () => SourceValueType,
2009
+ SourceValueTypeInput: () => SourceValueTypeInput,
2009
2010
  SupportNewTicketCommunityTypeInput: () => SupportNewTicketCommunityTypeInput,
2010
2011
  Sync: () => Sync,
2011
2012
  SyslogServerTransport: () => SyslogServerTransport,
@@ -2039,7 +2040,67 @@ __export(v27_0_0_exports, {
2039
2040
  ZpoolScrubRunAction: () => ZpoolScrubRunAction
2040
2041
  });
2041
2042
 
2042
- // src/generated/v27_0_0/api-types.ts
2043
+ // src/generated/v28_0_0/api-types.ts
2044
+ var Compression2 = {
2045
+ On: "ON",
2046
+ Off: "OFF",
2047
+ Lz4: "LZ4",
2048
+ Gzip: "GZIP",
2049
+ Gzip1: "GZIP-1",
2050
+ Gzip2: "GZIP-2",
2051
+ Gzip3: "GZIP-3",
2052
+ Gzip4: "GZIP-4",
2053
+ Gzip5: "GZIP-5",
2054
+ Gzip6: "GZIP-6",
2055
+ Gzip7: "GZIP-7",
2056
+ Gzip8: "GZIP-8",
2057
+ Gzip9: "GZIP-9",
2058
+ Zstd: "ZSTD",
2059
+ ZstdFast: "ZSTD-FAST",
2060
+ Zle: "ZLE",
2061
+ Lzjb: "LZJB",
2062
+ Zstd1: "ZSTD-1",
2063
+ Zstd2: "ZSTD-2",
2064
+ Zstd3: "ZSTD-3",
2065
+ Zstd4: "ZSTD-4",
2066
+ Zstd5: "ZSTD-5",
2067
+ Zstd6: "ZSTD-6",
2068
+ Zstd7: "ZSTD-7",
2069
+ Zstd8: "ZSTD-8",
2070
+ Zstd9: "ZSTD-9",
2071
+ Zstd10: "ZSTD-10",
2072
+ Zstd11: "ZSTD-11",
2073
+ Zstd12: "ZSTD-12",
2074
+ Zstd13: "ZSTD-13",
2075
+ Zstd14: "ZSTD-14",
2076
+ Zstd15: "ZSTD-15",
2077
+ Zstd16: "ZSTD-16",
2078
+ Zstd17: "ZSTD-17",
2079
+ Zstd18: "ZSTD-18",
2080
+ Zstd19: "ZSTD-19",
2081
+ ZstdFast1: "ZSTD-FAST-1",
2082
+ ZstdFast2: "ZSTD-FAST-2",
2083
+ ZstdFast3: "ZSTD-FAST-3",
2084
+ ZstdFast4: "ZSTD-FAST-4",
2085
+ ZstdFast5: "ZSTD-FAST-5",
2086
+ ZstdFast6: "ZSTD-FAST-6",
2087
+ ZstdFast7: "ZSTD-FAST-7",
2088
+ ZstdFast8: "ZSTD-FAST-8",
2089
+ ZstdFast9: "ZSTD-FAST-9",
2090
+ ZstdFast10: "ZSTD-FAST-10",
2091
+ ZstdFast20: "ZSTD-FAST-20",
2092
+ ZstdFast30: "ZSTD-FAST-30",
2093
+ ZstdFast40: "ZSTD-FAST-40",
2094
+ ZstdFast50: "ZSTD-FAST-50",
2095
+ ZstdFast60: "ZSTD-FAST-60",
2096
+ ZstdFast70: "ZSTD-FAST-70",
2097
+ ZstdFast80: "ZSTD-FAST-80",
2098
+ ZstdFast90: "ZSTD-FAST-90",
2099
+ ZstdFast100: "ZSTD-FAST-100",
2100
+ ZstdFast500: "ZSTD-FAST-500",
2101
+ ZstdFast1000: "ZSTD-FAST-1000",
2102
+ Inherit: "INHERIT"
2103
+ };
2043
2104
  var Service2 = {
2044
2105
  Middleware: "MIDDLEWARE",
2045
2106
  S3: "S3",
@@ -2047,6 +2108,14 @@ var Service2 = {
2047
2108
  Sudo: "SUDO",
2048
2109
  System: "SYSTEM"
2049
2110
  };
2111
+ var SourceValueTypeInput = {
2112
+ None: "NONE",
2113
+ Default: "DEFAULT",
2114
+ Temporary: "TEMPORARY",
2115
+ Local: "LOCAL",
2116
+ Inherited: "INHERITED",
2117
+ Received: "RECEIVED"
2118
+ };
2050
2119
  var VMWareMatchDatastoresWithDatasetsResultFilesystemTypeInput = {
2051
2120
  Filesystem: "FILESYSTEM",
2052
2121
  Volume: "VOLUME"
@@ -2060,8 +2129,8 @@ var SUPPORTED_API_VERSIONS = [
2060
2129
  "v25.10.3",
2061
2130
  "v25.10.4",
2062
2131
  "v25.10.5",
2063
- "v26.0.0",
2064
- "v27.0.0"
2132
+ "v27.0.0",
2133
+ "v28.0.0"
2065
2134
  ];
2066
2135
 
2067
2136
  // src/types/api-version.type.ts
@@ -2069,6 +2138,7 @@ var VersionCompatibility = /* @__PURE__ */ ((VersionCompatibility2) => {
2069
2138
  VersionCompatibility2["Compatible"] = "compatible";
2070
2139
  VersionCompatibility2["TooOld"] = "too-old";
2071
2140
  VersionCompatibility2["TooNew"] = "too-new";
2141
+ VersionCompatibility2["Unsupported"] = "unsupported";
2072
2142
  VersionCompatibility2["Invalid"] = "invalid";
2073
2143
  return VersionCompatibility2;
2074
2144
  })(VersionCompatibility || {});
@@ -2270,7 +2340,7 @@ var TrueNasApi = class {
2270
2340
  *
2271
2341
  * The id comes from the first job event whose `message_ids` carries this
2272
2342
  * request's id, not from the response: what a job method returns on the wire
2273
- * differs by version (v25.10 answers with the id, v26 with `null`), while
2343
+ * differs by version (v25.10 answers with the id, v27 with `null`), while
2274
2344
  * the event correlation holds for both.
2275
2345
  *
2276
2346
  * @returns Observable that emits the job ID when received from websocket events
@@ -2427,7 +2497,7 @@ var apiVersionConfig = {
2427
2497
  * not write its client, so the ceiling is the newest version in
2428
2498
  * `CLIENT_BY_VERSION_KEY`. A factory test asserts the two agree.
2429
2499
  */
2430
- MAX_SUPPORTED_VERSION: "v27.0.0",
2500
+ MAX_SUPPORTED_VERSION: "v28.0.0",
2431
2501
  /**
2432
2502
  * Version assumed when discovery is CORS-blocked, as v25.10.0's
2433
2503
  * `/api/versions` is. Used only for an appliance that answers a reachability
@@ -2487,6 +2557,9 @@ function checkVersionCompatibility(version) {
2487
2557
  if (compareVersions(version, maxVersion) > 0) {
2488
2558
  return "too-new" /* TooNew */;
2489
2559
  }
2560
+ if (!SUPPORTED_API_VERSIONS.includes(version.version)) {
2561
+ return "unsupported" /* Unsupported */;
2562
+ }
2490
2563
  return "compatible" /* Compatible */;
2491
2564
  }
2492
2565
  function isVersionSupported(version) {
@@ -2592,7 +2665,7 @@ var TrueNasAuthenticator = class _TrueNasAuthenticator {
2592
2665
  /**
2593
2666
  * `login_options` asking for a reconnect token, when the server understands it.
2594
2667
  *
2595
- * Omitted below v26. `AuthCommonOptions` is `additionalProperties: false`
2668
+ * Omitted below v27. `AuthCommonOptions` is `additionalProperties: false`
2596
2669
  * there and has only `user_info`, so sending the member is a validation
2597
2670
  * error, not an ignored field — it would fail login outright on the oldest
2598
2671
  * version this client supports.
@@ -2600,7 +2673,7 @@ var TrueNasAuthenticator = class _TrueNasAuthenticator {
2600
2673
  /**
2601
2674
  * Two things this does not do, both deliberate and both worth knowing.
2602
2675
  *
2603
- * There is no way for a consumer to decline: every v26+ password login now
2676
+ * There is no way for a consumer to decline: every v27+ password login now
2604
2677
  * mints a single-use credential carrying that session's roles, whether or not
2605
2678
  * the caller wants one. And the auto-relogin in the constructor subscribes
2606
2679
  * with no observer, so the token it mints is dropped — a caller reconnecting
@@ -2735,7 +2808,7 @@ var TrueNasAuthenticator = class _TrueNasAuthenticator {
2735
2808
  * e.g. to open another connection without asking for the password again.
2736
2809
  *
2737
2810
  * Tokens are single-use, short-lived, and voided by a `middlewared` restart.
2738
- * On v26+ each successful login mints a new one; store the newest. Token
2811
+ * On v27+ each successful login mints a new one; store the newest. Token
2739
2812
  * sessions are not re-logged automatically on reconnect — the caller must.
2740
2813
  */
2741
2814
  loginWithToken(token) {
@@ -2794,7 +2867,7 @@ var TrueNasAuthenticator = class _TrueNasAuthenticator {
2794
2867
  );
2795
2868
  }
2796
2869
  /**
2797
- * No reconnect token is requested here, though v26+ would mint one: an
2870
+ * No reconnect token is requested here, though v27+ would mint one: an
2798
2871
  * api-key session already reconnects without a prompt, since the key is held
2799
2872
  * and replayed. The token exists for the credential that cannot be.
2800
2873
  */
@@ -3457,7 +3530,7 @@ function toAppState(state) {
3457
3530
  case "STARTING":
3458
3531
  case "DEPLOYING":
3459
3532
  return "DEPLOYING" /* Deploying */;
3460
- // v25.10's freezer states are the same idea as v26's `SUSPENDED`: the
3533
+ // v25.10's freezer states are the same idea as v27's `SUSPENDED`: the
3461
3534
  // processes are paused, not exited. `FROZEN` is that pause completed, so it
3462
3535
  // and `SUSPENDED` are the same answer.
3463
3536
  case "SUSPENDED":
@@ -3569,14 +3642,14 @@ function toContainer(instance) {
3569
3642
  // declares only `description`, but the API returns `architecture`, `os`,
3570
3643
  // `release` and more, and callers were already receiving them. Narrowing
3571
3644
  // to the declared field would take data away to match a type that was
3572
- // always an under-declaration — the same call as the v26 `description`
3645
+ // always an under-declaration — the same call as the v27 `description`
3573
3646
  // widening, decided the same way.
3574
3647
  image: instance.image.description === null ? void 0 : { ...instance.image, description: instance.image.description }
3575
3648
  };
3576
3649
  }
3577
- var TrueNasApiClientV26 = class extends TrueNasApiClient {
3650
+ var TrueNasApiClientV27 = class extends TrueNasApiClient {
3578
3651
  /**
3579
- * Create v26-specific operation mappings
3652
+ * Create v27-specific operation mappings
3580
3653
  *
3581
3654
  * Operations return Observable<Job | null>:
3582
3655
  * - Async operations emit Job updates until complete
@@ -3590,7 +3663,7 @@ var TrueNasApiClientV26 = class extends TrueNasApiClient {
3590
3663
  containerQuery: () => this.api.query("container.query").pipe(
3591
3664
  map((containers) => containers.map(toContainer2))
3592
3665
  ),
3593
- // container.start is synchronous in v26.0.0 - emit null
3666
+ // container.start is synchronous in v27.0.0 - emit null
3594
3667
  containerStart: (id) => this.api.call("container.start", [parseInt(id, 10)]).pipe(map(() => null)),
3595
3668
  // container.stop emits job updates
3596
3669
  containerStop: (id, options) => this.api.job("container.stop", [
@@ -3600,7 +3673,7 @@ var TrueNasApiClientV26 = class extends TrueNasApiClient {
3600
3673
  force_after_timeout: options.force
3601
3674
  }
3602
3675
  ]),
3603
- // v26.0.0 doesn't have container.restart - chain stop + start
3676
+ // v27.0.0 doesn't have container.restart - chain stop + start
3604
3677
  // Emits Job updates during stop, then null when start completes
3605
3678
  containerRestart: (id, options) => {
3606
3679
  const numericId = parseInt(id, 10);
@@ -3652,9 +3725,9 @@ function toContainer2(container) {
3652
3725
  description
3653
3726
  };
3654
3727
  }
3655
- var TrueNasApiClientV27 = class extends TrueNasApiClient {
3728
+ var TrueNasApiClientV28 = class extends TrueNasApiClient {
3656
3729
  /**
3657
- * Create v27-specific operation mappings
3730
+ * Create v28-specific operation mappings
3658
3731
  *
3659
3732
  * Operations return Observable<Job | null>:
3660
3733
  * - Async operations emit Job updates until complete
@@ -3668,7 +3741,7 @@ var TrueNasApiClientV27 = class extends TrueNasApiClient {
3668
3741
  containerQuery: () => this.api.query("container.query").pipe(
3669
3742
  map((containers) => containers.map(toContainer3))
3670
3743
  ),
3671
- // container.start is synchronous in v27 - emit null
3744
+ // container.start is synchronous in v28 - emit null
3672
3745
  containerStart: (id) => this.api.call("container.start", [parseInt(id, 10)]).pipe(map(() => null)),
3673
3746
  // container.stop emits job updates
3674
3747
  containerStop: (id, options) => this.api.job("container.stop", [
@@ -3678,7 +3751,7 @@ var TrueNasApiClientV27 = class extends TrueNasApiClient {
3678
3751
  force_after_timeout: options.force
3679
3752
  }
3680
3753
  ]),
3681
- // v27 still has no container.restart - chain stop + start.
3754
+ // v28 still has no container.restart - chain stop + start.
3682
3755
  // Emits Job updates during stop, then null when start completes.
3683
3756
  containerRestart: (id, options) => {
3684
3757
  const numericId = parseInt(id, 10);
@@ -3700,7 +3773,7 @@ var TrueNasApiClientV27 = class extends TrueNasApiClient {
3700
3773
  )
3701
3774
  );
3702
3775
  },
3703
- // Absent options are omitted, as in v26: `[id, null]` fails validation.
3776
+ // Absent options are omitted, as in v27: `[id, null]` fails validation.
3704
3777
  containerDelete: (id, options) => this.api.job(
3705
3778
  "container.delete",
3706
3779
  options ? [parseInt(id, 10), options] : [parseInt(id, 10)]
@@ -3797,13 +3870,16 @@ var NoCompatibleVersionsError = class extends VersionDiscoveryError {
3797
3870
  constructor(hostname, availableVersions, supportedRange = {
3798
3871
  min: apiVersionConfig.MIN_SUPPORTED_VERSION,
3799
3872
  max: apiVersionConfig.MAX_SUPPORTED_VERSION
3800
- }) {
3873
+ }, supportedVersions = SUPPORTED_API_VERSIONS) {
3801
3874
  super(
3802
- `No compatible API versions available. Supported: ${supportedRange.min} to ${supportedRange.max}. Available: ${availableVersions.join(", ")}`,
3875
+ `No compatible API versions available. Supported: ${supportedVersions.join(
3876
+ ", "
3877
+ )}. Available: ${availableVersions.join(", ")}`,
3803
3878
  hostname
3804
3879
  );
3805
3880
  this.availableVersions = availableVersions;
3806
3881
  this.supportedRange = supportedRange;
3882
+ this.supportedVersions = supportedVersions;
3807
3883
  }
3808
3884
  };
3809
3885
  var InvalidVersionResponseError = class extends VersionDiscoveryError {
@@ -4222,8 +4298,8 @@ function selectRepresentativeFailure(failures) {
4222
4298
  }
4223
4299
  var CLIENT_BY_VERSION_KEY = {
4224
4300
  "25.10": TrueNasApiClientV2510,
4225
- "26": TrueNasApiClientV26,
4226
- "27": TrueNasApiClientV27
4301
+ "27": TrueNasApiClientV27,
4302
+ "28": TrueNasApiClientV28
4227
4303
  };
4228
4304
  function clientVersionKey(version) {
4229
4305
  if (version.year <= legacyCutoffYear) {
@@ -4280,6 +4356,6 @@ var UserRole = /* @__PURE__ */ ((UserRole2) => {
4280
4356
  return UserRole2;
4281
4357
  })(UserRole || {});
4282
4358
 
4283
- export { AppState, AuthError, AuthErrorCode, AuthResponseType, InvalidVersionResponseError, JobState, NoCompatibleVersionsError, SUPPORTED_API_VERSIONS, TrueNasApiClient, TrueNasApiClientV2510, TrueNasApiClientV26, TrueNasApiClientV27, TrueNasAuthMechanism, TrueNasAuthenticator, TrueNasConnection, UserRole, VersionCompatibility, VersionDiscovery, VersionDiscoveryError, VersionDiscoveryNetworkError, VersionDiscoveryTimeoutError, VersionEndpointNotFoundError, VersionTooNewError, VersionTooOldError, clientClassFor, consoleLogger, createTrueNasClient, getApiErrorMessage, getCloseMessage, isJobFinished, noopLogger, parseApiVersion, policyViolationCloseCode, v25_10_0_exports, v25_10_1_exports, v25_10_2_exports, v25_10_3_exports, v25_10_4_exports, v25_10_5_exports, v26_0_0_exports, v27_0_0_exports };
4284
- //# sourceMappingURL=chunk-RH7UXULE.js.map
4285
- //# sourceMappingURL=chunk-RH7UXULE.js.map
4359
+ export { AppState, AuthError, AuthErrorCode, AuthResponseType, InvalidVersionResponseError, JobState, NoCompatibleVersionsError, SUPPORTED_API_VERSIONS, TrueNasApiClient, TrueNasApiClientV2510, TrueNasApiClientV27, TrueNasApiClientV28, TrueNasAuthMechanism, TrueNasAuthenticator, TrueNasConnection, UserRole, VersionCompatibility, VersionDiscovery, VersionDiscoveryError, VersionDiscoveryNetworkError, VersionDiscoveryTimeoutError, VersionEndpointNotFoundError, VersionTooNewError, VersionTooOldError, clientClassFor, consoleLogger, createTrueNasClient, getApiErrorMessage, getCloseMessage, isJobFinished, noopLogger, parseApiVersion, policyViolationCloseCode, v25_10_0_exports, v25_10_1_exports, v25_10_2_exports, v25_10_3_exports, v25_10_4_exports, v25_10_5_exports, v27_0_0_exports, v28_0_0_exports };
4360
+ //# sourceMappingURL=chunk-LFNAVARU.js.map
4361
+ //# sourceMappingURL=chunk-LFNAVARU.js.map