@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.
@@ -4065,11 +4065,28 @@ var SmartGatewayClient = class {
4065
4065
  return this.http.get("/status");
4066
4066
  }
4067
4067
  /**
4068
- * Check gateway readiness. Returns either `{ status: 'ready', ... }` with
4069
- * a verified host count or `{ status: 'not_ready', reason, ... }`.
4068
+ * Check gateway readiness. Resolves to either `{ status: 'ready', ... }`
4069
+ * with a verified host count or `{ status: 'not_ready', reason, ... }`.
4070
+ *
4071
+ * NOTE: `/api/v3/ready` returns **HTTP 503** when not ready (so load
4072
+ * balancers / k8s probes drain the origin). This method unwraps that 503's
4073
+ * body and still RESOLVES to a `GatewayReadinessResponse` — it does not
4074
+ * throw for a not-ready gateway. Genuine errors (non-readiness 503s, 5xx,
4075
+ * network) still throw.
4070
4076
  */
4071
4077
  async getReadiness() {
4072
- return this.http.get("/ready");
4078
+ try {
4079
+ return await this.http.get("/ready");
4080
+ } catch (err) {
4081
+ if (err instanceof SdkHttpError && err.statusCode === 503) {
4082
+ const d = err.details;
4083
+ const body = d?.context ?? d;
4084
+ if (body?.status === "not_ready") {
4085
+ return body;
4086
+ }
4087
+ }
4088
+ throw err;
4089
+ }
4073
4090
  }
4074
4091
  /** Check gateway liveness. */
4075
4092
  async getLiveness() {