@acedatacloud/sdk 0.0.1 → 2026.322.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.
@@ -90,12 +90,13 @@ class Transport {
90
90
  });
91
91
  clearTimeout(timer);
92
92
  if (resp.status >= 400) {
93
+ const text = await resp.text();
93
94
  let body;
94
95
  try {
95
- body = (await resp.json());
96
+ body = JSON.parse(text);
96
97
  }
97
98
  catch {
98
- body = { error: { code: 'unknown', message: await resp.text() } };
99
+ body = { error: { code: 'unknown', message: text } };
99
100
  }
100
101
  if (RETRY_STATUS_CODES.has(resp.status) && attempt < this.maxRetries) {
101
102
  await sleep(backoffDelay(attempt) * 1000);
@@ -131,12 +132,13 @@ class Transport {
131
132
  signal: controller.signal,
132
133
  });
133
134
  if (resp.status >= 400) {
135
+ const text = await resp.text();
134
136
  let body;
135
137
  try {
136
- body = (await resp.json());
138
+ body = JSON.parse(text);
137
139
  }
138
140
  catch {
139
- body = { error: { code: 'unknown', message: '' } };
141
+ body = { error: { code: 'unknown', message: text } };
140
142
  }
141
143
  throw mapError(resp.status, body);
142
144
  }
@@ -191,12 +193,13 @@ class Transport {
191
193
  });
192
194
  clearTimeout(timer);
193
195
  if (resp.status >= 400) {
196
+ const text = await resp.text();
194
197
  let respBody;
195
198
  try {
196
- respBody = (await resp.json());
199
+ respBody = JSON.parse(text);
197
200
  }
198
201
  catch {
199
- respBody = { error: { code: 'unknown', message: await resp.text() } };
202
+ respBody = { error: { code: 'unknown', message: text } };
200
203
  }
201
204
  throw mapError(resp.status, respBody);
202
205
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acedatacloud/sdk",
3
- "version": "0.0.1",
3
+ "version": "2026.322.1",
4
4
  "description": "Official TypeScript SDK for AceDataCloud — AI-powered data services",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -10,13 +10,13 @@
10
10
  "test": "jest --forceExit",
11
11
  "lint": "tsc --noEmit"
12
12
  },
13
- "dependencies": {},
14
13
  "devDependencies": {
15
- "typescript": "^5.0.0",
14
+ "@types/jest": "^29.0.0",
16
15
  "@types/node": "^20.0.0",
16
+ "dotenv": "^17.3.1",
17
17
  "jest": "^29.0.0",
18
18
  "ts-jest": "^29.0.0",
19
- "@types/jest": "^29.0.0"
19
+ "typescript": "^5.0.0"
20
20
  },
21
21
  "files": [
22
22
  "dist",
@@ -125,11 +125,12 @@ export class Transport {
125
125
  clearTimeout(timer);
126
126
 
127
127
  if (resp.status >= 400) {
128
+ const text = await resp.text();
128
129
  let body: Record<string, unknown>;
129
130
  try {
130
- body = (await resp.json()) as Record<string, unknown>;
131
+ body = JSON.parse(text) as Record<string, unknown>;
131
132
  } catch {
132
- body = { error: { code: 'unknown', message: await resp.text() } };
133
+ body = { error: { code: 'unknown', message: text } };
133
134
  }
134
135
  if (RETRY_STATUS_CODES.has(resp.status) && attempt < this.maxRetries) {
135
136
  await sleep(backoffDelay(attempt) * 1000);
@@ -171,11 +172,12 @@ export class Transport {
171
172
  });
172
173
 
173
174
  if (resp.status >= 400) {
175
+ const text = await resp.text();
174
176
  let body: Record<string, unknown>;
175
177
  try {
176
- body = (await resp.json()) as Record<string, unknown>;
178
+ body = JSON.parse(text) as Record<string, unknown>;
177
179
  } catch {
178
- body = { error: { code: 'unknown', message: '' } };
180
+ body = { error: { code: 'unknown', message: text } };
179
181
  }
180
182
  throw mapError(resp.status, body);
181
183
  }
@@ -241,11 +243,12 @@ export class Transport {
241
243
  clearTimeout(timer);
242
244
 
243
245
  if (resp.status >= 400) {
246
+ const text = await resp.text();
244
247
  let respBody: Record<string, unknown>;
245
248
  try {
246
- respBody = (await resp.json()) as Record<string, unknown>;
249
+ respBody = JSON.parse(text) as Record<string, unknown>;
247
250
  } catch {
248
- respBody = { error: { code: 'unknown', message: await resp.text() } };
251
+ respBody = { error: { code: 'unknown', message: text } };
249
252
  }
250
253
  throw mapError(resp.status, respBody);
251
254
  }