@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/dist/index.mjs CHANGED
@@ -563,7 +563,7 @@ var AutoMLClient = class {
563
563
  const { data } = await this.synapCores._getHttpClient().get("/automl/models", {
564
564
  params: filters
565
565
  });
566
- 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 : [];
566
+ 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 : [];
567
567
  return list.map((model) => ({
568
568
  id: model.id ?? model.name,
569
569
  name: model.name,
@@ -2039,6 +2039,10 @@ var GraphEdgeApi = class {
2039
2039
  properties: data.properties ?? props
2040
2040
  };
2041
2041
  }
2042
+ /** Delete an edge by id. Mirrors `graph.nodes.delete`. */
2043
+ async delete(id) {
2044
+ await this.synapCores._getHttpClient().delete(`/graph/edges/${id}`);
2045
+ }
2042
2046
  };
2043
2047
  var GraphIndexesApi = class {
2044
2048
  constructor(synapCores) {
@@ -2935,13 +2939,20 @@ var SynapCores = class {
2935
2939
  timeout: this.config.timeout,
2936
2940
  headers: {
2937
2941
  "Content-Type": "application/json",
2938
- "User-Agent": "synapcores-nodejs/0.4.0",
2942
+ "User-Agent": "synapcores-nodejs/0.4.2",
2939
2943
  ...authHeader
2940
2944
  },
2941
2945
  ...httpsAgent && { httpsAgent }
2942
2946
  });
2943
2947
  this.httpClient.interceptors.response.use(
2944
- (response) => response,
2948
+ (response) => {
2949
+ const body = response.data;
2950
+ const isEnvelope = body && typeof body === "object" && !Array.isArray(body) && "data" in body && ("meta" in body || Object.keys(body).length === 1);
2951
+ if (isEnvelope) {
2952
+ response.data = body.data;
2953
+ }
2954
+ return response;
2955
+ },
2945
2956
  (error) => this.handleError(error)
2946
2957
  );
2947
2958
  this.automl = new AutoMLClient(this);