@dyrected/sdk 2.4.0 → 2.4.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.
package/dist/index.cjs CHANGED
@@ -1162,15 +1162,14 @@ var DyrectedClient = class {
1162
1162
  ...init,
1163
1163
  headers: allHeaders
1164
1164
  });
1165
- if (!res.ok) {
1166
- const body = await res.json().catch(() => ({ message: "Unknown error" }));
1167
- throw new DyrectedError(
1168
- body.message || `Request failed with status ${res.status}`,
1169
- res.status,
1170
- body.errors || []
1171
- );
1165
+ if (res && typeof res.ok === "boolean") {
1166
+ if (!res.ok) {
1167
+ const body = await res.json().catch(() => ({ message: "Unknown error" }));
1168
+ throw new DyrectedError(body.message || `Request failed with status ${res.status}`, res.status, body.code);
1169
+ }
1170
+ return res.json();
1172
1171
  }
1173
- return res.json();
1172
+ return res;
1174
1173
  }
1175
1174
  };
1176
1175
  function createClient(config) {
package/dist/index.js CHANGED
@@ -1124,15 +1124,14 @@ var DyrectedClient = class {
1124
1124
  ...init,
1125
1125
  headers: allHeaders
1126
1126
  });
1127
- if (!res.ok) {
1128
- const body = await res.json().catch(() => ({ message: "Unknown error" }));
1129
- throw new DyrectedError(
1130
- body.message || `Request failed with status ${res.status}`,
1131
- res.status,
1132
- body.errors || []
1133
- );
1127
+ if (res && typeof res.ok === "boolean") {
1128
+ if (!res.ok) {
1129
+ const body = await res.json().catch(() => ({ message: "Unknown error" }));
1130
+ throw new DyrectedError(body.message || `Request failed with status ${res.status}`, res.status, body.code);
1131
+ }
1132
+ return res.json();
1134
1133
  }
1135
- return res.json();
1134
+ return res;
1136
1135
  }
1137
1136
  };
1138
1137
  function createClient(config) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dyrected/sdk",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -23,7 +23,7 @@
23
23
  "tsup": "^8.5.1",
24
24
  "typescript": "^5.4.5",
25
25
  "vitest": "^1.0.0",
26
- "@dyrected/core": "2.4.0"
26
+ "@dyrected/core": "2.4.1"
27
27
  },
28
28
  "license": "BSL-1.1",
29
29
  "author": "Ajola Technologies Ltd",