graphlit-client 1.0.20251211003 → 1.0.20251215001
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 +44 -8
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -3676,11 +3676,18 @@ class Graphlit {
|
|
|
3676
3676
|
mutation,
|
|
3677
3677
|
variables: variables || {},
|
|
3678
3678
|
});
|
|
3679
|
-
if (result.errors) {
|
|
3680
|
-
|
|
3679
|
+
if (result.errors && result.errors.length > 0) {
|
|
3680
|
+
// Only throw if we have no usable data - allow partial data through
|
|
3681
|
+
if (!result.data) {
|
|
3682
|
+
const errorMessage = result.errors
|
|
3683
|
+
.map((err) => this.prettyPrintGraphQLError(err))
|
|
3684
|
+
.join("\n");
|
|
3685
|
+
throw new Error(errorMessage);
|
|
3686
|
+
}
|
|
3687
|
+
// Log warning but continue with partial data
|
|
3688
|
+
console.warn("GraphQL mutation returned partial data with errors:", result.errors
|
|
3681
3689
|
.map((err) => this.prettyPrintGraphQLError(err))
|
|
3682
|
-
.join("\n");
|
|
3683
|
-
throw new Error(errorMessage);
|
|
3690
|
+
.join("\n"));
|
|
3684
3691
|
}
|
|
3685
3692
|
if (!result.data) {
|
|
3686
3693
|
throw new Error("No data returned from mutation.");
|
|
@@ -3689,6 +3696,17 @@ class Graphlit {
|
|
|
3689
3696
|
}
|
|
3690
3697
|
catch (error) {
|
|
3691
3698
|
if (error instanceof ApolloError && error.graphQLErrors.length > 0) {
|
|
3699
|
+
// Check if we have partial data in the error
|
|
3700
|
+
const apolloError = error;
|
|
3701
|
+
if (apolloError.networkError && "result" in apolloError.networkError) {
|
|
3702
|
+
const networkResult = apolloError.networkError.result;
|
|
3703
|
+
if (networkResult?.data) {
|
|
3704
|
+
console.warn("GraphQL mutation returned partial data with errors:", error.graphQLErrors
|
|
3705
|
+
.map((err) => this.prettyPrintGraphQLError(err))
|
|
3706
|
+
.join("\n"));
|
|
3707
|
+
return networkResult.data;
|
|
3708
|
+
}
|
|
3709
|
+
}
|
|
3692
3710
|
const errorMessage = error.graphQLErrors
|
|
3693
3711
|
.map((err) => this.prettyPrintGraphQLError(err))
|
|
3694
3712
|
.join("\n");
|
|
@@ -3712,11 +3730,18 @@ class Graphlit {
|
|
|
3712
3730
|
query,
|
|
3713
3731
|
variables: variables || {},
|
|
3714
3732
|
});
|
|
3715
|
-
if (result.errors) {
|
|
3716
|
-
|
|
3733
|
+
if (result.errors && result.errors.length > 0) {
|
|
3734
|
+
// Only throw if we have no usable data - allow partial data through
|
|
3735
|
+
if (!result.data) {
|
|
3736
|
+
const errorMessage = result.errors
|
|
3737
|
+
.map((err) => this.prettyPrintGraphQLError(err))
|
|
3738
|
+
.join("\n");
|
|
3739
|
+
throw new Error(errorMessage);
|
|
3740
|
+
}
|
|
3741
|
+
// Log warning but continue with partial data
|
|
3742
|
+
console.warn("GraphQL query returned partial data with errors:", result.errors
|
|
3717
3743
|
.map((err) => this.prettyPrintGraphQLError(err))
|
|
3718
|
-
.join("\n");
|
|
3719
|
-
throw new Error(errorMessage);
|
|
3744
|
+
.join("\n"));
|
|
3720
3745
|
}
|
|
3721
3746
|
if (!result.data) {
|
|
3722
3747
|
throw new Error("No data returned from query.");
|
|
@@ -3725,6 +3750,17 @@ class Graphlit {
|
|
|
3725
3750
|
}
|
|
3726
3751
|
catch (error) {
|
|
3727
3752
|
if (error instanceof ApolloError && error.graphQLErrors.length > 0) {
|
|
3753
|
+
// Check if we have partial data in the error
|
|
3754
|
+
const apolloError = error;
|
|
3755
|
+
if (apolloError.networkError && "result" in apolloError.networkError) {
|
|
3756
|
+
const networkResult = apolloError.networkError.result;
|
|
3757
|
+
if (networkResult?.data) {
|
|
3758
|
+
console.warn("GraphQL query returned partial data with errors:", error.graphQLErrors
|
|
3759
|
+
.map((err) => this.prettyPrintGraphQLError(err))
|
|
3760
|
+
.join("\n"));
|
|
3761
|
+
return networkResult.data;
|
|
3762
|
+
}
|
|
3763
|
+
}
|
|
3728
3764
|
const errorMessage = error.graphQLErrors
|
|
3729
3765
|
.map((err) => this.prettyPrintGraphQLError(err))
|
|
3730
3766
|
.join("\n");
|