@lightsparkdev/core 1.3.0 → 1.3.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/CHANGELOG.md +8 -0
- package/dist/index.cjs +7 -1
- package/dist/index.js +7 -1
- package/package.json +5 -3
- package/src/requester/Requester.ts +13 -0
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1782,9 +1782,15 @@ var Requester = class {
|
|
|
1782
1782
|
const responseJson = await response.json();
|
|
1783
1783
|
const data = responseJson.data;
|
|
1784
1784
|
if (!data) {
|
|
1785
|
+
let firstErrorName = void 0;
|
|
1786
|
+
if (Array.isArray(responseJson.errors) && responseJson.errors.length > 0) {
|
|
1787
|
+
const firstError = responseJson.errors[0];
|
|
1788
|
+
firstErrorName = firstError["extensions"]?.["error_name"];
|
|
1789
|
+
}
|
|
1785
1790
|
throw new LightsparkException_default(
|
|
1786
1791
|
"RequestFailed",
|
|
1787
|
-
`Request ${operation} failed. ${JSON.stringify(responseJson.errors)}
|
|
1792
|
+
`Request ${operation} failed. ${JSON.stringify(responseJson.errors)}`,
|
|
1793
|
+
{ errorName: firstErrorName }
|
|
1788
1794
|
);
|
|
1789
1795
|
}
|
|
1790
1796
|
return data;
|
package/dist/index.js
CHANGED
|
@@ -635,9 +635,15 @@ var Requester = class {
|
|
|
635
635
|
const responseJson = await response.json();
|
|
636
636
|
const data = responseJson.data;
|
|
637
637
|
if (!data) {
|
|
638
|
+
let firstErrorName = void 0;
|
|
639
|
+
if (Array.isArray(responseJson.errors) && responseJson.errors.length > 0) {
|
|
640
|
+
const firstError = responseJson.errors[0];
|
|
641
|
+
firstErrorName = firstError["extensions"]?.["error_name"];
|
|
642
|
+
}
|
|
638
643
|
throw new LightsparkException_default(
|
|
639
644
|
"RequestFailed",
|
|
640
|
-
`Request ${operation} failed. ${JSON.stringify(responseJson.errors)}
|
|
645
|
+
`Request ${operation} failed. ${JSON.stringify(responseJson.errors)}`,
|
|
646
|
+
{ errorName: firstErrorName }
|
|
641
647
|
);
|
|
642
648
|
}
|
|
643
649
|
return data;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightsparkdev/core",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Lightspark JS SDK",
|
|
5
5
|
"author": "Lightspark Inc.",
|
|
6
6
|
"keywords": [
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"homepage": "https://github.com/lightsparkdev/js-sdk",
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
16
|
-
"url": "https://github.com/lightsparkdev/js-sdk.git"
|
|
16
|
+
"url": "git+https://github.com/lightsparkdev/js-sdk.git"
|
|
17
17
|
},
|
|
18
18
|
"bugs": {
|
|
19
19
|
"url": "https://github.com/lightsparkdev/js-sdk/issues"
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"files": [
|
|
39
39
|
"src/*",
|
|
40
40
|
"dist/*",
|
|
41
|
+
"dist/utils/*",
|
|
41
42
|
"CHANGELOG.md"
|
|
42
43
|
],
|
|
43
44
|
"scripts": {
|
|
@@ -50,7 +51,7 @@
|
|
|
50
51
|
"lint:fix": "eslint --fix .",
|
|
51
52
|
"lint:watch": "esw ./src -w --ext .ts,.tsx,.js --color",
|
|
52
53
|
"lint": "eslint .",
|
|
53
|
-
"package
|
|
54
|
+
"package:checks": "yarn publint && yarn attw --pack .",
|
|
54
55
|
"postversion": "yarn build",
|
|
55
56
|
"test": "node --experimental-vm-modules $(yarn bin jest) --no-cache --runInBand --bail src/**/tests/**/*.test.ts",
|
|
56
57
|
"types:watch": "tsc-absolute --watch",
|
|
@@ -82,6 +83,7 @@
|
|
|
82
83
|
"lodash-es": "^4.17.21",
|
|
83
84
|
"prettier": "3.0.3",
|
|
84
85
|
"prettier-plugin-organize-imports": "^3.2.4",
|
|
86
|
+
"publint": "^0.3.9",
|
|
85
87
|
"ts-jest": "^29.1.1",
|
|
86
88
|
"tsc-absolute": "^1.0.1",
|
|
87
89
|
"tsup": "^8.2.4",
|
|
@@ -208,9 +208,22 @@ class Requester {
|
|
|
208
208
|
};
|
|
209
209
|
const data = responseJson.data;
|
|
210
210
|
if (!data) {
|
|
211
|
+
let firstErrorName: string | undefined = undefined;
|
|
212
|
+
if (
|
|
213
|
+
Array.isArray(responseJson.errors) &&
|
|
214
|
+
responseJson.errors.length > 0
|
|
215
|
+
) {
|
|
216
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
217
|
+
const firstError = responseJson.errors[0];
|
|
218
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
219
|
+
firstErrorName = firstError["extensions"]?.["error_name"] as
|
|
220
|
+
| string
|
|
221
|
+
| undefined;
|
|
222
|
+
}
|
|
211
223
|
throw new LightsparkException(
|
|
212
224
|
"RequestFailed",
|
|
213
225
|
`Request ${operation} failed. ${JSON.stringify(responseJson.errors)}`,
|
|
226
|
+
{ errorName: firstErrorName },
|
|
214
227
|
);
|
|
215
228
|
}
|
|
216
229
|
return data;
|