@01.software/sdk 0.4.1 → 0.4.3
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/auth.d.cts +1 -1
- package/dist/auth.d.ts +1 -1
- package/dist/{const-BsO3aVX_.d.cts → const-C3GC2SxR.d.cts} +1 -1
- package/dist/{const-DZyvV9wU.d.ts → const-ikSyKVND.d.ts} +1 -1
- package/dist/index.cjs +18 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +18 -3
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-BsjHfeAF.d.cts → payload-types-DPka7hJu.d.cts} +27 -1
- package/dist/{payload-types-BsjHfeAF.d.ts → payload-types-DPka7hJu.d.ts} +27 -1
- package/dist/realtime.d.cts +2 -2
- package/dist/realtime.d.ts +2 -2
- package/dist/ui/flow.cjs.map +1 -1
- package/dist/ui/flow.d.cts +1 -1
- package/dist/ui/flow.d.ts +1 -1
- package/dist/ui/flow.js.map +1 -1
- package/dist/ui/form.d.cts +1 -1
- package/dist/ui/form.d.ts +1 -1
- package/dist/ui/video.d.cts +1 -1
- package/dist/ui/video.d.ts +1 -1
- package/dist/{webhook-CkL56e65.d.cts → webhook-B8BfJ_Ka.d.cts} +2 -2
- package/dist/{webhook-BBWl8O2f.d.ts → webhook-CvNTdBWV.d.ts} +2 -2
- package/dist/webhook.d.cts +3 -3
- package/dist/webhook.d.ts +3 -3
- package/package.json +3 -3
package/dist/auth.d.cts
CHANGED
package/dist/auth.d.ts
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -354,7 +354,7 @@ function resolveApiUrl() {
|
|
|
354
354
|
// src/core/internal/utils/http.ts
|
|
355
355
|
var DEFAULT_TIMEOUT = 3e4;
|
|
356
356
|
var DEFAULT_RETRYABLE_STATUSES = [408, 429, 500, 502, 503, 504];
|
|
357
|
-
var NON_RETRYABLE_STATUSES = [401, 403, 404, 422];
|
|
357
|
+
var NON_RETRYABLE_STATUSES = [400, 401, 403, 404, 422];
|
|
358
358
|
var SAFE_METHODS = ["GET", "HEAD", "OPTIONS"];
|
|
359
359
|
function debugLog(debug, type, message, data) {
|
|
360
360
|
if (!debug) return;
|
|
@@ -366,6 +366,7 @@ function debugLog(debug, type, message, data) {
|
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
368
|
function getErrorSuggestion(status) {
|
|
369
|
+
if (status === 400) return "The request data failed validation. Check field values and types.";
|
|
369
370
|
if (status === 401) return "Please check your authentication credentials.";
|
|
370
371
|
if (status === 403) return "Access denied. Check your credentials or permissions.";
|
|
371
372
|
if (status === 404) return "The requested resource was not found.";
|
|
@@ -375,6 +376,7 @@ function getErrorSuggestion(status) {
|
|
|
375
376
|
}
|
|
376
377
|
function parseErrorBody(response) {
|
|
377
378
|
return __async(this, null, function* () {
|
|
379
|
+
var _a;
|
|
378
380
|
const fallback = {
|
|
379
381
|
errorMessage: `HTTP ${response.status}: ${response.statusText}`,
|
|
380
382
|
userMessage: `Request failed (status: ${response.status})`
|
|
@@ -382,14 +384,27 @@ function parseErrorBody(response) {
|
|
|
382
384
|
try {
|
|
383
385
|
const body = yield response.json();
|
|
384
386
|
if (body.errors && Array.isArray(body.errors)) {
|
|
385
|
-
const
|
|
387
|
+
const fieldErrors = [];
|
|
388
|
+
for (const e of body.errors) {
|
|
389
|
+
if (((_a = e.data) == null ? void 0 : _a.errors) && Array.isArray(e.data.errors) && e.data.errors.length > 0) {
|
|
390
|
+
for (const fe of e.data.errors) {
|
|
391
|
+
fieldErrors.push({
|
|
392
|
+
field: fe.path || fe.field,
|
|
393
|
+
message: fe.message
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
} else if (e.field || e.message) {
|
|
397
|
+
fieldErrors.push({ field: e.field, message: e.message });
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
const details = (fieldErrors.length > 0 ? fieldErrors : body.errors).map(
|
|
386
401
|
(e) => e.field ? `${e.field}: ${e.message}` : e.message
|
|
387
402
|
).filter(Boolean).join("; ");
|
|
388
403
|
if (details) {
|
|
389
404
|
return {
|
|
390
405
|
errorMessage: `HTTP ${response.status}: ${details}`,
|
|
391
406
|
userMessage: details,
|
|
392
|
-
errors: body.errors
|
|
407
|
+
errors: fieldErrors.length > 0 ? fieldErrors : body.errors
|
|
393
408
|
};
|
|
394
409
|
}
|
|
395
410
|
}
|