@hsuite/smart-engines-sdk 3.6.0 → 3.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.6.1 — 2026-06-15
4
+
5
+ ### Fixed
6
+
7
+ - **`SmartGatewayClient.getReadiness()` no longer throws when the gateway is not ready.** The gateway's `/api/v3/ready` now returns **HTTP 503** (was 200) when not ready — honest readiness so load balancers / k8s probes can drain a degraded origin. `getReadiness()` now unwraps that 503: the gateway's global exception filter wraps the body as `{statusCode,error,message,context:{status:'not_ready',...}}` (payload under `context`; a non-filtered server's flat top-level body is also accepted), and the method still **resolves** to a `GatewayReadinessResponse` (`{status:'ready'|'not_ready'}`) in both the ready (200) and not-ready (503) cases. Return shape unchanged; genuine errors (non-readiness 503s, 5xx, network) still throw. (#1114)
8
+
3
9
  ## 3.5.0 — 2026-06-01
4
10
 
5
11
  **100% prod-ready arc.** Final cleanup pass after the 3.4.x publication. Closes every finding from two rounds of adversarial verification: legacy/dead-API code removed, BaaS dual-transport collapsed onto the shared HttpClient, path-traversal exposure closed via `encodePathParam` repo-wide, typed signer surfaces narrowed off `any`, test coverage taken from 62% → 90% statements / 49% → 81% branches / 64% → 85% functions / 63% → 91% lines, README + compodoc shipped, and one phantom test spec (615 lines that never imported the class it claimed to test) replaced with 43 real tests.
package/dist/index.js CHANGED
@@ -9688,11 +9688,28 @@ var SmartGatewayClient = class {
9688
9688
  return this.http.get("/status");
9689
9689
  }
9690
9690
  /**
9691
- * Check gateway readiness. Returns either `{ status: 'ready', ... }` with
9692
- * a verified host count or `{ status: 'not_ready', reason, ... }`.
9691
+ * Check gateway readiness. Resolves to either `{ status: 'ready', ... }`
9692
+ * with a verified host count or `{ status: 'not_ready', reason, ... }`.
9693
+ *
9694
+ * NOTE: `/api/v3/ready` returns **HTTP 503** when not ready (so load
9695
+ * balancers / k8s probes drain the origin). This method unwraps that 503's
9696
+ * body and still RESOLVES to a `GatewayReadinessResponse` — it does not
9697
+ * throw for a not-ready gateway. Genuine errors (non-readiness 503s, 5xx,
9698
+ * network) still throw.
9693
9699
  */
9694
9700
  async getReadiness() {
9695
- return this.http.get("/ready");
9701
+ try {
9702
+ return await this.http.get("/ready");
9703
+ } catch (err) {
9704
+ if (err instanceof SdkHttpError && err.statusCode === 503) {
9705
+ const d = err.details;
9706
+ const body = d?.context ?? d;
9707
+ if (body?.status === "not_ready") {
9708
+ return body;
9709
+ }
9710
+ }
9711
+ throw err;
9712
+ }
9696
9713
  }
9697
9714
  /** Check gateway liveness. */
9698
9715
  async getLiveness() {