@scalemule/nextjs 0.0.2 → 0.0.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/client.js +19 -7
- package/dist/client.mjs +19 -7
- package/dist/index.js +19 -7
- package/dist/index.mjs +19 -7
- package/dist/server/auth.js +12 -4
- package/dist/server/auth.mjs +12 -4
- package/dist/server/index.js +12 -4
- package/dist/server/index.mjs +12 -4
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -443,11 +443,15 @@ var ScaleMuleClient = class {
|
|
|
443
443
|
});
|
|
444
444
|
clearTimeout(timeoutId);
|
|
445
445
|
const text = await response.text();
|
|
446
|
-
|
|
446
|
+
let responseData = null;
|
|
447
|
+
try {
|
|
448
|
+
responseData = text ? JSON.parse(text) : null;
|
|
449
|
+
} catch {
|
|
450
|
+
}
|
|
447
451
|
if (!response.ok) {
|
|
448
452
|
const error = responseData?.error || {
|
|
449
453
|
code: `HTTP_${response.status}`,
|
|
450
|
-
message: responseData?.message || response.statusText
|
|
454
|
+
message: responseData?.message || text || response.statusText
|
|
451
455
|
};
|
|
452
456
|
if (attempt < maxRetries && RETRYABLE_STATUS_CODES.has(response.status)) {
|
|
453
457
|
lastError = error;
|
|
@@ -586,11 +590,15 @@ var ScaleMuleClient = class {
|
|
|
586
590
|
body: retryFormData
|
|
587
591
|
});
|
|
588
592
|
const uploadText = await response.text();
|
|
589
|
-
|
|
593
|
+
let responseData = null;
|
|
594
|
+
try {
|
|
595
|
+
responseData = uploadText ? JSON.parse(uploadText) : null;
|
|
596
|
+
} catch {
|
|
597
|
+
}
|
|
590
598
|
if (!response.ok) {
|
|
591
599
|
const error = responseData?.error || {
|
|
592
600
|
code: `HTTP_${response.status}`,
|
|
593
|
-
message: responseData?.message || response.statusText
|
|
601
|
+
message: responseData?.message || uploadText || response.statusText
|
|
594
602
|
};
|
|
595
603
|
if (attempt < maxRetries && RETRYABLE_STATUS_CODES.has(response.status)) {
|
|
596
604
|
lastError = error;
|
|
@@ -669,14 +677,18 @@ var ScaleMuleClient = class {
|
|
|
669
677
|
});
|
|
670
678
|
xhr.addEventListener("load", () => {
|
|
671
679
|
try {
|
|
672
|
-
|
|
680
|
+
let data = null;
|
|
681
|
+
try {
|
|
682
|
+
data = xhr.responseText ? JSON.parse(xhr.responseText) : null;
|
|
683
|
+
} catch {
|
|
684
|
+
}
|
|
673
685
|
if (xhr.status >= 200 && xhr.status < 300) {
|
|
674
686
|
const unwrapped = data?.data !== void 0 ? data.data : data;
|
|
675
687
|
resolve(unwrapped);
|
|
676
688
|
} else {
|
|
677
|
-
reject(new ScaleMuleApiError(data
|
|
689
|
+
reject(new ScaleMuleApiError(data?.error || {
|
|
678
690
|
code: `HTTP_${xhr.status}`,
|
|
679
|
-
message: data
|
|
691
|
+
message: data?.message || xhr.responseText || "Upload failed"
|
|
680
692
|
}));
|
|
681
693
|
}
|
|
682
694
|
} catch {
|
package/dist/client.mjs
CHANGED
|
@@ -441,11 +441,15 @@ var ScaleMuleClient = class {
|
|
|
441
441
|
});
|
|
442
442
|
clearTimeout(timeoutId);
|
|
443
443
|
const text = await response.text();
|
|
444
|
-
|
|
444
|
+
let responseData = null;
|
|
445
|
+
try {
|
|
446
|
+
responseData = text ? JSON.parse(text) : null;
|
|
447
|
+
} catch {
|
|
448
|
+
}
|
|
445
449
|
if (!response.ok) {
|
|
446
450
|
const error = responseData?.error || {
|
|
447
451
|
code: `HTTP_${response.status}`,
|
|
448
|
-
message: responseData?.message || response.statusText
|
|
452
|
+
message: responseData?.message || text || response.statusText
|
|
449
453
|
};
|
|
450
454
|
if (attempt < maxRetries && RETRYABLE_STATUS_CODES.has(response.status)) {
|
|
451
455
|
lastError = error;
|
|
@@ -584,11 +588,15 @@ var ScaleMuleClient = class {
|
|
|
584
588
|
body: retryFormData
|
|
585
589
|
});
|
|
586
590
|
const uploadText = await response.text();
|
|
587
|
-
|
|
591
|
+
let responseData = null;
|
|
592
|
+
try {
|
|
593
|
+
responseData = uploadText ? JSON.parse(uploadText) : null;
|
|
594
|
+
} catch {
|
|
595
|
+
}
|
|
588
596
|
if (!response.ok) {
|
|
589
597
|
const error = responseData?.error || {
|
|
590
598
|
code: `HTTP_${response.status}`,
|
|
591
|
-
message: responseData?.message || response.statusText
|
|
599
|
+
message: responseData?.message || uploadText || response.statusText
|
|
592
600
|
};
|
|
593
601
|
if (attempt < maxRetries && RETRYABLE_STATUS_CODES.has(response.status)) {
|
|
594
602
|
lastError = error;
|
|
@@ -667,14 +675,18 @@ var ScaleMuleClient = class {
|
|
|
667
675
|
});
|
|
668
676
|
xhr.addEventListener("load", () => {
|
|
669
677
|
try {
|
|
670
|
-
|
|
678
|
+
let data = null;
|
|
679
|
+
try {
|
|
680
|
+
data = xhr.responseText ? JSON.parse(xhr.responseText) : null;
|
|
681
|
+
} catch {
|
|
682
|
+
}
|
|
671
683
|
if (xhr.status >= 200 && xhr.status < 300) {
|
|
672
684
|
const unwrapped = data?.data !== void 0 ? data.data : data;
|
|
673
685
|
resolve(unwrapped);
|
|
674
686
|
} else {
|
|
675
|
-
reject(new ScaleMuleApiError(data
|
|
687
|
+
reject(new ScaleMuleApiError(data?.error || {
|
|
676
688
|
code: `HTTP_${xhr.status}`,
|
|
677
|
-
message: data
|
|
689
|
+
message: data?.message || xhr.responseText || "Upload failed"
|
|
678
690
|
}));
|
|
679
691
|
}
|
|
680
692
|
} catch {
|
package/dist/index.js
CHANGED
|
@@ -448,11 +448,15 @@ var ScaleMuleClient = class {
|
|
|
448
448
|
});
|
|
449
449
|
clearTimeout(timeoutId);
|
|
450
450
|
const text = await response.text();
|
|
451
|
-
|
|
451
|
+
let responseData = null;
|
|
452
|
+
try {
|
|
453
|
+
responseData = text ? JSON.parse(text) : null;
|
|
454
|
+
} catch {
|
|
455
|
+
}
|
|
452
456
|
if (!response.ok) {
|
|
453
457
|
const error = responseData?.error || {
|
|
454
458
|
code: `HTTP_${response.status}`,
|
|
455
|
-
message: responseData?.message || response.statusText
|
|
459
|
+
message: responseData?.message || text || response.statusText
|
|
456
460
|
};
|
|
457
461
|
if (attempt < maxRetries && RETRYABLE_STATUS_CODES.has(response.status)) {
|
|
458
462
|
lastError = error;
|
|
@@ -591,11 +595,15 @@ var ScaleMuleClient = class {
|
|
|
591
595
|
body: retryFormData
|
|
592
596
|
});
|
|
593
597
|
const uploadText = await response.text();
|
|
594
|
-
|
|
598
|
+
let responseData = null;
|
|
599
|
+
try {
|
|
600
|
+
responseData = uploadText ? JSON.parse(uploadText) : null;
|
|
601
|
+
} catch {
|
|
602
|
+
}
|
|
595
603
|
if (!response.ok) {
|
|
596
604
|
const error = responseData?.error || {
|
|
597
605
|
code: `HTTP_${response.status}`,
|
|
598
|
-
message: responseData?.message || response.statusText
|
|
606
|
+
message: responseData?.message || uploadText || response.statusText
|
|
599
607
|
};
|
|
600
608
|
if (attempt < maxRetries && RETRYABLE_STATUS_CODES.has(response.status)) {
|
|
601
609
|
lastError = error;
|
|
@@ -674,14 +682,18 @@ var ScaleMuleClient = class {
|
|
|
674
682
|
});
|
|
675
683
|
xhr.addEventListener("load", () => {
|
|
676
684
|
try {
|
|
677
|
-
|
|
685
|
+
let data = null;
|
|
686
|
+
try {
|
|
687
|
+
data = xhr.responseText ? JSON.parse(xhr.responseText) : null;
|
|
688
|
+
} catch {
|
|
689
|
+
}
|
|
678
690
|
if (xhr.status >= 200 && xhr.status < 300) {
|
|
679
691
|
const unwrapped = data?.data !== void 0 ? data.data : data;
|
|
680
692
|
resolve(unwrapped);
|
|
681
693
|
} else {
|
|
682
|
-
reject(new ScaleMuleApiError(data
|
|
694
|
+
reject(new ScaleMuleApiError(data?.error || {
|
|
683
695
|
code: `HTTP_${xhr.status}`,
|
|
684
|
-
message: data
|
|
696
|
+
message: data?.message || xhr.responseText || "Upload failed"
|
|
685
697
|
}));
|
|
686
698
|
}
|
|
687
699
|
} catch {
|
package/dist/index.mjs
CHANGED
|
@@ -446,11 +446,15 @@ var ScaleMuleClient = class {
|
|
|
446
446
|
});
|
|
447
447
|
clearTimeout(timeoutId);
|
|
448
448
|
const text = await response.text();
|
|
449
|
-
|
|
449
|
+
let responseData = null;
|
|
450
|
+
try {
|
|
451
|
+
responseData = text ? JSON.parse(text) : null;
|
|
452
|
+
} catch {
|
|
453
|
+
}
|
|
450
454
|
if (!response.ok) {
|
|
451
455
|
const error = responseData?.error || {
|
|
452
456
|
code: `HTTP_${response.status}`,
|
|
453
|
-
message: responseData?.message || response.statusText
|
|
457
|
+
message: responseData?.message || text || response.statusText
|
|
454
458
|
};
|
|
455
459
|
if (attempt < maxRetries && RETRYABLE_STATUS_CODES.has(response.status)) {
|
|
456
460
|
lastError = error;
|
|
@@ -589,11 +593,15 @@ var ScaleMuleClient = class {
|
|
|
589
593
|
body: retryFormData
|
|
590
594
|
});
|
|
591
595
|
const uploadText = await response.text();
|
|
592
|
-
|
|
596
|
+
let responseData = null;
|
|
597
|
+
try {
|
|
598
|
+
responseData = uploadText ? JSON.parse(uploadText) : null;
|
|
599
|
+
} catch {
|
|
600
|
+
}
|
|
593
601
|
if (!response.ok) {
|
|
594
602
|
const error = responseData?.error || {
|
|
595
603
|
code: `HTTP_${response.status}`,
|
|
596
|
-
message: responseData?.message || response.statusText
|
|
604
|
+
message: responseData?.message || uploadText || response.statusText
|
|
597
605
|
};
|
|
598
606
|
if (attempt < maxRetries && RETRYABLE_STATUS_CODES.has(response.status)) {
|
|
599
607
|
lastError = error;
|
|
@@ -672,14 +680,18 @@ var ScaleMuleClient = class {
|
|
|
672
680
|
});
|
|
673
681
|
xhr.addEventListener("load", () => {
|
|
674
682
|
try {
|
|
675
|
-
|
|
683
|
+
let data = null;
|
|
684
|
+
try {
|
|
685
|
+
data = xhr.responseText ? JSON.parse(xhr.responseText) : null;
|
|
686
|
+
} catch {
|
|
687
|
+
}
|
|
676
688
|
if (xhr.status >= 200 && xhr.status < 300) {
|
|
677
689
|
const unwrapped = data?.data !== void 0 ? data.data : data;
|
|
678
690
|
resolve(unwrapped);
|
|
679
691
|
} else {
|
|
680
|
-
reject(new ScaleMuleApiError(data
|
|
692
|
+
reject(new ScaleMuleApiError(data?.error || {
|
|
681
693
|
code: `HTTP_${xhr.status}`,
|
|
682
|
-
message: data
|
|
694
|
+
message: data?.message || xhr.responseText || "Upload failed"
|
|
683
695
|
}));
|
|
684
696
|
}
|
|
685
697
|
} catch {
|
package/dist/server/auth.js
CHANGED
|
@@ -431,10 +431,14 @@ var ScaleMuleServer = class {
|
|
|
431
431
|
body: formData
|
|
432
432
|
});
|
|
433
433
|
const text = await response.text();
|
|
434
|
-
|
|
434
|
+
let responseData = null;
|
|
435
|
+
try {
|
|
436
|
+
responseData = text ? JSON.parse(text) : null;
|
|
437
|
+
} catch {
|
|
438
|
+
}
|
|
435
439
|
if (!response.ok) {
|
|
436
440
|
throw new ScaleMuleApiError(
|
|
437
|
-
responseData?.error || { code: "UPLOAD_FAILED", message: "Upload failed" }
|
|
441
|
+
responseData?.error || { code: "UPLOAD_FAILED", message: text || "Upload failed" }
|
|
438
442
|
);
|
|
439
443
|
}
|
|
440
444
|
const data = responseData?.data !== void 0 ? responseData.data : responseData;
|
|
@@ -625,11 +629,15 @@ var ScaleMuleServer = class {
|
|
|
625
629
|
body: options.body ? JSON.stringify(options.body) : void 0
|
|
626
630
|
});
|
|
627
631
|
const text = await response.text();
|
|
628
|
-
|
|
632
|
+
let responseData = null;
|
|
633
|
+
try {
|
|
634
|
+
responseData = text ? JSON.parse(text) : null;
|
|
635
|
+
} catch {
|
|
636
|
+
}
|
|
629
637
|
if (!response.ok) {
|
|
630
638
|
const error = responseData?.error || {
|
|
631
639
|
code: `HTTP_${response.status}`,
|
|
632
|
-
message: responseData?.message || response.statusText
|
|
640
|
+
message: responseData?.message || text || response.statusText
|
|
633
641
|
};
|
|
634
642
|
throw new ScaleMuleApiError(error);
|
|
635
643
|
}
|
package/dist/server/auth.mjs
CHANGED
|
@@ -429,10 +429,14 @@ var ScaleMuleServer = class {
|
|
|
429
429
|
body: formData
|
|
430
430
|
});
|
|
431
431
|
const text = await response.text();
|
|
432
|
-
|
|
432
|
+
let responseData = null;
|
|
433
|
+
try {
|
|
434
|
+
responseData = text ? JSON.parse(text) : null;
|
|
435
|
+
} catch {
|
|
436
|
+
}
|
|
433
437
|
if (!response.ok) {
|
|
434
438
|
throw new ScaleMuleApiError(
|
|
435
|
-
responseData?.error || { code: "UPLOAD_FAILED", message: "Upload failed" }
|
|
439
|
+
responseData?.error || { code: "UPLOAD_FAILED", message: text || "Upload failed" }
|
|
436
440
|
);
|
|
437
441
|
}
|
|
438
442
|
const data = responseData?.data !== void 0 ? responseData.data : responseData;
|
|
@@ -623,11 +627,15 @@ var ScaleMuleServer = class {
|
|
|
623
627
|
body: options.body ? JSON.stringify(options.body) : void 0
|
|
624
628
|
});
|
|
625
629
|
const text = await response.text();
|
|
626
|
-
|
|
630
|
+
let responseData = null;
|
|
631
|
+
try {
|
|
632
|
+
responseData = text ? JSON.parse(text) : null;
|
|
633
|
+
} catch {
|
|
634
|
+
}
|
|
627
635
|
if (!response.ok) {
|
|
628
636
|
const error = responseData?.error || {
|
|
629
637
|
code: `HTTP_${response.status}`,
|
|
630
|
-
message: responseData?.message || response.statusText
|
|
638
|
+
message: responseData?.message || text || response.statusText
|
|
631
639
|
};
|
|
632
640
|
throw new ScaleMuleApiError(error);
|
|
633
641
|
}
|
package/dist/server/index.js
CHANGED
|
@@ -555,10 +555,14 @@ var ScaleMuleServer = class {
|
|
|
555
555
|
body: formData
|
|
556
556
|
});
|
|
557
557
|
const text = await response.text();
|
|
558
|
-
|
|
558
|
+
let responseData = null;
|
|
559
|
+
try {
|
|
560
|
+
responseData = text ? JSON.parse(text) : null;
|
|
561
|
+
} catch {
|
|
562
|
+
}
|
|
559
563
|
if (!response.ok) {
|
|
560
564
|
throw new ScaleMuleApiError(
|
|
561
|
-
responseData?.error || { code: "UPLOAD_FAILED", message: "Upload failed" }
|
|
565
|
+
responseData?.error || { code: "UPLOAD_FAILED", message: text || "Upload failed" }
|
|
562
566
|
);
|
|
563
567
|
}
|
|
564
568
|
const data = responseData?.data !== void 0 ? responseData.data : responseData;
|
|
@@ -749,11 +753,15 @@ var ScaleMuleServer = class {
|
|
|
749
753
|
body: options.body ? JSON.stringify(options.body) : void 0
|
|
750
754
|
});
|
|
751
755
|
const text = await response.text();
|
|
752
|
-
|
|
756
|
+
let responseData = null;
|
|
757
|
+
try {
|
|
758
|
+
responseData = text ? JSON.parse(text) : null;
|
|
759
|
+
} catch {
|
|
760
|
+
}
|
|
753
761
|
if (!response.ok) {
|
|
754
762
|
const error = responseData?.error || {
|
|
755
763
|
code: `HTTP_${response.status}`,
|
|
756
|
-
message: responseData?.message || response.statusText
|
|
764
|
+
message: responseData?.message || text || response.statusText
|
|
757
765
|
};
|
|
758
766
|
throw new ScaleMuleApiError(error);
|
|
759
767
|
}
|
package/dist/server/index.mjs
CHANGED
|
@@ -553,10 +553,14 @@ var ScaleMuleServer = class {
|
|
|
553
553
|
body: formData
|
|
554
554
|
});
|
|
555
555
|
const text = await response.text();
|
|
556
|
-
|
|
556
|
+
let responseData = null;
|
|
557
|
+
try {
|
|
558
|
+
responseData = text ? JSON.parse(text) : null;
|
|
559
|
+
} catch {
|
|
560
|
+
}
|
|
557
561
|
if (!response.ok) {
|
|
558
562
|
throw new ScaleMuleApiError(
|
|
559
|
-
responseData?.error || { code: "UPLOAD_FAILED", message: "Upload failed" }
|
|
563
|
+
responseData?.error || { code: "UPLOAD_FAILED", message: text || "Upload failed" }
|
|
560
564
|
);
|
|
561
565
|
}
|
|
562
566
|
const data = responseData?.data !== void 0 ? responseData.data : responseData;
|
|
@@ -747,11 +751,15 @@ var ScaleMuleServer = class {
|
|
|
747
751
|
body: options.body ? JSON.stringify(options.body) : void 0
|
|
748
752
|
});
|
|
749
753
|
const text = await response.text();
|
|
750
|
-
|
|
754
|
+
let responseData = null;
|
|
755
|
+
try {
|
|
756
|
+
responseData = text ? JSON.parse(text) : null;
|
|
757
|
+
} catch {
|
|
758
|
+
}
|
|
751
759
|
if (!response.ok) {
|
|
752
760
|
const error = responseData?.error || {
|
|
753
761
|
code: `HTTP_${response.status}`,
|
|
754
|
-
message: responseData?.message || response.statusText
|
|
762
|
+
message: responseData?.message || text || response.statusText
|
|
755
763
|
};
|
|
756
764
|
throw new ScaleMuleApiError(error);
|
|
757
765
|
}
|
package/package.json
CHANGED