@synapcores/sdk 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,29 @@
3
3
  All notable changes to `@synapcores/sdk` are documented here.
4
4
  This project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
5
 
6
+ ## 0.4.2 — 2026-05-22 — gateway envelope unwrap (fixes `executeQuery`, `sql`, prepared statements, embeddings)
7
+
8
+ ### Fixed
9
+
10
+ - **`client.executeQuery()` / `client.sql()` / prepared statements now return
11
+ rows.** The gateway wraps every success payload in a uniform envelope —
12
+ `{ data: <payload>, meta: { request_id, timestamp } }` — but several methods
13
+ read fields off the *envelope* (`data.columns`, `data.rows`, …) instead of the
14
+ payload, so they came back `undefined`. This forced consumers to drop down to
15
+ raw HTTP. The response is now unwrapped **once, centrally, in the Axios
16
+ response interceptor**, so every method and sub-client receives the bare
17
+ payload. Methods that already hand-unwrapped (`listCollectionsDetailed`,
18
+ `automl`, vector collections) keep working — their defensive `data?.data ?? data`
19
+ reads are now no-ops. Non-enveloped/streaming responses pass through untouched.
20
+ - **`automl.listModels()`** updated to read the unwrapped array shape
21
+ (`data` / `data.items`) with the older nested shapes kept as fallbacks.
22
+
23
+ ### Why this matters
24
+
25
+ Parameterized queries (`$1` placeholders) are bound **server-side** as of
26
+ gateway v1.6.6.6-ce; with this SDK release, `client.executeQuery({ sql, parameters })`
27
+ is the correct, injection-safe, end-to-end path — no raw-axios workaround needed.
28
+
6
29
  ## 0.4.0 — 2026-05-18 — vector-subsystem + auth alignment with v1.6.5.2-ce gateway
7
30
 
8
31
  Closes three wire-format gaps surfaced during the OpenClaw v0.1.0 integration.
package/dist/index.js CHANGED
@@ -626,7 +626,7 @@ var AutoMLClient = class {
626
626
  const { data } = await this.synapCores._getHttpClient().get("/automl/models", {
627
627
  params: filters
628
628
  });
629
- const list = Array.isArray(data) ? data : Array.isArray(data?.data) ? data.data : Array.isArray(data?.models) ? data.models : Array.isArray(data?.data?.items) ? data.data.items : [];
629
+ const list = Array.isArray(data) ? data : Array.isArray(data?.items) ? data.items : Array.isArray(data?.models) ? data.models : Array.isArray(data?.data) ? data.data : Array.isArray(data?.data?.items) ? data.data.items : [];
630
630
  return list.map((model) => ({
631
631
  id: model.id ?? model.name,
632
632
  name: model.name,
@@ -3002,13 +3002,20 @@ var SynapCores = class {
3002
3002
  timeout: this.config.timeout,
3003
3003
  headers: {
3004
3004
  "Content-Type": "application/json",
3005
- "User-Agent": "synapcores-nodejs/0.4.0",
3005
+ "User-Agent": "synapcores-nodejs/0.4.2",
3006
3006
  ...authHeader
3007
3007
  },
3008
3008
  ...httpsAgent && { httpsAgent }
3009
3009
  });
3010
3010
  this.httpClient.interceptors.response.use(
3011
- (response) => response,
3011
+ (response) => {
3012
+ const body = response.data;
3013
+ const isEnvelope = body && typeof body === "object" && !Array.isArray(body) && "data" in body && ("meta" in body || Object.keys(body).length === 1);
3014
+ if (isEnvelope) {
3015
+ response.data = body.data;
3016
+ }
3017
+ return response;
3018
+ },
3012
3019
  (error) => this.handleError(error)
3013
3020
  );
3014
3021
  this.automl = new AutoMLClient(this);