@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/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,
@@ -2939,13 +2939,20 @@ var SynapCores = class {
2939
2939
  timeout: this.config.timeout,
2940
2940
  headers: {
2941
2941
  "Content-Type": "application/json",
2942
- "User-Agent": "synapcores-nodejs/0.4.0",
2942
+ "User-Agent": "synapcores-nodejs/0.4.2",
2943
2943
  ...authHeader
2944
2944
  },
2945
2945
  ...httpsAgent && { httpsAgent }
2946
2946
  });
2947
2947
  this.httpClient.interceptors.response.use(
2948
- (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
+ },
2949
2956
  (error) => this.handleError(error)
2950
2957
  );
2951
2958
  this.automl = new AutoMLClient(this);