graphlit-client 1.0.20240418022 → 1.0.20240418024
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 -0
- package/package.json +1 -1
package/dist/client.js
CHANGED
@@ -89,6 +89,17 @@ class Graphlit {
|
|
89
89
|
this.client = new core_1.ApolloClient({
|
90
90
|
link: authLink.concat(httpLink),
|
91
91
|
cache: new core_1.InMemoryCache(),
|
92
|
+
defaultOptions: {
|
93
|
+
watchQuery: {
|
94
|
+
errorPolicy: 'all',
|
95
|
+
},
|
96
|
+
query: {
|
97
|
+
errorPolicy: 'all',
|
98
|
+
},
|
99
|
+
mutate: {
|
100
|
+
errorPolicy: 'all',
|
101
|
+
}
|
102
|
+
}
|
92
103
|
});
|
93
104
|
}
|
94
105
|
createAlert(alert) {
|
@@ -401,6 +412,10 @@ class Graphlit {
|
|
401
412
|
mutation,
|
402
413
|
variables: variables || {}
|
403
414
|
});
|
415
|
+
if (result.errors) {
|
416
|
+
const errorMessage = result.errors.map(err => err.message).join("\n");
|
417
|
+
throw new Error(errorMessage);
|
418
|
+
}
|
404
419
|
if (!result.data) {
|
405
420
|
throw new Error('No data returned from mutation.');
|
406
421
|
}
|
@@ -426,6 +441,10 @@ class Graphlit {
|
|
426
441
|
query,
|
427
442
|
variables: variables || {}
|
428
443
|
});
|
444
|
+
if (result.errors) {
|
445
|
+
const errorMessage = result.errors.map(err => err.message).join("\n");
|
446
|
+
throw new Error(errorMessage);
|
447
|
+
}
|
429
448
|
if (!result.data) {
|
430
449
|
throw new Error('No data returned from query');
|
431
450
|
}
|