@synapcores/sdk 0.4.0 → 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.d.mts CHANGED
@@ -1909,6 +1909,8 @@ declare class GraphEdgeApi {
1909
1909
  private readonly synapCores;
1910
1910
  constructor(synapCores: SynapCores);
1911
1911
  create(from: string, to: string, type: string, props?: Record<string, any>): Promise<GraphEdge>;
1912
+ /** Delete an edge by id. Mirrors `graph.nodes.delete`. */
1913
+ delete(id: string): Promise<void>;
1912
1914
  }
1913
1915
  declare class GraphIndexesApi {
1914
1916
  private readonly synapCores;
package/dist/index.d.ts CHANGED
@@ -1909,6 +1909,8 @@ declare class GraphEdgeApi {
1909
1909
  private readonly synapCores;
1910
1910
  constructor(synapCores: SynapCores);
1911
1911
  create(from: string, to: string, type: string, props?: Record<string, any>): Promise<GraphEdge>;
1912
+ /** Delete an edge by id. Mirrors `graph.nodes.delete`. */
1913
+ delete(id: string): Promise<void>;
1912
1914
  }
1913
1915
  declare class GraphIndexesApi {
1914
1916
  private readonly synapCores;
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,
@@ -2102,6 +2102,10 @@ var GraphEdgeApi = class {
2102
2102
  properties: data.properties ?? props
2103
2103
  };
2104
2104
  }
2105
+ /** Delete an edge by id. Mirrors `graph.nodes.delete`. */
2106
+ async delete(id) {
2107
+ await this.synapCores._getHttpClient().delete(`/graph/edges/${id}`);
2108
+ }
2105
2109
  };
2106
2110
  var GraphIndexesApi = class {
2107
2111
  constructor(synapCores) {
@@ -2998,13 +3002,20 @@ var SynapCores = class {
2998
3002
  timeout: this.config.timeout,
2999
3003
  headers: {
3000
3004
  "Content-Type": "application/json",
3001
- "User-Agent": "synapcores-nodejs/0.4.0",
3005
+ "User-Agent": "synapcores-nodejs/0.4.2",
3002
3006
  ...authHeader
3003
3007
  },
3004
3008
  ...httpsAgent && { httpsAgent }
3005
3009
  });
3006
3010
  this.httpClient.interceptors.response.use(
3007
- (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
+ },
3008
3019
  (error) => this.handleError(error)
3009
3020
  );
3010
3021
  this.automl = new AutoMLClient(this);